Uh oh!
There was an error while loading. Please reload this page.
Fix impGetNodeAddr flag handling for volatile, unaligned, and initclass accesses - #122381
Conversation
Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
…IND_INITCLASS Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where impGetNodeAddr was returning flags (volatile, unaligned, nonfaulting, initclass) from the original access, but five call sites were ignoring these flags, potentially leading to incorrect semantics.
Key Changes
- Added
allowedMustPreserveIndirFlagsparameter toimpGetNodeAddrto control which flags are acceptable without creating a temp - Updated all call sites to pass appropriate flag masks and use the returned flags where needed
- Introduced
GTF_IND_MUST_PRESERVE_FLAGSconstant to represent flags that must be preserved (volatile, unaligned, initclass)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/jit/gentree.h | Introduces GTF_IND_MUST_PRESERVE_FLAGS constant and updates GTF_IND_COPYABLE_FLAGS to use it |
| src/coreclr/jit/compiler.h | Updates impGetNodeAddr signature to include allowedMustPreserveIndirFlags parameter |
| src/coreclr/jit/importer.cpp | Implements new parameter logic in impGetNodeAddr, updates all call sites to pass appropriate flags and use returned flags for indirections |
| src/coreclr/jit/importercalls.cpp | Updates SRCSUnsafeIntrinsic call site to use the new parameter |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jakobbotsch
commented
Jan 9, 2026
PTAL @dotnet/jit-contrib No diffs. Removes a number of TODOs. |
Uh oh!
There was an error while loading. Please reload this page.
MihaZupan
commented
Jan 13, 2026
Looks like this broke builds on main since #122167 was merged in between |
jakobbotsch
commented
Jan 13, 2026
#123128 should fix it |
impGetNodeAddrreturnsGTF_IND_COPYABLE_FLAGS(volatile, unaligned, nonfaulting, initclass) from the original access, but five call sites were ignoring these flags, potentially leading to incorrect semantics for volatile/unaligned/initclass operations.Changes:
Added
allowConfiguredDerefsparameter toimpGetNodeAddr: Whenfalse, indirections with volatile, unaligned, or initclass flags fall through to temp creation instead of returning the address directly. Defaults totruefor backward compatibility.Return buffers (3 sites): Set
allowConfiguredDerefs = falsewhen obtaining addresses for return buffer arguments passed to helpers. VM helpers cannot handle addresses with volatile, unaligned, or initclass flags.Struct field access on instance: Combine flags from
impGetNodeAddrwith prefix flags when creating the field indirection:Box-isinst optimization: Transfer flags to the hasValue field indirection:
Fixed recursive call: Preserve
allowConfiguredDerefsin GT_COMMA case to maintain semantics through comma expressions.All five
TODO-Bug?: verify if flags matter herecomments resolved.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.