From 21e0ac3b0d82b773a6996ad45a71157c417be80d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 12 Jan 2023 16:41:34 +1100 Subject: [PATCH] Add support for `local.tee` to `wasm-bindgen-wasm-interpreter` This doesn't solve #2969, since WASI uses plenty of instructions we don't support aside from `local.tee`, but it hopefully might solve [@tv42's issue](https://github.com/rustwasm/wasm-bindgen/issues/2969#issuecomment-1374524820). --- crates/wasm-interpreter/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index 699ea97c699..1b89eed6b1d 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -270,6 +270,10 @@ impl Frame<'_> { let val = stack.pop().unwrap(); self.locals.insert(e.local, val); } + Instr::LocalTee(e) => { + let val = stack.last().unwrap().clone(); + self.locals.insert(e.local, val); + } // Blindly assume all globals are the stack pointer Instr::GlobalGet(_) => stack.push(self.interp.sp),