This commit is contained in:
Stephan Stanisic 2024-11-22 09:36:10 +01:00
parent 38673dd8b4
commit 02bab4117d
2 changed files with 264 additions and 232 deletions

View File

@ -140,7 +140,6 @@ data Config l = Config
, locals :: [Labeled l Value] -- Local variables.
, stack :: [Labeled l Value] -- Explicit value stack.
, instrs :: [AdminInstr l] -- Next instructions to be executed.
, progcn :: l
}
deriving Show
@ -161,35 +160,46 @@ step cfg = do
(Drop, _ : stack) -> return cfg{stack, instrs} -- Evaluating Drop just pops and discards the top value from the stack.
(Unreachable, _) -> return cfg{instrs = [Trapping UnreachableExecuted]}
(I32_Const i, stack) -> do
v <- label cfg.progcn (V_I32 i)
s <- getLIOStateTCB
v <- label (lioLabel s) (V_I32 i)
return cfg{stack = v : stack, instrs}
(I64_Const i, stack) -> do
v <- label cfg.progcn (V_I64 i)
s <- getLIOStateTCB
v <- label (lioLabel s) (V_I64 i)
return cfg{stack = v : stack, instrs}
-- You can directly pattern match on the stack too.
-- The input program is validated before execution, so you can expect to find the right value types on the stack.
-- (I32_BinOp op, b : a : stack) -> do
-- V_I32 a' <- unlabel a
-- V_I32 b' <- unlabel b
-- s <- getLIOStateTCB
-- v <- label (labelOf a `lub` labelOf b `lub` (lioLabel s)) $ V_I32 (evalBinOp op a' b')
-- return cfg{stack = v : stack, instrs}
(I32_BinOp op, b : a : stack) -> do
V_I32 a' <- unlabel a
V_I32 b' <- unlabel b
v <- label (labelOf a `lub` labelOf b `lub` cfg.progcn) $ V_I32 (evalBinOp op a' b')
let v = evalBinOp op <$> a <*> b
return cfg{stack = v : stack, instrs}
(I32_RelOp op, b : a : stack) -> do
V_I32 a' <- unlabel a
V_I32 b' <- unlabel b
v <- label (labelOf a `lub` labelOf b `lub` cfg.progcn) $ boolToI32 (evalRelOp op a' b')
s <- getLIOStateTCB
v <- label (labelOf a `lub` labelOf b `lub` (lioLabel s)) $ boolToI32 (evalRelOp op a' b')
return cfg{stack = v : stack, instrs}
(I64_BinOp op, b : a : stack) -> do
V_I64 a' <- unlabel a
V_I64 b' <- unlabel b
v <- label (labelOf a `lub` labelOf b `lub` cfg.progcn) $ V_I64 (evalBinOp op a' b')
s <- getLIOStateTCB
v <- label (labelOf a `lub` labelOf b `lub` (lioLabel s)) $ V_I64 (evalBinOp op a' b')
return cfg{stack = v : stack, instrs}
(I64_RelOp op, b : a : stack) -> do
V_I64 a' <- unlabel a
V_I64 b' <- unlabel b
v <- label (labelOf a `lub` labelOf b `lub` cfg.progcn) $ boolToI32 (evalRelOp op a' b')
s <- getLIOStateTCB
v <- label (labelOf a `lub` labelOf b `lub` (lioLabel s)) $ boolToI32 (evalRelOp op a' b')
return cfg{stack = v : stack, instrs}
(LocalGet ix, stack) -> return cfg{stack = cfg.locals !! ix : stack, instrs}
@ -230,7 +240,8 @@ step cfg = do
_ -> return cfg{instrs = Plain (Br ix) : instrs, stack}
(Call fn, stack) -> do
vals <- mapM (label cfg.progcn . defaultValue) func.locals.unwrap
s <- getLIOStateTCB
vals <- mapM (label (lioLabel s) . defaultValue) func.locals.unwrap
return cfg{instrs=Frame m (take n stack ++ vals) [] body : instrs, stack = drop n stack}
where
func = fromJust $ lookup fn cfg.funcs
@ -243,7 +254,7 @@ step cfg = do
x -> error $ "Missing or ill-typed operand(s) on the stack\n" ++ show x
-- Administrative instructions:
Taint l -> return cfg{instrs, progcn = l}
Taint l -> return cfg{instrs}
Trapping msg -> return cfg{instrs = [Trapping msg]}
Breaking ix vs -> error "Breaking when not inside a label"
@ -255,7 +266,7 @@ step cfg = do
Label n k vs (Breaking 0 vs' : _) -> return cfg{instrs = map Plain k ++ instrs, stack = take n vs'}
Label n k vs (Breaking ix vs' : _) -> return cfg{instrs = Breaking (ix-1) vs' : instrs}
Label n k vs (e : es) -> do
cfg' <- step cfg{stack=vs, instrs=e:es}
cfg' <- step cfg{stack=vs, instrs=e:es} -- add toLabeled
return cfg'{stack=cfg.stack, instrs=(Label n k cfg'.stack cfg'.instrs) : instrs}
Frame n locs vs [] | n == length vs -> return cfg{stack=vs ++ cfg.stack, instrs}
@ -263,46 +274,47 @@ step cfg = do
Frame n locs vs (Trapping msg : _) -> return cfg{instrs=[Trapping msg]}
Frame n locs vs (Returning vs' : _) -> return cfg{stack=(take n vs') ++ cfg.stack, instrs}
Frame n locs vs es -> do
cfg' <- step cfg{stack=vs, instrs=es, locals=locs}
cfg' <- step cfg{stack=vs, instrs=es, locals=locs} -- add toLabeled
return cfg'{stack=cfg.stack, instrs=(Frame n cfg'.locals cfg'.stack cfg'.instrs):instrs, locals=cfg.locals}
-- "Drop"
test1 :: LIO Lattice2 (Config Lattice2)
test1 = do
l1 <- label Low (V_I32 1)
l0 <- label Low (V_I32 0)
let config = Config [] [] [] [l1, l0] [Plain Drop, Plain Drop] Low
let config = Config [] [] [] [l1, l0] [Plain Drop, Plain Drop]
stepUntilFinal config
-- "Add"
test2 :: LIO Lattice2 (Config Lattice2)
test2 = do
let config = Config [] [] [] [] [Plain $ I32_Const 6, Taint High, Plain $ I32_Const 7, Plain $ I32_BinOp Add] Low
let config = Config [] [] [] [] [Plain $ I32_Const 6, Taint High, Plain $ I32_Const 7, Plain $ I32_BinOp Add]
stepUntilFinal config
-- "Relop"
test3 :: LIO Lattice2 (Config Lattice2)
test3 = do
let config = Config [] [] [] [] [Plain $ I32_Const 6, Taint High, Plain $ I32_Const 7, Plain $ I32_RelOp Lt] Low
let config = Config [] [] [] [] [Plain $ I32_Const 6, Taint High, Plain $ I32_Const 7, Plain $ I32_RelOp Lt]
stepUntilFinal config
-- "LocalGet"
test4 :: LIO Lattice2 (Config Lattice2)
test4 = do
l7 <- label Low (V_I32 7)
let config = Config [] [] [l7] [] [Plain (LocalGet 0)] Low
let config = Config [] [] [l7] [] [Plain (LocalGet 0)]
stepUntilFinal config
-- "Add64"
test5 :: LIO Lattice2 (Config Lattice2)
test5 = do
let config = Config [] [] [] [] [Plain (I64_Const 2), Plain (I64_Const 3), Plain (I64_BinOp Add)] Low
let config = Config [] [] [] [] [Plain (I64_Const 2), Plain (I64_Const 3), Plain (I64_BinOp Add)]
stepUntilFinal config
-- "LocalSet"
test6 :: LIO Lattice2 (Config Lattice2)
test6 = do
l0 <- label Low (V_I32 0)
let config = Config [] [] [l0] [] [Plain (I32_Const 1), Plain (LocalSet 0)] Low
let config = Config [] [] [l0] [] [Plain (I32_Const 1), Plain (LocalSet 0)]
stepUntilFinal config
-- "Block"
@ -310,41 +322,41 @@ test7 :: LIO Lattice2 (Config Lattice2)
test7 = do
l5 <- label Low (V_I32 5)
lI32 <- label Low I32
stepUntilFinal $ Config [] [] [] [l5] [Plain (Block (Params [lI32]) (Results [lI32]) [I32_Const 1, I32_BinOp Add])] Low
stepUntilFinal $ Config [] [] [] [l5] [Plain (Block (Params [lI32]) (Results [lI32]) [I32_Const 1, I32_BinOp Add])]
-- "Loop"
test8 :: LIO Lattice2 (Config Lattice2)
test8 = do
l5 <- label Low (V_I32 5)
lI32 <- label Low I32
stepUntilFinal $ Config [] [] [] [l5] [Plain (Loop (Params [lI32]) (Results [lI32]) [I32_Const 1, I32_BinOp Add])] Low
stepUntilFinal $ Config [] [] [] [l5] [Plain (Loop (Params [lI32]) (Results [lI32]) [I32_Const 1, I32_BinOp Add])]
-- "BrIf-Block"
test9 :: LIO Lattice2 (Config Lattice2)
test9 = do
l5 <- label Low (V_I32 5)
lI32 <- label Low I32
stepUntilFinal $ Config [] [] [l5] [] [Plain (Block (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0, Unreachable])] Low
stepUntilFinal $ Config [] [] [l5] [] [Plain (Block (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0, Unreachable])]
-- "BrIf-Loop"
test10 :: LIO Lattice2 (Config Lattice2)
test10 = do
let l = Loop (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0]
l2 <- label Low (V_I32 2)
stepUntilFinal $ Config [] [] [l2] [] [Plain l] Low
stepUntilFinal $ Config [] [] [l2] [] [Plain l]
-- "Label-Nested"
test11 :: LIO Lattice2 (Config Lattice2)
test11 = do
lI32 <- label Low I32
stepUntilFinal $ Config [] [] [] [] [Plain (Block (Params []) (Results [lI32]) [Block (Params []) (Results [lI32, lI32]) [I32_Const 5, I32_Const 6, I32_Const 7, BrIf 1]])] Low
stepUntilFinal $ Config [] [] [] [] [Plain (Block (Params []) (Results [lI32]) [Block (Params []) (Results [lI32, lI32]) [I32_Const 5, I32_Const 6, I32_Const 7, BrIf 1]])]
-- "Label-Mutates-Locals"
test12 :: LIO Lattice2 (Config Lattice2)
test12 = do
l4 <- label Low (V_I32 4)
l5 <- label Low (V_I32 5)
stepUntilFinal $ Config [] [] [l5] [] [Label 0 [] [l4] [Plain (LocalSet 0), Plain (LocalGet 0)]] Low
stepUntilFinal $ Config [] [] [l5] [] [Label 0 [] [l4] [Plain (LocalSet 0), Plain (LocalGet 0)]]
-- "Call"
test13 :: LIO Lattice2 (Config Lattice2)
@ -353,14 +365,14 @@ test13 = do
l7 <- label Low (V_I32 7)
l5 <- label Low (V_I32 5)
let f = [("f", Func "f" (Params [lI32]) (Results [lI32]) (Locals []) [LocalGet 0, I32_Const 1, I32_BinOp Add])]
stepUntilFinal $ Config f [] [l7] [] [Plain (I32_Const 5), Plain (Call "f"), Plain (LocalGet 0), Plain (I32_BinOp Add)] Low
stepUntilFinal $ Config f [] [l7] [] [Plain (I32_Const 5), Plain (Call "f"), Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- "Return"
test14 :: LIO Lattice2 (Config Lattice2)
test14 = do
lI32 <- label Low I32
let f = [("f", Func "f" (Params [lI32]) (Results [lI32]) (Locals []) [LocalGet 0, I32_Const 1, I32_BinOp Add, Return, Unreachable])]
stepUntilFinal $ Config f [] [] [] [Plain (I32_Const 5), Plain (Call "f")] Low
stepUntilFinal $ Config f [] [] [] [Plain (I32_Const 5), Plain (Call "f")]
-- "Frame-Nested"
test15 :: LIO Lattice2 (Config Lattice2)
@ -369,17 +381,37 @@ test15 = do
let f = Func "f" (Params [lI32]) (Results [lI32]) (Locals []) [LocalGet 0, Block (Params [lI32]) (Results [lI32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add]]
g = Func "g" (Params [lI32]) (Results [lI32]) (Locals []) [Block (Params []) (Results [lI32]) [LocalGet 0, I32_Const 1, I32_BinOp Add, Br 0, Unreachable]]
fns = [("f", f), ("g", g)]
stepUntilFinal $ Config fns [] [] [] [Plain (I32_Const 5), Plain (Call "f"), Plain Drop] Low
stepUntilFinal $ Config fns [] [] [] [Plain (I32_Const 5), Plain (Call "f"), Plain Drop]
ifcTest1 :: LIO Lattice2 (Config Lattice2)
ifcTest1 = do
lI32 <- label Low I32
hI32 <- label High I32
h1 <- label High (V_I32 1)
let f = Func "f" (Params [hI32]) (Results [lI32]) (Locals [])
[ LocalGet 0
, Block (Params [lI32]) (Results [lI32]) -- if
[ Block (Params [lI32]) (Results [lI32]) -- else
[ BrIf 0
, I32_Const 1
, Br 1
]
, I32_Const 0
]
]
stepUntilFinal $ Config [("f", f)] [] [h1] [] [Plain (LocalGet 0), Plain (Call "f")]
sample :: LIO Lattice2 (Config Lattice2) -> IO ()
sample ex = do
putStrLn "Running with state Low and clearance High"
let state = LIOState Low High
y <- evalLIO ex state
(config, state) <- runLIO ex state
putStrLn "Final stack:"
print y
print config
print state
return ()

View File

@ -4,212 +4,212 @@ import MiniWasm.Execution
import MiniWasm.Syntax
import LIO
(~>) :: a -> b -> (a, b)
(~>) = (,)
-- (~>) :: a -> b -> (a, b)
-- (~>) = (,)
infixr 5 ~>
-- infixr 5 ~>
-- These test-cases verify that your interpreter properly reduces programs in a small-step fashion,
-- even in complex scenarios such as nested labels and function calls.
-- -- These test-cases verify that your interpreter properly reduces programs in a small-step fashion,
-- -- even in complex scenarios such as nested labels and function calls.
-- Each test consists of a sequence of 'Config's, and the test harness will check that your interpreter
-- produces the same sequence of Configs step-by-step.
-- -- Each test consists of a sequence of 'Config's, and the test harness will check that your interpreter
-- -- produces the same sequence of Configs step-by-step.
-- You can add your own or modify them, but be careful: Unlike the full program tests, these Configs
-- are not validated before being executed. If you add an invalid config, it will crash with an
-- unhelpful error like "ill-typed operands on the stack".
-- -- You can add your own or modify them, but be careful: Unlike the full program tests, these Configs
-- -- are not validated before being executed. If you add an invalid config, it will crash with an
-- -- unhelpful error like "ill-typed operands on the stack".
smallStepTests :: LIO Lattice2 [(String, [Config Lattice2])]
smallStepTests = do
l0 <- label Low (V_I32 0)
l1 <- label Low (V_I32 1)
l2 <- label Low (V_I32 2)
l3 <- label Low (V_I32 3)
l4 <- label Low (V_I32 4)
l5 <- label Low (V_I32 5)
-- smallStepTests :: LIO Lattice2 [(String, [Config Lattice2])]
-- smallStepTests = do
-- l0 <- label Low (V_I32 0)
-- l1 <- label Low (V_I32 1)
-- l2 <- label Low (V_I32 2)
-- l3 <- label Low (V_I32 3)
-- l4 <- label Low (V_I32 4)
-- l5 <- label Low (V_I32 5)
l2_64 <- label Low (V_I64 2)
l3_64 <- label Low (V_I64 3)
l5_64 <- label Low (V_I64 5)
-- l2_64 <- label Low (V_I64 2)
-- l3_64 <- label Low (V_I64 3)
-- l5_64 <- label Low (V_I64 5)
return [ "Nop"
~> [ Config [] [] [] [] [Plain Nop] Low
, Config [] [] [] [] [] Low
]
, "Drop"
~> [ Config [] [] [] [l1, l0] [Plain Drop, Plain Drop] Low
, Config [] [] [] [l0] [Plain Drop] Low
, Config [] [] [] [] [] Low
]
, "Unreachable"
~> [ Config [] [] [] [] [Plain Unreachable] Low
, Config [] [] [] [] [Trapping UnreachableExecuted] Low
]
, "Add"
~> [ Config [] [] [] [] [Plain (I32_Const 2), Plain (I32_Const 3), Plain (I32_BinOp Add)] Low
, Config [] [] [] [l2] [Plain (I32_Const 3), Plain (I32_BinOp Add)] Low
, Config [] [] [] [l3, l2] [Plain (I32_BinOp Add)] Low
, Config [] [] [] [l5] [] Low
]
, "Add64"
~> [ Config [] [] [] [] [Plain (I64_Const 2), Plain (I64_Const 3), Plain (I64_BinOp Add)] Low
, Config [] [] [] [l2_64] [Plain (I64_Const 3), Plain (I64_BinOp Add)] Low
, Config [] [] [] [l3_64, l2_64] [Plain (I64_BinOp Add)] Low
, Config [] [] [] [l5_64] [] Low
]
]
{-
, "LocalGet"
~> [ Config [] [] [V_I32 7] [] [Plain (LocalGet 0)]
, Config [] [] [V_I32 7] [V_I32 7] []
]
, "LocalSet"
~> [ Config [] [] [l0] [] [Plain (I32_Const 1), Plain (LocalSet 0)]
, Config [] [] [l0] [l1] [Plain (LocalSet 0)]
, Config [] [] [l1] [] []
]
, "MemSize"
~> [ Config [] [1 .. 10] [] [] [Plain MemSize]
, Config [] [1 .. 10] [] [l10] []
]
, "MemLoad"
~> [ Config [] [1 .. 10] [] [] [Plain (I32_Const 2), Plain I32_Load, Plain (I32_Const 4), Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [l2] [Plain I32_Load, Plain (I32_Const 4), Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [l3] [Plain (I32_Const 4), Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [l4, l3] [Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [l5, l3] [Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [l5, l5, l3] [Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [V_I32 6, l5, l3] [Plain (I32_Const 10), Plain I32_Load]
, Config [] [1 .. 10] [] [l10, V_I32 6, l5, l3] [Plain I32_Load]
, Config [] [1 .. 10] [] [V_I32 6, l5, l3] [Trapping MemoryOutOfBounds]
]
, "MemStore"
~> [ Config [] [1, 2, 3] [] [] [Plain (I32_Const 1), Plain (I32_Const 5), Plain I32_Store, Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
, Config [] [1, 2, 3] [] [l1] [Plain (I32_Const 5), Plain I32_Store, Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
, Config [] [1, 2, 3] [] [l5, l1] [Plain I32_Store, Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
, Config [] [1, 5, 3] [] [] [Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
, Config [] [1, 5, 3] [] [l3] [Plain (I32_Const 6), Plain I32_Store]
, Config [] [1, 5, 3] [] [V_I32 6, l3] [Plain I32_Store]
, Config [] [1, 5, 3] [] [] [Trapping MemoryOutOfBounds]
]
, "Block"
~> [ Config [] [] [] [l5] [Plain (Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add])]
, Config [] [] [] [] [Label 1 [] [l5] ([Plain (I32_Const 1), Plain (I32_BinOp Add)])]
, Config [] [] [] [] [Label 1 [] [l1, l5] ([Plain (I32_BinOp Add)])]
, Config [] [] [] [] [Label 1 [] [V_I32 6] ([])]
, Config [] [] [] [V_I32 6] []
]
, "Loop"
~> [ Config [] [] [] [l5] [Plain (Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add])]
, Config [] [] [] [] [Label 1 [Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add]] [l5] ([Plain (I32_Const 1), Plain (I32_BinOp Add)])]
, Config [] [] [] [] [Label 1 [Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add]] [l1, l5] ([Plain (I32_BinOp Add)])]
, Config [] [] [] [] [Label 1 [Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add]] [V_I32 6] ([])]
, Config [] [] [] [V_I32 6] []
]
, "BrIf-Block"
~> [ Config [] [] [l5] [] [Plain (Block (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0, Unreachable])]
, Config [] [] [l5] [] [Label 0 [] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l5] [] [Label 0 [] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l5] [] [Label 0 [] [l1, l5] [Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l5] [] [Label 0 [] [l4] [Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l4] [] [Label 0 [] [] [Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l4] [] [Label 0 [] [l4] [Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l4] [] [Label 0 [] [l0, l4] [Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l4] [] [Label 0 [] [l1] [Plain (BrIf 0), Plain Unreachable]]
, Config [] [] [l4] [] [Label 0 [] [] [Plain (Br 0), Plain Unreachable]]
, Config [] [] [l4] [] [Label 0 [] [] [Breaking 0 [], Plain Unreachable]]
, Config [] [] [l4] [] []
]
, "BrIf-Loop"
~> let l = Loop (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0]
in [ Config [] [] [l2] [] [Plain l]
, Config [] [] [l2] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l2] [] [Label 0 [l] [l2] [Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l2] [] [Label 0 [l] [l1, l2] [Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l2] [] [Label 0 [l] [l1] [Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [l1] [Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [l0, l1] [Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [l1] [Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [] [Plain (Br 0)]]
, Config [] [] [l1] [] [Label 0 [l] [] [Breaking 0 []]]
, Config [] [] [l1] [] [Plain l]
, Config [] [] [l1] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [l1] [Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [l1, l1] [Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l1] [] [Label 0 [l] [l0] [Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l0] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l0] [] [Label 0 [l] [l0] [Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l0] [] [Label 0 [l] [l0, l0] [Plain (I32_RelOp Gt), Plain (BrIf 0)]]
, Config [] [] [l0] [] [Label 0 [l] [l0] [Plain (BrIf 0)]]
, Config [] [] [l0] [] [Label 0 [l] [] []]
, Config [] [] [l0] [] []
]
, "Label-Nested"
~> [ Config [] [] [] [] [Plain (Block (Params []) (Results [I32]) [Block (Params []) (Results [I32, I32]) [I32_Const 5, I32_Const 6, I32_Const 7, BrIf 1]])]
, Config [] [] [] [] [Label 1 [] [] [Plain (Block (Params []) (Results [I32, I32]) [I32_Const 5, I32_Const 6, I32_Const 7, BrIf 1])]]
, Config [] [] [] [] [Label 1 [] [] [Label 2 [] [] [Plain (I32_Const 5), Plain (I32_Const 6), Plain (I32_Const 7), Plain (BrIf 1)]]]
, Config [] [] [] [] [Label 1 [] [] [Label 2 [] [l5] [Plain (I32_Const 6), Plain (I32_Const 7), Plain (BrIf 1)]]]
, Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 6, l5] [Plain (I32_Const 7), Plain (BrIf 1)]]]
, Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 7, V_I32 6, l5] [Plain (BrIf 1)]]]
, Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 6, l5] [Plain (Br 1)]]]
, Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 6, l5] [Breaking 1 [V_I32 6, l5]]]]
, Config [] [] [] [] [Label 1 [] [] [Breaking 0 [V_I32 6, l5]]]
, Config [] [] [] [V_I32 6] []
]
, "Label-Mutates-Locals"
~> [ Config [] [] [l5] [] [Label 0 [] [l4] [Plain (LocalSet 0), Plain (LocalGet 0)]]
, Config [] [] [l4] [] [Label 0 [] [] [Plain (LocalGet 0)]]
]
, "Call"
~> let f = [("f", Func "f" (Params [I32]) (Results [I32]) (Locals []) [LocalGet 0, I32_Const 1, I32_BinOp Add])]
in [ Config f [] [V_I32 7] [] [Plain (I32_Const 5), Plain (Call "f"), Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [l5] [Plain (Call "f"), Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [] [Frame 1 [l5] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Add)], Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [] [Frame 1 [l5] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Add)], Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [] [Frame 1 [l5] [l1, l5] [Plain (I32_BinOp Add)], Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [] [Frame 1 [l5] [V_I32 6] [], Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [V_I32 6] [Plain (LocalGet 0), Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [V_I32 7, V_I32 6] [Plain (I32_BinOp Add)]
, Config f [] [V_I32 7] [l13] []
]
, "Return"
~> let f = [("f", Func "f" (Params [I32]) (Results [I32]) (Locals []) [LocalGet 0, I32_Const 1, I32_BinOp Add, Return, Unreachable])]
in [ Config f [] [] [] [Plain (I32_Const 5), Plain (Call "f")]
, Config f [] [] [l5] [Plain (Call "f")]
, Config f [] [] [] [Frame 1 [l5] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Add), Plain Return, Plain Unreachable]]
, Config f [] [] [] [Frame 1 [l5] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Add), Plain Return, Plain Unreachable]]
, Config f [] [] [] [Frame 1 [l5] [l1, l5] [Plain (I32_BinOp Add), Plain Return, Plain Unreachable]]
, Config f [] [] [] [Frame 1 [l5] [V_I32 6] [Plain Return, Plain Unreachable]]
, Config f [] [] [] [Frame 1 [l5] [V_I32 6] [Returning [V_I32 6], Plain Unreachable]]
, Config f [] [] [V_I32 6] []
]
, "Frame-Nested"
~> let
f = Func "f" (Params [I32]) (Results [I32]) (Locals []) [LocalGet 0, Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add]]
g = Func "g" (Params [I32]) (Results [I32]) (Locals []) [Block (Params []) (Results [I32]) [LocalGet 0, I32_Const 1, I32_BinOp Add, Br 0, Unreachable]]
fns = [("f", f), ("g", g)]
in
[ Config fns [] [] [] [Plain (I32_Const 5), Plain (Call "f"), Plain Drop]
, Config fns [] [] [l5] [Plain (Call "f"), Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Plain (LocalGet 0), Plain (Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add])], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [l5] [Plain (Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add])], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Add), Plain (Call "g"), Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [l1, l5] [Plain (I32_BinOp Add), Plain (Call "g"), Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [V_I32 6] [Plain (Call "g"), Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Plain (Block (Params []) (Results [I32]) [LocalGet 0, I32_Const 1, I32_BinOp Add, Br 0, Unreachable])], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Add), Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [V_I32 6] [Plain (I32_Const 1), Plain (I32_BinOp Add), Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [l1, V_I32 6] [Plain (I32_BinOp Add), Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [V_I32 7] [Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [V_I32 7] [Breaking 0 [V_I32 7], Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [V_I32 7] [], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [V_I32 7] [Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [l1, V_I32 7] [Plain (I32_BinOp Add)]], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [V_I32 8] []], Plain Drop]
, Config fns [] [] [] [Frame 1 [l5] [V_I32 8] [], Plain Drop]
, Config fns [] [] [V_I32 8] [Plain Drop]
, Config fns [] [] [] []
]
]
-}
-- return [ "Nop"
-- ~> [ Config [] [] [] [] [Plain Nop] Low
-- , Config [] [] [] [] [] Low
-- ]
-- , "Drop"
-- ~> [ Config [] [] [] [l1, l0] [Plain Drop, Plain Drop] Low
-- , Config [] [] [] [l0] [Plain Drop] Low
-- , Config [] [] [] [] [] Low
-- ]
-- , "Unreachable"
-- ~> [ Config [] [] [] [] [Plain Unreachable] Low
-- , Config [] [] [] [] [Trapping UnreachableExecuted] Low
-- ]
-- , "Add"
-- ~> [ Config [] [] [] [] [Plain (I32_Const 2), Plain (I32_Const 3), Plain (I32_BinOp Add)] Low
-- , Config [] [] [] [l2] [Plain (I32_Const 3), Plain (I32_BinOp Add)] Low
-- , Config [] [] [] [l3, l2] [Plain (I32_BinOp Add)] Low
-- , Config [] [] [] [l5] [] Low
-- ]
-- , "Add64"
-- ~> [ Config [] [] [] [] [Plain (I64_Const 2), Plain (I64_Const 3), Plain (I64_BinOp Add)] Low
-- , Config [] [] [] [l2_64] [Plain (I64_Const 3), Plain (I64_BinOp Add)] Low
-- , Config [] [] [] [l3_64, l2_64] [Plain (I64_BinOp Add)] Low
-- , Config [] [] [] [l5_64] [] Low
-- ]
-- ]
-- {-
-- , "LocalGet"
-- ~> [ Config [] [] [V_I32 7] [] [Plain (LocalGet 0)]
-- , Config [] [] [V_I32 7] [V_I32 7] []
-- ]
-- , "LocalSet"
-- ~> [ Config [] [] [l0] [] [Plain (I32_Const 1), Plain (LocalSet 0)]
-- , Config [] [] [l0] [l1] [Plain (LocalSet 0)]
-- , Config [] [] [l1] [] []
-- ]
-- , "MemSize"
-- ~> [ Config [] [1 .. 10] [] [] [Plain MemSize]
-- , Config [] [1 .. 10] [] [l10] []
-- ]
-- , "MemLoad"
-- ~> [ Config [] [1 .. 10] [] [] [Plain (I32_Const 2), Plain I32_Load, Plain (I32_Const 4), Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [l2] [Plain I32_Load, Plain (I32_Const 4), Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [l3] [Plain (I32_Const 4), Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [l4, l3] [Plain I32_Load, Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [l5, l3] [Plain (I32_Const 5), Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [l5, l5, l3] [Plain I32_Load, Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [V_I32 6, l5, l3] [Plain (I32_Const 10), Plain I32_Load]
-- , Config [] [1 .. 10] [] [l10, V_I32 6, l5, l3] [Plain I32_Load]
-- , Config [] [1 .. 10] [] [V_I32 6, l5, l3] [Trapping MemoryOutOfBounds]
-- ]
-- , "MemStore"
-- ~> [ Config [] [1, 2, 3] [] [] [Plain (I32_Const 1), Plain (I32_Const 5), Plain I32_Store, Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
-- , Config [] [1, 2, 3] [] [l1] [Plain (I32_Const 5), Plain I32_Store, Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
-- , Config [] [1, 2, 3] [] [l5, l1] [Plain I32_Store, Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
-- , Config [] [1, 5, 3] [] [] [Plain (I32_Const 3), Plain (I32_Const 6), Plain I32_Store]
-- , Config [] [1, 5, 3] [] [l3] [Plain (I32_Const 6), Plain I32_Store]
-- , Config [] [1, 5, 3] [] [V_I32 6, l3] [Plain I32_Store]
-- , Config [] [1, 5, 3] [] [] [Trapping MemoryOutOfBounds]
-- ]
-- , "Block"
-- ~> [ Config [] [] [] [l5] [Plain (Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add])]
-- , Config [] [] [] [] [Label 1 [] [l5] ([Plain (I32_Const 1), Plain (I32_BinOp Add)])]
-- , Config [] [] [] [] [Label 1 [] [l1, l5] ([Plain (I32_BinOp Add)])]
-- , Config [] [] [] [] [Label 1 [] [V_I32 6] ([])]
-- , Config [] [] [] [V_I32 6] []
-- ]
-- , "Loop"
-- ~> [ Config [] [] [] [l5] [Plain (Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add])]
-- , Config [] [] [] [] [Label 1 [Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add]] [l5] ([Plain (I32_Const 1), Plain (I32_BinOp Add)])]
-- , Config [] [] [] [] [Label 1 [Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add]] [l1, l5] ([Plain (I32_BinOp Add)])]
-- , Config [] [] [] [] [Label 1 [Loop (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add]] [V_I32 6] ([])]
-- , Config [] [] [] [V_I32 6] []
-- ]
-- , "BrIf-Block"
-- ~> [ Config [] [] [l5] [] [Plain (Block (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0, Unreachable])]
-- , Config [] [] [l5] [] [Label 0 [] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l5] [] [Label 0 [] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l5] [] [Label 0 [] [l1, l5] [Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l5] [] [Label 0 [] [l4] [Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l4] [] [Label 0 [] [] [Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l4] [] [Label 0 [] [l4] [Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l4] [] [Label 0 [] [l0, l4] [Plain (I32_RelOp Gt), Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l4] [] [Label 0 [] [l1] [Plain (BrIf 0), Plain Unreachable]]
-- , Config [] [] [l4] [] [Label 0 [] [] [Plain (Br 0), Plain Unreachable]]
-- , Config [] [] [l4] [] [Label 0 [] [] [Breaking 0 [], Plain Unreachable]]
-- , Config [] [] [l4] [] []
-- ]
-- , "BrIf-Loop"
-- ~> let l = Loop (Params []) (Results []) [LocalGet 0, I32_Const 1, I32_BinOp Sub, LocalSet 0, LocalGet 0, I32_Const 0, I32_RelOp Gt, BrIf 0]
-- in [ Config [] [] [l2] [] [Plain l]
-- , Config [] [] [l2] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l2] [] [Label 0 [l] [l2] [Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l2] [] [Label 0 [l] [l1, l2] [Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l2] [] [Label 0 [l] [l1] [Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [l1] [Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [l0, l1] [Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [l1] [Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [] [Plain (Br 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [] [Breaking 0 []]]
-- , Config [] [] [l1] [] [Plain l]
-- , Config [] [] [l1] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [l1] [Plain (I32_Const 1), Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [l1, l1] [Plain (I32_BinOp Sub), Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l1] [] [Label 0 [l] [l0] [Plain (LocalSet 0), Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l0] [] [Label 0 [l] [] [Plain (LocalGet 0), Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l0] [] [Label 0 [l] [l0] [Plain (I32_Const 0), Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l0] [] [Label 0 [l] [l0, l0] [Plain (I32_RelOp Gt), Plain (BrIf 0)]]
-- , Config [] [] [l0] [] [Label 0 [l] [l0] [Plain (BrIf 0)]]
-- , Config [] [] [l0] [] [Label 0 [l] [] []]
-- , Config [] [] [l0] [] []
-- ]
-- , "Label-Nested"
-- ~> [ Config [] [] [] [] [Plain (Block (Params []) (Results [I32]) [Block (Params []) (Results [I32, I32]) [I32_Const 5, I32_Const 6, I32_Const 7, BrIf 1]])]
-- , Config [] [] [] [] [Label 1 [] [] [Plain (Block (Params []) (Results [I32, I32]) [I32_Const 5, I32_Const 6, I32_Const 7, BrIf 1])]]
-- , Config [] [] [] [] [Label 1 [] [] [Label 2 [] [] [Plain (I32_Const 5), Plain (I32_Const 6), Plain (I32_Const 7), Plain (BrIf 1)]]]
-- , Config [] [] [] [] [Label 1 [] [] [Label 2 [] [l5] [Plain (I32_Const 6), Plain (I32_Const 7), Plain (BrIf 1)]]]
-- , Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 6, l5] [Plain (I32_Const 7), Plain (BrIf 1)]]]
-- , Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 7, V_I32 6, l5] [Plain (BrIf 1)]]]
-- , Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 6, l5] [Plain (Br 1)]]]
-- , Config [] [] [] [] [Label 1 [] [] [Label 2 [] [V_I32 6, l5] [Breaking 1 [V_I32 6, l5]]]]
-- , Config [] [] [] [] [Label 1 [] [] [Breaking 0 [V_I32 6, l5]]]
-- , Config [] [] [] [V_I32 6] []
-- ]
-- , "Label-Mutates-Locals"
-- ~> [ Config [] [] [l5] [] [Label 0 [] [l4] [Plain (LocalSet 0), Plain (LocalGet 0)]]
-- , Config [] [] [l4] [] [Label 0 [] [] [Plain (LocalGet 0)]]
-- ]
-- , "Call"
-- ~> let f = [("f", Func "f" (Params [I32]) (Results [I32]) (Locals []) [LocalGet 0, I32_Const 1, I32_BinOp Add])]
-- in [ Config f [] [V_I32 7] [] [Plain (I32_Const 5), Plain (Call "f"), Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [l5] [Plain (Call "f"), Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [] [Frame 1 [l5] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Add)], Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [] [Frame 1 [l5] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Add)], Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [] [Frame 1 [l5] [l1, l5] [Plain (I32_BinOp Add)], Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [] [Frame 1 [l5] [V_I32 6] [], Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [V_I32 6] [Plain (LocalGet 0), Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [V_I32 7, V_I32 6] [Plain (I32_BinOp Add)]
-- , Config f [] [V_I32 7] [l13] []
-- ]
-- , "Return"
-- ~> let f = [("f", Func "f" (Params [I32]) (Results [I32]) (Locals []) [LocalGet 0, I32_Const 1, I32_BinOp Add, Return, Unreachable])]
-- in [ Config f [] [] [] [Plain (I32_Const 5), Plain (Call "f")]
-- , Config f [] [] [l5] [Plain (Call "f")]
-- , Config f [] [] [] [Frame 1 [l5] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Add), Plain Return, Plain Unreachable]]
-- , Config f [] [] [] [Frame 1 [l5] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Add), Plain Return, Plain Unreachable]]
-- , Config f [] [] [] [Frame 1 [l5] [l1, l5] [Plain (I32_BinOp Add), Plain Return, Plain Unreachable]]
-- , Config f [] [] [] [Frame 1 [l5] [V_I32 6] [Plain Return, Plain Unreachable]]
-- , Config f [] [] [] [Frame 1 [l5] [V_I32 6] [Returning [V_I32 6], Plain Unreachable]]
-- , Config f [] [] [V_I32 6] []
-- ]
-- , "Frame-Nested"
-- ~> let
-- f = Func "f" (Params [I32]) (Results [I32]) (Locals []) [LocalGet 0, Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add]]
-- g = Func "g" (Params [I32]) (Results [I32]) (Locals []) [Block (Params []) (Results [I32]) [LocalGet 0, I32_Const 1, I32_BinOp Add, Br 0, Unreachable]]
-- fns = [("f", f), ("g", g)]
-- in
-- [ Config fns [] [] [] [Plain (I32_Const 5), Plain (Call "f"), Plain Drop]
-- , Config fns [] [] [l5] [Plain (Call "f"), Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Plain (LocalGet 0), Plain (Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add])], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [l5] [Plain (Block (Params [I32]) (Results [I32]) [I32_Const 1, I32_BinOp Add, Call "g", I32_Const 1, I32_BinOp Add])], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [l5] [Plain (I32_Const 1), Plain (I32_BinOp Add), Plain (Call "g"), Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [l1, l5] [Plain (I32_BinOp Add), Plain (Call "g"), Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [V_I32 6] [Plain (Call "g"), Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Plain (Block (Params []) (Results [I32]) [LocalGet 0, I32_Const 1, I32_BinOp Add, Br 0, Unreachable])], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [] [Plain (LocalGet 0), Plain (I32_Const 1), Plain (I32_BinOp Add), Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [V_I32 6] [Plain (I32_Const 1), Plain (I32_BinOp Add), Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [l1, V_I32 6] [Plain (I32_BinOp Add), Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [V_I32 7] [Plain (Br 0), Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [] [Label 1 [] [V_I32 7] [Breaking 0 [V_I32 7], Plain Unreachable]], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [] [Frame 1 [V_I32 6] [V_I32 7] [], Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [V_I32 7] [Plain (I32_Const 1), Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [l1, V_I32 7] [Plain (I32_BinOp Add)]], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [] [Label 1 [] [V_I32 8] []], Plain Drop]
-- , Config fns [] [] [] [Frame 1 [l5] [V_I32 8] [], Plain Drop]
-- , Config fns [] [] [V_I32 8] [Plain Drop]
-- , Config fns [] [] [] []
-- ]
-- ]
-- -}