Skip to content

Commit e34f636

Browse files
committed
add LabelRegistry to new FuncTranslator
1 parent 857037f commit e34f636

File tree

1 file changed

+15
-2
lines changed
  • crates/wasmi/src/engine/translator/translator2

1 file changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ use self::{
1414
};
1515
use crate::{
1616
core::FuelCostsProvider,
17-
engine::{translator::WasmTranslator, CompiledFuncEntity},
17+
engine::{
18+
translator::{LabelRegistry, WasmTranslator},
19+
CompiledFuncEntity,
20+
},
1821
module::{FuncIdx, ModuleHeader, WasmiValueType},
1922
Engine,
2023
Error,
@@ -54,6 +57,8 @@ pub struct FuncTranslator {
5457
stack: Stack,
5558
/// Wasm layout to map stack slots to Wasmi registers.
5659
layout: StackLayout,
60+
/// Registers and pins labels and tracks their users.
61+
labels: LabelRegistry,
5762
}
5863

5964
/// Heap allocated data structured used by the [`FuncTranslator`].
@@ -63,6 +68,8 @@ pub struct FuncTranslatorAllocations {
6368
stack: Stack,
6469
/// Wasm layout to map stack slots to Wasmi registers.
6570
layout: StackLayout,
71+
/// Registers and pins labels and tracks their users.
72+
labels: LabelRegistry,
6673
}
6774

6875
impl WasmTranslator<'_> for FuncTranslator {
@@ -120,7 +127,11 @@ impl FuncTranslator {
120127
.get_consume_fuel()
121128
.then(|| config.fuel_costs())
122129
.cloned();
123-
let FuncTranslatorAllocations { stack, layout } = alloc;
130+
let FuncTranslatorAllocations {
131+
stack,
132+
layout,
133+
labels,
134+
} = alloc;
124135
Ok(Self {
125136
func,
126137
engine,
@@ -129,6 +140,7 @@ impl FuncTranslator {
129140
fuel_costs,
130141
stack,
131142
layout,
143+
labels,
132144
})
133145
}
134146

@@ -137,6 +149,7 @@ impl FuncTranslator {
137149
FuncTranslatorAllocations {
138150
stack: self.stack,
139151
layout: self.layout,
152+
labels: self.labels,
140153
}
141154
}
142155

0 commit comments

Comments
 (0)