diff options
| author | Henry <mail@henrygressmann.de> | 2026-04-24 00:13:23 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-04-24 00:13:23 +0200 |
| commit | 19038bfea6a65e2aad89ec6a8fa51c41da35b219 (patch) | |
| tree | b4f33812059e60f55a6f85a78789b83476269908 /crates/parser/src/visit.rs | |
| parent | 5b318177aa4f79246e772c5fcef6ee4bac5bdaa0 (diff) | |
feat: new binopt superinstructions
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/visit.rs')
| -rw-r--r-- | crates/parser/src/visit.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/parser/src/visit.rs b/crates/parser/src/visit.rs index 5c99df2..5e1ca15 100644 --- a/crates/parser/src/visit.rs +++ b/crates/parser/src/visit.rs @@ -240,8 +240,8 @@ impl<'a, R: WasmModuleResources> wasmparser::VisitOperator<'a> for FunctionBuild } fn visit_loop(&mut self, _ty: wasmparser::BlockType) -> Self::Output { - if !matches!(self.instructions.last(), Some(Instruction::Nop)) { - self.instructions.push(Instruction::Nop); // add nop to ensure that no superinstruction can be merged across block boundaries + if !matches!(self.instructions.last(), Some(Instruction::Nop | Instruction::MergeBarrier)) { + self.instructions.push(Instruction::MergeBarrier); // prevent superinstructions from merging across block boundaries } let start_ip = self.instructions.len(); self.ctx_stack.push(LoweringCtx { kind: BlockKind::Loop, has_else: false, start_ip, branch_jumps: Vec::new() }); @@ -266,8 +266,8 @@ impl<'a, R: WasmModuleResources> wasmparser::VisitOperator<'a> for FunctionBuild ctx.has_else = true; ctx.branch_jumps.push(jump_ip); self.patch_jump_if_zero(cond_jump_ip, self.instructions.len()); - if !matches!(self.instructions.last(), Some(Instruction::Nop)) { - self.instructions.push(Instruction::Nop); // add nop to ensure that no superinstruction can be merged across block boundaries + if !matches!(self.instructions.last(), Some(Instruction::Nop | Instruction::MergeBarrier)) { + self.instructions.push(Instruction::MergeBarrier); // prevent superinstructions from merging across block boundaries } }; }; @@ -276,8 +276,8 @@ impl<'a, R: WasmModuleResources> wasmparser::VisitOperator<'a> for FunctionBuild fn visit_end(&mut self) -> Self::Output { if let Some(ctx) = self.ctx_stack.pop() { self.patch_end_jumps(ctx, self.instructions.len()); - if !matches!(self.instructions.last(), Some(Instruction::Nop)) { - self.instructions.push(Instruction::Nop); // add nop to ensure that no superinstruction can be merged across block boundaries + if !matches!(self.instructions.last(), Some(Instruction::Nop | Instruction::MergeBarrier)) { + self.instructions.push(Instruction::MergeBarrier); // prevent superinstructions from merging across block boundaries } } else { self.instructions.push(Instruction::Return); |
