Skip to content

Commit 625df92

Browse files
committed
add FuncTranslator::pin_label utility method
1 parent 09be48b commit 625df92

File tree

1 file changed

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

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use self::{
3030
use crate::{
3131
core::{FuelCostsProvider, Typed, TypedVal, ValType},
3232
engine::{
33-
translator::{Instr, LabelRegistry, WasmTranslator},
33+
translator::{Instr, LabelRef, LabelRegistry, WasmTranslator},
3434
BlockType,
3535
CompiledFuncEntity,
3636
TranslationError,
@@ -279,6 +279,13 @@ impl FuncTranslator {
279279
Ok(())
280280
}
281281

282+
/// Pins the `label` to the next [`Instr`].
283+
fn pin_label(&mut self, label: LabelRef) {
284+
self.labels
285+
.pin_label(label, self.instrs.next_instr())
286+
.unwrap_or_else(|err| panic!("failed to pin label to next instruction: {err}"));
287+
}
288+
282289
/// Convert the [`Operand`] at `depth` into an [`Operand::Temp`] by copying if necessary.
283290
///
284291
/// # Note

0 commit comments

Comments
 (0)