Skip to content

JIT/wasm: place SCC dispatcher inside Wasm try region when needed#129025

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-scc-try-entry
Jun 6, 2026
Merged

JIT/wasm: place SCC dispatcher inside Wasm try region when needed#129025
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-scc-try-entry

Conversation

@AndyAyersMS
Copy link
Copy Markdown
Member

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.

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>
Copilot AI review requested due to automatic review settings June 5, 2026 00:23
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 5, 2026
@AndyAyersMS
Copy link
Copy Markdown
Member Author

@dotnet/wasm-contrib PTAL
fyi @dotnet/jit-contrib

These came up doing some more extensive testing of R2R'd pri0 tests.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_WASM check for unsupported SCC header try-nesting relationships.
  • Improve debug dumps to report the dispatcher’s chosen EH region (try vs handler vs method).

Copy link
Copy Markdown
Member

@JulieLeeMSFT JulieLeeMSFT left a comment

Choose a reason for hiding this comment

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

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.

@AndyAyersMS
Copy link
Copy Markdown
Member Author

Failures were #129065

@AndyAyersMS
Copy link
Copy Markdown
Member Author

/ba-g known failures

@AndyAyersMS AndyAyersMS merged commit 2d24182 into dotnet:main Jun 6, 2026
131 of 141 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants