[Wasm RyuJit] assert function regions are contiguous after control flow - #131433
Open
AndyAyersMS wants to merge 1 commit into
Open
[Wasm RyuJit] assert function regions are contiguous after control flow#131433AndyAyersMS wants to merge 1 commit into
AndyAyersMS wants to merge 1 commit into
Conversation
Codegen emits one wasm function body per region (main method and each funclet) by walking the block order. Add a debug check after fgWasmControlFlow that each region's blocks are contiguous in the order. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b7c0ded2-277e-4756-aa38-e786756ceb45
Member
Author
|
@adamperlin PTAL Just adding some defensive checks; out of order blocks lead to more confusing errors in codegen. |
|
Azure Pipelines: Successfully started running 6 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a DEBUG-only validation in the Wasm-specific control-flow phase to ensure basic blocks belonging to each “wasm function region” (main method and each funclet/filter region) appear contiguously in the final physical block order that codegen walks. This helps catch invalid block ordering early, given Wasm codegen emits one Wasm function body per region.
Changes:
- Add a DEBUG assertion in
fgWasmControlFlowthat detects “re-entry” into a previously closed funclet region while iteratingBlocks(). - Factor out region classification logic into a new helper
bbFuncletRegionOfand reuse it frombbIsInSameFunclet. - Declare the new helper on
Compilerto make it available to other compilation phases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/coreclr/jit/fgwasm.cpp |
Adds a DEBUG-only contiguity check over physical block order to ensure each funclet region forms one contiguous block sequence. |
src/coreclr/jit/compiler.hpp |
Introduces bbFuncletRegionOf (main region = 0, filter adjustment) and re-implements bbIsInSameFunclet in terms of it. |
src/coreclr/jit/compiler.h |
Adds the bbFuncletRegionOf declaration to the Compiler class. |
adamperlin
approved these changes
Jul 27, 2026
adamperlin
left a comment
Contributor
There was a problem hiding this comment.
This looks good to me!
Member
Author
|
/ba-g build timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Codegen emits one wasm function body per region (main method and each funclet) by walking the block order. Add a debug check after fgWasmControlFlow that each region's blocks are contiguous in the order.