Skip to content

[EH] Fix assumption that all throw_refs are created from rethrows #6524

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

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Apr 23, 2024

shouldBeRef incorrectly assumed that all throw_refs within a catch body had been generated from rethrows, which was not true, because throw_refs are also created when translating try-delegates:

curr->body = builder.makeThrowRef(innerBody);

This fixes the assumption and changes cast to dynCast.

`shouldBeRef` incorrectly assumed that all `throw_ref`s within a `catch`
body had been generated from `rethrow`s, which was not true, because
`throw_ref`s are also created when translating `try`-`delegate`s:
https://github.com/WebAssembly/binaryen/blob/219e668e87b012c0634043ed702534b8be31231f/src/passes/TranslateEH.cpp#L304

This fixes the assumption and changes `cast` to `dynCast`.
@aheejin aheejin requested a review from kripken April 23, 2024 16:06
@aheejin aheejin merged commit 94ddae0 into WebAssembly:main Apr 23, 2024
@aheejin aheejin deleted the translate_fix_throw_ref branch April 23, 2024 16:59
@gkdn gkdn mentioned this pull request Aug 31, 2024
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