} 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
}
BOOL ReadyToRunInfo::MethodIterator::Next()
{
- STANDARD_VM_CONTRACT;
+ CONTRACTL
+ {
+ GC_TRIGGERS;
+ THROWS;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
while (++m_methodDefIndex < (int)m_pInfo->m_methodDefEntryPoints.GetCount())
{
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;