Skip to content

Commit 5472787

Browse files
committed
simplify translate_end_func when in unreachable state
1 parent 3ad8234 commit 5472787

File tree

1 file changed

+4
-1
lines changed
  • crates/wasmi/src/engine/translator/func2

1 file changed

+4
-1
lines changed

crates/wasmi/src/engine/translator/func2/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ impl FuncTranslator {
250250

251251
/// Translates the end of the Wasm function enclosing Wasm `block`.
252252
fn translate_end_func(&mut self, frame: BlockControlFrame) -> Result<(), Error> {
253+
if !self.reachable {
254+
return Ok(());
255+
}
253256
let _fuel_info = match (&self.fuel_costs, frame.consume_fuel_instr()) {
254257
(Some(fuel_costs), Some(consume_fuel)) => {
255258
FuelInfo::some(fuel_costs.clone(), consume_fuel)
@@ -258,7 +261,7 @@ impl FuncTranslator {
258261
_ => unreachable!(),
259262
};
260263
let len_results = frame.ty().len_results(&self.engine);
261-
if self.reachable && frame.is_branched_to() && len_results > 1 {
264+
if frame.is_branched_to() && len_results > 1 {
262265
let height = frame.height();
263266
let len_results = usize::from(len_results);
264267
for depth in 0..len_results {

0 commit comments

Comments
 (0)