New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement parsing of tables with initializer expressions #823
Implement parsing of tables with initializer expressions #823
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Reading over the proposal though I'm not sure if the TableType
is the best place to store and parse this. It seems that the initialization expression is only a matter for table definitions, not general type declarations such as table imports. If that's the case, could the parsing here be updated to only parse the initialization expression for a table declaration rather than a general table type?
I made this decision based on implied idea that this default/init expression becomes a "metadata" that affect other operations such as |
I don't think that it's type level information, though, but rather runtime information? I could be misunderstanding the spec, though, but for example when a table is imported is the initializer element specified? If so I would expect that the spec would grow more logic around the "matching" semantics to test whether two table types are equivalent, and if not I think it's runtime information that is stateful but not part of the type information. |
The function references proposal adds initializer for tables when its type is non-nullable reference. The text format is extended with constant expression (which can have ref.func). The binary format adds `0x40 0x00` prefix to the table section entry to indicate expression presence. https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md
0a4a661
to
622323e
Compare
Simplified patch by moving |
This fixes a recent fuzz-bug found from bytecodealliance#823 where initialization expressions needed to be expanded before resolution.
This fixes a recent fuzz-bug found from #823 where initialization expressions needed to be expanded before resolution.
The function references proposal adds initializer for tables when its type is non-nullable reference. The text format is extended with constant expression (which can have
ref.func
). The binary format adds0x40 0x00
prefix to the table section entry to indicate expression presence.https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md