JIT: Keep intrinsic-only loops fully interruptible - #133884
Merged
Merged
Conversation
|
Azure Pipelines: 16 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: @agocke |
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix GC deadlock in Span.CopyTo method
JIT: Keep intrinsic-only loops fully interruptible
Sep 14, 2026
EgorBo
marked this pull request as ready for review
September 14, 2026 18:25
Member
|
Almost no diffs, slight increase in GC info as expected, since full interruptability adds size. |
|
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. |
Member
|
PTAL @AndyAyersMS @dotnet/jit-contrib |
AndyAyersMS
reviewed
Sep 14, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Narrow the intrinsic check and add regression tests for the described GC scenarios.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This JIT change prevents GC suspension deadlocks in loops whose only intrinsic call is removed during lowering.
Changes:
- Excludes special intrinsics from GC safe-point detection.
- Treats intrinsic-only loops as fully interruptible.
File summaries
| File | Summary |
|---|---|
src/coreclr/jit/compiler.hpp |
Updates IsGcSafePoint; review found the condition may be broader than removable intrinsics and noted missing promised regression coverage. |
Review details
Suppressed comments (1)
src/coreclr/jit/compiler.hpp:3892
IsSpecialIntrinsicis broader than the calls that this PR's lowering can remove: the importer also marks cases such asThread.get_CurrentThread,Array<T>.GetEnumerator,String.FastAllocateString, and math intrinsics that may be re-materialized as user calls. The relevant unrolling inLowerCallis additionally target-gated to AMD64/ARM64, but this check applies on every target. When one of these calls survives, suppressing its safe-point flag needlessly makes loops fully interruptible and increases GC-info/codegen cost; please narrow the condition to removable intrinsics/targets or justify the broader cost.
if (!call->IsFastTailCall() && !call->IsSpecialIntrinsic())
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
This was referenced Sep 14, 2026
AndyAyersMS
approved these changes
Sep 15, 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.
Later optimizations can remove a loop’s only intrinsic call after interruptibility is decided, leaving a partially interruptible, safepoint-free loop that hangs GC suspension.
IsSpecialIntrinsiccalls fromIsGcSafePoint, conservatively making intrinsic-only loops fully interruptible.SequenceEqual,Fill, andClearduring GC, with a large-copy control whose helper call survives.