mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-18 03:11:21 +00:00
Fix singlepass error when no function code present
This commit is contained in:
@ -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 (mut 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![];
|
||||
|
||||
|
Reference in New Issue
Block a user