From e0d9eeb51f4ba390407660695943c2620f496afd Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Tue, 10 Apr 2018 21:59:54 -0700 Subject: [PATCH] fix tee_local semantic --- src/Language/Wasm/Interpreter.hs | 2 +- tests/Test.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Wasm/Interpreter.hs b/src/Language/Wasm/Interpreter.hs index ca65b1d..865b4a9 100644 --- a/src/Language/Wasm/Interpreter.hs +++ b/src/Language/Wasm/Interpreter.hs @@ -593,7 +593,7 @@ eval store FunctionInstance { funcType, moduleInstance, code = Function { localT return $ Done ctx { stack = rest, locals = locals ctx // [(fromIntegral i, v)] } step ctx@EvalCtx{ locals = ls, stack = (v:rest) } (TeeLocal i) = return $ Done ctx { - stack = (ls ! fromIntegral i) : rest, + stack = v : rest, locals = locals ctx // [(fromIntegral i, v)] } step ctx (GetGlobal i) = do diff --git a/tests/Test.hs b/tests/Test.hs index febd4af..c60ba01 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -34,7 +34,7 @@ compile file = do main :: IO () main = do files <- Directory.listDirectory "tests/samples" - -- let files = ["resizing.wast"] + -- let files = ["tee_local.wast"] scriptTestCases <- (`mapM` files) $ \file -> do content <- LBS.readFile $ "tests/samples/" ++ file let Right script = Parser.parseScript <$> Lexer.scanner content