Skip to content

Commit

Permalink
Merge #680
Browse files Browse the repository at this point in the history
680: Fix singlepass error when no function code present r=bjfish a=bjfish



Co-authored-by: Brandon Fish <[email protected]>
Co-authored-by: Brandon Fish <[email protected]>
  • Loading branch information
3 people authored Aug 19, 2019
2 parents 7762a72 + 38b1e3d commit 6b2cd7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 252 deletions.
24 changes: 12 additions & 12 deletions lib/singlepass-backend/src/codegen_x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,22 +404,22 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
mut self,
_: &ModuleInfo,
) -> Result<(X64ExecutionContext, Box<dyn CacheGen>), CodegenError> {
let (assembler, breakpoints) = match self.functions.last_mut() {
Some(x) => (x.assembler.take().unwrap(), x.breakpoints.take().unwrap()),
None => {
return Err(CodegenError {
message: "no function",
});
}
let (assembler, function_labels, breakpoints) = match self.functions.last_mut() {
Some(x) => (
x.assembler.take().unwrap(),
x.function_labels.take().unwrap(),
x.breakpoints.take().unwrap(),
),
None => (
self.assembler.take().unwrap(),
self.function_labels.take().unwrap(),
HashMap::new(),
),
};

let total_size = assembler.get_offset().0;
let output = assembler.finalize().unwrap();

let function_labels = if let Some(x) = self.functions.last() {
x.function_labels.as_ref().unwrap()
} else {
self.function_labels.as_ref().unwrap()
};
let mut out_labels: Vec<FuncPtr> = vec![];
let mut out_offsets: Vec<AssemblyOffset> = vec![];

Expand Down
Loading

0 comments on commit 6b2cd7e

Please sign in to comment.