mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Fix LLVM refactor unreachable depth
This commit is contained in:
parent
31acf81762
commit
e1138a553b
@ -2525,7 +2525,7 @@ pub struct LLVMFunctionCodeGenerator {
|
|||||||
// value_stack: Vec<(Location, LocalOrTemp)>,
|
// value_stack: Vec<(Location, LocalOrTemp)>,
|
||||||
// control_stack: Vec<ControlFrame>,
|
// control_stack: Vec<ControlFrame>,
|
||||||
// machine: Machine,
|
// machine: Machine,
|
||||||
// unreachable_depth: usize,
|
unreachable_depth: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||||
@ -2675,29 +2675,24 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
|||||||
let signatures = &self.signatures;
|
let signatures = &self.signatures;
|
||||||
let mut ctx = self.ctx.as_mut().unwrap();
|
let mut ctx = self.ctx.as_mut().unwrap();
|
||||||
|
|
||||||
let mut unreachable_depth = 0;
|
|
||||||
if !state.reachable {
|
if !state.reachable {
|
||||||
match *op {
|
match *op {
|
||||||
Operator::Block { ty: _ } | Operator::Loop { ty: _ } | Operator::If { ty: _ } => {
|
Operator::Block { ty: _ } | Operator::Loop { ty: _ } | Operator::If { ty: _ } => {
|
||||||
unreachable_depth += 1;
|
self.unreachable_depth += 1;
|
||||||
// continue;
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Operator::Else => {
|
Operator::Else => {
|
||||||
if unreachable_depth != 0 {
|
if self.unreachable_depth != 0 {
|
||||||
// continue;
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Operator::End => {
|
Operator::End => {
|
||||||
if unreachable_depth != 0 {
|
if self.unreachable_depth != 0 {
|
||||||
unreachable_depth -= 1;
|
self.unreachable_depth -= 1;
|
||||||
// continue;
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// continue;
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4781,6 +4776,7 @@ impl ModuleCodeGenerator<LLVMFunctionCodeGenerator, LLVMBackend, CodegenError>
|
|||||||
::std::mem::transmute::<&Intrinsics, &'static Intrinsics>(&self.intrinsics)
|
::std::mem::transmute::<&Intrinsics, &'static Intrinsics>(&self.intrinsics)
|
||||||
},
|
},
|
||||||
ctx: None,
|
ctx: None,
|
||||||
|
unreachable_depth: 0,
|
||||||
};
|
};
|
||||||
self.functions.push(code);
|
self.functions.push(code);
|
||||||
Ok(self.functions.last_mut().unwrap())
|
Ok(self.functions.last_mut().unwrap())
|
||||||
|
Loading…
Reference in New Issue
Block a user