[EH] Fix binary parsing for catchless try + inner delegate #4370
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We do some postprocessing after parsing
Tryto make suredelegateonly targets
trys and notblocks:binaryen/src/wasm/wasm-binary.cpp
Lines 6404 to 6426 in 9659f9b
But in case the outer
tryhas neither ofcatchnordelegate, theprevious code just return prematurely, skipping the postprocessing part,
resulting in a binary parsing error. This PR removes that early-exiting
code.
Some test outputs have changed because
trys are assigned labels afterthe early exit. But those labels can be removed by other optimization
passes when there is no inner
rethrowordelegatethat targets them.(On a side note, the restriction that
delegatecannot target ablockhas been removed a few months ago in the spec, so if a
delegatetargets a
block, it means it is just rethrown from that block. But Istill think this is a convenient invariant to hold at least within the
binaryen IR. I'm planning to allow parsing of
delegatetargetingblocks later, but I will make them point totrywhen read in theIR. At the moment the LLVM toolchain does not generate such code.)