Skip to content

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

Open
AndyAyersMS wants to merge 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-scc-try-entry
Open

JIT/wasm: place SCC dispatcher inside Wasm try region when needed#129025
AndyAyersMS wants to merge 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).

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.

2 participants