Description
Some information about a module doesn't get passed down to one of the text2abstract operations that need it:
wasm-semantics/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm-text.md
Lines 837 to 849 in b353017
On line 839, t2aDefns
is invoked on the functions of the module with the context C
. However, this context doesn't contain the signatures for the types in the module, only their ids. So, when t2a goes to calculate the indices of the variables in a function body, it doesn't have the function parameters for named types.
Here's an example from the wasm tests func.wast
that fails because of this:
(module
(type $sig (func (param i32) (result i32)))
(func (export "f") (type $sig)
(local $var i32)
(local.get $var)
)
)
(assert_return (invoke "f" (i32.const 42)) (i32.const 0))
$var
here is assigned index 0. But, it should be 1, as the (param i32)
in the function signature is at index 0 already. So, when "f"
gets invoked, (local.get 0)
is evaluated and returned, which is where the 42
that was passed in is at.
Relevant rules:
wasm-semantics/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm-text.md
Lines 883 to 888 in b353017
wasm-semantics/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm-text.md
Lines 1309 to 1325 in b353017