Skip to content

Commit 029bd41

Browse files
committed
differentiate between func enclosing block in translation
1 parent 1401875 commit 029bd41

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ impl FuncTranslator {
237237

238238
/// Translates the end of a Wasm `block` control frame.
239239
fn translate_end_block(&mut self, frame: BlockControlFrame) -> Result<(), Error> {
240+
if self.stack.is_control_empty() {
241+
return self.translate_end_func(frame);
242+
}
243+
todo!()
244+
}
245+
246+
/// Translates the end of the Wasm function enclosing Wasm `block`.
247+
fn translate_end_func(&mut self, frame: BlockControlFrame) -> Result<(), Error> {
240248
todo!()
241249
}
242250

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ impl Stack {
9999
self.operands.register_locals(amount, ty)
100100
}
101101

102+
/// Returns `true` if the control stack is empty.
103+
pub fn is_control_empty(&self) -> bool {
104+
self.controls.is_empty()
105+
}
106+
102107
/// Returns the current height of the [`Stack`].
103108
///
104109
/// # Note

0 commit comments

Comments
 (0)