JIT/wasm: place SCC dispatcher inside Wasm try region when needed#129025
Conversation
If an SCC header is a Wasm try entry, the SCC dispatcher must be placed inside that try region. Handle this case. If a different SCC header is in a sibling or deeper-nested try, we cannot yet handle the flow transformation needed; flag this with NYI_WASM for now. Fixes some cases in dotnet#128234. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@dotnet/wasm-contrib PTAL These came up doing some more extensive testing of R2R'd pri0 tests. |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Wasm SCC (irreducible-loop) “switch dispatcher” transformation to respect EH/try-region entry rules by placing the dispatcher inside a Wasm try region when an SCC entry header is also the try entry block. It also adds an explicit NYI_WASM guard for cases where another SCC entry header lives in a sibling or deeper-nested try region that would require a more complex flow transformation.
Changes:
- When an SCC header is a Wasm try entry, create the dispatcher block in that try region (and place it near the try header) so the dispatcher’s outgoing edges don’t create “middle-entry” edges into the try.
- Route inbound flow through the Wasm try header when a dispatcher is placed inside the try, and add an
NYI_WASMcheck for unsupported SCC header try-nesting relationships. - Improve debug dumps to report the dispatcher’s chosen EH region (try vs handler vs method).
JulieLeeMSFT
left a comment
There was a problem hiding this comment.
LGTM. It makes a multi-entry (irreducible) SCC reducible by moving the BBJ_SWITCH dispatcher into the Wasm try region when one of the SCC headers is also the Wasm try entry. So, case edges to in-try headers don't become illegal middle-entry edges.
Also, it handles the NYI cases where another SCC entry header lives in a sibling or deeper nested try region.
|
Failures were #129065 |
|
/ba-g known failures |
If an SCC header is a Wasm try entry, the SCC dispatcher must be placed inside that try region. Handle this case. If a different SCC header is in a sibling or deeper-nested try, we cannot yet handle the flow transformation needed; flag this with NYI_WASM for now.
Fixes some cases in #128234.