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
Test failure JIT\\Regression\\JitBlue\\Runtime_45557\\Runtime_45557\\Runtime_45557.cmd #79518
but we don't get the corresponding GC reference change of ; GC ptr vars +{V33}. So our codegen GC tracking sets are incorrect. This is because when we generate code, we call genUpdateLife() which calls UpdateLife() which calls fgIsIndirOfAddrOfLocal() on the LCL_FLD_ADDR, and fgIsIndirOfAddrOfLocal() does not know about LCL_FLD_ADDR. Thus, no codegen GC info is updated.
Of course; this is quite the old bug. I've been wondering how we haven't hit it until now. The fix is that tree life updater needs to handle LCL_FLD_ADDR as well.
Of course; this is quite the old bug. I've been wondering how we haven't hit it until now. The fix is that tree life updater needs to handle LCL_FLD_ADDR as well.
I'm not sure that is correct: GC info only knows about registers or stack slots. Stack slots are GC/byref variables, not struct fields -- I believe structs are reported as untracked.
It seems like maybe when we decide to convert a STORE_LCL_FLD to a STOREIND(LCL_FLD_ADDR), we should actually convert it to a STOREIND(LCL_VAR_ADDR). When we do the conversion to STOREIND(LCL_FLD_ADDR), what are the guarantees? In the case I'm looking at, it's a single-reg TYP_REF gc register struct, at offset zero. Can that be asserted? In that case, it seems converting to LCL_VAR_ADDR seems safe.
I'm not sure that is correct: GC info only knows about registers or stack slots.
Yes, but GC info is just one user of liveness in codegen (the most prominent of course, but, e. g. debug info also uses it). The model is that whatever tree life updater does must match whatever the liveness pass has computed, which definitely means handling LCL_FLD_ADDR.
Stack slots are GC/byref variables, not struct fields -- I believe structs are reported as untracked.
That is true, and, I suspect, is the reason we haven't seen this kind of bug surface yet. But the reason it is true is also just a limitation of our liveness tracking implementation (we fail to do proper liveness updates for block stores, basically). There are TODO-CQs (and issues) which say we should improve it. Whether that's worth it is a separate topic, but it is definitely not a fundamental limitation.
LCL_FLD_ADDR and LCL_VAR_ADDR
LCL_FLD_ADDR at a zero offset must be equivalent to LCL_VAR_ADDR or illegal. I don't think making it illegal is a good idea, it would just make some code more complicated for no benefit. In fact, I think we should delete LCL_VAR_ADDR completely and use LCL_FLD_ADDR [0] as the representation for it, making things a little more canonical by default.
Activity
v-wenyuxu commentedon Dec 19, 2022
Failed again in: runtime-coreclr gcstress-extra 20221217.1
Failed test:
Error message:
BruceForstall commentedon Dec 22, 2022
The failure looks like a variation of #45557 that led to this unit test.
After morph, we have a
structcopy of a promoted field that is a struct of a single GC pointer:In Lower, in the middle of processing, we have:
and then convert the
STORE_LCL_FLDto:When we generate code for the STOREIND, we get:
but we don't get the corresponding GC reference change of
; GC ptr vars +{V33}. So our codegen GC tracking sets are incorrect. This is because when we generate code, we callgenUpdateLife()which callsUpdateLife()which callsfgIsIndirOfAddrOfLocal()on the LCL_FLD_ADDR, andfgIsIndirOfAddrOfLocal()does not know about LCL_FLD_ADDR. Thus, no codegen GC info is updated.BruceForstall commentedon Dec 22, 2022
Previously, we had:
which got rewritten in lower as:
which would be further rewritten as:
so there was no LCL_FLD_ADDR involved.
BruceForstall commentedon Dec 22, 2022
Maybe
fgIsIndirOfAddrOfLocal()andTreeLifeUpdater<ForCodeGen>::UpdateLifeVar()should handle LCL_VAR_ADDR?Lowering::LowerStoreSingleRegCallStruct()converts from STORE_OBJ to STOREIND. Maybe it shouldn't if the addr is a LCL_FLD_ADDR?BruceForstall commentedon Dec 22, 2022
This regression is due to #78131.
@SingleAccretion Can you take a look?
SingleAccretion commentedon Dec 22, 2022
Of course; this is quite the old bug. I've been wondering how we haven't hit it until now. The fix is that tree life updater needs to handle LCL_FLD_ADDR as well.
BruceForstall commentedon Dec 22, 2022
I'm not sure that is correct: GC info only knows about registers or stack slots. Stack slots are GC/byref variables, not struct fields -- I believe structs are reported as untracked.
It seems like maybe when we decide to convert a STORE_LCL_FLD to a STOREIND(LCL_FLD_ADDR), we should actually convert it to a STOREIND(LCL_VAR_ADDR). When we do the conversion to STOREIND(LCL_FLD_ADDR), what are the guarantees? In the case I'm looking at, it's a single-reg TYP_REF gc register struct, at offset zero. Can that be asserted? In that case, it seems converting to LCL_VAR_ADDR seems safe.
SingleAccretion commentedon Dec 22, 2022
Yes, but GC info is just one user of liveness in codegen (the most prominent of course, but, e. g. debug info also uses it). The model is that whatever tree life updater does must match whatever the liveness pass has computed, which definitely means handling
LCL_FLD_ADDR.That is true, and, I suspect, is the reason we haven't seen this kind of bug surface yet. But the reason it is true is also just a limitation of our liveness tracking implementation (we fail to do proper liveness updates for block stores, basically). There are
TODO-CQs (and issues) which say we should improve it. Whether that's worth it is a separate topic, but it is definitely not a fundamental limitation.LCL_FLD_ADDRat a zero offset must be equivalent toLCL_VAR_ADDRor illegal. I don't think making it illegal is a good idea, it would just make some code more complicated for no benefit. In fact, I think we should deleteLCL_VAR_ADDRcompletely and useLCL_FLD_ADDR [0]as the representation for it, making things a little more canonical by default.