Skip to content
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

Add an arity immediate to tuple.extract #6172

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Add an arity immediate to tuple.extract #6172

merged 1 commit into from
Dec 13, 2023

Conversation

tlively
Copy link
Member

@tlively tlively commented Dec 12, 2023

Once support for tuple.extract lands in the new WAT parser, this arity immediate
will let the parser determine how many values it should pop off the stack to
serve as the tuple operand to tuple.extract. This will usually coincide with
the arity of a tuple-producing instruction on top of the stack, but in the
spirit of treating the input as a proper stack machine, it will not have to and
the parser will still work correctly.

Once support for tuple.extract lands in the new WAT parser, this arity immediate
will let the parser determine how many values it should pop off the stack to
serve as the tuple operand to `tuple.extract`. This will usually coincide with
the arity of a tuple-producing instruction on top of the stack, but in the
spirit of treating the input as a proper stack machine, it will not have to and
the parser will still work correctly.
@tlively tlively requested a review from kripken December 12, 2023 23:38
@tlively
Copy link
Member Author

tlively commented Dec 12, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get why these changes are unavoidable, but am also a little unhappy about them... but there is no alternative.

@tlively
Copy link
Member Author

tlively commented Dec 12, 2023

This one is perhaps slightly less necessary than the previous ones, but it will still avoid a small amount of extra complexity in IRBuilder. Right now IRBuilder::pop takes a particular number of values to pop (where a tuple is multiple values), so you have to know the size of the tuple you're popping in advance. In principle we could add a new method popWhatever to work around this, but that's certainly something we would never need for a real WebAssembly instruction.

@kripken
Copy link
Member

kripken commented Dec 13, 2023

It's fine as it is, I think. It's consistent with the other tuple changes, all of which are necessary.

@tlively tlively merged commit 28bea54 into main Dec 13, 2023
14 checks passed
@tlively tlively deleted the tuple-extract-arity branch December 13, 2023 01:20
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
Once support for tuple.extract lands in the new WAT parser, this arity immediate
will let the parser determine how many values it should pop off the stack to
serve as the tuple operand to `tuple.extract`. This will usually coincide with
the arity of a tuple-producing instruction on top of the stack, but in the
spirit of treating the input as a proper stack machine, it will not have to and
the parser will still work correctly.
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

Successfully merging this pull request may close these issues.

2 participants