Repository navigation
Conversation
…erruptible code Converting a pinned pointer back to a byref (ref *ptr) can be a no-op move when both locals share a register. The emitter learns register GC liveness from emitted instructions only, so the register was not reported until the next IG and the pin could be released while the byref was untracked. Fixes dotnet#138268 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b1986f27-d029-45e5-be9b-a311d8cf8033
|
Azure Pipelines: Successfully started running 6 pipeline(s). 9 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 |
Avoids the code size regression: start a new IG carrying codegen's GC info when a same-register store turns a non-GC value into a GC local. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b1986f27-d029-45e5-be9b-a311d8cf8033
EgorBo
enabled auto-merge (squash)
November 25, 2026 18:13
EgorBo
disabled auto-merge
November 25, 2026 18:13
This branch has not been deployed
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.
Fixes #138268
When a non-GC local (e.g. a pinned pointer) is stored into a GC local that got the same register, codegen elides the move. In fully interruptible code the emitter learns register GC liveness only from emitted instructions (and IG boundaries), so the register wasn't reported until the next IG. In
TensorPrimitivesVectorized128on arm64 the unpin landed inside that window, so a compacting GC could move the array while the only byref to it sat in an unreported register:Fix: in that case start a new IG carrying codegen's current GC info (the same thing temp labels do), so x5 becomes live at the right offset with no extra instructions. The only diffs are GC info and IG boundaries.
Minimal repro (a multi-threaded GC stress, too slow for a regression test): https://gist.github.com/EgorBo/70b824e0197c2ea16edc1107b9ecaa0c