Skip to content

Commit 402a09d

Browse files
committed
add (debug) asserts for is_instruction_parameter
1 parent 1f28afe commit 402a09d

File tree

1 file changed

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

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{Instr, Reset, ReusableAllocations};
22
use crate::{
33
core::FuelCostsProvider,
4-
engine::translator::utils::BumpFuelConsumption as _,
4+
engine::translator::utils::{BumpFuelConsumption as _, IsInstructionParameter as _},
55
ir::Instruction,
66
Engine,
77
Error,
@@ -97,6 +97,10 @@ impl InstrEncoder {
9797

9898
/// Pushes a non-parameter [`Instruction`] to the [`InstrEncoder`].
9999
fn push_instr_impl(&mut self, instruction: Instruction) -> Result<Instr, Error> {
100+
debug_assert!(
101+
!instruction.is_instruction_parameter(),
102+
"parameter: {instruction:?}"
103+
);
100104
let instr = self.next_instr();
101105
self.instrs.push(instruction);
102106
self.last_instr = Some(instr);
@@ -107,6 +111,10 @@ impl InstrEncoder {
107111
///
108112
/// The parameter is associated to the last pushed [`Instruction`].
109113
pub fn push_param(&mut self, instruction: Instruction) {
114+
debug_assert!(
115+
instruction.is_instruction_parameter(),
116+
"non-parameter: {instruction:?}"
117+
);
110118
self.instrs.push(instruction);
111119
}
112120

0 commit comments

Comments
 (0)