Skip to content

Commit 03b6040

Browse files
committed
add Reset for FuncTranslatorAllocations
1 parent 522a143 commit 03b6040

File tree

1 file changed

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

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ pub struct FuncTranslatorAllocations {
7878
instrs: InstrEncoder,
7979
}
8080

81+
impl Reset for FuncTranslatorAllocations {
82+
fn reset(&mut self) {
83+
self.stack.reset();
84+
self.layout.reset();
85+
self.labels.reset();
86+
self.instrs.reset();
87+
}
88+
}
89+
8190
impl WasmTranslator<'_> for FuncTranslator {
8291
type Allocations = FuncTranslatorAllocations;
8392

@@ -137,7 +146,12 @@ impl FuncTranslator {
137146
stack,
138147
layout,
139148
labels,
140-
} = alloc;
149+
instrs,
150+
} = {
151+
let mut alloc = alloc;
152+
alloc.reset();
153+
alloc
154+
};
141155
Ok(Self {
142156
func,
143157
engine,

0 commit comments

Comments
 (0)