memset(m_rpCLRTypes, 0, sizeof(m_rpCLRTypes));
#endif // FEATURE_COMINTEROP
- m_pUMEntryThunkCache = NULL;
-
m_pAsyncPool = NULL;
m_handleStore = NULL;
delete m_pDefaultContext;
m_pDefaultContext = NULL;
- if (m_pUMEntryThunkCache)
- {
- delete m_pUMEntryThunkCache;
- m_pUMEntryThunkCache = NULL;
- }
-
#ifdef FEATURE_COMINTEROP
if (m_pRCWCache)
{
}
#ifndef CROSSGEN_COMPILE
-// U->M thunks created in this domain and not associated with a delegate.
-UMEntryThunkCache *AppDomain::GetUMEntryThunkCache()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- if (!m_pUMEntryThunkCache)
- {
- UMEntryThunkCache *pUMEntryThunkCache = new UMEntryThunkCache(this);
-
- if (FastInterlockCompareExchangePointer(&m_pUMEntryThunkCache, pUMEntryThunkCache, NULL) != NULL)
- {
- // some thread swooped in and set the field
- delete pUMEntryThunkCache;
- }
- }
- _ASSERTE(m_pUMEntryThunkCache);
- return m_pUMEntryThunkCache;
-}
#ifdef FEATURE_COMINTEROP
class DomainAssembly;
struct InteropMethodTableData;
class LoadLevelLimiter;
-class UMEntryThunkCache;
class TypeEquivalenceHashTable;
class StringArrayList;
// IL stub cache with fabricated MethodTable parented by a random module in this AD.
ILStubCache m_ILStubCache;
- // U->M thunks created in this domain and not associated with a delegate.
- // The cache is keyed by MethodDesc pointers.
- UMEntryThunkCache *m_pUMEntryThunkCache;
-
// The number of times we have entered this AD
ULONG m_dwThreadEnterCount;
// The number of threads that have entered this AD, for ADU only
BOOL IsBindingModelLocked();
BOOL LockBindingModel();
- UMEntryThunkCache *GetUMEntryThunkCache();
-
ILStubCache* GetILStubCache()
{
LIMITED_METHOD_CONTRACT;
if (NDirect::MarshalingRequired(pMD, pMD->GetSig(), pMD->GetModule()))
COMPlusThrow(kNotSupportedException, W("NotSupported_NonBlittableTypes"));
- // Get UMEntryThunk from appdomain thunkcache cache.
- UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
+ // Get UMEntryThunk from the thunk cache.
+ UMEntryThunk *pUMEntryThunk = pMD->GetLoaderAllocator()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
#if defined(_TARGET_X86_) && !defined(FEATURE_STUBS_AS_IL)
if (pMD==NULL || !pMD->IsStatic() || pMD->ContainsGenericVariables())
ThrowHR(COR_E_MISSINGMETHOD);
- UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
+ UMEntryThunk *pUMEntryThunk = pMD->GetLoaderAllocator()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
*fnPtr = (INT_PTR)pUMEntryThunk->GetCode();
END_DOMAIN_TRANSITION;
m_pJumpStubCache = NULL;
m_IsCollectible = false;
+ m_pUMEntryThunkCache = NULL;
+
m_nLoaderAllocator = InterlockedIncrement64((LONGLONG *)&LoaderAllocator::cLoaderAllocatorsCreated);
}
m_fGCPressure = false;
}
+ delete m_pUMEntryThunkCache;
+ m_pUMEntryThunkCache = NULL;
+
m_crstLoaderAllocator.Destroy();
m_LoaderAllocatorReferences.RemoveAll();
}
}
+// U->M thunks created in this LoaderAllocator and not associated with a delegate.
+UMEntryThunkCache *LoaderAllocator::GetUMEntryThunkCache()
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_ANY;
+ INJECT_FAULT(COMPlusThrowOM(););
+ }
+ CONTRACTL_END;
+
+ if (!m_pUMEntryThunkCache)
+ {
+ UMEntryThunkCache *pUMEntryThunkCache = new UMEntryThunkCache(GetAppDomain());
+
+ if (FastInterlockCompareExchangePointer(&m_pUMEntryThunkCache, pUMEntryThunkCache, NULL) != NULL)
+ {
+ // some thread swooped in and set the field
+ delete pUMEntryThunkCache;
+ }
+ }
+ _ASSERTE(m_pUMEntryThunkCache);
+ return m_pUMEntryThunkCache;
+}
+
#endif // !CROSSGEN_COMPILE
#endif // !DACCESS_COMPILE
template <typename ELEMENT>
class ListLockEntryBase;
typedef ListLockEntryBase<void*> ListLockEntry;
+class UMEntryThunkCache;
class LoaderAllocator
{
BYTE * m_pVSDHeapInitialAlloc;
BYTE * m_pCodeHeapInitialAlloc;
+ // U->M thunks that are not associated with a delegate.
+ // The cache is keyed by MethodDesc pointers.
+ UMEntryThunkCache * m_pUMEntryThunkCache;
+
public:
BYTE *GetVSDHeapInitialBlock(DWORD *pSize);
BYTE *GetCodeHeapInitialBlock(const BYTE * loAddr, const BYTE * hiAddr, DWORD minimumSize, DWORD *pSize);
LIMITED_METHOD_CONTRACT;
return m_pVirtualCallStubManager;
}
+
+ UMEntryThunkCache *GetUMEntryThunkCache();
+
#endif
}; // class LoaderAllocator