Skip to content

Commit 07b0efc

Browse files
Translator: Fix performance regression in local.set
`popOperand` now resets the last emission record, so local.set always failed to relink the result register
1 parent aac670d commit 07b0efc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/WasmKit/Translator.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,8 @@ struct InstructionTranslator<Context: TranslatorContext>: InstructionVisitor {
15781578
let type = try locals.type(of: localIndex)
15791579
let result = localReg(localIndex)
15801580

1581-
guard let op = try popOperand(type) else { return }
1581+
guard try checkBeforePop(typeHint: type) else { return }
1582+
let op = try valueStack.pop(type)
15821583

15831584
if case .const(let slotIndex, _) = op {
15841585
// Optimize (local.set $x (i32.const $c)) to reg:$x = 42 rather than through const slot

0 commit comments

Comments
 (0)