DWORD countExportedTypesAfterProfilerUpdate = GetMDImport()->GetCountWithTokenKind(mdtExportedType);
DWORD countCustomAttributeCount = GetMDImport()->GetCountWithTokenKind(mdtCustomAttribute);
+ if (m_dwTypeCount == countTypesAfterProfilerUpdate
+ && m_dwExportedTypeCount == countExportedTypesAfterProfilerUpdate
+ && m_dwCustomAttributeCount == countCustomAttributeCount)
+ {
+ // The profiler added no new types, do not create the in memory hashes
+ return;
+ }
+
// R2R pre-computes an export table and tries to avoid populating a class hash at runtime. However the profiler can
// still add new types on the fly by calling here. If that occurs we fallback to the slower path of creating the
// in memory hashtable as usual.
m_dwCustomAttributeCount = GetMDImport()->GetCountWithTokenKind(mdtCustomAttribute);
}
+ BOOL profilerCallbackHappened = FALSE;
// Notify the profiler, this may cause metadata to be updated
{
BEGIN_PIN_PROFILER(CORProfilerTrackModuleLoads());
g_profControlBlock.pProfInterface->ModuleAttachedToAssembly((ModuleID) this,
(AssemblyID)m_pAssembly);
}
+
+ profilerCallbackHappened = TRUE;
}
END_PIN_PROFILER();
}
// If there are more types than before, add these new types to the
// assembly
- if (!IsResource())
+ if (profilerCallbackHappened && !IsResource())
{
UpdateNewlyAddedTypes();
}
}
}
#endif // defined(_DEBUG) && !defined(DACCESS_COMPILE)
-