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

[Parser] Parse tags and throw #6126

Merged
merged 2 commits into from
Nov 21, 2023
Merged

[Parser] Parse tags and throw #6126

merged 2 commits into from
Nov 21, 2023

Conversation

tlively
Copy link
Member

@tlively tlively commented Nov 17, 2023

Also fix the parser to correctly error if an imported item appears after a
non-imported item and make the corresponding fix to the test.

@tlively tlively requested a review from ashleynh November 17, 2023 03:09
@tlively
Copy link
Member Author

tlively commented Nov 17, 2023

When branches target control flow structures other than blocks or loops, the
IRBuilder wraps those control flow structures with an extra block for the
branches to target in Binaryen IR. Usually that block has the same type as the
control flow structure it wraps, but when the control flow structure is
unreachable because all its bodies are unreachable, the wrapper block may still
need to have a non-unreachable type if it is targeted by branches.

Previously the wrapper block would also be unreachable in that case. Fix the bug
by tracking whether the wrapper block will be targeted by any branches and use
the control flow structure's original, non-unreachable type if so.
Also fix the parser to correctly error if an imported item appears after a
non-imported item and make the corresponding fix to the test.
@tlively tlively changed the base branch from main to ir-builder-scope-types November 21, 2023 01:53
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $throw
throw 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

How did throw de bruijn 2 become $1?

Copy link
Collaborator

Choose a reason for hiding this comment

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

talked offline: not a de bruijn idx, but a tag idx.

Base automatically changed from ir-builder-scope-types to main November 21, 2023 07:50
@tlively tlively merged commit cccc7a6 into main Nov 21, 2023
14 checks passed
@tlively tlively deleted the parser-tag-throw branch November 21, 2023 07:50
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
Also fix the parser to correctly error if an imported item appears after a
non-imported item and make the corresponding fix to the test.
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