diff options
author | Brian Robbins <brianrob@microsoft.com> | 2016-04-19 19:39:12 -0700 |
---|---|---|
committer | Brian Robbins <brianrob@microsoft.com> | 2016-04-19 19:39:12 -0700 |
commit | b82077e95ca8834ee97f763c1382d273d5fc6767 (patch) | |
tree | 3c8c80350a3a15dd9e9ce38cf2ad994bc7dc4199 /src/vm | |
parent | 325bbda47d362bc8596f407aa8cd7809bbd65443 (diff) | |
parent | 9d55fe745fbecbaa19983da0c3eaf75668ece866 (diff) | |
download | coreclr-b82077e95ca8834ee97f763c1382d273d5fc6767.tar.gz coreclr-b82077e95ca8834ee97f763c1382d273d5fc6767.tar.bz2 coreclr-b82077e95ca8834ee97f763c1382d273d5fc6767.zip |
Merge pull request #4387 from brianrob/ngenrundown
Add support for ready to run to NGEN rundown
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/eventtrace.cpp | 33 | ||||
-rw-r--r-- | src/vm/readytoruninfo.cpp | 49 | ||||
-rw-r--r-- | src/vm/readytoruninfo.h | 1 |
3 files changed, 77 insertions, 6 deletions
diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 5e35f9a2b8..b9d12a76ed 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -6805,15 +6805,38 @@ VOID ETW::MethodLog::SendEventsForNgenMethods(Module *pModule, DWORD dwEventOpti } CONTRACTL_END; #ifdef FEATURE_PREJIT - if(!pModule || !pModule->HasNativeImage()) + if (!pModule) return; - MethodIterator mi(pModule); + PEImageLayout * pLoadedLayout = pModule->GetFile()->GetLoaded(); + _ASSERTE(pLoadedLayout != NULL); - while(mi.Next()) +#ifdef FEATURE_READYTORUN + if (pLoadedLayout->HasReadyToRunHeader()) { - MethodDesc *hotDesc = (MethodDesc *)mi.GetMethodDesc(); - ETW::MethodLog::SendMethodEvent(hotDesc, dwEventOptions, FALSE); + ReadyToRunInfo::MethodIterator mi(pModule->GetReadyToRunInfo()); + while (mi.Next()) + { + // Call GetMethodDesc_NoRestore instead of GetMethodDesc to avoid restoring methods at shutdown. + MethodDesc *hotDesc = (MethodDesc *)mi.GetMethodDesc_NoRestore(); + if (hotDesc != NULL) + { + ETW::MethodLog::SendMethodEvent(hotDesc, dwEventOptions, FALSE); + } + } + + return; + } +#endif // FEATURE_READYTORUN + if (pModule->HasNativeImage()) + { + MethodIterator mi(pModule); + + while (mi.Next()) + { + MethodDesc *hotDesc = (MethodDesc *)mi.GetMethodDesc(); + ETW::MethodLog::SendMethodEvent(hotDesc, dwEventOptions, FALSE); + } } #endif // FEATURE_PREJIT } diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp index 56dc506b1b..ada502a417 100644 --- a/src/vm/readytoruninfo.cpp +++ b/src/vm/readytoruninfo.cpp @@ -531,7 +531,13 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, BOOL fFixups /*=TRUE*/) BOOL ReadyToRunInfo::MethodIterator::Next() { - STANDARD_VM_CONTRACT; + CONTRACTL + { + GC_TRIGGERS; + THROWS; + MODE_ANY; + } + CONTRACTL_END; while (++m_methodDefIndex < (int)m_pInfo->m_methodDefEntryPoints.GetCount()) { @@ -549,6 +555,47 @@ MethodDesc * ReadyToRunInfo::MethodIterator::GetMethodDesc() return MemberLoader::GetMethodDescFromMethodDef(m_pInfo->m_pModule, mdtMethodDef | (m_methodDefIndex + 1), FALSE); } +MethodDesc * ReadyToRunInfo::MethodIterator::GetMethodDesc_NoRestore() +{ + CONTRACTL + { + GC_TRIGGERS; + THROWS; + MODE_ANY; + } + CONTRACTL_END; + + uint offset; + if (!m_pInfo->m_methodDefEntryPoints.TryGetAt(m_methodDefIndex, &offset)) + { + return NULL; + } + + uint id; + offset = m_pInfo->m_nativeReader.DecodeUnsigned(offset, &id); + + if (id & 1) + { + if (id & 2) + { + uint val; + m_pInfo->m_nativeReader.DecodeUnsigned(offset, &val); + offset -= val; + } + + id >>= 2; + } + else + { + id >>= 1; + } + + _ASSERTE(id < m_pInfo->m_nRuntimeFunctions); + PCODE pEntryPoint = dac_cast<TADDR>(m_pInfo->m_pLayout->GetBase()) + m_pInfo->m_pRuntimeFunctions[id].BeginAddress; + + return m_pInfo->GetMethodDescForEntryPoint(pEntryPoint); +} + PCODE ReadyToRunInfo::MethodIterator::GetMethodStartAddress() { STANDARD_VM_CONTRACT; diff --git a/src/vm/readytoruninfo.h b/src/vm/readytoruninfo.h index 9ca4050054..ae903ced9c 100644 --- a/src/vm/readytoruninfo.h +++ b/src/vm/readytoruninfo.h @@ -111,6 +111,7 @@ public: BOOL Next(); MethodDesc * GetMethodDesc(); + MethodDesc * GetMethodDesc_NoRestore(); PCODE GetMethodStartAddress(); }; |