Conversation
lukewagner
left a comment
There was a problem hiding this comment.
Much more convenient to write/read the signature inline, so I like this change.
|
Merging based on above approval and off-line feedback. |
Implement #599 in interpreter and adapt & add tests.
Function type gets its own element rather than being a part of the call_indirect (see WebAssembly/spec#599)
Function type gets its own element rather than being a part of the call_indirect (see WebAssembly/spec#599)
|
I have a request for clarification here as I'm just getting around to implementing this. On spec/test/core/call_indirect.wast Line 59 in 98b90e2 So, just to confirm, the module-level function type def list can be altered while parsing instructions? I can ask this in a new issue or in another place if this issue isn't where it should happen. |
Yes, the behavior is the same as defining a function without an explicit function type. |
|
Thanks @binji, and just one more confirmation since order is important, if the type for the func that contains this |
|
Not sure if I quite understand, but here's an example: The type section should have: |
|
Yes, note the sentence at the end of the section, which states that "abbreviations are expanded in the order they appear". |
|
Perfect, thanks! It's just taking me a bit of extra work because not only did I never have the type def list passed in as contextual state to my insn parser, but I hadn't needed any module-level mutable state in there until now (granted I could just return a bunch of immutable things from every recursive insn-parse call and shore up, but same annoyance applies). I also didn't add the function type to the module-level list until after I had parsed the whole function w/ insns hence the most recent question. Thanks again. |
) Function type gets its own element rather than being a part of the call_indirect (see WebAssembly/spec#599) EOSIO note: Only cherry-pick the .cpp changes for this. Trying to pull up the tests is not feasible. We don't use the tests anyways.
…y#602) Implement WebAssembly#599 in interpreter and adapt & add tests.
This is a late but small change/extension to the text format that I floated with some people.
Instead of a simple type index, the call signature for
call_indirectis specified using the existingtypeusesyntax used e.g. in function declarations:That makes it consistent with how types are/will be referenced elsewhere (besides function declarations, e.g. in block signatures in the multi-value proposal). Furthermore, as the example shows, it implies that you can write the call signature inline, like for functions and blocks.
The expansion rules are like for function declarations. However, inline types for call_indirect must not include parameter names.