diff options
author | Noah Falk <noahfalk@users.noreply.github.com> | 2017-10-12 14:41:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-12 14:41:49 -0700 |
commit | 5dac5732c998cb3f9c613c65dea41a3e3a249c01 (patch) | |
tree | 79a9efe4fca7d13e1fbae7d9538e79906ad673f0 /src/debug | |
parent | 248819b8360ac9b0961c9064c8c4f9f31e72f9a1 (diff) | |
download | coreclr-5dac5732c998cb3f9c613c65dea41a3e3a249c01.tar.gz coreclr-5dac5732c998cb3f9c613c65dea41a3e3a249c01.tar.bz2 coreclr-5dac5732c998cb3f9c613c65dea41a3e3a249c01.zip |
Fix #14427 (#14429)
Enumerate all of the jitted instances of a method using the tiered compilation manager
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/ee/debugger.h | 2 | ||||
-rw-r--r-- | src/debug/ee/functioninfo.cpp | 63 |
2 files changed, 58 insertions, 7 deletions
diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index 812bde5513..0bcfca1620 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -966,6 +966,8 @@ public: // Ensure the DJI cache is completely up to date. (This is heavy weight). void CreateDJIsForNativeBlobs(AppDomain * pAppDomain, Module * pModuleFilter = NULL); + // Ensure the DJI cache is up to date for a particular closed method desc + void CreateDJIsForMethodDesc(MethodDesc * pMethodDesc); // Get an iterator for all native blobs (accounts for Generics, Enc, + Prejiiting). // Must be stopped when we do this. This could be heavy weight. diff --git a/src/debug/ee/functioninfo.cpp b/src/debug/ee/functioninfo.cpp index 78bba432e5..5ed88d4c09 100644 --- a/src/debug/ee/functioninfo.cpp +++ b/src/debug/ee/functioninfo.cpp @@ -2006,16 +2006,65 @@ void DebuggerMethodInfo::CreateDJIsForNativeBlobs(AppDomain * pAppDomain, Module if (pLoaderModule->GetLoaderAllocator()->IsUnloaded()) continue; - // We just ask for the DJI to ensure that it's lazily created. - // This should only fail in an oom scenario. - DebuggerJitInfo * djiTest = g_pDebugger->GetLatestJitInfoFromMethodDesc(pDesc); - if (djiTest == NULL) + CreateDJIsForMethodDesc(pDesc); + } +} + + +//--------------------------------------------------------------------------------------- +// +// Bring the DJI cache up to date for jitted code instances of a particular MethodDesc. +// +// +void DebuggerMethodInfo::CreateDJIsForMethodDesc(MethodDesc * pMethodDesc) +{ + CONTRACTL + { + SO_NOT_MAINLINE; + THROWS; + GC_NOTRIGGER; + } + CONTRACTL_END; + + + // The debugger doesn't track Lightweight-codegen methods b/c they have no metadata. + if (pMethodDesc->IsDynamicMethod()) + { + return; + } + +#ifdef FEATURE_CODE_VERSIONING + CodeVersionManager* pCodeVersionManager = pMethodDesc->GetCodeVersionManager(); + // grab the code version lock to iterate available versions of the code + { + CodeVersionManager::TableLockHolder lock(pCodeVersionManager); + NativeCodeVersionCollection nativeCodeVersions = pCodeVersionManager->GetNativeCodeVersions(pMethodDesc); + + for (NativeCodeVersionIterator itr = nativeCodeVersions.Begin(), end = nativeCodeVersions.End(); itr != end; itr++) { - // We're oom. Give up. - ThrowOutOfMemory(); - return; + // Some versions may not be compiled yet - skip those for now + // if they compile later the JitCompiled callback will add a DJI to our cache at that time + PCODE codeAddr = itr->GetNativeCode(); + if (codeAddr) + { + // The DJI may already be populated in the cache, if so CreateInitAndAdd is + // a no-op and that is fine. + BOOL unusedDjiWasCreated; + CreateInitAndAddJitInfo(pMethodDesc, codeAddr, &unusedDjiWasCreated); + } } } +#else + // We just ask for the DJI to ensure that it's lazily created. + // This should only fail in an oom scenario. + DebuggerJitInfo * djiTest = g_pDebugger->GetLatestJitInfoFromMethodDesc(pDesc); + if (djiTest == NULL) + { + // We're oom. Give up. + ThrowOutOfMemory(); + return; + } +#endif } /* |