Closed ShinWonho closed 7 months ago
The typing rule for modules that you quote invokes a special rule for typing sequences of globals, which is defined here (or when you click on the turnstile). That updates the context incrementally, just like the interpreter does. This is different from iterating individual invocations as done for other entities.
So AFAICS there is no inconsistency between spec and interpreter, merely a bug in wat2wasm.
Oh, the specification also updates the context in validating the sequence of globals. I missed that. Thank you for the comment!
Validation in the specification
When validating globals, it uses context
C'
which only contains imported globalsigt
in the global field.Validation in the gc reference interpreter
However, the gc reference interpreter continuously updates context and validates globals using the updated context.
Inconsistency
I check the following wasm module with wat2wasm in wabt and the gc reference interpreter
Because this gc proposal contains function references and tail-call proposals, I enable all of them and run wat2wasm. wat2wasm raise type error, while reference interpreter doesn't.