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
@MichalStrehovsky or @trylek Any thoughts on this? I've been looking through the CrossGen2 code but it isn't clear to me how this offset is computed. Assert fired from here.
@AaronRobinsonMSFT - thanks for the heads-up; this is complicated, the latest changes in this space were made by @jkoritzinsky as part of the runtime type layout cleanup; interestingly enough one of the most recent issues was zero-sized structs and I cannot help speculating this may be somehow related as it seems to me that the InvalidCSharp.WithTypedReferenceField`1<T> is exactly a struct derived from a zero-size struct (ValueType) albeit is has auto layout i.e. it seems to me that on this particular occasion Crossgen2 "is right" - there's no reason for Field to be pushed to offset 8 as there shouldn't be any fields "before it". One way or another, according to my experience debugging this basically amounts to stepping through the code in
(for explicit types), taking down notes as to what code paths / algorithms / values were used to place the problematic fields and comparing the logic to
but at this point I don't have sufficient understanding to make an educated guess whether they are related or not. If it's not directly blocking your current efforts, I would suggest filing an issue with the area-crossgen2-coreclr label and the Crossgen2 team will make sure they get fixed.
Activity
AaronRobinsonMSFT commentedon Jan 28, 2022
@MichalStrehovsky or @trylek Any thoughts on this? I've been looking through the CrossGen2 code but it isn't clear to me how this offset is computed. Assert fired from here.
When looking at the type in SOS, not R2R, the offset of the field is
0x10.The type definition in IL is:
trylek commentedon Jan 28, 2022
@AaronRobinsonMSFT - thanks for the heads-up; this is complicated, the latest changes in this space were made by @jkoritzinsky as part of the runtime type layout cleanup; interestingly enough one of the most recent issues was zero-sized structs and I cannot help speculating this may be somehow related as it seems to me that the
InvalidCSharp.WithTypedReferenceField`1<T>is exactly a struct derived from a zero-size struct (ValueType) albeit is has auto layout i.e. it seems to me that on this particular occasion Crossgen2 "is right" - there's no reason forFieldto be pushed to offset 8 as there shouldn't be any fields "before it". One way or another, according to my experience debugging this basically amounts to stepping through the code inruntime/src/coreclr/vm/methodtablebuilder.cpp
Line 7994 in c7adf55
(for auto layout types) and
runtime/src/coreclr/vm/classlayoutinfo.cpp
Line 585 in c7adf55
(for explicit types), taking down notes as to what code paths / algorithms / values were used to place the problematic fields and comparing the logic to
runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunMetadataFieldLayoutAlgorithm.cs
Line 799 in c7adf55
(which drives the equivalent algorithm in Crossgen2). I'm disabling another test that fails due to type layout mismatch in
#64420
but at this point I don't have sufficient understanding to make an educated guess whether they are related or not. If it's not directly blocking your current efforts, I would suggest filing an issue with the area-crossgen2-coreclr label and the Crossgen2 team will make sure they get fixed.