Skip to content

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
@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.

3 participants