Skip to content

Stack branch type checking of call_indirect #318

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

Closed
binji opened this issue Aug 8, 2016 · 5 comments
Closed

Stack branch type checking of call_indirect #318

binji opened this issue Aug 8, 2016 · 5 comments

Comments

@binji
Copy link
Member

binji commented Aug 8, 2016

Type checking of call_indirect on the stack branch is currently defined as:

  | CallIndirect x ->
    let FuncType (ins, out) = type_ c.types x in
    (ins @ [I32Type]) --> Stack out

Which means the table index comes last (i.e. is on the top of the stack), is that correct? This is inconsistent with the binary format 0xb where the function index is first. Though I've also noticed that this isn't specified in the binary format design docs: https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#basic-operators-described-here.

Is this also changing with binary_0xc, or is this a bug?

@kripken
Copy link
Member

kripken commented Aug 8, 2016

I believe this is an intentional change, yes, to make call_indirect more like select, br_table, etc. The change showed up in b155302 together with test changes for it.

@binji
Copy link
Member Author

binji commented Aug 8, 2016

OK, that makes sense, kind of.

@rossberg
Copy link
Member

Yes, we decided to make this change for 0xC. Somebody still has to write the PR, though. I can do that.

@rossberg
Copy link
Member

See WebAssembly/design#758.

@rossberg
Copy link
Member

Design repo has been updated.

ngzhian added a commit to ngzhian/spec that referenced this issue Nov 4, 2021
rossberg pushed a commit that referenced this issue Jul 23, 2024
This method mirrors the type methods on the other interfaces (Global, Memory,
etc) as defined in the JS type reflection proposal
(https://github.com/WebAssembly/js-types/blob/main/proposals/js-types/Overview.md)
Since this proposal will be standardized first, JS types should be rebased on top
of exception-handling, and this method should be moved there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants