Skip to content

[Wasm RyuJit] multi entry try preliminaries#126327

Open
AndyAyersMS wants to merge 7 commits intodotnet:mainfrom
AndyAyersMS:WasmMultiEntryTryPreliminaries
Open

[Wasm RyuJit] multi entry try preliminaries#126327
AndyAyersMS wants to merge 7 commits intodotnet:mainfrom
AndyAyersMS:WasmMultiEntryTryPreliminaries

Conversation

@AndyAyersMS
Copy link
Copy Markdown
Member

Prep work for handling multi-entry try regions in Wasm targeting.

  • Allow the FlowGraphTryRegion descriptors to be built with or without a backing DFS. If there is no DFS, use bbNum-based bit vectors, and assert if asked to enumerate in blocks reverse post order.
  • Mark the Wasm EH dispatch blocks that can branch back into their try with BBF_CATCH_RESUMPTION.
  • Keep track of try regions with multiple entries. and also track all the entry edges.
  • Update diagnostics to allow for catch resumption entries into trys.
  • Bail out in Wasm Control Flow if there is a multi-entry try.

Copilot AI review requested due to automatic review settings March 30, 2026 19:21
@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 Mar 30, 2026
@AndyAyersMS AndyAyersMS changed the title Wasm multi entry try preliminaries [Wasm RyuJit] multi entry try preliminaries Mar 30, 2026
@AndyAyersMS
Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib

@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

Prep work in CoreCLR JIT for handling (and currently detecting/bailing on) multi-entry try regions during Wasm control-flow restructuring.

Changes:

  • Extend FlowGraphTryRegions / FlowGraphTryRegion to optionally operate without a DFS, track try blocks via bitvectors, and record try-entry edges / side-entry status.
  • Mark Wasm EH dispatch switch blocks as BBF_CATCH_RESUMPTION and bail out of Wasm control flow when multi-entry try regions are detected.
  • Relax EH predecessor diagnostics on Wasm to tolerate catch-resumption edges into the middle of try regions (transiently during restructuring).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/coreclr/jit/flowgraph.cpp Builds try-region descriptors using DFS or bbNum indexing; records entry edges and flags side-entry/multi-entry tries; updates dump output.
src/coreclr/jit/fgwasm.cpp Uses try-region info to NYI on multi-entry tries; marks dispatch switch blocks as catch resumptions; adjusts EH-flow handling.
src/coreclr/jit/fgdiagnostic.cpp Allows (Wasm) catch-resumption edges to enter try blocks mid-region during restructuring.
src/coreclr/jit/compiler.hpp Asserts RPO enumeration is only used when a DFS is available; updates bitvector trait usage.
src/coreclr/jit/compiler.h Adds entry-edge tracking and multi-entry try tracking; stores compiler pointer/traits; adds Wasm state flags.
src/coreclr/jit/block.h Introduces BBF_CATCH_RESUMPTION basic-block flag.

Comment on lines +2762 to +2765
// Catch resumptions are allowed to jump into try blocks at any point.
// They are transients during Wasm control flow restructuring.
// TODO: revoke after SCC
if (m_compiler->fgWasmHasCatchResumptions && blockPred->HasFlag(BBF_CATCH_RESUMPTION))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is meant by a "catch resumption"?

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