You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
optRemoveRedundantZeroInits doesn't know about some safe points #102577
DOTNET_TieredCompilation=0, DOTNET_GCStress=0xC, DOTNET_ReadyToRun=0 (it looks like GC stress doesn't apply to precompiled code).
Expected result: nothing happens.
Actual result:
Assert failure(PID17360 [0x000043d0], Thread:14716 [0x397c]):!CREATE_CHECK_STRING(!"Detected use of a corrupted OBJECTREF. Possible GC hole.")
Cause: optRemoveRedundantZeroInits doesn't know that the block copy may become a safe point. Zero-init and future calls introduced late suffer from the same problem.
The most robust fix for this would probably be to move optRemoveRedundantZeroInits later (make it part of late liveness, say).
The most robust fix for this would probably be to move optRemoveRedundantZeroInits later (make it part of late liveness, say).
It might also be nice to not rely on GTF_CALL.
If this optimization is done at a stage when everything that needs to be a call is already a call, it could be more precise about "No-GC" cases.
I suspect we may be missing some optimizable cases when "No-GC" call is an operand/subexpression.
Cause: optRemoveRedundantZeroInits doesn't know that the block copy may become a safe point. Zero-init and future calls introduced late suffer from the same problem.
Do we have a similar problem with casts that end up calling managed helpers or they are already calls at the time when this optimization runs?
The most robust fix for this would probably be to move optRemoveRedundantZeroInits later (make it part of late liveness, say).
It might also be nice to not rely on GTF_CALL.
If this optimization is done at a stage when everything that needs to be a call is already a call, it could be more precise about "No-GC" cases. I suspect we may be missing some optimizable cases when "No-GC" call is an operand/subexpression.
My understanding that we rely on liveness phase to drop the redundant zeroings so doing this in a late phase won't be that useful
Cause: optRemoveRedundantZeroInits doesn't know that the block copy may become a safe point. Zero-init and future calls introduced late suffer from the same problem.
Do we have a similar problem with casts that end up calling managed helpers or they are already calls at the time when this optimization runs?
I think they're always calls, aren't they? I mean they might be expanded, but they can't be collapsed back to calls
I think they're always calls, aren't they? I mean they might be expanded, but they can't be collapsed back to calls
I am just not that familiar with how JIT handles them - whether they are always calls or there are cast operators in the tree that later are lowered into calls.
I guess, considering how long we had managed cast helpers, we would know by now if they cause trouble.
I am just not that familiar with how JIT handles them - whether they are always calls or there are cast operators in the tree that later are lowered into calls.
Ah, you meant GT_CAST probably (to cast primitives). Let me check, maybe we might lower it into a call on some 32bit targets or/and in checked context.
Most things end up as either calls or GTF_CALL-marked something (e. g. GT_INTRINSIC) by the time optRemoveRedundantZeroInits runs. Casts are turned into calls in global morph.
The cases that suffer from this issue are only those recent lowering additions where previously always-no-GC nodes get turned into potentially-GC helpers.
Activity
dotnet-policy-service commentedon May 22, 2024
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
VSadov commentedon May 22, 2024
probably explains #101890
VSadov commentedon May 22, 2024
It might also be nice to not rely on
GTF_CALL.If this optimization is done at a stage when everything that needs to be a call is already a call, it could be more precise about "No-GC" cases.
I suspect we may be missing some optimizable cases when "No-GC" call is an operand/subexpression.
VSadov commentedon May 22, 2024
Do we have a similar problem with casts that end up calling managed helpers or they are already calls at the time when this optimization runs?
EgorBo commentedon May 22, 2024
My understanding that we rely on liveness phase to drop the redundant zeroings so doing this in a late phase won't be that useful
EgorBo commentedon May 22, 2024
I think they're always calls, aren't they? I mean they might be expanded, but they can't be collapsed back to calls
VSadov commentedon May 22, 2024
I am just not that familiar with how JIT handles them - whether they are always calls or there are cast operators in the tree that later are lowered into calls.
I guess, considering how long we had managed cast helpers, we would know by now if they cause trouble.
EgorBo commentedon May 22, 2024
Ah, you meant GT_CAST probably (to cast primitives). Let me check, maybe we might lower it into a call on some 32bit targets or/and in checked context.
SingleAccretion commentedon May 22, 2024
Most things end up as either calls or
GTF_CALL-marked something (e. g.GT_INTRINSIC) by the timeoptRemoveRedundantZeroInitsruns. Casts are turned into calls in global morph.The cases that suffer from this issue are only those recent lowering additions where previously always-no-GC nodes get turned into potentially-GC helpers.