Repository navigation
[wasm] Insert GC Polls in Cycles - #136406
Closed
adamperlin wants to merge 3 commits into
Closed
adamperlin wants to merge 3 commits into
adamperlin wants to merge 3 commits into
Conversation
…back-edges and mark cycle headers as BBF_NEEDS_GCPOLL
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 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
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression tests do not deterministically verify poll emission or collection safety with live references and interior byrefs.
1 open issue
What changed in this PR
Adds GC poll placement for WebAssembly control-flow cycles, addressing the Wasm ReadyToRun polling gap described in #133431.
Changes:
- Marks cycle headers for polling, including implicit cycles through tail calls.
- Makes the frame-size node available outside target guards and adds debug display support.
- Adds browser/CoreCLR regression cases for loops, live references, interior byrefs, and tail calls.
| File | Description |
|---|---|
src/tests/JIT/Regression_3/WasmGCPolls/WasmGCPollsTailCalls.ilproj |
Builds the IL test helper library. |
src/tests/JIT/Regression_3/WasmGCPolls/WasmGCPollsTailCalls.il |
Adds tail-call and control-flow edge cases. |
src/tests/JIT/Regression_3/WasmGCPolls/WasmGCPolls.csproj |
Configures isolated browser/CoreCLR ReadyToRun tests. |
src/tests/JIT/Regression_3/WasmGCPolls/WasmGCPolls.cs |
Checks results across several cycle shapes. |
src/coreclr/jit/gtlist.h |
Moves the frame-size node into the unconditional node list. |
src/coreclr/jit/gentree.cpp |
Handles frame-size nodes in debug output. |
src/coreclr/jit/flowgraph.cpp |
Detects cycles and marks headers for GC polls. |
src/coreclr/jit/compiler.h |
Declares the cycle-marking helper. |
Review effort: Balanced
Comment on lines
+18
to
+20
| Assert.Equal(expected, SimpleCycle(iterations)); | ||
| Assert.Equal(expected, ReferenceCycle(iterations)); | ||
| Assert.Equal(expected, InteriorByrefCycle(iterations)); |
This was referenced Oct 24, 2026
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.

Resolves #133431. We don't have fully interruptible GC mode in Wasm, so if we have a cycle there may not be an opportunity for a GC; insert GC polls at cycle headers to conservatively ensure we do have GC opporunities.