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:
$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.
Some information about a module doesn't get passed down to one of the text2abstract operations that need it: https://github.com/runtimeverification/wasm-semantics/blob/b353017e7178731daa12cba75dc81fd69e20a81f/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm-text.md?plain=1#L837-L849
On line 839,
t2aDefns
is invoked on the functions of the module with the contextC
. 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:$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 the42
that was passed in is at.Relevant rules:
https://github.com/runtimeverification/wasm-semantics/blob/b353017e7178731daa12cba75dc81fd69e20a81f/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm-text.md?plain=1#L883-L888
https://github.com/runtimeverification/wasm-semantics/blob/b353017e7178731daa12cba75dc81fd69e20a81f/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm-text.md?plain=1#L1309-L1325