WebAssembly / spec

WebAssembly specification, reference interpreter, and test suite.
https://webassembly.github.io/spec/
Other
3.09k stars 438 forks source link

[spec] Fixing module typing for active elem/data segments #1737

Closed raoxiaojia closed 4 months ago

raoxiaojia commented 4 months ago

Under the current module typing rules, if a module defines any module elem/data segment with an active mode, then it cannot be well-typed: this is because the definition requires each elem/data to be well-typed under the C' context, but no tables and memories exist there.

This proposed change fixes this issue by allowing the module elem and data segments to access the full tables and memories accessible in the module.

raoxiaojia commented 4 months ago

Thanks! I think you need to fix it in the Latex rule as well.

You are right -- done unless I've missed anything else! I'm not sure if the new additions would fit into the same line, but I'm uncertain if you'd want to introduce an additional line break there.