Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local preservation upon entering a loop during translation #1218

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix translation bug
  • Loading branch information
Robbepop committed Oct 2, 2024
commit d59ff4a4a49ccdbe5fdddc091e8e5ec1030ad19f
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/translator/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 152,7 @@ impl<'a> VisitOperator<'a> for FuncTranslator {
));
return Ok(());
}
self.preserve_locals()?;
// Copy `loop` parameters over to where it expects its branch parameters.
let len_block_params = block_type.len_params(self.engine());
self.alloc.stack.pop_n(
Expand All @@ -162,7 163,6 @@ impl<'a> VisitOperator<'a> for FuncTranslator {
.alloc
.stack
.push_dynamic_n(usize::from(len_block_params))?;
// self.preserve_locals()?; // TODO: find a case where local preservation before loops is necessary
let fuel_info = self.fuel_info();
self.alloc.instr_encoder.encode_copies(
&mut self.alloc.stack,
Expand Down