return pMT;
}
+#ifndef DACCESS_COMPILE
+//---------------------------------------------------------------------------------------
+void BaseDomain::RemoveTypesFromTypeIDMap(LoaderAllocator* pLoaderAllocator)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ } CONTRACTL_END;
+
+ m_typeIDMap.RemoveTypes(pLoaderAllocator);
+}
+#endif // DACCESS_COMPILE
+
//---------------------------------------------------------------------------------------
//
BOOL
UINT32 GetTypeID(PTR_MethodTable pMT);
UINT32 LookupTypeID(PTR_MethodTable pMT);
PTR_MethodTable LookupType(UINT32 id);
+#ifndef DACCESS_COMPILE
+ void RemoveTypesFromTypeIDMap(LoaderAllocator* pLoaderAllocator);
+#endif // DACCESS_COMPILE
private:
// I have yet to figure out an efficent way to get the number of handles
#ifndef DACCESS_COMPILE
//------------------------------------------------------------------------
+// Remove all types that belong to the passed in LoaderAllocator
+void TypeIDMap::RemoveTypes(LoaderAllocator *pLoaderAllocator)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ } CONTRACTL_END;
+
+ // Take the lock
+ CrstHolder lh(&m_lock);
+
+ for (HashMap::Iterator it = m_mtMap.begin(); !it.end(); ++it)
+ {
+ if (((MethodTable*)it.GetKey())->GetLoaderAllocator() == pLoaderAllocator)
+ {
+ // Note: the entry is just marked for deletion, the removal happens in Compact below
+ m_mtMap.DeleteValue(it.GetKey(), it.GetValue());
+ }
+ }
+
+ m_mtMap.Compact();
+
+ for (HashMap::Iterator it = m_idMap.begin(); !it.end(); ++it)
+ {
+ if (((MethodTable*)(it.GetValue() << 1))->GetLoaderAllocator() == pLoaderAllocator)
+ {
+ // Note: the entry is just marked for deletion, the removal happens in Compact below
+ m_idMap.DeleteValue(it.GetKey(), it.GetValue());
+ }
+ }
+
+ m_idMap.Compact();
+}
+//------------------------------------------------------------------------
// If TRUE, it points to a matching entry.
// If FALSE, it is at the insertion point.
BOOL
// returns the new ID.
UINT32 GetTypeID(PTR_MethodTable pMT);
+#ifndef DACCESS_COMPILE
+ //------------------------------------------------------------------------
+ // Remove all types that belong to the passed in LoaderAllocator
+ void RemoveTypes(LoaderAllocator* pLoaderAllocator);
+#endif // DACCESS_COMPILE
+
//------------------------------------------------------------------------
inline UINT32 GetCount()
{ LIMITED_METHOD_CONTRACT; return m_entryCount; }
{
_ASSERTE(!pDomainLoaderAllocatorDestroyIterator->IsAlive());
+ GetAppDomain()->RemoveTypesFromTypeIDMap(pDomainLoaderAllocatorDestroyIterator);
+
DomainAssemblyIterator domainAssemblyIt(pDomainLoaderAllocatorDestroyIterator->m_pFirstDomainAssemblyFromSameALCToDelete);
// Release all assemblies from the same ALC