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
MethodTable::IsClassInited returns false for <PrivateImplementationDetails> class #104247
This code (TieredCompilation=0) used to fold RvaData[2] into 3, it's no longer happening because getStaticFieldContent gives up on <PrivateImplementationDetails> being non-initialized statically (despite the fact it has no cctor)
Previously, it used to return true and everything was correctly folded, it's no longer the case after #99183
Activity
ghost added
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
I think the problem is more in the JIT/EE interface.
Before the change, CORINFO_FLG_FIELD_INITCLASS means initialization is required.
After the change, CORINFO_FLG_FIELD_INITCLASS means initialization may be required, call initClass to be sure.
We either need to fix JIT/EE interface to have the old behavior; or we need fix the JIT to account for the new behavior.
Alternatively, we can get rid of CORINFO_FLG_FIELD_INITCLASS and require JIT to always call initClass to figure out whether the initialization is required.
Why does initClass need to be called for CreateSpan(ldtoken) in the first place? The unexpanded implementation of CreateSpan(ldtoken) does not trigger static constructors, so I do not see why we need to call initClass in the intrinsic expansion of CreateSpan(ldtoken).
Why does initClass need to be called for CreateSpan(ldtoken) in the first place? The unexpanded implementation of CreateSpan(ldtoken) does not trigger static constructors, so I do not see why we need to call initClass in the intrinsic expansion of CreateSpan(ldtoken).
um.. so it means nobody calls initClass for <PrivateImplementationDetails> (since the only way it's referenced is via CreateSpan(ldtoken)) and then getStaticFieldContent always refuses to fold anything since IsClassInited will return false. I feel like I am missing something 😐 how is JIT-EE fixup going to help here?
I think we would prefer to make a new function... I'm calling it IsClassInitedOrPreinited which will will do the IsClassInited check + the AttemptToPreinit + a final IsClassInited. It looks like there may be several places in the JIT interface which should be calling it and just using the more complete function is a more reliable fix. I'm taking a look at making that change, which seems fairly simple.
Activity
dotnet-policy-service commentedon Jul 1, 2024
Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.
jkotas commentedon Jul 1, 2024
I think the problem is more in the JIT/EE interface.
Before the change,
CORINFO_FLG_FIELD_INITCLASSmeans initialization is required.After the change,
CORINFO_FLG_FIELD_INITCLASSmeans initialization may be required, callinitClassto be sure.We either need to fix JIT/EE interface to have the old behavior; or we need fix the JIT to account for the new behavior.
Alternatively, we can get rid of
CORINFO_FLG_FIELD_INITCLASSand require JIT to always callinitClassto figure out whether the initialization is required.EgorBo commentedon Jul 1, 2024
so who (and when) is going to call
initClassin case ofCreateSpan(ldtoken)?jkotas commentedon Jul 1, 2024
Why does
initClassneed to be called forCreateSpan(ldtoken)in the first place? The unexpanded implementation ofCreateSpan(ldtoken)does not trigger static constructors, so I do not see why we need to callinitClassin the intrinsic expansion ofCreateSpan(ldtoken).EgorBo commentedon Jul 1, 2024
um.. so it means nobody calls
initClassfor<PrivateImplementationDetails>(since the only way it's referenced is viaCreateSpan(ldtoken)) and thengetStaticFieldContentalways refuses to fold anything sinceIsClassInitedwill return false. I feel like I am missing something 😐 how is JIT-EE fixup going to help here?jkotas commentedon Jul 1, 2024
getStaticFieldContentmay want to callAttemptToPreinit()before callingIsClassInitialized.davidwrighton commentedon Jul 1, 2024
I think we would prefer to make a new function... I'm calling it
IsClassInitedOrPreinitedwhich will will do theIsClassInitedcheck + theAttemptToPreinit+ a finalIsClassInited. It looks like there may be several places in the JIT interface which should be calling it and just using the more complete function is a more reliable fix. I'm taking a look at making that change, which seems fairly simple.Fix dotnet#104247 by providing a new helper function which means what…
Detect class inited status more correctly in prestub/jitinterface (#1…