-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allocate static boxes on FOH #2 #79188
Conversation
…holding level 4 lock CrstStaticBoxInit"
@jkotas maybe it rings a bell to you - so when I set
My understanding that it happens because of |
AssemblyLoader can run arbitrary code (e.g. due to user overridable ResolveAssembly event). You do not want to be holding any runtime locks when the assembly loader runs. |
@jkotas it looks like the issue is fixed via |
/azp run runtime-coreclr outerloop, runtime-coreclr gcstress0x3-gcstress0xc |
Azure Pipelines successfully started running 2 pipeline(s). |
If it is the case, it means that |
src/coreclr/vm/jitinterface.cpp
Outdated
@@ -1561,7 +1561,33 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, | |||
GCX_COOP(); | |||
|
|||
pResult->fieldLookup.addr = pField->GetStaticAddressHandle((void*)pField->GetBase()); | |||
pResult->fieldLookup.accessType = IAT_VALUE; | |||
GCPROTECT_BEGININTERIOR(pResult->fieldLookup.addr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What guarantees that pResult->fieldLookup.addr
is not going to move once it is return to the JIT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkotas I don't have a good explanation yet, what I understand so far:
GetGCStaticsBasePointer
is assumed to be moveable already: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/methodtable.cpp#L3485- I thought that it supposed to return an address to a pinned area so that's how we can give it to JIT
but apparently it works differently for collectible contexts? And in case of collectible context is not supposed to be consumed by JIT (should go through theCORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS
helper) - the places where it's used already seem to be safe? because of COOP and nothing triggers GC (and e.g. BulkStaticsLogger::LogAllStatics() has GC_NOTRIGGER)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the statics for collectible types do not seem to be pinned:
runtime/src/coreclr/vm/appdomain.cpp
Line 4184 in 1ad1022
void DomainLocalModule::AllocateDynamicClass(MethodTable *pMT) |
I think that this means that we need to avoid giving the JIT address of the collectible type statics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this means that we need to avoid giving the JIT address of the collectible type statics?
Looks like we already don't do it, at least we don't hit that path where we set the address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise. Thank you!
Co-authored-by: Jan Kotas <[email protected]>
Failures are #79255 |
Reverts 2nd part of #78296 revert.
NOTE: this doesn't fix the flaky NRE as I'm able to reproduce it locally