Skip to content

Commit 72a4572

Browse files
committed
add AllocConst impl for StackLayout
This allows to use StackLayout as parameter to try_into_cmp_branch_instr ext-trait method.
1 parent 402a09d commit 72a4572

File tree

1 file changed

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

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use self::consts::{ConstRegistry, ConstRegistryIter};
44
use super::{LocalIdx, Operand, OperandIdx, Reset};
55
use crate::{
66
core::{UntypedVal, ValType},
7-
engine::TranslationError,
7+
engine::{translator::comparator::AllocConst, TranslationError},
88
ir::Reg,
99
Error,
1010
};
@@ -127,6 +127,12 @@ impl StackLayout {
127127
}
128128
}
129129

130+
impl AllocConst for StackLayout {
131+
fn alloc_const<T: Into<UntypedVal>>(&mut self, value: T) -> Result<Reg, Error> {
132+
self.const_to_reg(value)
133+
}
134+
}
135+
130136
/// The [`StackSpace`] of a [`Reg`].
131137
#[derive(Debug, Copy, Clone)]
132138
pub enum StackSpace {

0 commit comments

Comments
 (0)