fix call_indirect evaluation
This commit is contained in:
@@ -572,7 +572,7 @@ eval store FunctionInstance { funcType, moduleInstance, code = Function { localT
|
|||||||
return $ Done ctx { stack = reverse res ++ (drop (length args) $ stack ctx) }
|
return $ Done ctx { stack = reverse res ++ (drop (length args) $ stack ctx) }
|
||||||
step ctx@EvalCtx{ stack = (VI32 v): rest } (CallIndirect typeIdx) = do
|
step ctx@EvalCtx{ stack = (VI32 v): rest } (CallIndirect typeIdx) = do
|
||||||
let funcType = funcTypes moduleInstance ! fromIntegral typeIdx
|
let funcType = funcTypes moduleInstance ! fromIntegral typeIdx
|
||||||
let TableInstance { elements } = tableInstances store ! (tableaddrs moduleInstance ! fromIntegral v)
|
let TableInstance { elements } = tableInstances store ! (tableaddrs moduleInstance ! 0)
|
||||||
let funcAddr = elements !? fromIntegral v
|
let funcAddr = elements !? fromIntegral v
|
||||||
case funcAddr of
|
case funcAddr of
|
||||||
Just (Just addr) -> do
|
Just (Just addr) -> do
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ compile file = do
|
|||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
files <- Directory.listDirectory "tests/samples"
|
files <- Directory.listDirectory "tests/samples"
|
||||||
let files = ["linking.wast"]
|
-- let files = ["linking.wast"]
|
||||||
scriptTestCases <- (`mapM` files) $ \file -> do
|
scriptTestCases <- (`mapM` files) $ \file -> do
|
||||||
content <- LBS.readFile $ "tests/samples/" ++ file
|
content <- LBS.readFile $ "tests/samples/" ++ file
|
||||||
let Right script = Parser.parseScript <$> Lexer.scanner content
|
let Right script = Parser.parseScript <$> Lexer.scanner content
|
||||||
|
|||||||
Reference in New Issue
Block a user