From d4d1d9cf44a39446435826f4c2eefc72932a1df5 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 28 Nov 2018 18:18:04 -0800 Subject: [PATCH] Delete code related to LoaderOptimization and SharedDomain (dotnet/coreclr#21031) Commit migrated from https://github.com/dotnet/coreclr/commit/b6d47b3a1b5b05c25968701615707e381f35a7ce --- src/coreclr/clrdefinitions.cmake | 5 +- src/coreclr/crossgen.cmake | 1 - src/coreclr/src/debug/daccess/dacdbiimpl.cpp | 15 +- src/coreclr/src/debug/daccess/dacimpl.h | 32 +- src/coreclr/src/debug/daccess/enummem.cpp | 2 - src/coreclr/src/debug/daccess/nidump.cpp | 1 - src/coreclr/src/debug/daccess/request.cpp | 37 +- src/coreclr/src/inc/CrstTypes.def | 118 +----- src/coreclr/src/inc/corhdr.h | 4 - src/coreclr/src/inc/crsttypes.h | 315 +++++++--------- src/coreclr/src/inc/dacvars.h | 4 +- src/coreclr/src/inc/vptr_list.h | 2 - src/coreclr/src/palrt/convert.h | 126 ------- src/coreclr/src/palrt/shstr.h | 138 ------- src/coreclr/src/vm/appdomain.cpp | 533 +-------------------------- src/coreclr/src/vm/appdomain.hpp | 382 +------------------ src/coreclr/src/vm/appdomain.inl | 19 - src/coreclr/src/vm/ceeload.cpp | 188 +--------- src/coreclr/src/vm/ceeload.h | 81 ---- src/coreclr/src/vm/ceeload.inl | 13 - src/coreclr/src/vm/ceemain.cpp | 3 - src/coreclr/src/vm/clsload.cpp | 245 +----------- src/coreclr/src/vm/clsload.hpp | 3 - src/coreclr/src/vm/codeman.cpp | 11 +- src/coreclr/src/vm/codeman.h | 3 +- src/coreclr/src/vm/codeversion.cpp | 18 +- src/coreclr/src/vm/codeversion.h | 2 +- src/coreclr/src/vm/corhost.cpp | 9 +- src/coreclr/src/vm/domainfile.cpp | 294 +-------------- src/coreclr/src/vm/domainfile.h | 28 -- src/coreclr/src/vm/eventtrace.cpp | 102 ++--- src/coreclr/src/vm/genmeth.cpp | 66 ---- src/coreclr/src/vm/ilstubresolver.cpp | 9 +- src/coreclr/src/vm/invokeutil.cpp | 8 +- src/coreclr/src/vm/jitinterface.cpp | 18 +- src/coreclr/src/vm/loaderallocator.cpp | 12 - src/coreclr/src/vm/loaderallocator.hpp | 21 -- src/coreclr/src/vm/loaderallocator.inl | 26 -- src/coreclr/src/vm/method.cpp | 10 +- src/coreclr/src/vm/methoditer.cpp | 121 +----- src/coreclr/src/vm/methoditer.h | 34 +- src/coreclr/src/vm/methodtable.cpp | 3 +- src/coreclr/src/vm/pefile.h | 8 +- src/coreclr/src/vm/profilingenumerators.cpp | 32 -- src/coreclr/src/vm/proftoeeinterfaceimpl.cpp | 2 - src/coreclr/src/vm/runtimehandles.cpp | 13 +- src/coreclr/src/vm/typedesc.cpp | 20 +- src/coreclr/src/vm/virtualcallstub.cpp | 22 -- 48 files changed, 263 insertions(+), 2896 deletions(-) delete mode 100644 src/coreclr/src/palrt/convert.h delete mode 100644 src/coreclr/src/palrt/shstr.h diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index 5ee91fc..a540414 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -158,8 +158,7 @@ endif(FEATURE_INTERPRETER) add_definitions(-DFEATURE_ISYM_READER) if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) add_definitions(-DFEATURE_JUMPSTAMP) - endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) -add_definitions(-DFEATURE_LOADER_OPTIMIZATION) +endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) if (CLR_CMAKE_PLATFORM_LINUX OR WIN32) add_definitions(-DFEATURE_MANAGED_ETW) endif(CLR_CMAKE_PLATFORM_LINUX OR WIN32) @@ -240,4 +239,4 @@ if(WIN32) if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) add_definitions(-DFEATURE_DATABREAKPOINT) endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) -endif(WIN32) \ No newline at end of file +endif(WIN32) diff --git a/src/coreclr/crossgen.cmake b/src/coreclr/crossgen.cmake index 75739df..8f68039 100644 --- a/src/coreclr/crossgen.cmake +++ b/src/coreclr/crossgen.cmake @@ -10,7 +10,6 @@ remove_definitions( -DFEATURE_CODE_VERSIONING -DEnC_SUPPORTED -DFEATURE_EVENT_TRACE=1 - -DFEATURE_LOADER_OPTIMIZATION -DFEATURE_MULTICOREJIT -DFEATURE_PERFMAP -DFEATURE_REJIT diff --git a/src/coreclr/src/debug/daccess/dacdbiimpl.cpp b/src/coreclr/src/debug/daccess/dacdbiimpl.cpp index b19d4c4..d8ed188 100644 --- a/src/coreclr/src/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/src/debug/daccess/dacdbiimpl.cpp @@ -3445,10 +3445,7 @@ void DacDbiInterfaceImpl::GetStackFramesFromException(VMPTR_Object vmObject, Dac AppDomain* pDomain = NULL; DomainFile* pDomainFile = NULL; - if (pBaseDomain->IsSharedDomain()) - pDomain = SystemDomain::System()->DefaultDomain(); - else - pDomain = pBaseDomain->AsAppDomain(); + pDomain = pBaseDomain->AsAppDomain(); _ASSERTE(pDomain != NULL); @@ -6805,14 +6802,8 @@ bool DacDbiInterfaceImpl::GetAppDomainForObject(CORDB_ADDRESS addr, OUT VMPTR_Ap PTR_Module module = mt->GetModule(); PTR_Assembly assembly = module->GetAssembly(); BaseDomain *baseDomain = assembly->GetDomain(); - - if (baseDomain->IsSharedDomain()) - { - pModule->SetDacTargetPtr(PTR_HOST_TO_TADDR(module)); - *pAppDomain = VMPTR_AppDomain::NullPtr(); - *pDomainFile = VMPTR_DomainFile::NullPtr(); - } - else if (baseDomain->IsAppDomain()) + + if (baseDomain->IsAppDomain()) { pAppDomain->SetDacTargetPtr(PTR_HOST_TO_TADDR(baseDomain->AsAppDomain())); pModule->SetDacTargetPtr(PTR_HOST_TO_TADDR(module)); diff --git a/src/coreclr/src/debug/daccess/dacimpl.h b/src/coreclr/src/debug/daccess/dacimpl.h index e05575c..c783a43 100644 --- a/src/coreclr/src/debug/daccess/dacimpl.h +++ b/src/coreclr/src/debug/daccess/dacimpl.h @@ -512,10 +512,6 @@ struct ProcessModIter AppDomainIterator m_domainIter; bool m_nextDomain; AppDomain::AssemblyIterator m_assemIter; - bool m_iterShared; -#ifdef FEATURE_LOADER_OPTIMIZATION - SharedDomain::SharedAssemblyIterator m_sharedIter; -#endif Assembly* m_curAssem; Assembly::ModuleIterator m_modIter; @@ -524,25 +520,23 @@ struct ProcessModIter { SUPPORTS_DAC; m_nextDomain = true; - m_iterShared = false; m_curAssem = NULL; } Assembly * NextAssem() { SUPPORTS_DAC; - while (!m_iterShared) + for (;;) { if (m_nextDomain) { if (!m_domainIter.Next()) { - m_iterShared = true; break; } m_nextDomain = false; - + m_assemIter = m_domainIter.GetDomain()->IterateAssembliesEx((AssemblyIterationFlags)( kIncludeLoaded | kIncludeExecution)); } @@ -553,30 +547,12 @@ struct ProcessModIter m_nextDomain = true; continue; } - + // Note: DAC doesn't need to keep the assembly alive - see code:CollectibleAssemblyHolder#CAH_DAC CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); - if (!pAssembly->IsDomainNeutral()) - { - // We've found a domain-specific assembly, so this is a unique element in the Assembly - // iteration. - return pAssembly; - } - - // Found a shared assembly, which may be duplicated - // across app domains. Ignore it now and let - // it get picked up in the shared iteration where - // it'll only occur once. - } -#ifdef FEATURE_LOADER_OPTIMIZATION - if (!m_sharedIter.Next()) - { - return NULL; + return pAssembly; } - return m_sharedIter.GetAssembly(); -#else return NULL; -#endif } Module* NextModule(void) diff --git a/src/coreclr/src/debug/daccess/enummem.cpp b/src/coreclr/src/debug/daccess/enummem.cpp index f6749c3..7dce6e9 100644 --- a/src/coreclr/src/debug/daccess/enummem.cpp +++ b/src/coreclr/src/debug/daccess/enummem.cpp @@ -226,7 +226,6 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags) // then run constructor in place // ReportMem(m_globalBase + g_dacGlobals.SystemDomain__m_pSystemDomain, sizeof(SystemDomain)); - ReportMem(m_globalBase + g_dacGlobals.SharedDomain__m_pSharedDomain, sizeof(SharedDomain)); // We need IGCHeap pointer to make EEVersion work ReportMem(m_globalBase + g_dacGlobals.dac__g_pGCHeap, sizeof(IGCHeap *)); @@ -277,7 +276,6 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags) // then run constructor in place // CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( SystemDomain::m_pSystemDomain.EnumMem(); ) - CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( SharedDomain::m_pSharedDomain.EnumMem(); ) CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pDebugger.EnumMem(); ) CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pEEInterface.EnumMem(); ) if (g_pDebugInterface != nullptr) diff --git a/src/coreclr/src/debug/daccess/nidump.cpp b/src/coreclr/src/debug/daccess/nidump.cpp index 0cd2dfd..2165e3e 100644 --- a/src/coreclr/src/debug/daccess/nidump.cpp +++ b/src/coreclr/src/debug/daccess/nidump.cpp @@ -3770,7 +3770,6 @@ void NativeImageDumper::DumpModule( PTR_Module module ) { DisplayWriteFieldPointer( m_pBinder, NULL, Module, MODULE ); } - _ASSERTE(module->m_activeDependencies.GetCount() == 0); /* REVISIT_TODO Tue 10/25/2005 diff --git a/src/coreclr/src/debug/daccess/request.cpp b/src/coreclr/src/debug/daccess/request.cpp index fcd21fe..73c4517 100644 --- a/src/coreclr/src/debug/daccess/request.cpp +++ b/src/coreclr/src/debug/daccess/request.cpp @@ -2281,7 +2281,7 @@ ClrDataAccess::GetAppDomainStoreData(struct DacpAppDomainStoreData *adsData) SOSDacEnter(); adsData->systemDomain = HOST_CDADDR(SystemDomain::System()); - adsData->sharedDomain = HOST_CDADDR(SharedDomain::GetDomain()); + adsData->sharedDomain = NULL; // Get an accurate count of appdomains. adsData->DomainCount = 0; @@ -2314,17 +2314,7 @@ ClrDataAccess::GetAppDomainData(CLRDATA_ADDRESS addr, struct DacpAppDomainData * appdomainData->pStubHeap = HOST_CDADDR(pLoaderAllocator->GetStubHeap()); appdomainData->appDomainStage = STAGE_OPEN; - if (pBaseDomain->IsSharedDomain()) - { - #ifdef FEATURE_LOADER_OPTIMIZATION - SharedDomain::SharedAssemblyIterator i; - while (i.Next()) - { - appdomainData->AssemblyCount++; - } - #endif // FEATURE_LOADER_OPTIMIZATION - } - else if (pBaseDomain->IsAppDomain()) + if (pBaseDomain->IsAppDomain()) { AppDomain * pAppDomain = pBaseDomain->AsAppDomain(); appdomainData->DomainLocalBlock = appdomainData->AppDomainPtr + @@ -2458,28 +2448,7 @@ ClrDataAccess::GetAssemblyList(CLRDATA_ADDRESS addr, int count, CLRDATA_ADDRESS BaseDomain* pBaseDomain = PTR_BaseDomain(TO_TADDR(addr)); int n=0; - if (pBaseDomain->IsSharedDomain()) - { -#ifdef FEATURE_LOADER_OPTIMIZATION - SharedDomain::SharedAssemblyIterator i; - if (values) - { - while (i.Next() && n < count) - values[n++] = HOST_CDADDR(i.GetAssembly()); - } - else - { - while (i.Next()) - n++; - } - - if (pNeeded) - *pNeeded = n; -#else - hr = E_UNEXPECTED; -#endif - } - else if (pBaseDomain->IsAppDomain()) + if (pBaseDomain->IsAppDomain()) { AppDomain::AssemblyIterator i = pBaseDomain->AsAppDomain()->IterateAssembliesEx( (AssemblyIterationFlags)(kIncludeLoading | kIncludeLoaded | kIncludeExecution)); diff --git a/src/coreclr/src/inc/CrstTypes.def b/src/coreclr/src/inc/CrstTypes.def index c08ee70..537134a 100644 --- a/src/coreclr/src/inc/CrstTypes.def +++ b/src/coreclr/src/inc/CrstTypes.def @@ -86,7 +86,7 @@ Crst AllowedFiles End Crst AppDomainCache - AcquiredBefore FusionBindContext FusionLoadContext LoaderHeap UniqueStack UnresolvedClassLock + AcquiredBefore UniqueStack UnresolvedClassLock End Crst AppDomainHandleTable @@ -112,7 +112,7 @@ Crst AssemblyDependencyGraph End Crst AvailableParamTypes - AcquiredBefore FusionBindContext FusionLoadContext IbcProfile LoaderHeap + AcquiredBefore IbcProfile LoaderHeap End Crst BaseDomain @@ -160,7 +160,7 @@ End Crst Contexts AcquiredBefore AvailableParamTypes Cer ClassInit DeadlockDetection DomainLocalBlock FuncPtrStubs GlobalStrLiteralMap Jit LoaderHeap ModuleLookupTable RWLock SigConvert SingleUseLock - StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock FusionClosure + StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock End Crst CoreCLRBinderLog @@ -279,71 +279,9 @@ Crst FuncPtrStubs End Crst FusionAppCtx - AcquiredBefore FusionPolicyConfigPool FusionSingleUse FusionAssemblyDownload -End - -Crst FusionAssemblyDownload - AcquiredBefore FusionDownload UniqueStack -End - -Crst FusionBindResult -End - -Crst FusionClb -End - -Crst FusionClosure - AcquiredBefore FusionBindContext FusionLoadContext FusionAppCtx FusionClosureGraph DomainLocalBlock ModuleFixup -End - -Crst FusionClosureGraph - AcquiredBefore FusionAppCtx FusionBindContext FusionLoadContext -End - -Crst FusionConfigSettings -End - -Crst FusionDownload -End - -Crst FusionLoadContext AcquiredBefore PEImage End -Crst FusionBindContext - AcquiredBefore PEImage -End - -Crst FusionLog - AcquiredBefore IbcProfile UniqueStack -End - -Crst FusionWarningLog - AcquiredBefore FusionBindContext FusionLoadContext FusionLog -End - -Crst FusionNgenIndex - AcquiredBefore SystemDomainDelayedUnloadList -End - -Crst FusionNgenIndexPool - AcquiredBefore SystemDomainDelayedUnloadList -End - -Crst FusionPcyCache -End - -Crst FusionPolicyConfigPool - AcquiredBefore UniqueStack -End - -Crst FusionSingleUse - AcquiredBefore PEImage -End - -Crst FusionIsoLibInit -End - Crst NativeBinderInit Unordered End @@ -353,7 +291,7 @@ Crst NativeImageCache End Crst GCCover - AcquiredBefore LoaderHeap ReJITSharedDomainTable + AcquiredBefore LoaderHeap End Crst GCMemoryPressure @@ -389,7 +327,7 @@ Crst ILStubGen End Crst InstMethodHashTable - AcquiredBefore FusionBindContext FusionLoadContext LoaderHeap UniqueStack JumpStubCache + AcquiredBefore LoaderHeap UniqueStack JumpStubCache End Crst InterfaceVTableMap @@ -430,8 +368,8 @@ End Crst JumpStubCache AcquiredBefore ExecuteManRangeLock LoaderHeap SingleUseLock - AcquiredAfter AppDomainCache ExecuteManLock FusionAssemblyDownload FusionNgenIndex FusionNgenIndexPool - ILStubGen SharedBaseDomain ThreadpoolTimerQueue ThreadpoolWaitThreads + AcquiredAfter AppDomainCache ExecuteManLock + ILStubGen ThreadpoolTimerQueue ThreadpoolWaitThreads TPMethodTable TypeIDMap BaseDomain AssemblyLoader End @@ -502,17 +440,10 @@ End Crst PatchEntryPoint End -Crst PEFileSecurityManager -End - Crst PEImage AcquiredBefore UniqueStack End -Crst ILFingerprintCache - AcquiredBefore PEImage -End - Crst PEImagePDBStream End @@ -520,12 +451,10 @@ Crst PendingTypeLoadEntry AcquiredBefore AppDomainCache AppDomainHandleTable AssemblyLoader AvailableClass AvailableParamTypes BaseDomain ClassInit DeadlockDetection DebuggerController DebuggerJitInfo DebuggerMutex DomainLocalBlock DynLinkZapItems Exception ExecuteManRangeLock FuncPtrStubs - FusionAppCtx FusionAssemblyDownload FusionBindResult FusionClosure FusionDownload - FusionBindContext FusionLoadContext FusionNgenIndex FusionNgenIndexPool FusionPcyCache - FusionPolicyConfigPool FusionSingleUse GlobalStrLiteralMap HandleTable IbcProfile + FusionAppCtx GlobalStrLiteralMap HandleTable IbcProfile IJWFixupData IJWHash ISymUnmanagedReader Jit JumpStubCache LoaderHeap ModIntPairList Module ModuleLookupTable PEImage SecurityStackwalkCache SharedAssemblyCreate - SharedBaseDomain SigConvert SingleUseLock StubDispatchCache StubUnwindInfoHeapSegments + SigConvert SingleUseLock StubDispatchCache StubUnwindInfoHeapSegments SyncBlockCache SystemDomain ThreadIdDispenser ThreadStore TypeIDMap UnresolvedClassLock SameLevelAs PendingTypeLoadEntry End @@ -567,28 +496,17 @@ Crst Reflection AcquiredBefore LoaderHeap UnresolvedClassLock End -// Used to synchronize all rejit information stored in a given AppDomain. One of these -// crsts exist per domain (except the SharedDomain--see below) +// Used to synchronize all rejit information stored in a given AppDomain. Crst ReJITDomainTable AcquiredBefore LoaderHeap SingleUseLock DeadlockDetection JumpStubCache DebuggerController AcquiredAfter ReJITGlobalRequest ThreadStore GlobalStrLiteralMap SystemDomain DebuggerMutex End -// Same as ReJITDomainTable, but this is for the SharedDomain's ReJitManager. Only -// reason we have a special type for the SharedDomain's ReJitManager is so that we can -// explicitly level this guy differently from ReJITDomainTable, so that both the -// SharedDomain's ReJitManager table lock AND one non-SharedDomain's ReJitManager table -// lock may be held simultaneously. This is useful during ETW rundown. -Crst ReJITSharedDomainTable - AcquiredBefore ReJITDomainTable - AcquiredAfter ReJITGlobalRequest ThreadStore GlobalStrLiteralMap SystemDomain DebuggerMutex -End - // Used to synchronize all global requests (which may span multiple AppDomains) which add // new functions to rejit tables, or request Reverts on existing functions in the rejit // tables. One of these crsts exist per runtime. Crst ReJITGlobalRequest - AcquiredBefore ThreadStore ReJITSharedDomainTable ReJITDomainTable SystemDomain + AcquiredBefore ThreadStore ReJITDomainTable SystemDomain End // ETW infrastructure uses this crst to protect a hash table of TypeHandles which is @@ -622,13 +540,6 @@ End Crst SaveModuleProfileData End -Crst SecurityPolicyCache -End - -Crst SecurityPolicyInit - AcquiredBefore SecurityPolicyCache -End - Crst SecurityStackwalkCache End @@ -636,10 +547,6 @@ Crst SharedAssemblyCreate AcquiredBefore DeadlockDetection UniqueStack End -Crst SharedBaseDomain - AcquiredBefore UniqueStack -End - Crst SigConvert AcquiredBefore LoaderHeap End @@ -682,10 +589,11 @@ Crst SyncHashLock End Crst SystemBaseDomain + AcquiredBefore LoaderHeap UniqueStack End Crst SystemDomain - AcquiredBefore DebuggerMutex HandleTable IbcProfile SaveModuleProfileData SecurityPolicyCache + AcquiredBefore DebuggerMutex HandleTable IbcProfile SaveModuleProfileData ThreadIdDispenser ThreadStore End diff --git a/src/coreclr/src/inc/corhdr.h b/src/coreclr/src/inc/corhdr.h index 4065f05..9b891d8 100644 --- a/src/coreclr/src/inc/corhdr.h +++ b/src/coreclr/src/inc/corhdr.h @@ -1819,10 +1819,6 @@ typedef enum CorAttributeTargets #define DEFAULTDOMAIN_MTA_TYPE "System.MTAThreadAttribute" #define DEFAULTDOMAIN_MTA_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID} -#define DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE_W L"System.LoaderOptimizationAttribute" -#define DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE "System.LoaderOptimizationAttribute" -#define DEFAULTDOMAIN_LOADEROPTIMIZATION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I1} - #define NONVERSIONABLE_TYPE_W L"System.Runtime.Versioning.NonVersionableAttribute" #define NONVERSIONABLE_TYPE "System.Runtime.Versioning.NonVersionableAttribute" diff --git a/src/coreclr/src/inc/crsttypes.h b/src/coreclr/src/inc/crsttypes.h index f2f0095..2dc6a20 100644 --- a/src/coreclr/src/inc/crsttypes.h +++ b/src/coreclr/src/inc/crsttypes.h @@ -66,130 +66,107 @@ enum CrstType CrstFriendAccessCache = 47, CrstFuncPtrStubs = 48, CrstFusionAppCtx = 49, - CrstFusionAssemblyDownload = 50, - CrstFusionBindContext = 51, - CrstFusionBindResult = 52, - CrstFusionClb = 53, - CrstFusionClosure = 54, - CrstFusionClosureGraph = 55, - CrstFusionConfigSettings = 56, - CrstFusionDownload = 57, - CrstFusionIsoLibInit = 58, - CrstFusionLoadContext = 59, - CrstFusionLog = 60, - CrstFusionNgenIndex = 61, - CrstFusionNgenIndexPool = 62, - CrstFusionPcyCache = 63, - CrstFusionPolicyConfigPool = 64, - CrstFusionSingleUse = 65, - CrstFusionWarningLog = 66, - CrstGCCover = 67, - CrstGCMemoryPressure = 68, - CrstGlobalStrLiteralMap = 69, - CrstHandleTable = 70, - CrstHostAssemblyMap = 71, - CrstHostAssemblyMapAdd = 72, - CrstIbcProfile = 73, - CrstIJWFixupData = 74, - CrstIJWHash = 75, - CrstILFingerprintCache = 76, - CrstILStubGen = 77, - CrstInlineTrackingMap = 78, - CrstInstMethodHashTable = 79, - CrstInterfaceVTableMap = 80, - CrstInterop = 81, - CrstInteropData = 82, - CrstIOThreadpoolWorker = 83, - CrstIsJMCMethod = 84, - CrstISymUnmanagedReader = 85, - CrstJit = 86, - CrstJitGenericHandleCache = 87, - CrstJitPerf = 88, - CrstJumpStubCache = 89, - CrstLeafLock = 90, - CrstListLock = 91, - CrstLoaderAllocator = 92, - CrstLoaderAllocatorReferences = 93, - CrstLoaderHeap = 94, - CrstMda = 95, - CrstMetadataTracker = 96, - CrstModIntPairList = 97, - CrstModule = 98, - CrstModuleFixup = 99, - CrstModuleLookupTable = 100, - CrstMulticoreJitHash = 101, - CrstMulticoreJitManager = 102, - CrstMUThunkHash = 103, - CrstNativeBinderInit = 104, - CrstNativeImageCache = 105, - CrstNls = 106, - CrstNotifyGdb = 107, - CrstObjectList = 108, - CrstOnEventManager = 109, - CrstPatchEntryPoint = 110, - CrstPEFileSecurityManager = 111, - CrstPEImage = 112, - CrstPEImagePDBStream = 113, - CrstPendingTypeLoadEntry = 114, - CrstPinHandle = 115, - CrstPinnedByrefValidation = 116, - CrstProfilerGCRefDataFreeList = 117, - CrstProfilingAPIStatus = 118, - CrstPublisherCertificate = 119, - CrstRCWCache = 120, - CrstRCWCleanupList = 121, - CrstRCWRefCache = 122, - CrstReadyToRunEntryPointToMethodDescMap = 123, - CrstReDacl = 124, - CrstReflection = 125, - CrstReJITDomainTable = 126, - CrstReJITGlobalRequest = 127, - CrstReJITSharedDomainTable = 128, - CrstRemoting = 129, - CrstRetThunkCache = 130, - CrstRWLock = 131, - CrstSavedExceptionInfo = 132, - CrstSaveModuleProfileData = 133, - CrstSecurityPolicyCache = 134, - CrstSecurityPolicyInit = 135, - CrstSecurityStackwalkCache = 136, - CrstSharedAssemblyCreate = 137, - CrstSharedBaseDomain = 138, - CrstSigConvert = 139, - CrstSingleUseLock = 140, - CrstSpecialStatics = 141, - CrstSqmManager = 142, - CrstStackSampler = 143, - CrstStressLog = 144, - CrstStrongName = 145, - CrstStubCache = 146, - CrstStubDispatchCache = 147, - CrstStubUnwindInfoHeapSegments = 148, - CrstSyncBlockCache = 149, - CrstSyncHashLock = 150, - CrstSystemBaseDomain = 151, - CrstSystemDomain = 152, - CrstSystemDomainDelayedUnloadList = 153, - CrstThreadIdDispenser = 154, - CrstThreadpoolEventCache = 155, - CrstThreadpoolTimerQueue = 156, - CrstThreadpoolWaitThreads = 157, - CrstThreadpoolWorker = 158, - CrstThreadStaticDataHashTable = 159, - CrstThreadStore = 160, - CrstTieredCompilation = 161, - CrstTPMethodTable = 162, - CrstTypeEquivalenceMap = 163, - CrstTypeIDMap = 164, - CrstUMEntryThunkCache = 165, - CrstUMThunkHash = 166, - CrstUniqueStack = 167, - CrstUnresolvedClassLock = 168, - CrstUnwindInfoTableLock = 169, - CrstVSDIndirectionCellLock = 170, - CrstWinRTFactoryCache = 171, - CrstWrapperTemplate = 172, - kNumberOfCrstTypes = 173 + CrstGCCover = 50, + CrstGCMemoryPressure = 51, + CrstGlobalStrLiteralMap = 52, + CrstHandleTable = 53, + CrstHostAssemblyMap = 54, + CrstHostAssemblyMapAdd = 55, + CrstIbcProfile = 56, + CrstIJWFixupData = 57, + CrstIJWHash = 58, + CrstILStubGen = 59, + CrstInlineTrackingMap = 60, + CrstInstMethodHashTable = 61, + CrstInterfaceVTableMap = 62, + CrstInterop = 63, + CrstInteropData = 64, + CrstIOThreadpoolWorker = 65, + CrstIsJMCMethod = 66, + CrstISymUnmanagedReader = 67, + CrstJit = 68, + CrstJitGenericHandleCache = 69, + CrstJitPerf = 70, + CrstJumpStubCache = 71, + CrstLeafLock = 72, + CrstListLock = 73, + CrstLoaderAllocator = 74, + CrstLoaderAllocatorReferences = 75, + CrstLoaderHeap = 76, + CrstMda = 77, + CrstMetadataTracker = 78, + CrstModIntPairList = 79, + CrstModule = 80, + CrstModuleFixup = 81, + CrstModuleLookupTable = 82, + CrstMulticoreJitHash = 83, + CrstMulticoreJitManager = 84, + CrstMUThunkHash = 85, + CrstNativeBinderInit = 86, + CrstNativeImageCache = 87, + CrstNls = 88, + CrstNotifyGdb = 89, + CrstObjectList = 90, + CrstOnEventManager = 91, + CrstPatchEntryPoint = 92, + CrstPEImage = 93, + CrstPEImagePDBStream = 94, + CrstPendingTypeLoadEntry = 95, + CrstPinHandle = 96, + CrstPinnedByrefValidation = 97, + CrstProfilerGCRefDataFreeList = 98, + CrstProfilingAPIStatus = 99, + CrstPublisherCertificate = 100, + CrstRCWCache = 101, + CrstRCWCleanupList = 102, + CrstRCWRefCache = 103, + CrstReadyToRunEntryPointToMethodDescMap = 104, + CrstReDacl = 105, + CrstReflection = 106, + CrstReJITDomainTable = 107, + CrstReJITGlobalRequest = 108, + CrstRemoting = 109, + CrstRetThunkCache = 110, + CrstRWLock = 111, + CrstSavedExceptionInfo = 112, + CrstSaveModuleProfileData = 113, + CrstSecurityStackwalkCache = 114, + CrstSharedAssemblyCreate = 115, + CrstSigConvert = 116, + CrstSingleUseLock = 117, + CrstSpecialStatics = 118, + CrstSqmManager = 119, + CrstStackSampler = 120, + CrstStressLog = 121, + CrstStrongName = 122, + CrstStubCache = 123, + CrstStubDispatchCache = 124, + CrstStubUnwindInfoHeapSegments = 125, + CrstSyncBlockCache = 126, + CrstSyncHashLock = 127, + CrstSystemBaseDomain = 128, + CrstSystemDomain = 129, + CrstSystemDomainDelayedUnloadList = 130, + CrstThreadIdDispenser = 131, + CrstThreadpoolEventCache = 132, + CrstThreadpoolTimerQueue = 133, + CrstThreadpoolWaitThreads = 134, + CrstThreadpoolWorker = 135, + CrstThreadStaticDataHashTable = 136, + CrstThreadStore = 137, + CrstTieredCompilation = 138, + CrstTPMethodTable = 139, + CrstTypeEquivalenceMap = 140, + CrstTypeIDMap = 141, + CrstUMEntryThunkCache = 142, + CrstUMThunkHash = 143, + CrstUniqueStack = 144, + CrstUnresolvedClassLock = 145, + CrstUnwindInfoTableLock = 146, + CrstVSDIndirectionCellLock = 147, + CrstWinRTFactoryCache = 148, + CrstWrapperTemplate = 149, + kNumberOfCrstTypes = 150 }; #endif // __CRST_TYPES_INCLUDED @@ -202,18 +179,18 @@ int g_rgCrstLevelMap[] = { 9, // CrstAllowedFiles 9, // CrstAppDomainCache - 13, // CrstAppDomainHandleTable + 12, // CrstAppDomainHandleTable 0, // CrstArgBasedStubCache 0, // CrstAssemblyDependencyGraph 0, // CrstAssemblyIdentityCache 0, // CrstAssemblyList 7, // CrstAssemblyLoader 3, // CrstAvailableClass - 6, // CrstAvailableParamTypes + 3, // CrstAvailableParamTypes 7, // CrstBaseDomain -1, // CrstCCompRC 9, // CrstCer - 12, // CrstClassFactInfoHash + 11, // CrstClassFactInfoHash 8, // CrstClassInit -1, // CrstClrNotification 0, // CrstCLRPrivBinderMaps @@ -221,7 +198,7 @@ int g_rgCrstLevelMap[] = 6, // CrstCodeFragmentHeap 4, // CrstCOMWrapperCache 0, // CrstConnectionNameTable - 17, // CrstContexts + 15, // CrstContexts -1, // CrstCoreCLRBinderLog 0, // CrstCrstCLRPrivBinderLocalWinMDPath 7, // CrstCSPCache @@ -234,9 +211,9 @@ int g_rgCrstLevelMap[] = 0, // CrstDebuggerHeapExecMemLock 0, // CrstDebuggerHeapLock 4, // CrstDebuggerJitInfo - 10, // CrstDebuggerMutex + 9, // CrstDebuggerMutex 0, // CrstDelegateToFPtrHash - 15, // CrstDomainLocalBlock + 14, // CrstDomainLocalBlock 0, // CrstDynamicIL 3, // CrstDynamicMT 3, // CrstDynLinkZapItems @@ -249,41 +226,23 @@ int g_rgCrstLevelMap[] = 3, // CrstFCall 7, // CrstFriendAccessCache 7, // CrstFuncPtrStubs - 9, // CrstFusionAppCtx - 7, // CrstFusionAssemblyDownload - 5, // CrstFusionBindContext - 0, // CrstFusionBindResult - 0, // CrstFusionClb - 16, // CrstFusionClosure - 10, // CrstFusionClosureGraph - 0, // CrstFusionConfigSettings - 0, // CrstFusionDownload - 0, // CrstFusionIsoLibInit - 5, // CrstFusionLoadContext - 4, // CrstFusionLog - 7, // CrstFusionNgenIndex - 7, // CrstFusionNgenIndexPool - 0, // CrstFusionPcyCache - 4, // CrstFusionPolicyConfigPool - 5, // CrstFusionSingleUse - 6, // CrstFusionWarningLog - 10, // CrstGCCover + 5, // CrstFusionAppCtx + 3, // CrstGCCover 0, // CrstGCMemoryPressure - 12, // CrstGlobalStrLiteralMap + 11, // CrstGlobalStrLiteralMap 1, // CrstHandleTable 0, // CrstHostAssemblyMap 3, // CrstHostAssemblyMapAdd 0, // CrstIbcProfile 9, // CrstIJWFixupData 0, // CrstIJWHash - 5, // CrstILFingerprintCache 7, // CrstILStubGen 3, // CrstInlineTrackingMap - 16, // CrstInstMethodHashTable + 15, // CrstInstMethodHashTable 0, // CrstInterfaceVTableMap 17, // CrstInterop 4, // CrstInteropData - 12, // CrstIOThreadpoolWorker + 11, // CrstIOThreadpoolWorker 0, // CrstIsJMCMethod 7, // CrstISymUnmanagedReader 8, // CrstJit @@ -292,17 +251,17 @@ int g_rgCrstLevelMap[] = 6, // CrstJumpStubCache 0, // CrstLeafLock -1, // CrstListLock - 14, // CrstLoaderAllocator - 15, // CrstLoaderAllocatorReferences + 13, // CrstLoaderAllocator + 14, // CrstLoaderAllocatorReferences 0, // CrstLoaderHeap 0, // CrstMda -1, // CrstMetadataTracker 0, // CrstModIntPairList 4, // CrstModule - 14, // CrstModuleFixup + 13, // CrstModuleFixup 3, // CrstModuleLookupTable 0, // CrstMulticoreJitHash - 12, // CrstMulticoreJitManager + 11, // CrstMulticoreJitManager 0, // CrstMUThunkHash -1, // CrstNativeBinderInit -1, // CrstNativeImageCache @@ -311,10 +270,9 @@ int g_rgCrstLevelMap[] = 2, // CrstObjectList 0, // CrstOnEventManager 0, // CrstPatchEntryPoint - 0, // CrstPEFileSecurityManager 4, // CrstPEImage 0, // CrstPEImagePDBStream - 18, // CrstPendingTypeLoadEntry + 16, // CrstPendingTypeLoadEntry 0, // CrstPinHandle 0, // CrstPinnedByrefValidation 0, // CrstProfilerGCRefDataFreeList @@ -327,18 +285,14 @@ int g_rgCrstLevelMap[] = 0, // CrstReDacl 9, // CrstReflection 7, // CrstReJITDomainTable - 13, // CrstReJITGlobalRequest - 9, // CrstReJITSharedDomainTable - 19, // CrstRemoting + 12, // CrstReJITGlobalRequest + 17, // CrstRemoting 3, // CrstRetThunkCache 0, // CrstRWLock 3, // CrstSavedExceptionInfo 0, // CrstSaveModuleProfileData - 0, // CrstSecurityPolicyCache - 3, // CrstSecurityPolicyInit 0, // CrstSecurityStackwalkCache 4, // CrstSharedAssemblyCreate - 7, // CrstSharedBaseDomain 3, // CrstSigConvert 5, // CrstSingleUseLock 0, // CrstSpecialStatics @@ -351,16 +305,16 @@ int g_rgCrstLevelMap[] = 4, // CrstStubUnwindInfoHeapSegments 3, // CrstSyncBlockCache 0, // CrstSyncHashLock - 0, // CrstSystemBaseDomain - 12, // CrstSystemDomain + 4, // CrstSystemBaseDomain + 11, // CrstSystemDomain 0, // CrstSystemDomainDelayedUnloadList 0, // CrstThreadIdDispenser 0, // CrstThreadpoolEventCache 7, // CrstThreadpoolTimerQueue 7, // CrstThreadpoolWaitThreads - 12, // CrstThreadpoolWorker + 11, // CrstThreadpoolWorker 4, // CrstThreadStaticDataHashTable - 11, // CrstThreadStore + 10, // CrstThreadStore 9, // CrstTieredCompilation 9, // CrstTPMethodTable 3, // CrstTypeEquivalenceMap @@ -428,23 +382,6 @@ LPCSTR g_rgCrstNameMap[] = "CrstFriendAccessCache", "CrstFuncPtrStubs", "CrstFusionAppCtx", - "CrstFusionAssemblyDownload", - "CrstFusionBindContext", - "CrstFusionBindResult", - "CrstFusionClb", - "CrstFusionClosure", - "CrstFusionClosureGraph", - "CrstFusionConfigSettings", - "CrstFusionDownload", - "CrstFusionIsoLibInit", - "CrstFusionLoadContext", - "CrstFusionLog", - "CrstFusionNgenIndex", - "CrstFusionNgenIndexPool", - "CrstFusionPcyCache", - "CrstFusionPolicyConfigPool", - "CrstFusionSingleUse", - "CrstFusionWarningLog", "CrstGCCover", "CrstGCMemoryPressure", "CrstGlobalStrLiteralMap", @@ -454,7 +391,6 @@ LPCSTR g_rgCrstNameMap[] = "CrstIbcProfile", "CrstIJWFixupData", "CrstIJWHash", - "CrstILFingerprintCache", "CrstILStubGen", "CrstInlineTrackingMap", "CrstInstMethodHashTable", @@ -489,7 +425,6 @@ LPCSTR g_rgCrstNameMap[] = "CrstObjectList", "CrstOnEventManager", "CrstPatchEntryPoint", - "CrstPEFileSecurityManager", "CrstPEImage", "CrstPEImagePDBStream", "CrstPendingTypeLoadEntry", @@ -506,17 +441,13 @@ LPCSTR g_rgCrstNameMap[] = "CrstReflection", "CrstReJITDomainTable", "CrstReJITGlobalRequest", - "CrstReJITSharedDomainTable", "CrstRemoting", "CrstRetThunkCache", "CrstRWLock", "CrstSavedExceptionInfo", "CrstSaveModuleProfileData", - "CrstSecurityPolicyCache", - "CrstSecurityPolicyInit", "CrstSecurityStackwalkCache", "CrstSharedAssemblyCreate", - "CrstSharedBaseDomain", "CrstSigConvert", "CrstSingleUseLock", "CrstSpecialStatics", diff --git a/src/coreclr/src/inc/dacvars.h b/src/coreclr/src/inc/dacvars.h index 54c1ce6..f4a04b2 100644 --- a/src/coreclr/src/inc/dacvars.h +++ b/src/coreclr/src/inc/dacvars.h @@ -119,12 +119,12 @@ DEFINE_DACVAR(ULONG, PTR_Thread, dac__g_pSuspensionThread, ::g_pSuspensionThread DEFINE_DACVAR(ULONG, DWORD, dac__g_heap_type, g_heap_type) DEFINE_DACVAR(ULONG, PTR_GcDacVars, dac__g_gcDacGlobals, g_gcDacGlobals) +DEFINE_DACVAR(ULONG, PTR_AppDomain, AppDomain__m_pTheAppDomain, AppDomain::m_pTheAppDomain) DEFINE_DACVAR(ULONG, PTR_SystemDomain, SystemDomain__m_pSystemDomain, SystemDomain::m_pSystemDomain) DEFINE_DACVAR(ULONG, ArrayListStatic, SystemDomain__m_appDomainIndexList, SystemDomain::m_appDomainIndexList) DEFINE_DACVAR(ULONG, BOOL, SystemDomain__s_fForceDebug, SystemDomain::s_fForceDebug) DEFINE_DACVAR(ULONG, BOOL, SystemDomain__s_fForceProfiling, SystemDomain::s_fForceProfiling) DEFINE_DACVAR(ULONG, BOOL, SystemDomain__s_fForceInstrument, SystemDomain::s_fForceInstrument) -DEFINE_DACVAR(ULONG, PTR_SharedDomain, SharedDomain__m_pSharedDomain, SharedDomain::m_pSharedDomain) #ifdef FEATURE_INTEROP_DEBUGGING DEFINE_DACVAR(ULONG, DWORD, dac__g_debuggerWordTLSIndex, g_debuggerWordTLSIndex) @@ -167,7 +167,7 @@ DEFINE_DACVAR(ULONG, PTR_BYTE, dac__g_highest_address, ::g_highest_address) DEFINE_DACVAR(ULONG, IGCHeap, dac__g_pGCHeap, ::g_pGCHeap) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pThinLockThreadIdDispenser, ::g_pThinLockThreadIdDispenser) -DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pModuleIndexDispenser, ::g_pModuleIndexDispenser) +DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pModuleIndexDispenser, ::g_pModuleIndexDispenser) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pObjectClass, ::g_pObjectClass) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pRuntimeTypeClass, ::g_pRuntimeTypeClass) DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pCanonMethodTableClass, ::g_pCanonMethodTableClass) diff --git a/src/coreclr/src/inc/vptr_list.h b/src/coreclr/src/inc/vptr_list.h index 7b7b5f0..566cfa6 100644 --- a/src/coreclr/src/inc/vptr_list.h +++ b/src/coreclr/src/inc/vptr_list.h @@ -27,7 +27,6 @@ VPTR_CLASS(Module) VPTR_CLASS(ReflectionModule) VPTR_CLASS(AppDomain) -VPTR_CLASS(SharedDomain) VPTR_CLASS(SystemDomain) VPTR_CLASS(DomainAssembly) @@ -119,5 +118,4 @@ VPTR_CLASS(LoaderCodeHeap) VPTR_CLASS(HostCodeHeap) VPTR_CLASS(GlobalLoaderAllocator) -VPTR_CLASS(AppDomainLoaderAllocator) VPTR_CLASS(AssemblyLoaderAllocator) diff --git a/src/coreclr/src/palrt/convert.h b/src/coreclr/src/palrt/convert.h deleted file mode 100644 index 8e3a9d4..0000000 --- a/src/coreclr/src/palrt/convert.h +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -// =========================================================================== -// File: convert.h -// -// =========================================================================== - -/*** -*Purpose: -* Common header (shared by convert.cpp and decimal.cpp) for numeric -* conversions and other math stuff. -* -*Revision History: -* -* -* -*Implementation Notes: -* -*****************************************************************************/ - -#ifndef _CONVERT_H_ /* { */ -#define _CONVERT_H_ - -//*********************************************************************** -// -// Structures -// - -typedef union{ - struct { -#if BIGENDIAN - ULONG sign:1; - ULONG exp:11; - ULONG mantHi:20; - ULONG mantLo; -#else // BIGENDIAN - ULONG mantLo; - ULONG mantHi:20; - ULONG exp:11; - ULONG sign:1; -#endif - } u; - double dbl; -} DBLSTRUCT; - -// Intializer for a DBLSTRUCT -#if BIGENDIAN -#define DEFDS(Lo, Hi, exp, sign) { {sign, exp, Hi, Lo } } -#else -#define DEFDS(Lo, Hi, exp, sign) { {Lo, Hi, exp, sign} } -#endif - - -typedef struct { -#if BIGENDIAN - ULONG sign:1; - ULONG exp:8; - ULONG mant:23; -#else - ULONG mant:23; - ULONG exp:8; - ULONG sign:1; -#endif -} SNGSTRUCT; - - - -typedef union { - DWORDLONG int64; - struct { -#ifdef BIGENDIAN - ULONG Hi; - ULONG Lo; -#else - ULONG Lo; - ULONG Hi; -#endif - } u; -} SPLIT64; - - - -//*********************************************************************** -// -// Constants -// - -static const ULONG ulTenToTenDiv4 = 2500000000U; -static const ULONG ulTenToNine = 1000000000U; - -//*********************************************************************** -// -// Inlines for Decimal -// - - -#ifndef UInt32x32To64 -#define UInt32x32To64(a, b) ((DWORDLONG)((DWORD)(a)) * (DWORDLONG)((DWORD)(b))) -#endif - -#define Div64by32(num, den) ((ULONG)((DWORDLONG)(num) / (ULONG)(den))) -#define Mod64by32(num, den) ((ULONG)((DWORDLONG)(num) % (ULONG)(den))) - -inline DWORDLONG DivMod32by32(ULONG num, ULONG den) -{ - SPLIT64 sdl; - - sdl.u.Lo = num / den; - sdl.u.Hi = num % den; - return sdl.int64; -} - -inline DWORDLONG DivMod64by32(DWORDLONG num, ULONG den) -{ - SPLIT64 sdl; - - sdl.u.Lo = Div64by32(num, den); - sdl.u.Hi = Mod64by32(num, den); - return sdl.int64; -} - -#endif /* } _CONVERT_H_ */ diff --git a/src/coreclr/src/palrt/shstr.h b/src/coreclr/src/palrt/shstr.h deleted file mode 100644 index 64d2c22..0000000 --- a/src/coreclr/src/palrt/shstr.h +++ /dev/null @@ -1,138 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -// =========================================================================== -// File: shstr.h -// -// ShStr class ported from shlwapi for urlpars.cpp (especially for Fusion) -// =========================================================================== - -#ifndef _SHSTR_H_ - -// default shstr to something small, so we don't waste too much stack space -// MAX_PATH is used frequently, so we'd like to a factor of that - so that -// if we do grow to MAX_PATH size, we don't waste any extra. -#define DEFAULT_SHSTR_LENGTH (MAX_PATH_FNAME/4) - - -#ifdef UNICODE -#define ShStr ShStrW -#define UrlStr UrlStrW -#endif //UNICODE - - -class ShStrW -{ -public: - - // - // Constructors - // - ShStrW(); - - // - // Destructor - // - ~ShStrW() - {Reset();} - - // - // the first are the only ones that count - // - HRESULT SetStr(LPCSTR pszStr, DWORD cchStr); - HRESULT SetStr(LPCSTR pszStr); - HRESULT SetStr(LPCWSTR pwszStr, DWORD cchStr); - - // the rest just call into the first three - HRESULT SetStr(LPCWSTR pwszStr) - {return SetStr(pwszStr, (DWORD) -1);} - HRESULT SetStr(ShStrW &shstr) - {return SetStr(shstr._pszStr);} - - - ShStrW& operator=(LPCSTR pszStr) - {SetStr(pszStr); return *this;} - ShStrW& operator=(LPCWSTR pwszStr) - {SetStr(pwszStr); return *this;} - ShStrW& operator=(ShStrW &shstr) - {SetStr(shstr._pszStr); return *this;} - - - LPCWSTR GetStr() - {return _pszStr;} - operator LPCWSTR() - {return _pszStr;} - - LPWSTR GetInplaceStr(void) - {return _pszStr;} - - // People want to play with the bytes in OUR internal buffer. If they - // call us correctly, and assume that the resulting pointer is only valid - // as far as they want or as far as the current length, then let them. - LPWSTR GetModifyableStr(DWORD cchSizeToModify) - { - if (cchSizeToModify > _cchSize) - if (FAILED(SetSize(cchSizeToModify))) - return NULL; - return _pszStr; - } - - HRESULT Append(LPCWSTR pszStr, DWORD cchStr); - HRESULT Append(LPCWSTR pszStr) - {return Append(pszStr, (DWORD) -1);} - HRESULT Append(WCHAR ch) - {return Append(&ch, 1);} - - - VOID Reset(); - -#ifdef DEBUG - BOOL IsValid(); -#else - BOOL IsValid() - {return (BOOL) (_pszStr ? TRUE : FALSE);} -#endif //DEBUG - - DWORD GetSize() - {ASSERT(!(_cchSize % DEFAULT_SHSTR_LENGTH)); return (_pszStr ? _cchSize : 0);} - - HRESULT SetSize(DWORD cchSize); - DWORD GetLen() - {return lstrlenW(_pszStr);} - - - -protected: -// friend UrlStr; -/* - TCHAR GetAt(DWORD cch) - {return cch < _cchSize ? _pszStr[cch] : TEXT('\0');} - TCHAR SetAt(TCHAR ch, DWORD cch) - {return cch < _cchSize ? _pszStr[cch] = ch : TEXT('\0');} -*/ -private: - - HRESULT _SetStr(LPCSTR psz); - HRESULT _SetStr(LPCSTR psz, DWORD cb); - HRESULT _SetStr(LPCWSTR pwszStr, DWORD cchStr); - - WCHAR _szDefaultBuffer[DEFAULT_SHSTR_LENGTH]; - LPWSTR _pszStr; - DWORD _cchSize; - - -}; //ShStrW - -#ifdef UNICODE -typedef ShStrW SHSTR; -typedef ShStrW *PSHSTR; -#endif //UNICODE - -typedef ShStrW SHSTRW; -typedef ShStrW *PSHSTRW; - - -#endif // _SHSTR_H_ diff --git a/src/coreclr/src/vm/appdomain.cpp b/src/coreclr/src/vm/appdomain.cpp index 3b4f55a..0a5e9de 100644 --- a/src/coreclr/src/vm/appdomain.cpp +++ b/src/coreclr/src/vm/appdomain.cpp @@ -97,28 +97,17 @@ static const WCHAR OTHER_DOMAIN_FRIENDLY_NAME_PREFIX[] = W("Domain"); #define STATIC_OBJECT_TABLE_BUCKET_SIZE 1020 -#define MAX_URL_LENGTH 2084 // same as INTERNET_MAX_URL_LENGTH - //#define _DEBUG_ADUNLOAD 1 -HRESULT RunDllMain(MethodDesc *pMD, HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved); // clsload.cpp - - - - - // Statics +SPTR_IMPL(AppDomain, AppDomain, m_pTheAppDomain); SPTR_IMPL(SystemDomain, SystemDomain, m_pSystemDomain); SVAL_IMPL(ArrayListStatic, SystemDomain, m_appDomainIndexList); -SPTR_IMPL(SharedDomain, SharedDomain, m_pSharedDomain); SVAL_IMPL(BOOL, SystemDomain, s_fForceDebug); SVAL_IMPL(BOOL, SystemDomain, s_fForceProfiling); SVAL_IMPL(BOOL, SystemDomain, s_fForceInstrument); -// The one and only AppDomain -AppDomain* AppDomain::m_pTheAppDomain = NULL; - #ifndef DACCESS_COMPILE // Base Domain Statics @@ -126,10 +115,6 @@ CrstStatic BaseDomain::m_SpecialStaticsCrst; int BaseDomain::m_iNumberOfProcessors = 0; -// Shared Domain Statics -DECLSPEC_ALIGN(16) -static BYTE g_pSharedDomainMemory[sizeof(SharedDomain)]; - // System Domain Statics GlobalStringLiteralMap* SystemDomain::m_pGlobalStringLiteralMap = NULL; @@ -739,7 +724,7 @@ BaseDomain::BaseDomain() m_ILStubGenLock.PreInit(); #ifdef FEATURE_CODE_VERSIONING - m_codeVersionManager.PreInit(this == (BaseDomain *)g_pSharedDomainMemory); + m_codeVersionManager.PreInit(); #endif } //BaseDomain::BaseDomain @@ -760,9 +745,7 @@ void BaseDomain::Init() // Initialize the domain locks // - if (this == reinterpret_cast(&g_pSharedDomainMemory[0])) - m_DomainCrst.Init(CrstSharedBaseDomain); - else if (this == reinterpret_cast(&g_pSystemDomainMemory[0])) + if (this == reinterpret_cast(&g_pSystemDomainMemory[0])) m_DomainCrst.Init(CrstSystemBaseDomain); else m_DomainCrst.Init(CrstBaseDomain); @@ -1251,70 +1234,6 @@ OBJECTREF* BaseDomain::AllocateObjRefPtrsInLargeTable(int nRequested, OBJECTREF* #endif // !DACCESS_COMPILE -/*static*/ -PTR_BaseDomain BaseDomain::ComputeBaseDomain( - BaseDomain * pGenericDefinitionDomain, // the domain that owns the generic type or method - Instantiation classInst, // the type arguments to the type (if any) - Instantiation methodInst) // the type arguments to the method (if any) -{ - CONTRACT(PTR_BaseDomain) - { - NOTHROW; - GC_NOTRIGGER; - FORBID_FAULT; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - SUPPORTS_DAC; - SO_TOLERANT; - } - CONTRACT_END - - if (pGenericDefinitionDomain && pGenericDefinitionDomain->IsAppDomain()) - RETURN PTR_BaseDomain(pGenericDefinitionDomain); - - for (DWORD i = 0; i < classInst.GetNumArgs(); i++) - { - PTR_BaseDomain pArgDomain = classInst[i].GetDomain(); - if (pArgDomain->IsAppDomain()) - RETURN pArgDomain; - } - - for (DWORD i = 0; i < methodInst.GetNumArgs(); i++) - { - PTR_BaseDomain pArgDomain = methodInst[i].GetDomain(); - if (pArgDomain->IsAppDomain()) - RETURN pArgDomain; - } - RETURN (pGenericDefinitionDomain ? - PTR_BaseDomain(pGenericDefinitionDomain) : - PTR_BaseDomain(SystemDomain::System())); -} - -PTR_BaseDomain BaseDomain::ComputeBaseDomain(TypeKey * pKey) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - SUPPORTS_DAC; - } - CONTRACTL_END; - - - if (pKey->GetKind() == ELEMENT_TYPE_CLASS) - return BaseDomain::ComputeBaseDomain(pKey->GetModule()->GetDomain(), - pKey->GetInstantiation()); - else if (pKey->GetKind() != ELEMENT_TYPE_FNPTR) - return pKey->GetElementType().GetDomain(); - else - return BaseDomain::ComputeBaseDomain(NULL,Instantiation(pKey->GetRetAndArgTypes(), pKey->GetNumArgs()+1)); -} - - - - - #ifndef DACCESS_COMPILE // Insert class in the hash table @@ -2076,7 +1995,6 @@ void SystemDomain::Attach() // Create the one and only app domain AppDomain::Create(); - SharedDomain::Attach(); // Each domain gets its own ReJitManager, and ReJitManager has its own static // initialization to run @@ -2159,21 +2077,11 @@ void SystemDomain::Terminate() // bNotifyProfiler is ignored m_pSystemAssembly = NULL; - if(m_pwDevpath) { - delete[] m_pwDevpath; - m_pwDevpath = NULL; - } - m_dwDevpath = 0; - m_fDevpath = FALSE; - if (m_pGlobalStringLiteralMap) { delete m_pGlobalStringLiteralMap; m_pGlobalStringLiteralMap = NULL; } - - SharedDomain::Detach(); - BaseDomain::Terminate(); #ifdef FEATURE_COMINTEROP @@ -3574,20 +3482,6 @@ void SystemDomain::NotifyProfilerStartup() g_profControlBlock.pProfInterface->AppDomainCreationFinished((AppDomainID) System()->DefaultDomain(), S_OK); END_PIN_PROFILER(); } - - { - BEGIN_PIN_PROFILER(CORProfilerTrackAppDomainLoads()); - _ASSERTE(SharedDomain::GetDomain()); - g_profControlBlock.pProfInterface->AppDomainCreationStarted((AppDomainID) SharedDomain::GetDomain()); - END_PIN_PROFILER(); - } - - { - BEGIN_PIN_PROFILER(CORProfilerTrackAppDomainLoads()); - _ASSERTE(SharedDomain::GetDomain()); - g_profControlBlock.pProfInterface->AppDomainCreationFinished((AppDomainID) SharedDomain::GetDomain(), S_OK); - END_PIN_PROFILER(); - } } HRESULT SystemDomain::NotifyProfilerShutdown() @@ -3668,11 +3562,9 @@ AppDomain::AppDomain() memset(m_rpCLRTypes, 0, sizeof(m_rpCLRTypes)); #endif // FEATURE_COMINTEROP - m_pAsyncPool = NULL; m_handleStore = NULL; m_ExposedObject = NULL; - m_pComIPForExposedObject = NULL; #ifdef _DEBUG m_pThreadTrackInfoList = NULL; @@ -3823,8 +3715,6 @@ void AppDomain::Init() m_dwId = SystemDomain::GetNewAppDomainId(this); - m_LoaderAllocator.Init(this); - #ifndef CROSSGEN_COMPILE //Allocate the threadpool entry before the appdomain id list. Otherwise, //the thread pool list will be out of sync if insertion of id in @@ -3987,15 +3877,8 @@ void AppDomain::Terminate() GCX_PREEMP(); - _ASSERTE(m_dwThreadEnterCount == 0 || IsDefaultDomain()); - if (m_pComIPForExposedObject) - { - m_pComIPForExposedObject->Release(); - m_pComIPForExposedObject = NULL; - } - delete m_pDefaultContext; m_pDefaultContext = NULL; @@ -4088,8 +3971,6 @@ void AppDomain::Terminate() m_ReflectionCrst.Destroy(); m_RefClassFactCrst.Destroy(); - m_LoaderAllocator.Terminate(); - BaseDomain::Terminate(); if (m_handleStore) @@ -4184,63 +4065,6 @@ OBJECTREF AppDomain::GetExposedObject() #endif // !CROSSGEN_COMPILE #ifdef FEATURE_COMINTEROP -#ifndef CROSSGEN_COMPILE -HRESULT AppDomain::GetComIPForExposedObject(IUnknown **pComIP) -{ - // Assumption: This function is called for AppDomain's that the current - // thread is in or has entered, or the AppDomain is kept alive. - // - // Assumption: This function can now throw. The caller is responsible for any - // BEGIN_EXTERNAL_ENTRYPOINT, EX_TRY, or other - // techniques to convert to a COM HRESULT protocol. - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - HRESULT hr = S_OK; - Thread *pThread = GetThread(); - if (m_pComIPForExposedObject) - { - GCX_PREEMP_THREAD_EXISTS(pThread); - m_pComIPForExposedObject->AddRef(); - *pComIP = m_pComIPForExposedObject; - return S_OK; - } - - IUnknown* punk = NULL; - - OBJECTREF ref = NULL; - GCPROTECT_BEGIN(ref); - - EnsureComStarted(); - - ENTER_DOMAIN_PTR(this,ADV_DEFAULTAD) - { - ref = GetExposedObject(); - punk = GetComIPFromObjectRef(&ref); - if (FastInterlockCompareExchangePointer(&m_pComIPForExposedObject, punk, NULL) == NULL) - { - GCX_PREEMP_THREAD_EXISTS(pThread); - m_pComIPForExposedObject->AddRef(); - } - } - END_DOMAIN_TRANSITION; - - GCPROTECT_END(); - - if(SUCCEEDED(hr)) - { - *pComIP = m_pComIPForExposedObject; - } - - return hr; -} -#endif //#ifndef CROSSGEN_COMPILE - MethodTable *AppDomain::GetRedirectedType(WinMDAdapter::RedirectedTypeIndex index) { CONTRACTL @@ -4913,9 +4737,6 @@ CHECK AppDomain::CheckCanExecuteManagedCode(MethodDesc* pMD) "Managed code can only run when its module has been activated in the current app domain"); } - CHECK_MSG(!IsPassiveDomain() || pModule->CanExecuteCode(), - "Executing managed code from an unsafe assembly in a Passive AppDomain"); - CHECK_OK; } @@ -5462,90 +5283,9 @@ CHECK AppDomain::CheckValidModule(Module * pModule) if (pModule->FindDomainFile(this) != NULL) CHECK_OK; - CCHECK_START - { - Assembly * pAssembly = pModule->GetAssembly(); - - CCHECK(pAssembly->IsDomainNeutral()); -#ifdef FEATURE_LOADER_OPTIMIZATION - Assembly * pSharedAssembly = NULL; - _ASSERTE(this == ::GetAppDomain()); - { - SharedAssemblyLocator locator(pAssembly->GetManifestFile()); - pSharedAssembly = SharedDomain::GetDomain()->FindShareableAssembly(&locator); - } - - CCHECK(pAssembly == pSharedAssembly); -#endif - } - CCHECK_END; - CHECK_OK; } -#ifdef FEATURE_LOADER_OPTIMIZATION -// Loads an existing Module into an AppDomain -// WARNING: this can only be done in a very limited scenario - the Module must be an unloaded domain neutral -// dependency in the app domain in question. Normal code should not call this! -DomainFile *AppDomain::LoadDomainNeutralModuleDependency(Module *pModule, FileLoadLevel targetLevel) -{ - CONTRACT(DomainFile *) - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(::GetAppDomain()==this); - PRECONDITION(CheckPointer(pModule)); - POSTCONDITION(CheckValidModule(pModule)); - POSTCONDITION(CheckPointer(RETVAL)); - POSTCONDITION(RETVAL->GetModule() == pModule); - } - CONTRACT_END; - - DomainFile *pDomainFile = pModule->FindDomainFile(this); - - STRESS_LOG3(LF_CLASSLOADER, LL_INFO100,"LDNMD: DomainFile %p for module %p in AppDomain %i\n",pDomainFile,pModule,GetId().m_dwId); - - if (pDomainFile == NULL) - { - GCX_PREEMP(); - - Assembly *pAssembly = pModule->GetAssembly(); - - DomainAssembly *pDomainAssembly = pAssembly->FindDomainAssembly(this); - if (pDomainAssembly == NULL) - { - AssemblySpec spec(this); - spec.InitializeSpec(pAssembly->GetManifestFile()); - - pDomainAssembly = spec.LoadDomainAssembly(targetLevel); - } - else - { - //if the domain assembly already exists, we need to load it to the target level - pDomainAssembly->EnsureLoadLevel (targetLevel); - } - - if(pAssembly != pDomainAssembly->GetAssembly()) - { - ThrowHR(SECURITY_E_INCOMPATIBLE_SHARE); - } - - _ASSERTE (pModule == pAssembly->GetManifestModule()); - pDomainFile = pDomainAssembly; - } - else - { - // If the DomainFile already exists, we need to load it to the target level. - pDomainFile->EnsureLoadLevel (targetLevel); - } - - RETURN pDomainFile; -} - -#endif // FEATURE_LOADER_OPTIMIZATION - - static void NormalizeAssemblySpecForNativeDependencies(AssemblySpec * pSpec) { CONTRACTL @@ -7628,245 +7368,10 @@ end: } #endif // _DEBUG - -#endif // CROSSGEN_COMPILE - -void *SharedDomain::operator new(size_t size, void *pInPlace) -{ - LIMITED_METHOD_CONTRACT; - return pInPlace; -} - -void SharedDomain::operator delete(void *pMem) -{ - LIMITED_METHOD_CONTRACT; - // Do nothing - new() was in-place -} - - -void SharedDomain::Attach() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // Create the global SharedDomain and initialize it. - m_pSharedDomain = new (&g_pSharedDomainMemory[0]) SharedDomain(); - SystemDomain::GetGlobalLoaderAllocator()->m_pDomain = m_pSharedDomain; - // This cannot fail since g_pSharedDomainMemory is a static array. - CONSISTENCY_CHECK(CheckPointer(m_pSharedDomain)); - - LOG((LF_CLASSLOADER, - LL_INFO10, - "Created shared domain at %p\n", - m_pSharedDomain)); - - // We need to initialize the memory pools etc. for the system domain. - m_pSharedDomain->Init(); // Setup the memory heaps - - // allocate a Virtual Call Stub Manager for the shared domain - m_pSharedDomain->InitVSD(); -} - -#ifndef CROSSGEN_COMPILE -void SharedDomain::Detach() -{ - if (m_pSharedDomain) - { - m_pSharedDomain->Terminate(); - delete m_pSharedDomain; - m_pSharedDomain = NULL; - } -} #endif // CROSSGEN_COMPILE #endif // !DACCESS_COMPILE -SharedDomain *SharedDomain::GetDomain() -{ - LIMITED_METHOD_DAC_CONTRACT; - - return m_pSharedDomain; -} - -#ifndef DACCESS_COMPILE - -#define INITIAL_ASSEMBLY_MAP_SIZE 17 -void SharedDomain::Init() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - BaseDomain::Init(); - -#ifdef FEATURE_LOADER_OPTIMIZATION - m_FileCreateLock.Init(CrstSharedAssemblyCreate, CRST_DEFAULT,TRUE); - - LockOwner lock = { &m_DomainCrst, IsOwnerOfCrst }; - m_assemblyMap.Init(INITIAL_ASSEMBLY_MAP_SIZE, CompareSharedAssembly, TRUE, &lock); -#endif // FEATURE_LOADER_OPTIMIZATION - - ETW::LoaderLog::DomainLoad(this); -} - -#ifndef CROSSGEN_COMPILE -void SharedDomain::Terminate() -{ - // make sure we delete the StringLiteralMap before unloading - // the asemblies since the string literal map entries can - // point to metadata string literals. - GetLoaderAllocator()->CleanupStringLiteralMap(); - -#ifdef FEATURE_LOADER_OPTIMIZATION - PtrHashMap::PtrIterator i = m_assemblyMap.begin(); - - while (!i.end()) - { - Assembly *pAssembly = (Assembly*) i.GetValue(); - delete pAssembly; - ++i; - } - - ListLockEntry* pElement; - pElement = m_FileCreateLock.Pop(TRUE); - while (pElement) - { -#ifdef STRICT_CLSINITLOCK_ENTRY_LEAK_DETECTION - _ASSERTE (dbg_fDrasticShutdown || g_fInControlC); -#endif - delete(pElement); - pElement = (FileLoadLock*) m_FileCreateLock.Pop(TRUE); - } - m_FileCreateLock.Destroy(); -#endif // FEATURE_LOADER_OPTIMIZATION - BaseDomain::Terminate(); -} -#endif // CROSSGEN_COMPILE - - - -#ifdef FEATURE_LOADER_OPTIMIZATION - -BOOL SharedDomain::CompareSharedAssembly(UPTR u1, UPTR u2) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - // This is the input to the lookup - SharedAssemblyLocator *pLocator = (SharedAssemblyLocator *) (u1<<1); - - // This is the value stored in the table - Assembly *pAssembly = (Assembly *) u2; - if (pLocator->GetType()==SharedAssemblyLocator::DOMAINASSEMBLY) - return FALSE; - else - if (pLocator->GetType()==SharedAssemblyLocator::PEASSEMBLY) - return pAssembly->GetManifestFile()->Equals(pLocator->GetPEAssembly()); - else - if (pLocator->GetType()==SharedAssemblyLocator::PEASSEMBLYEXACT) - return pAssembly->GetManifestFile() == pLocator->GetPEAssembly(); - _ASSERTE(!"Unexpected type of assembly locator"); - return FALSE; -} - -DWORD SharedAssemblyLocator::Hash() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - if (m_type==DOMAINASSEMBLY) - return GetDomainAssembly()->HashIdentity(); - if (m_type==PEASSEMBLY||m_type==PEASSEMBLYEXACT) - return GetPEAssembly()->HashIdentity(); - _ASSERTE(!"Unexpected type of assembly locator"); - return 0; -} - -Assembly * SharedDomain::FindShareableAssembly(SharedAssemblyLocator * pLocator) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - Assembly * match= (Assembly *) m_assemblyMap.LookupValue(pLocator->Hash(), pLocator); - if (match != (Assembly *) INVALIDENTRY) - return match; - else - return NULL; -} - -SIZE_T SharedDomain::GetShareableAssemblyCount() -{ - LIMITED_METHOD_CONTRACT; - - return m_assemblyMap.GetCount(); -} - -void SharedDomain::AddShareableAssembly(Assembly * pAssembly) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // We have a lock on the file. There should be no races to add the same assembly. - - { - LockHolder holder(this); - - EX_TRY - { - pAssembly->SetIsTenured(); - m_assemblyMap.InsertValue(pAssembly->HashIdentity(), pAssembly); - } - EX_HOOK - { - // There was an error adding the assembly to the assembly hash (probably an OOM), - // so we need to unset the tenured bit so that correct cleanup can happen. - pAssembly->UnsetIsTenured(); - } - EX_END_HOOK - } - - LOG((LF_CODESHARING, - LL_INFO100, - "Successfully added shareable assembly \"%s\".\n", - pAssembly->GetManifestFile()->GetSimpleName())); -} - -#endif // FEATURE_LOADER_OPTIMIZATION -#endif // !DACCESS_COMPILE - DWORD DomainLocalModule::GetClassFlags(MethodTable* pMT, DWORD iClassIndex /*=(DWORD)-1*/) { CONTRACTL { @@ -8574,6 +8079,13 @@ void AppDomain::EnumStaticGCRefs(promote_func* fn, ScanContext* sc) #endif // !DACCESS_COMPILE //------------------------------------------------------------------------ +PTR_LoaderAllocator BaseDomain::GetLoaderAllocator() +{ + WRAPPER_NO_CONTRACT; + return SystemDomain::GetGlobalLoaderAllocator(); // The one and only domain is not unloadable +} + +//------------------------------------------------------------------------ UINT32 BaseDomain::GetTypeID(PTR_MethodTable pMT) { CONTRACTL { THROWS; @@ -8608,9 +8120,6 @@ PTR_MethodTable BaseDomain::LookupType(UINT32 id) { } CONTRACTL_END; PTR_MethodTable pMT = m_typeIDMap.LookupType(id); - if (pMT == NULL && !IsSharedDomain()) { - pMT = SharedDomain::GetDomain()->LookupType(id); - } CONSISTENCY_CHECK(CheckPointer(pMT)); CONSISTENCY_CHECK(pMT->IsInterface()); @@ -9192,8 +8701,6 @@ AppDomain::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, } m_sDomainLocalBlock.EnumMemoryRegions(flags); - - m_LoaderAllocator.EnumMemoryRegions(flags); } void @@ -9224,26 +8731,6 @@ SystemDomain::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, (&m_appDomainIndexList)->EnumMemoryRegions(flags); } -void -SharedDomain::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, - bool enumThis) -{ - SUPPORTS_DAC; - if (enumThis) - { - DAC_ENUM_VTHIS(); - } - BaseDomain::EnumMemoryRegions(flags, false); -#ifdef FEATURE_LOADER_OPTIMIZATION - m_assemblyMap.EnumMemoryRegions(flags); - SharedAssemblyIterator assem; - while (assem.Next()) - { - assem.GetAssembly()->EnumMemoryRegions(flags); - } -#endif -} - #endif //DACCESS_COMPILE diff --git a/src/coreclr/src/vm/appdomain.hpp b/src/coreclr/src/vm/appdomain.hpp index 5bc7ba6..71e2ea1 100644 --- a/src/coreclr/src/vm/appdomain.hpp +++ b/src/coreclr/src/vm/appdomain.hpp @@ -52,7 +52,6 @@ class BaseDomain; class SystemDomain; -class SharedDomain; class AppDomain; class CompilationDomain; class AppDomainEnum; @@ -1083,10 +1082,11 @@ public: } virtual BOOL IsAppDomain() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } - virtual BOOL IsSharedDomain() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } - inline BOOL IsDefaultDomain(); // defined later in this file - virtual PTR_LoaderAllocator GetLoaderAllocator() = 0; + BOOL IsSharedDomain() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } + BOOL IsDefaultDomain() { LIMITED_METHOD_DAC_CONTRACT; return TRUE; } + + PTR_LoaderAllocator GetLoaderAllocator(); virtual PTR_AppDomain AsAppDomain() { LIMITED_METHOD_CONTRACT; @@ -1095,17 +1095,6 @@ public: return NULL; } - - // If one domain is the SharedDomain and one is an AppDomain then - // return the AppDomain, i.e. return the domain with the shorter lifetime - // of the two given domains. - static PTR_BaseDomain ComputeBaseDomain( - BaseDomain *pGenericDefinitionDomain, // the domain that owns the generic type or method - Instantiation classInst, // the type arguments to the type (if any) - Instantiation methodInst = Instantiation()); // the type arguments to the method (if any) - - static PTR_BaseDomain ComputeBaseDomain(TypeKey * pTypeKey); - #ifdef FEATURE_COMINTEROP //**************************************************************************************** // @@ -1702,43 +1691,6 @@ public: }; // class CollectibleAssemblyHolder<> //--------------------------------------------------------------------------------------- -// -#ifdef FEATURE_LOADER_OPTIMIZATION -class SharedAssemblyLocator -{ -public: - enum - { - DOMAINASSEMBLY = 1, - PEASSEMBLY = 2, - PEASSEMBLYEXACT = 3 - }; - DWORD GetType() {LIMITED_METHOD_CONTRACT; return m_type;}; -#ifndef DACCESS_COMPILE - DomainAssembly* GetDomainAssembly() {LIMITED_METHOD_CONTRACT; _ASSERTE(m_type==DOMAINASSEMBLY); return (DomainAssembly*)m_value;}; - PEAssembly* GetPEAssembly() {LIMITED_METHOD_CONTRACT; _ASSERTE(m_type==PEASSEMBLY||m_type==PEASSEMBLYEXACT); return (PEAssembly*)m_value;}; - SharedAssemblyLocator(DomainAssembly* pAssembly) - { - LIMITED_METHOD_CONTRACT; - m_type=DOMAINASSEMBLY; - m_value=pAssembly; - } - SharedAssemblyLocator(PEAssembly* pFile, DWORD type = PEASSEMBLY) - { - LIMITED_METHOD_CONTRACT; - m_type = type; - m_value = pFile; - } -#endif // DACCESS_COMPILE - - DWORD Hash(); -protected: - DWORD m_type; - LPVOID m_value; - ULONG m_uIdentityHash; -}; -#endif // FEATURE_LOADER_OPTIMIZATION - // // Stores binding information about failed assembly loads for DAC // @@ -1865,8 +1817,6 @@ class AppDomainIterator; const DWORD DefaultADID = 1; -template class AppDomainCreationHolder; - // An Appdomain is the managed equivalent of a process. It is an isolation unit (conceptually you don't // have pointers directly from one appdomain to another, but rather go through remoting proxies). It is // also a unit of unloading. @@ -1904,7 +1854,7 @@ public: //----------------------------------------------------------------------------------------------------------------- // Convenience wrapper for ::GetAppDomain to provide better encapsulation. - static AppDomain * GetCurrentDomain() + static PTR_AppDomain GetCurrentDomain() { return m_pTheAppDomain; } //----------------------------------------------------------------------------------------------------------------- @@ -1915,8 +1865,6 @@ public: HRESULT SetWinrtApplicationContext(SString &appLocalWinMD); #endif // FEATURE_COMINTEROP - BOOL CanReversePInvokeEnter(); - void SetReversePInvokeCannotEnter(); bool MustForceTrivialWaitOperations(); void SetForceTrivialWaitOperations(); @@ -1970,8 +1918,6 @@ public: OBJECTHANDLE GetRawExposedObjectHandleForDebugger() { LIMITED_METHOD_DAC_CONTRACT; return m_ExposedObject; } #ifdef FEATURE_COMINTEROP - HRESULT GetComIPForExposedObject(IUnknown **pComIP); - MethodTable *GetRedirectedType(WinMDAdapter::RedirectedTypeIndex index); #endif // FEATURE_COMINTEROP @@ -2304,9 +2250,6 @@ public: CHECK CheckValidModule(Module *pModule); -#ifdef FEATURE_LOADER_OPTIMIZATION - DomainFile *LoadDomainNeutralModuleDependency(Module *pModule, FileLoadLevel targetLevel); -#endif // private: void LoadSystemAssemblies(); @@ -2615,17 +2558,6 @@ public: IUnknown *CreateFusionContext(); - void OverrideDefaultContextBinder(IUnknown *pOverrideBinder) - { - LIMITED_METHOD_CONTRACT; - - _ASSERTE(pOverrideBinder != NULL); - pOverrideBinder->AddRef(); - m_pFusionContext->Release(); - m_pFusionContext = pOverrideBinder; - } - - #ifdef FEATURE_PREJIT CorCompileConfigFlags GetNativeConfigFlags(); #endif // FEATURE_PREJIT @@ -3031,7 +2963,6 @@ public: PTR_LoaderHeap GetStubHeap(); PTR_LoaderHeap GetLowFrequencyHeap(); PTR_LoaderHeap GetHighFrequencyHeap(); - virtual PTR_LoaderAllocator GetLoaderAllocator(); #ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING #define ARM_ETW_ALLOC_THRESHOLD (4 * 1024 * 1024) @@ -3217,8 +3148,6 @@ private: // Return FALSE if more work is needed BOOL StopEEAndUnwindThreads(unsigned int retryCount, BOOL *pFMarkUnloadRequestThread); - AppDomainLoaderAllocator m_LoaderAllocator; - // List of unloaded LoaderAllocators, protected by code:GetLoaderAllocatorReferencesLock (for now) LoaderAllocator * m_pDelayedLoaderAllocatorUnloadList; @@ -3231,12 +3160,12 @@ public: void SetGCRefPoint(int gccounter) { LIMITED_METHOD_CONTRACT; - m_LoaderAllocator.SetGCRefPoint(gccounter); + GetLoaderAllocator()->SetGCRefPoint(gccounter); } int GetGCRefPoint() { LIMITED_METHOD_CONTRACT; - return m_LoaderAllocator.GetGCRefPoint(); + return GetLoaderAllocator()->GetGCRefPoint(); } static USHORT GetOffsetOfId() @@ -3269,7 +3198,7 @@ public: private: // The one and only AppDomain - static AppDomain* m_pTheAppDomain; + SPTR_DECL(AppDomain, m_pTheAppDomain); SString m_friendlyName; PTR_Assembly m_pRootAssembly; @@ -3283,8 +3212,6 @@ private: OBJECTHANDLE m_ExposedObject; - IUnknown *m_pComIPForExposedObject; - // Hash table that maps a clsid to a type PtrHashMap m_clsidHash; @@ -3312,8 +3239,6 @@ private: MethodTable* m_pLicenseInteropHelperMT; #endif // FEATURE_COMINTEROP - AssemblySink* m_pAsyncPool; // asynchronous retrival object pool (only one is kept) - // The index of this app domain among existing app domains (starting from 1) ADIndex m_dwIndex; @@ -3738,7 +3663,6 @@ class SystemDomain : public BaseDomain public: static PTR_LoaderAllocator GetGlobalLoaderAllocator(); - virtual PTR_LoaderAllocator GetLoaderAllocator() { WRAPPER_NO_CONTRACT; return GetGlobalLoaderAllocator(); } static AppDomain* GetAppDomainFromId(ADID indx,DWORD ADValidityKind) { CONTRACTL @@ -4135,11 +4059,6 @@ private: InlineSString<100> m_SystemDirectory; - - LPWSTR m_pwDevpath; - DWORD m_dwDevpath; - BOOL m_fDevpath; // have we searched the environment - // @TODO: CTS, we can keep the com modules in a single assembly or in different assemblies. // We are currently using different assemblies but this is potentitially to slow... @@ -4352,293 +4271,8 @@ class AppDomainIterator : public UnsafeAppDomainIterator } }; // class AppDomainIterator -typedef VPTR(class SharedDomain) PTR_SharedDomain; - -class SharedDomain : public BaseDomain -{ - VPTR_VTABLE_CLASS_AND_CTOR(SharedDomain, BaseDomain) - -public: - - static void Attach(); - static void Detach(); - - virtual BOOL IsSharedDomain() { LIMITED_METHOD_DAC_CONTRACT; return TRUE; } - virtual PTR_LoaderAllocator GetLoaderAllocator() { WRAPPER_NO_CONTRACT; return SystemDomain::GetGlobalLoaderAllocator(); } - - virtual PTR_AppDomain AsAppDomain() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - _ASSERTE(!"Not an AppDomain"); - return NULL; - } - - static SharedDomain * GetDomain(); - - void Init(); - void Terminate(); - - // This will also set the tenured bit if and only if the add was successful, - // and will make sure that the bit appears atomically set to all readers that - // might be accessing the hash on another thread. - MethodTable * FindIndexClass(SIZE_T index); - -#ifdef FEATURE_LOADER_OPTIMIZATION - void AddShareableAssembly(Assembly * pAssembly); - - class SharedAssemblyIterator - { - PtrHashMap::PtrIterator i; - Assembly * m_pAssembly; - - public: - SharedAssemblyIterator() : - i(GetDomain() ? GetDomain()->m_assemblyMap.firstBucket() : NULL) - { LIMITED_METHOD_DAC_CONTRACT; } - - BOOL Next() - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (i.end()) - return FALSE; - - m_pAssembly = PTR_Assembly(dac_cast(i.GetValue())); - ++i; - return TRUE; - } - - Assembly * GetAssembly() - { - LIMITED_METHOD_DAC_CONTRACT; - - return m_pAssembly; - } - - private: - friend class SharedDomain; - }; - - Assembly * FindShareableAssembly(SharedAssemblyLocator * pLocator); - SIZE_T GetShareableAssemblyCount(); -#endif //FEATURE_LOADER_OPTIMIZATION - -private: - friend class SharedAssemblyIterator; - friend class SharedFileLockHolder; - friend class ClrDataAccess; - -#ifndef DACCESS_COMPILE - void *operator new(size_t size, void *pInPlace); - void operator delete(void *pMem); -#endif - - SPTR_DECL(SharedDomain, m_pSharedDomain); - -#ifdef FEATURE_LOADER_OPTIMIZATION - PEFileListLock m_FileCreateLock; - SIZE_T m_nextClassIndex; - PtrHashMap m_assemblyMap; -#endif - -public: -#ifdef DACCESS_COMPILE - virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags, - bool enumThis); -#endif - -#ifdef FEATURE_LOADER_OPTIMIZATION - // Hash map comparison function` - static BOOL CompareSharedAssembly(UPTR u1, UPTR u2); -#endif -}; - -#ifdef FEATURE_LOADER_OPTIMIZATION -class SharedFileLockHolderBase : protected HolderBase -{ - protected: - PEFileListLock *m_pLock; - ListLockEntry *m_pLockElement; - - SharedFileLockHolderBase(PEFile *value) - : HolderBase(value) - { - LIMITED_METHOD_CONTRACT; - - m_pLock = NULL; - m_pLockElement = NULL; - } - -#ifndef DACCESS_COMPILE - void DoAcquire() - { - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - - PEFileListLockHolder lockHolder(m_pLock); - - m_pLockElement = m_pLock->FindFileLock(m_value); - if (m_pLockElement == NULL) - { - m_pLockElement = new ListLockEntry(m_pLock, m_value); - m_pLock->AddElement(m_pLockElement); - } - else - m_pLockElement->AddRef(); - - lockHolder.Release(); - - m_pLockElement->Enter(); - } - - void DoRelease() - { - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FORBID_FAULT; - - m_pLockElement->Leave(); - m_pLockElement->Release(); - m_pLockElement = NULL; - } -#endif // DACCESS_COMPILE -}; - -class SharedFileLockHolder : public BaseHolder -{ - public: - DEBUG_NOINLINE SharedFileLockHolder(SharedDomain *pDomain, PEFile *pFile, BOOL Take = TRUE) - : BaseHolder(pFile, FALSE) - { - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_FAULT; - ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT; - - m_pLock = &pDomain->m_FileCreateLock; - if (Take) - Acquire(); - } -}; -#endif // FEATURE_LOADER_OPTIMIZATION - -inline BOOL BaseDomain::IsDefaultDomain() -{ - LIMITED_METHOD_DAC_CONTRACT; - return (SystemDomain::System()->DefaultDomain() == this); -} - #include "comreflectioncache.inl" -#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) -// holds an extra reference so needs special Extract() and should not have SuppressRelease() -// Holders/Wrappers have nonvirtual methods so cannot use them as the base class -template -class AppDomainCreationHolder -{ -private: - // disable the copy ctor - AppDomainCreationHolder(const AppDomainCreationHolder&) {} - -protected: - AppDomainType* m_pDomain; - BOOL m_bAcquired; - void ReleaseAppDomainDuringCreation() - { - CONTRACTL - { - NOTHROW; - WRAPPER(GC_TRIGGERS); - PRECONDITION(m_bAcquired); - PRECONDITION(CheckPointer(m_pDomain)); - } - CONTRACTL_END; - - if (m_pDomain->NotReadyForManagedCode()) - { - m_pDomain->Release(); - } - }; - -public: - AppDomainCreationHolder() - { - m_pDomain=NULL; - m_bAcquired=FALSE; - }; - ~AppDomainCreationHolder() - { - if (m_bAcquired) - { - Release(); - } - }; - void Assign(AppDomainType* pDomain) - { - if(m_bAcquired) - Release(); - m_pDomain=pDomain; - if(m_pDomain) - { - AppDomain::RefTakerAcquire(m_pDomain); -#ifdef _DEBUG - m_pDomain->IncCreationCount(); -#endif // _DEBUG - } - m_bAcquired=TRUE; - }; - - void Release() - { - _ASSERTE(m_bAcquired); - if(m_pDomain) - { -#ifdef _DEBUG - m_pDomain->DecCreationCount(); -#endif // _DEBUG - if(!m_pDomain->IsDefaultDomain()) - ReleaseAppDomainDuringCreation(); - AppDomain::RefTakerRelease(m_pDomain); - }; - m_bAcquired=FALSE; - }; - - AppDomainType* Extract() - { - _ASSERTE(m_bAcquired); - if(m_pDomain) - { -#ifdef _DEBUG - m_pDomain->DecCreationCount(); -#endif // _DEBUG - AppDomain::RefTakerRelease(m_pDomain); - } - m_bAcquired=FALSE; - return m_pDomain; - }; - - AppDomainType* operator ->() - { - _ASSERTE(m_bAcquired); - return m_pDomain; - } - - operator AppDomainType*() - { - _ASSERTE(m_bAcquired); - return m_pDomain; - } - - void DoneCreating() - { - Extract(); - } -}; -#endif // !DACCESS_COMPILE && !CROSSGEN_COMPILE - #define INVALID_APPDOMAIN_ID ((DWORD)-1) #define CURRENT_APPDOMAIN_ID ((ADID)(DWORD)0) diff --git a/src/coreclr/src/vm/appdomain.inl b/src/coreclr/src/vm/appdomain.inl index 37fb501..d2a87ed 100644 --- a/src/coreclr/src/vm/appdomain.inl +++ b/src/coreclr/src/vm/appdomain.inl @@ -86,19 +86,6 @@ inline BOOL AppDomain::HasNativeDllSearchDirectories() return m_NativeDllSearchDirectories.GetCount() !=0; } - -inline BOOL AppDomain::CanReversePInvokeEnter() -{ - LIMITED_METHOD_CONTRACT; - return m_ReversePInvokeCanEnter; -} - -inline void AppDomain::SetReversePInvokeCannotEnter() -{ - LIMITED_METHOD_CONTRACT; - m_ReversePInvokeCanEnter=FALSE; -} - inline bool AppDomain::MustForceTrivialWaitOperations() { LIMITED_METHOD_CONTRACT; @@ -129,12 +116,6 @@ inline PTR_LoaderHeap AppDomain::GetStubHeap() return GetLoaderAllocator()->GetStubHeap(); } -inline PTR_LoaderAllocator AppDomain::GetLoaderAllocator() -{ - WRAPPER_NO_CONTRACT; - return PTR_LoaderAllocator(PTR_HOST_MEMBER_TADDR(AppDomain,this,m_LoaderAllocator)); -} - /* static */ inline DWORD DomainLocalModule::DynamicEntry::GetOffsetOfDataBlob() { diff --git a/src/coreclr/src/vm/ceeload.cpp b/src/coreclr/src/vm/ceeload.cpp index 9f3c709..52600c8 100644 --- a/src/coreclr/src/vm/ceeload.cpp +++ b/src/coreclr/src/vm/ceeload.cpp @@ -1524,9 +1524,7 @@ static bool IsLikelyDependencyOf(Module * pModule, Module * pOtherModule) // (System.dll or System.Core.dll) and the app assemblies. Because of this extra layer, the check below won't see the direct // reference between these low level system assemblies and the app assemblies. The prefererred zap module for instantiations of generic // collections from these low level system assemblies (like LinkedList) should be module of AppType. It would be module of the generic - // collection without this check. On desktop (FEATURE_FULL_NGEN defined), it would result into inefficient code because of the instantiations - // would be speculative. On CoreCLR (FEATURE_FULL_NGEN not defined), it would result into the instantiations not getting saved into native - // image at all. + // collection without this check. // // Similar problem exists for Windows.Foundation.winmd. There is a cycle between Windows.Foundation.winmd and Windows.Storage.winmd. This cycle // would cause prefererred zap module for instantiations of foundation types (like IAsyncOperation) to be Windows.Foundation.winmd. @@ -1886,11 +1884,6 @@ DomainFile *Module::GetDomainFile(AppDomain *pDomain) DomainLocalBlock *pLocalBlock = pDomain->GetDomainLocalBlock(); DomainFile *pDomainFile = pLocalBlock->TryGetDomainFile(GetModuleIndex()); -#if !defined(DACCESS_COMPILE) && defined(FEATURE_LOADER_OPTIMIZATION) - if (pDomainFile == NULL) - pDomainFile = pDomain->LoadDomainNeutralModuleDependency(this, FILE_LOADED); -#endif // !DACCESS_COMPILE - RETURN (PTR_DomainFile) pDomainFile; } else @@ -4742,153 +4735,14 @@ void Module::AddActiveDependency(Module *pModule, BOOL unconditional) PRECONDITION(pModule != this); PRECONDITION(!IsSystem()); PRECONDITION(!GetAssembly()->IsDomainNeutral() || pModule->GetAssembly()->IsDomainNeutral() || GetAppDomain()->IsDefaultDomain()); - POSTCONDITION(IsSingleAppDomain() || HasActiveDependency(pModule)); - POSTCONDITION(IsSingleAppDomain() || !unconditional || HasUnconditionalActiveDependency(pModule)); // Postcondition about activation } CONTRACT_END; - // Activation tracking is not require in single domain mode. Activate the target immediately. - if (IsSingleAppDomain()) - { - pModule->EnsureActive(); - RETURN; - } - - // In the default AppDomain we delay a closure walk until a sharing attempt has been made - // This might result in a situation where a domain neutral assembly from the default AppDomain - // depends on something resolved by assembly resolve event (even Ref.Emit assemblies) - // Since we won't actually share such assemblies, and the default AD itself cannot go away we - // do not need to assert for such assemblies, thus " || GetAppDomain()->IsDefaultDomain()" - - CONSISTENCY_CHECK_MSG(!GetAssembly()->IsDomainNeutral() || pModule->GetAssembly()->IsDomainNeutral() || GetAppDomain()->IsDefaultDomain(), - "Active dependency from domain neutral to domain bound is illegal"); - - // We must track this dependency for multiple domains' use - STRESS_LOG2(LF_CLASSLOADER, LL_INFO100000," %p -> %p\n",this,pModule); - - _ASSERTE(!unconditional || pModule->HasNativeImage()); - _ASSERTE(!unconditional || HasNativeImage()); - - COUNT_T index; - - // this function can run in parallel with DomainFile::Activate and sychronizes via GetNumberOfActivations() - // because we expose dependency only in the end Domain::Activate might miss it, but it will increment a counter module - // so we can realize we have to additionally propagate a dependency into that appdomain. - // currently we do it just by rescanning al appdomains. - // needless to say, updating the counter and checking counter+adding dependency to the list should be atomic - - - BOOL propagate = FALSE; - ULONG startCounter=0; - ULONG endCounter=0; - do - { - // First, add the dependency to the physical dependency list - { -#ifdef _DEBUG - CHECK check; - if (unconditional) - check=DomainFile::CheckUnactivatedInAllDomains(this); -#endif // _DEBUG - - CrstHolder lock(&m_Crst); - startCounter=GetNumberOfActivations(); - - index = m_activeDependencies.FindElement(0, pModule); - if (index == (COUNT_T) ArrayList::NOT_FOUND) - { - propagate = TRUE; - STRESS_LOG3(LF_CLASSLOADER, LL_INFO100,"Adding new module dependency %p -> %p, unconditional=%i\n",this,pModule,unconditional); - } - - if (unconditional) - { - if (propagate) - { - CONSISTENCY_CHECK_MSG(check, - "Unconditional dependency cannot be added after module has already been activated"); - - index = m_activeDependencies.GetCount(); - m_activeDependencies.Append(pModule); - m_unconditionalDependencies.SetBit(index); - STRESS_LOG2(LF_CLASSLOADER, LL_INFO100," Unconditional module dependency propagated %p -> %p\n",this,pModule); - // Now other threads can skip this dependency without propagating. - } - RETURN; - } - - } - - // Now we have to propagate any module activations in the loader - - if (propagate) - { - - _ASSERTE(!unconditional); - DomainFile::PropagateNewActivation(this, pModule); - - CrstHolder lock(&m_Crst); - STRESS_LOG2(LF_CLASSLOADER, LL_INFO100," Conditional module dependency propagated %p -> %p\n",this,pModule); - // Now other threads can skip this dependency without propagating. - endCounter=GetNumberOfActivations(); - if(startCounter==endCounter) - m_activeDependencies.Append(pModule); - } - - }while(propagate && startCounter!=endCounter); //need to retry if someone was activated in parallel + pModule->EnsureActive(); RETURN; } -BOOL Module::HasActiveDependency(Module *pModule) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pModule)); - } - CONTRACTL_END; - - if (pModule == this) - return TRUE; - - DependencyIterator i = IterateActiveDependencies(); - while (i.Next()) - { - if (i.GetDependency() == pModule) - return TRUE; - } - - return FALSE; -} - -BOOL Module::HasUnconditionalActiveDependency(Module *pModule) -{ - CONTRACTL - { - NOTHROW; - CAN_TAKE_LOCK; - MODE_ANY; - PRECONDITION(CheckPointer(pModule)); - } - CONTRACTL_END; - - if (pModule == this) - return TRUE; - - DependencyIterator i = IterateActiveDependencies(); - while (i.Next()) - { - if (i.GetDependency() == pModule - && i.IsUnconditional()) - return TRUE; - } - - return FALSE; -} - void Module::EnableModuleFailureTriggers(Module *pModuleTo, AppDomain *pDomain) { CONTRACTL @@ -6305,38 +6159,6 @@ void Module::DebugLogRidMapOccupancy() } #endif // _DEBUG -BOOL Module::CanExecuteCode() -{ - WRAPPER_NO_CONTRACT; - -#ifdef FEATURE_PREJIT - // In a passive domain, we lock down which assemblies can run code - if (!GetAppDomain()->IsPassiveDomain()) - return TRUE; - - Assembly * pAssembly = GetAssembly(); - PEAssembly * pPEAssembly = pAssembly->GetManifestFile(); - - // Only mscorlib is allowed to execute code in an ngen passive domain - if (IsCompilationProcess()) - return pPEAssembly->IsSystem(); - - // ExecuteDLLForAttach does not run the managed entry point in - // a passive domain to avoid loader-lock deadlocks. - // Hence, it is not safe to execute any code from this assembly. - if (pPEAssembly->GetEntryPointToken(INDEBUG(TRUE)) != mdTokenNil) - return FALSE; - - // EXEs loaded using LoadAssembly() may not be loaded at their - // preferred base address. If they have any relocs, these may - // not have been fixed up. - if (!pPEAssembly->IsDll() && !pPEAssembly->IsILOnly()) - return FALSE; -#endif // FEATURE_PREJIT - - return TRUE; -} - // // FindMethod finds a MethodDesc for a global function methoddef or ref // @@ -9918,12 +9740,6 @@ void Module::Fixup(DataImage *image) image->ZeroField(this, offsetof(Module, m_pISymUnmanagedReader), sizeof(m_pISymUnmanagedReader)); image->ZeroField(this, offsetof(Module, m_ISymUnmanagedReaderCrst), sizeof(m_ISymUnmanagedReaderCrst)); - // Clear active dependencies - they will be refilled at load time - image->ZeroField(this, offsetof(Module, m_activeDependencies), sizeof(m_activeDependencies)); - new (image->GetImagePointer(this, offsetof(Module, m_unconditionalDependencies))) SynchronizedBitMask(); - image->ZeroField(this, offsetof(Module, m_unconditionalDependencies) + offsetof(SynchronizedBitMask, m_bitMaskLock) + offsetof(SimpleRWLock,m_spinCount), sizeof(m_unconditionalDependencies.m_bitMaskLock.m_spinCount)); - image->ZeroField(this, offsetof(Module, m_dwNumberOfActivations), sizeof(m_dwNumberOfActivations)); - image->ZeroField(this, offsetof(Module, m_LookupTableCrst), sizeof(m_LookupTableCrst)); m_TypeDefToMethodTableMap.Fixup(image); diff --git a/src/coreclr/src/vm/ceeload.h b/src/coreclr/src/vm/ceeload.h index b421484..9910d15 100644 --- a/src/coreclr/src/vm/ceeload.h +++ b/src/coreclr/src/vm/ceeload.h @@ -1448,12 +1448,6 @@ private: // Format the above stream is in (if any) ESymbolFormat m_symbolFormat; - // Active dependencies - ArrayList m_activeDependencies; - - SynchronizedBitMask m_unconditionalDependencies; - ULONG m_dwNumberOfActivations; - // For protecting additions to the heap CrstExplicitInit m_LookupTableCrst; @@ -1913,8 +1907,6 @@ protected: #endif CHECK CheckActivated(); - ULONG GetNumberOfActivations(); - ULONG IncrementNumberOfActivations(); IMDInternalImport *GetMDImport() const { @@ -2556,13 +2548,6 @@ public: public: void NotifyEtwLoadFinished(HRESULT hr); - // Get any cached ITypeLib* for the module. - ITypeLib *GetTypeLib(); - // Cache the ITypeLib*, if one is not already cached. - void SetTypeLib(ITypeLib *pITLB); - ITypeLib *GetTypeLibTCE(); - void SetTypeLibTCE(ITypeLib *pITLB); - // Enregisters a VASig. VASigCookie *GetVASigCookie(Signature vaSignature); @@ -2578,9 +2563,6 @@ public: m_pDllMain = pMD; } - BOOL CanExecuteCode(); - - // This data is only valid for NGEN'd modules, and for modules we're creating at NGEN time. ModuleCtorInfo* GetZapModuleCtorInfo() { @@ -2708,69 +2690,6 @@ public: void AddActiveDependency(Module *pModule, BOOL unconditional); - // Active dependency iterator - class DependencyIterator - { - protected: - ArrayList::Iterator m_i; - COUNT_T m_index; - SynchronizedBitMask* m_unconditionalFlags; - - friend class Module; - - DependencyIterator(ArrayList *list, SynchronizedBitMask *unconditionalFlags) - : m_index((COUNT_T)-1), - m_unconditionalFlags(unconditionalFlags) - { - WRAPPER_NO_CONTRACT; - m_i = list->Iterate(); - } - - public: - Module *GetDependency() - { - return ((FixupPointer *)m_i.GetElementPtr())->GetValue(); - } - - BOOL Next() - { - LIMITED_METHOD_CONTRACT; - while (m_i.Next()) - { - ++m_index; - -#ifdef FEATURE_PREJIT - // When iterating all dependencies, we do not restore any tokens - // as we want to be lazy. - PTR_Module pModule = ((FixupPointer *)m_i.GetElementPtr())->GetValue(); - if (!CORCOMPILE_IS_POINTER_TAGGED(dac_cast(pModule))) - return TRUE; - -#else - return TRUE; -#endif - - } - return FALSE; - } - BOOL IsUnconditional() - { - if (m_unconditionalFlags == NULL) - return TRUE; - else - return m_unconditionalFlags->TestBit(m_index); - } - }; - - DependencyIterator IterateActiveDependencies() - { - WRAPPER_NO_CONTRACT; - return DependencyIterator(&m_activeDependencies, &m_unconditionalDependencies); - } - - BOOL HasActiveDependency(Module *pModule); - BOOL HasUnconditionalActiveDependency(Module *pModule); - // Turn triggers from this module into runtime checks void EnableModuleFailureTriggers(Module *pModule, AppDomain *pDomain); diff --git a/src/coreclr/src/vm/ceeload.inl b/src/coreclr/src/vm/ceeload.inl index 2c48265..c961c1f 100644 --- a/src/coreclr/src/vm/ceeload.inl +++ b/src/coreclr/src/vm/ceeload.inl @@ -498,19 +498,6 @@ FORCEINLINE PTR_DomainLocalModule Module::GetDomainLocalModule(AppDomain *pDomai return pDomain->GetDomainLocalBlock()->GetModuleSlot(GetModuleIndex()); } -FORCEINLINE ULONG Module::GetNumberOfActivations() -{ - _ASSERTE(m_Crst.OwnedByCurrentThread()); - return m_dwNumberOfActivations; -} - -FORCEINLINE ULONG Module::IncrementNumberOfActivations() -{ - CrstHolder lock(&m_Crst); - return ++m_dwNumberOfActivations; -} - - #ifdef FEATURE_PREJIT #include "nibblestream.h" diff --git a/src/coreclr/src/vm/ceemain.cpp b/src/coreclr/src/vm/ceemain.cpp index 428e3cf..468a1da 100644 --- a/src/coreclr/src/vm/ceemain.cpp +++ b/src/coreclr/src/vm/ceemain.cpp @@ -1195,9 +1195,6 @@ void InnerCoEEShutDownCOM() while (i.Next()) i.GetDomain()->DeleteMarshalingData(); - // Release marshaling data in shared domain as well - SharedDomain::GetDomain()->DeleteMarshalingData(); - #ifdef FEATURE_APPX // Cleanup cached factory pointer in SynchronizationContextNative SynchronizationContextNative::Cleanup(); diff --git a/src/coreclr/src/vm/clsload.cpp b/src/coreclr/src/vm/clsload.cpp index 9c4afd5..91b9dd5 100644 --- a/src/coreclr/src/vm/clsload.cpp +++ b/src/coreclr/src/vm/clsload.cpp @@ -177,17 +177,9 @@ PTR_Module ClassLoader::ComputeLoaderModuleWorker( } else if (pFirstNonSystemSharedModule != NULL) { -#ifdef FEATURE_FULL_NGEN - // pFirstNonSystemSharedModule may be module of speculative generic instantiation. - // If we are domain neutral, we have to use constituent of the instantiation to store - // statics. We need to ensure that we can create DomainModule in all domains - // that this instantiations may get activated in. PZM is good approximation of such constituent. - pLoaderModule = Module::ComputePreferredZapModule(pDefinitionModule, classInst, methodInst); -#else // Use pFirstNonSystemSharedModule just so C ends up in module C - it // shouldn't actually matter at all though. pLoaderModule = pFirstNonSystemSharedModule; -#endif } else { @@ -1502,173 +1494,6 @@ TypeHandle ClassLoader::LookupTypeHandleForTypeKeyInner(TypeKey *pKey, BOOL fChe return TypeHandle(); } - -//--------------------------------------------------------------------------- -// ClassLoader::TryFindDynLinkZapType -// -// This is a major routine in the process of finding and using -// zapped generic instantiations (excluding those which were zapped into -// their PreferredZapModule). -// -// DynLinkZapItems are generic instantiations that may have been NGEN'd -// into more than one NGEN image (e.g. the code and TypeHandle for -// List may in principle be zapped into several client images - it is theoretically -// an NGEN policy decision about how often this done, though for now we -// have hard-baked a strategy). -// -// There are lots of potential problems with this kind of duplication -// and the way we get around nearly all of these is to make sure that -// we only use one at most one "unique" copy of each item -// at runtime. Thus we keep tables in the SharedDomain and the AppDomain indicating -// which unique items have been chosen. If an item is "loaded" by this technique -// then it will not be loaded by any other technique. -// -// Note generic instantiations may have the good fortune to be zapped -// into the "PreferredZapModule". If so we can eager bind to them and -// they will not be considered to be DynLinkZapItems. We always -// look in the PreferredZapModule first, and we do not add an entry to the -// DynLinkZapItems table for this case. -// -// Zap references to DynLinkZapItems are always via encoded fixups, except -// for a few intra-module references when one DynLinkZapItem is "TightlyBound" -// to another, e.g. an canonical DynLinkZap MethodTable may directly refer to -// its EEClass - this is because we know that if one is used at runtime then the -// other will also be. These items should be thought of as together constituting -// one DynLinkedZapItem. -// -// This function section searches for a copy of the instantiation in various NGEN images. -// This is effectively like doing a load since we are choosing which copy of the instantiation -// to use from among a number of potential candidates. We have to have the loading lock -// for this item before we can do this to make sure no other threads choose a -// different copy of the instantiation, and that no other threads are JIT-loading -// the instantiation. - - - -#ifndef DACCESS_COMPILE -#ifdef FEATURE_FULL_NGEN -/* static */ -TypeHandle ClassLoader::TryFindDynLinkZapType(TypeKey *pKey) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM()); - PRECONDITION(CheckPointer(pKey)); - PRECONDITION(pKey->IsConstructed()); - MODE_ANY; - } - CONTRACTL_END; - - // Never use dyn link zap items during ngen time. We will independently decide later - // whether we want to store the item into ngen image or not. - // Note that it is not good idea to make decisions based on the list of depencies here - // since their list may not be fully populated yet. - if (IsCompilationProcess()) - return TypeHandle(); - - TypeHandle th = TypeHandle(); - -#ifndef CROSSGEN_COMPILE - // We need to know which domain the item must live in (DomainNeutral or AppDomain) - // Note we can't use the domain from GetLoaderModule()->GetDomain() because at NGEN - // time this may not be accurate (we may be deliberately duplicating a domain-neutral - // instantiation into a domain-specific image, in the sense that the LoaderModule - // returned by ComputeLoaderModule may be the current module being - // NGEN'd).... - - BaseDomain * pRequiredDomain = BaseDomain::ComputeBaseDomain(pKey); - - // Next look in each ngen'ed image in turn - - // Searching the shared domain and the app domain are slightly different. - if (pRequiredDomain->IsSharedDomain()) - { - // This switch to cooperative mode makes the iteration below thread safe. It ensures that the underlying - // async HashMap storage is not going to disapper while we are iterating it. Other uses of SharedAssemblyIterator - // have same problem, but I have fixed just this one as targeted ask mode fix. - GCX_COOP(); - - // Searching for SharedDomain instantiation involves searching all shared assemblies.... - // Note we may choose to use an instantiation from an assembly that is from an NGEN - // image that is not logically speaking part of the currently running AppDomain. This - // tkaes advantage of the fact that at the moment SharedDomain NGEN images are never unloaded. - // Thus SharedDomain NGEN images effectively contribute all their instantiations to all - // AppDomains. - // - // This will have to change if we ever start unloading NGEN images from the SharedDomain - SharedDomain::SharedAssemblyIterator assem; - while (th.IsNull() && assem.Next()) - { - ModuleIterator i = assem.GetAssembly()->IterateModules(); - - while (i.Next()) - { - Module *pModule = i.GetModule(); - if (!pModule->HasNativeImage()) - continue; - - // If the module hasn't reached FILE_LOADED in some domain, it cannot provide candidate instantiations - if (!pModule->IsReadyForTypeLoad()) - continue; - - TypeHandle thFromZapModule = pModule->GetAvailableParamTypes()->GetValue(pKey); - - // Check that the item really is a zapped item, i.e. that it has not been JIT-loaded to the module - if (thFromZapModule.IsNull() || !thFromZapModule.IsZapped()) - continue; - - th = thFromZapModule; - } - } - } - else - { - // Searching for domain specific instantiation involves searching all - // domain-specific assemblies in the relevant AppDomain.... - - AppDomain * pDomain = pRequiredDomain->AsAppDomain(); - - AppDomain::AssemblyIterator assemblyIterator = pDomain->IterateAssembliesEx( - (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)); - CollectibleAssemblyHolder pDomainAssembly; - - while (th.IsNull() && assemblyIterator.Next(pDomainAssembly.This())) - { - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); - // Make sure the domain of the NGEN'd images associated with the assembly matches... - if (pAssembly->GetDomain() == pRequiredDomain) - { - DomainAssembly::ModuleIterator i = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while (th.IsNull() && i.Next()) - { - Module * pModule = i.GetLoadedModule(); - if (!pModule->HasNativeImage()) - continue; - - // If the module hasn't reached FILE_LOADED in some domain, it cannot provide candidate instantiations - if (!pModule->IsReadyForTypeLoad()) - continue; - - TypeHandle thFromZapModule = pModule->GetAvailableParamTypes()->GetValue(pKey); - - // Check that the item really is a zapped item - if (thFromZapModule.IsNull() || !thFromZapModule.IsZapped()) - continue; - - th = thFromZapModule; - } - } - } - } -#endif // CROSSGEN_COMPILE - - return th; -} -#endif // FEATURE_FULL_NGEN -#endif // !DACCESS_COMPILE - // FindClassModuleThrowing discovers which module the type you're looking for is in and loads the Module if necessary. // Basically, it iterates through all of the assembly's modules until a name match is found in a module's // AvailableClassHashTable. @@ -3583,48 +3408,22 @@ TypeHandle ClassLoader::CreateTypeHandleForTypeKey(TypeKey* pKey, AllocMemTracke } else if (pKey->HasInstantiation()) { -#ifdef FEATURE_FULL_NGEN - // Try to find the type in an NGEN'd image. - typeHnd = TryFindDynLinkZapType(pKey); - - if (!typeHnd.IsNull()) + if (IsCanonicalGenericInstantiation(pKey->GetInstantiation())) { -#ifdef _DEBUG - if (LoggingOn(LF_CLASSLOADER, LL_INFO10000)) - { - SString name; - TypeString::AppendTypeKeyDebug(name, pKey); - LOG((LF_CLASSLOADER, LL_INFO10000, "GENERICS:CreateTypeHandleForTypeKey: found dyn-link ngen type %S with pointer %p in module %S\n", name.GetUnicode(), typeHnd.AsPtr(), - typeHnd.GetLoaderModule()->GetDebugName())); - } -#endif - if (typeHnd.GetLoadLevel() == CLASS_LOAD_UNRESTOREDTYPEKEY) - { - OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(CLASS_LOADED); - - typeHnd.DoRestoreTypeKey(); - } + typeHnd = CreateTypeHandleForTypeDefThrowing(pKey->GetModule(), + pKey->GetTypeToken(), + pKey->GetInstantiation(), + pamTracker); } else -#endif // FEATURE_FULL_NGEN { - if (IsCanonicalGenericInstantiation(pKey->GetInstantiation())) - { - typeHnd = CreateTypeHandleForTypeDefThrowing(pKey->GetModule(), - pKey->GetTypeToken(), - pKey->GetInstantiation(), - pamTracker); - } - else - { - typeHnd = CreateTypeHandleForNonCanonicalGenericInstantiation(pKey, - pamTracker); - } + typeHnd = CreateTypeHandleForNonCanonicalGenericInstantiation(pKey, + pamTracker); + } #if defined(_DEBUG) && !defined(CROSSGEN_COMPILE) - if (Nullable::IsNullableType(typeHnd)) - Nullable::CheckFieldOffsets(typeHnd); + if (Nullable::IsNullableType(typeHnd)) + Nullable::CheckFieldOffsets(typeHnd); #endif - } } else if (pKey->GetKind() == ELEMENT_TYPE_FNPTR) { @@ -4804,29 +4603,7 @@ static MethodTable* GetEnclosingMethodTable(MethodTable *pMT) } CONTRACT_END; - MethodTable *pmtEnclosing = NULL; - - // In the common case, the method table will be either shared or in the AppDomain we're currently - // running in. If this is true, we can just access its enclosing method table directly. - // - // However, if the current method table is actually in another AppDomain (for instance, we're reflecting - // across AppDomains), then we cannot get its enclsoing type in our AppDomain since doing that may involve - // loading the enclosing type. Instead, we need to transition back to the original domain (which we - // should already be running in higher up on the stack) and get the method table we're looking for. - - if (pMT->GetDomain()->IsSharedDomain() || pMT->GetDomain()->AsAppDomain() == GetAppDomain()) - { - pmtEnclosing = pMT->LoadEnclosingMethodTable(); - } - else - { - GCX_COOP(); - ENTER_DOMAIN_PTR(pMT->GetDomain()->AsAppDomain(), ADV_RUNNINGIN); - pmtEnclosing = pMT->LoadEnclosingMethodTable(); - END_DOMAIN_TRANSITION; - } - - RETURN pmtEnclosing; + RETURN pMT->LoadEnclosingMethodTable(); } StaticAccessCheckContext::StaticAccessCheckContext(MethodDesc* pCallerMethod) diff --git a/src/coreclr/src/vm/clsload.hpp b/src/coreclr/src/vm/clsload.hpp index 9689979..a0debb2 100644 --- a/src/coreclr/src/vm/clsload.hpp +++ b/src/coreclr/src/vm/clsload.hpp @@ -1008,9 +1008,6 @@ private: static void LoadExactParentAndInterfacesTransitively(MethodTable *pMT); - - static TypeHandle TryFindDynLinkZapType(TypeKey* pKey); - // Create a non-canonical instantiation of a generic type based off the canonical instantiation // (For example, MethodTable for List is based on the MethodTable for List<__Canon>) static TypeHandle CreateTypeHandleForNonCanonicalGenericInstantiation(TypeKey *pTypeKey, diff --git a/src/coreclr/src/vm/codeman.cpp b/src/coreclr/src/vm/codeman.cpp index 815507f..57d58d8 100644 --- a/src/coreclr/src/vm/codeman.cpp +++ b/src/coreclr/src/vm/codeman.cpp @@ -449,7 +449,7 @@ extern CrstStatic g_StubUnwindInfoHeapSegmentsCrst; STANDARD_VM_CONTRACT; { // CodeHeapIterator holds the m_CodeHeapCritSec, which insures code heaps don't get deallocated while being walked - EEJitManager::CodeHeapIterator heapIterator(NULL, NULL); + EEJitManager::CodeHeapIterator heapIterator(NULL); // Currently m_CodeHeapCritSec is given the CRST_UNSAFE_ANYMODE flag which allows it to be taken in a GC_NOTRIGGER // region but also disallows GC_TRIGGERS. We need GC_TRIGGERS because we take another lock. Ideally we would @@ -571,7 +571,7 @@ DeleteJitHeapCache #if !defined(DACCESS_COMPILE) -EEJitManager::CodeHeapIterator::CodeHeapIterator(BaseDomain *pDomainFilter, LoaderAllocator *pLoaderAllocatorFilter) +EEJitManager::CodeHeapIterator::CodeHeapIterator(LoaderAllocator *pLoaderAllocatorFilter) : m_lockHolder(&(ExecutionManager::GetEEJitManager()->m_CodeHeapCritSec)), m_Iterator(NULL, 0, NULL, 0) { CONTRACTL @@ -583,7 +583,6 @@ EEJitManager::CodeHeapIterator::CodeHeapIterator(BaseDomain *pDomainFilter, Load CONTRACTL_END; m_pHeapList = NULL; - m_pDomain = pDomainFilter; m_pLoaderAllocator = pLoaderAllocatorFilter; m_pHeapList = ExecutionManager::GetEEJitManager()->GetCodeHeapList(); if(m_pHeapList) @@ -628,12 +627,6 @@ BOOL EEJitManager::CodeHeapIterator::Next() BYTE * code = m_Iterator.GetMethodCode(); CodeHeader * pHdr = (CodeHeader *)(code - sizeof(CodeHeader)); m_pCurrent = !pHdr->IsStubCodeBlock() ? pHdr->GetMethodDesc() : NULL; - if (m_pDomain && m_pCurrent) - { - BaseDomain *pCurrentBaseDomain = m_pCurrent->GetDomain(); - if(pCurrentBaseDomain != m_pDomain) - continue; - } // LoaderAllocator filter if (m_pLoaderAllocator && m_pCurrent) diff --git a/src/coreclr/src/vm/codeman.h b/src/coreclr/src/vm/codeman.h index ebf92e4..13c7543 100644 --- a/src/coreclr/src/vm/codeman.h +++ b/src/coreclr/src/vm/codeman.h @@ -1121,12 +1121,11 @@ public: CrstHolder m_lockHolder; HeapList *m_pHeapList; LoaderAllocator *m_pLoaderAllocator; - BaseDomain *m_pDomain; MethodSectionIterator m_Iterator; MethodDesc *m_pCurrent; public: - CodeHeapIterator(BaseDomain *pDomainFilter = NULL, LoaderAllocator *pLoaderAllocatorFilter = NULL); + CodeHeapIterator(LoaderAllocator *pLoaderAllocatorFilter = NULL); ~CodeHeapIterator(); BOOL Next(); diff --git a/src/coreclr/src/vm/codeversion.cpp b/src/coreclr/src/vm/codeversion.cpp index 93b0663..a108bf7 100644 --- a/src/coreclr/src/vm/codeversion.cpp +++ b/src/coreclr/src/vm/codeversion.cpp @@ -1730,14 +1730,10 @@ CodeVersionManager::CodeVersionManager() //--------------------------------------------------------------------------------------- // // Called from BaseDomain::BaseDomain to do any constructor-time initialization. -// Presently, this takes care of initializing the Crst, choosing the type based on -// whether this ReJitManager belongs to the SharedDomain. +// Presently, this takes care of initializing the Crst. // -// Arguments: -// * fSharedDomain - nonzero iff this ReJitManager belongs to the SharedDomain. -// -void CodeVersionManager::PreInit(BOOL fSharedDomain) +void CodeVersionManager::PreInit() { CONTRACTL { @@ -1750,7 +1746,7 @@ void CodeVersionManager::PreInit(BOOL fSharedDomain) #ifndef DACCESS_COMPILE m_crstTable.Init( - fSharedDomain ? CrstReJITSharedDomainTable : CrstReJITDomainTable, + CrstReJITDomainTable, CrstFlags(CRST_UNSAFE_ANYMODE | CRST_DEBUGGER_THREAD | CRST_REENTRANCY | CRST_TAKEN_DURING_SHUTDOWN)); #endif // DACCESS_COMPILE } @@ -2437,19 +2433,12 @@ HRESULT CodeVersionManager::EnumerateDomainClosedMethodDescs( } #endif //_DEBUG - // If pAppDomainToSearch is NULL, iterate through all existing - // instantiations loaded into the SharedDomain. If pAppDomainToSearch is non-NULL, - // iterate through all existing instantiations in pAppDomainToSearch, and only consider - // instantiations in non-domain-neutral assemblies (as we already covered domain - // neutral assemblies when we searched the SharedDomain). - LoadedMethodDescIterator::AssemblyIterationMode mode = LoadedMethodDescIterator::kModeSharedDomainAssemblies; // these are the default flags which won't actually be used in shared mode other than // asserting they were specified with their default values AssemblyIterationFlags assemFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution); ModuleIterationOption moduleFlags = (ModuleIterationOption)kModIterIncludeLoaded; if (pAppDomainToSearch != NULL) { - mode = LoadedMethodDescIterator::kModeUnsharedADAssemblies; assemFlags = (AssemblyIterationFlags)(kIncludeAvailableToProfilers | kIncludeExecution); moduleFlags = (ModuleIterationOption)kModIterIncludeAvailableToProfilers; } @@ -2457,7 +2446,6 @@ HRESULT CodeVersionManager::EnumerateDomainClosedMethodDescs( pAppDomainToSearch, pModuleContainingMethodDef, methodDef, - mode, assemFlags, moduleFlags); CollectibleAssemblyHolder pDomainAssembly; diff --git a/src/coreclr/src/vm/codeversion.h b/src/coreclr/src/vm/codeversion.h index 39b03f0..1762793 100644 --- a/src/coreclr/src/vm/codeversion.h +++ b/src/coreclr/src/vm/codeversion.h @@ -565,7 +565,7 @@ class CodeVersionManager public: CodeVersionManager(); - void PreInit(BOOL fSharedDomain); + void PreInit(); class TableLockHolder : public CrstHolder { diff --git a/src/coreclr/src/vm/corhost.cpp b/src/coreclr/src/vm/corhost.cpp index 7294f38..6519616 100644 --- a/src/coreclr/src/vm/corhost.cpp +++ b/src/coreclr/src/vm/corhost.cpp @@ -711,9 +711,7 @@ HRESULT CorHost2::_CreateAppDomain( BEGIN_EXTERNAL_ENTRYPOINT(&hr); GCX_COOP_THREAD_EXISTS(GET_THREAD()); - AppDomainCreationHolder pDomain; - - pDomain.Assign(SystemDomain::System()->DefaultDomain()); + AppDomain* pDomain = SystemDomain::System()->DefaultDomain(); ETW::LoaderLog::DomainLoad(pDomain, (LPWSTR)wszFriendlyName); @@ -722,9 +720,6 @@ HRESULT CorHost2::_CreateAppDomain( pDomain->SetIgnoreUnhandledExceptions(); } - if (dwFlags & APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE) - pDomain->SetReversePInvokeCannotEnter(); - if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS) pDomain->SetForceTrivialWaitOperations(); @@ -774,8 +769,6 @@ HRESULT CorHost2::_CreateAppDomain( m_fAppDomainCreated = TRUE; } - // DoneCreating releases ownership of AppDomain. After this call, there should be no access to pDomain. - pDomain.DoneCreating(); END_EXTERNAL_ENTRYPOINT; diff --git a/src/coreclr/src/vm/domainfile.cpp b/src/coreclr/src/vm/domainfile.cpp index 8f19137..664d10e 100644 --- a/src/coreclr/src/vm/domainfile.cpp +++ b/src/coreclr/src/vm/domainfile.cpp @@ -1208,215 +1208,30 @@ void DomainFile::Activate() // Now activate any dependencies. // This will typically cause reentrancy of course. - if (!IsSingleAppDomain()) - { - // increment the counter (see the comment in Module::AddActiveDependency) - GetModule()->IncrementNumberOfActivations(); - -#ifdef FEATURE_LOADER_OPTIMIZATION - AppDomain *pDomain = this->GetAppDomain(); - Module::DependencyIterator i = GetCurrentModule()->IterateActiveDependencies(); - STRESS_LOG2(LF_LOADER, LL_INFO100,"Activating module %p in AD %i",GetCurrentModule(),pDomain->GetId().m_dwId); - - while (i.Next()) - { - Module *pModule = i.GetDependency(); - DomainFile *pDomainFile = pModule->FindDomainFile(pDomain); - if (pDomainFile == NULL) - pDomainFile = pDomain->LoadDomainNeutralModuleDependency(pModule, FILE_LOADED); - - STRESS_LOG3(LF_LOADER, LL_INFO100,"Activating dependency %p -> %p, unconditional=%i",GetCurrentModule(),pModule,i.IsUnconditional()); - - if (i.IsUnconditional()) - { - // Let any failures propagate - pDomainFile->EnsureActive(); - } - else - { - // Enable triggers if we fail here - if (!pDomainFile->TryEnsureActive()) - GetCurrentModule()->EnableModuleFailureTriggers(pModule, this->GetAppDomain()); - } - STRESS_LOG3(LF_LOADER, LL_INFO100,"Activated dependency %p -> %p, unconditional=%i",GetCurrentModule(),pModule,i.IsUnconditional()); - } -#endif - } - #ifndef CROSSGEN_COMPILE - if (m_pModule->CanExecuteCode()) - { - // - // Now call the module constructor. Note that this might cause reentrancy; - // this is fine and will be handled by the class cctor mechanism. - // - MethodTable *pMT = m_pModule->GetGlobalMethodTable(); - if (pMT != NULL) - { - pMT->CheckRestore(); - m_bDisableActivationCheck=TRUE; - pMT->CheckRunClassInitThrowing(); - } -#ifdef _DEBUG - if (g_pConfig->ExpandModulesOnLoad()) - { - m_pModule->ExpandAll(); - } -#endif //_DEBUG - } - else - { - // This exception does not need to be localized as it can only happen in - // NGen and PEVerify, and we are not localizing those tools. - _ASSERTE(this->GetAppDomain()->IsPassiveDomain()); - // This assert will fire if we attempt to run non-mscorlib code from within ngen - // Current audits of the system indicate that this will never occur, but if it does - // the exception below will prevent actual non-mscorlib code execution. - _ASSERTE(!this->GetAppDomain()->IsCompilationDomain()); - - LPCWSTR message = W("You may be trying to evaluate a permission from an assembly ") - W("without FullTrust, or which cannot execute code for other reasons."); - COMPlusThrowNonLocalized(kFileLoadException, message); - } -#endif // CROSSGEN_COMPILE - - RETURN; -} - -#ifdef FEATURE_LOADER_OPTIMIZATION -BOOL DomainFile::PropagateActivationInAppDomain(Module *pModuleFrom, Module *pModuleTo, AppDomain* pDomain) -{ - CONTRACTL - { - PRECONDITION(CheckPointer(pModuleFrom)); - PRECONDITION(CheckPointer(pModuleTo)); - THROWS; // should only throw transient failures - DISABLED(GC_TRIGGERS); - MODE_ANY; - } - CONTRACTL_END; - -#ifdef FEATURE_MULTICOREJIT - // Reset the flag to allow managed code to be called in multicore JIT background thread from this routine - ThreadStateNCStackHolder holder(-1, Thread::TSNC_CallingManagedCodeDisabled); -#endif - - BOOL completed=true; - EX_TRY - { - GCX_COOP(); - - ENTER_DOMAIN_PTR(pDomain,ADV_ITERATOR); //iterator - DomainFile *pDomainFileFrom = pModuleFrom->FindDomainFile(pDomain); - if (pDomainFileFrom != NULL && pDomain->IsLoading(pDomainFileFrom, FILE_ACTIVE)) - { - STRESS_LOG3(LF_LOADER, LL_INFO100,"Found DomainFile %p for module %p in AppDomain %i\n",pDomainFileFrom,pModuleFrom,pDomain->GetId().m_dwId); - DomainFile *pDomainFileTo = pModuleTo->FindDomainFile(pDomain); - if (pDomainFileTo == NULL) - pDomainFileTo = pDomain->LoadDomainNeutralModuleDependency(pModuleTo, FILE_LOADED); - - if (!pDomainFileTo->TryEnsureActive()) - pModuleFrom->EnableModuleFailureTriggers(pModuleTo, pDomain); - else if (!pDomainFileTo->IsActive()) - { - // We are in a reentrant case - completed = FALSE; - } - } - END_DOMAIN_TRANSITION; - } - EX_CATCH - { - if (!IsExceptionOfType(kAppDomainUnloadedException, GET_EXCEPTION())) - EX_RETHROW; - } - EX_END_CATCH(SwallowAllExceptions) - return completed; -} -#endif + // + // Now call the module constructor. Note that this might cause reentrancy; + // this is fine and will be handled by the class cctor mechanism. + // -// Returns TRUE if activation is completed for all app domains -// static -BOOL DomainFile::PropagateNewActivation(Module *pModuleFrom, Module *pModuleTo) -{ - CONTRACTL + MethodTable *pMT = m_pModule->GetGlobalMethodTable(); + if (pMT != NULL) { - PRECONDITION(CheckPointer(pModuleFrom)); - PRECONDITION(CheckPointer(pModuleTo)); - THROWS; // should only throw transient failures - GC_TRIGGERS; - MODE_ANY; + pMT->CheckRestore(); + m_bDisableActivationCheck=TRUE; + pMT->CheckRunClassInitThrowing(); } - CONTRACTL_END; - - BOOL completed = TRUE; -#ifdef FEATURE_LOADER_OPTIMIZATION - if (pModuleFrom->GetAssembly()->IsDomainNeutral()) - { - AppDomainIterator ai(TRUE); - Thread *pThread = GetThread(); - - while (ai.Next()) - { - STRESS_LOG3(LF_LOADER, LL_INFO100,"Attempting to propagate domain-neutral conditional module dependency %p -> %p to AppDomain %i\n",pModuleFrom,pModuleTo,ai.GetDomain()->GetId().m_dwId); - completed &= PropagateActivationInAppDomain(pModuleFrom,pModuleTo,ai.GetDomain()); - } - } - else -#endif - { - AppDomain *pDomain = pModuleFrom->GetDomain()->AsAppDomain(); - DomainFile *pDomainFileFrom = pModuleFrom->GetDomainFile(pDomain); - if (pDomain->IsLoading(pDomainFileFrom, FILE_ACTIVE)) - { - // The dependency should already be loaded - DomainFile *pDomainFileTo = pModuleTo->GetDomainFile(pDomain); - if (!pDomainFileTo->TryEnsureActive()) - pModuleFrom->EnableModuleFailureTriggers(pModuleTo, pDomain); - else if (!pDomainFileTo->IsActive()) - { - // Reentrant case - completed = FALSE; - } - } - } - - return completed; -} - -// Checks that module has not been activated in any domain -CHECK DomainFile::CheckUnactivatedInAllDomains(Module *pModule) -{ - CONTRACTL +#ifdef _DEBUG + if (g_pConfig->ExpandModulesOnLoad()) { - PRECONDITION(CheckPointer(pModule)); - THROWS; - GC_TRIGGERS; - MODE_ANY; + m_pModule->ExpandAll(); } - CONTRACTL_END; - - if (pModule->GetAssembly()->IsDomainNeutral()) - { - AppDomainIterator ai(TRUE); +#endif //_DEBUG - while (ai.Next()) - { - AppDomain *pDomain = ai.GetDomain(); - DomainFile *pDomainFile = pModule->FindDomainFile(pDomain); - if (pDomainFile != NULL) - CHECK(!pDomainFile->IsActive()); - } - } - else - { - DomainFile *pDomainFile = pModule->FindDomainFile(pModule->GetDomain()->AsAppDomain()); - if (pDomainFile != NULL) - CHECK(!pDomainFile->IsActive()); - } +#endif // CROSSGEN_COMPILE - CHECK_OK; + RETURN; } #ifdef FEATURE_PREJIT @@ -1448,7 +1263,6 @@ DomainAssembly::DomainAssembly(AppDomain *pDomain, PEFile *pFile, LoaderAllocato : DomainFile(pDomain, pFile), m_pAssembly(NULL), m_debuggerFlags(DACF_NONE), - m_MissingDependenciesCheckStatus(CMD_Unknown), m_fDebuggerUnloadStarted(FALSE), m_fCollectible(pLoaderAllocator->IsCollectible()), m_fHostAssemblyPublished(false), @@ -1628,23 +1442,6 @@ OBJECTREF DomainAssembly::GetExposedAssemblyObject() } // DomainAssembly::GetExposedAssemblyObject #endif // CROSSGEN_COMPILE -#ifdef FEATURE_LOADER_OPTIMIZATION - - -BOOL DomainAssembly::MissingDependenciesCheckDone() -{ - return m_MissingDependenciesCheckStatus != CMD_Unknown; -} - -CMD_State DomainAssembly::CheckMissingDependencies() -{ - //CoreCLR simply doesn't share if dependencies are missing - return CMD_NotNeeded; -} - -#endif // FEATURE_LOADER_OPTIMIZATION - - DomainFile* DomainAssembly::FindIJWModule(HMODULE hMod) { CONTRACT (DomainFile*) @@ -1736,31 +1533,7 @@ void DomainAssembly::FindNativeImage() ReleaseHolder pNativeImage = GetFile()->GetNativeImageWithRef(); - if(!IsSystem() && !SystemDomain::System()->SystemFile()->HasNativeImage()) - { - m_dwReasonForRejectingNativeImage = ReasonForRejectingNativeImage_MscorlibNotNative; - STRESS_LOG2(LF_ZAP,LL_INFO100,"Rejecting native file %p, because mscolib has not NI - reason 0x%x\n",pNativeImage.GetValue(),m_dwReasonForRejectingNativeImage); - ExternalLog(LL_ERROR, "Rejecting native image because mscorlib does not have native image"); - GetFile()->ClearNativeImage(); - - // Always throw exceptions when we throw the NI out - ThrowHR(CLR_E_BIND_SYS_ASM_NI_MISSING); - } - else - if (!CheckZapSecurity(pNativeImage)) - { - m_dwReasonForRejectingNativeImage = ReasonForRejectingNativeImage_FailedSecurityCheck; - STRESS_LOG2(LF_ZAP,LL_INFO100,"Rejecting native file %p, because security check failed - reason 0x%x\n",pNativeImage.GetValue(),m_dwReasonForRejectingNativeImage); - ExternalLog(LL_ERROR, "Rejecting native image because it failed the security check. " - "The assembly's permissions must have changed since the time it was ngenned, " - "or it is running with a different security context."); - - GetFile()->ClearNativeImage(); - - // Always throw exceptions when we throw the NI out - ThrowHR(CLR_E_BIND_NI_SECURITY_FAILURE); - } - else if (!CheckZapDependencyIdentities(pNativeImage)) + if (!CheckZapDependencyIdentities(pNativeImage)) { m_dwReasonForRejectingNativeImage = ReasonForRejectingNativeImage_DependencyIdentityMismatch; STRESS_LOG2(LF_ZAP,LL_INFO100,"Rejecting native file %p, because dependency identity mismatch - reason 0x%x\n",pNativeImage.GetValue(),m_dwReasonForRejectingNativeImage); @@ -1775,30 +1548,13 @@ void DomainAssembly::FindNativeImage() } else { - // We can only use a native image for a single Module. If this is a domain-bound - // load, we know that this means only a single load will use this image, so we can just - // flag it as in use. - - // If on the other hand, we are going to be domain neutral, we may have many loads use - // the same native image. Still, we only want to allow the native image to be used - // by loads which are going to end up with the same Module. So, we have to effectively - // eagerly compute whether that will be the case eagerly, now. To enable this computation, - // we store the binding closure in the image. - Module * pNativeModule = pNativeImage->GetLoadedLayout()->GetPersistedModuleImage(); EnsureWritablePages(pNativeModule); PEFile ** ppNativeFile = (PEFile **) (PBYTE(pNativeModule) + Module::GetFileOffset()); - GetFile()->SetNativeImageUsedExclusively(); PEAssembly * pFile = (PEAssembly *)FastInterlockCompareExchangePointer((void **)ppNativeFile, (void *)GetFile(), (void *)NULL); STRESS_LOG3(LF_ZAP,LL_INFO100,"Attempted to set new native file %p, old file was %p, location in the image=%p\n",GetFile(),pFile,ppNativeFile); - if (pFile!=NULL && !IsSystem() && - - ( pFile == PEFile::Dummy() || - pFile->IsNativeImageUsedExclusively() || - !(GetFile()->GetPath().Equals(pFile->GetPath()))) - - ) + if (pFile!=NULL) { // The non-shareable native image has already been used in this process by another Module. // We have to abandon the native image. (Note that it isn't enough to @@ -1823,9 +1579,7 @@ void DomainAssembly::FindNativeImage() } else { - //If we are the first and others can reuse us, we cannot go away - if ((pFile == NULL) && (!GetFile()->IsNativeImageUsedExclusively())) - GetFile()->AddRef(); + GetFile()->AddRef(); LOG((LF_ZAP, LL_INFO100, "ZAP: Found a candidate native image for %s\n", GetSimpleName())); } @@ -2301,18 +2055,6 @@ BOOL DomainAssembly::CheckZapDependencyIdentities(PEImage *pNativeImage) return TRUE; } - -BOOL DomainAssembly::CheckZapSecurity(PEImage *pNativeImage) -{ - CONTRACTL - { - INSTANCE_CHECK; - STANDARD_VM_CHECK; - } - CONTRACTL_END; - - return TRUE; -} #endif // FEATURE_PREJIT diff --git a/src/coreclr/src/vm/domainfile.h b/src/coreclr/src/vm/domainfile.h index 9673c65..2329540 100644 --- a/src/coreclr/src/vm/domainfile.h +++ b/src/coreclr/src/vm/domainfile.h @@ -318,14 +318,6 @@ class DomainFile void Activate(); #endif - // This is called when a new active dependency is added. - static BOOL PropagateNewActivation(Module *pModuleFrom, Module *pModuleTo); -#ifdef FEATURE_LOADER_OPTIMIZATION - static BOOL PropagateActivationInAppDomain(Module *pModuleFrom, Module *pModuleTo, AppDomain* pDomain); -#endif - // This can be used to verify that no propagation is needed - static CHECK CheckUnactivatedInAllDomains(Module *pModule); - // This should be used to permanently set the load to fail. Do not use with transient conditions void SetError(Exception *ex); @@ -485,15 +477,6 @@ enum ModuleIterationOption kModIterIncludeAvailableToProfilers = 3, }; - -enum CMD_State -{ - CMD_Unknown, - CMD_NotNeeded, - CMD_IndeedMissing, - CMD_Resolved -}; - // -------------------------------------------------------------------------------- // DomainAssembly is a subclass of DomainFile which specifically represents a assembly. // -------------------------------------------------------------------------------- @@ -519,13 +502,6 @@ public: return m_pLoaderAllocator; } -#ifdef FEATURE_LOADER_OPTIMIZATION - -public: - CMD_State CheckMissingDependencies(); - BOOL MissingDependenciesCheckDone(); -#endif // FEATURE_LOADER_OPTIMIZATION - #ifndef DACCESS_COMPILE void ReleaseFiles(); #endif // DACCESS_COMPILE @@ -677,9 +653,6 @@ public: void GetOptimizedIdentitySignature(CORCOMPILE_ASSEMBLY_SIGNATURE *pSignature); BOOL CheckZapDependencyIdentities(PEImage *pNativeImage); - BOOL CheckZapSecurity(PEImage *pNativeImage); - - BOOL CheckFileSystemTimeStamps(PEFile *pZapManifest); #endif // FEATURE_PREJIT @@ -769,7 +742,6 @@ private: LOADERHANDLE m_hExposedAssemblyObject; PTR_Assembly m_pAssembly; DebuggerAssemblyControlFlags m_debuggerFlags; - CMD_State m_MissingDependenciesCheckStatus; ArrayList m_Modules; BOOL m_fDebuggerUnloadStarted; BOOL m_fCollectible; diff --git a/src/coreclr/src/vm/eventtrace.cpp b/src/coreclr/src/vm/eventtrace.cpp index 7528322..7a45cb1 100644 --- a/src/coreclr/src/vm/eventtrace.cpp +++ b/src/coreclr/src/vm/eventtrace.cpp @@ -5633,32 +5633,19 @@ VOID ETW::LoaderLog::SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptio return; PCWSTR szDtraceOutput1=W(""); - BOOL bIsDefaultDomain = pBaseDomain->IsDefaultDomain(); BOOL bIsAppDomain = pBaseDomain->IsAppDomain(); - BOOL bIsExecutable = bIsAppDomain ? !(pBaseDomain->AsAppDomain()->IsPassiveDomain()) : FALSE; - BOOL bIsSharedDomain = pBaseDomain->IsSharedDomain(); - UINT32 uSharingPolicy = 0; ULONGLONG ullDomainId = (ULONGLONG)pBaseDomain; - ULONG ulDomainFlags = ((bIsDefaultDomain ? ETW::LoaderLog::LoaderStructs::DefaultDomain : 0) | - (bIsExecutable ? ETW::LoaderLog::LoaderStructs::ExecutableDomain : 0) | - (bIsSharedDomain ? ETW::LoaderLog::LoaderStructs::SharedDomain : 0) | - (uSharingPolicy<<28)); + ULONG ulDomainFlags = ETW::LoaderLog::LoaderStructs::DefaultDomain | ETW::LoaderLog::LoaderStructs::ExecutableDomain; LPCWSTR wsEmptyString = W(""); - LPCWSTR wsSharedString = W("SharedDomain"); LPWSTR lpswzDomainName = (LPWSTR)wsEmptyString; - if(bIsAppDomain) - { - if(wszFriendlyName) - lpswzDomainName = (PWCHAR)wszFriendlyName; - else - lpswzDomainName = (PWCHAR)pBaseDomain->AsAppDomain()->GetFriendlyName(); - } + if(wszFriendlyName) + lpswzDomainName = (PWCHAR)wszFriendlyName; else - lpswzDomainName = (LPWSTR)wsSharedString; + lpswzDomainName = (PWCHAR)pBaseDomain->AsAppDomain()->GetFriendlyName(); /* prepare events args for ETW and ETM */ szDtraceOutput1 = (PCWSTR)lpswzDomainName; @@ -6810,7 +6797,7 @@ VOID ETW::MethodLog::SendEventsForJitMethodsHelper(BaseDomain *pDomainFilter, GC_NOTRIGGER; } CONTRACTL_END; - EEJitManager::CodeHeapIterator heapIterator(pDomainFilter, pLoaderAllocatorFilter); + EEJitManager::CodeHeapIterator heapIterator(pLoaderAllocatorFilter); while (heapIterator.Next()) { MethodDesc * pMD = heapIterator.GetMethod(); @@ -6953,7 +6940,6 @@ VOID ETW::MethodLog::SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAl // We only support getting rejit IDs when filtering by domain. if (pDomainFilter) { - CodeVersionManager::TableLockHolder lkRejitMgrSharedDomain(SharedDomain::GetDomain()->GetCodeVersionManager()); CodeVersionManager::TableLockHolder lkRejitMgrModule(pDomainFilter->GetCodeVersionManager()); SendEventsForJitMethodsHelper(pDomainFilter, pLoaderAllocatorFilter, @@ -7049,63 +7035,35 @@ VOID ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp { ETW::MethodLog::SendEventsForJitMethods(pDomain, NULL, enumerationOptions); } - - if (pDomain->IsAppDomain()) + + AppDomain::AssemblyIterator assemblyIterator = pDomain->AsAppDomain()->IterateAssembliesEx( + (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)); + CollectibleAssemblyHolder pDomainAssembly; + while (assemblyIterator.Next(pDomainAssembly.This())) { - AppDomain::AssemblyIterator assemblyIterator = pDomain->AsAppDomain()->IterateAssembliesEx( - (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)); - CollectibleAssemblyHolder pDomainAssembly; - while (assemblyIterator.Next(pDomainAssembly.This())) + CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); + BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); + if (bIsDomainNeutral) + continue; + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); - BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); - if (bIsDomainNeutral) - continue; - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } - - DomainModuleIterator domainModuleIterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while (domainModuleIterator.Next()) - { - Module * pModule = domainModuleIterator.GetModule(); - ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); - } - - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } + ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); } - } - else - { - SharedDomain::SharedAssemblyIterator sharedDomainIterator; - while (sharedDomainIterator.Next()) + + DomainModuleIterator domainModuleIterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); + while (domainModuleIterator.Next()) { - Assembly * pAssembly = sharedDomainIterator.GetAssembly(); - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } - - ModuleIterator domainModuleIterator = pAssembly->IterateModules(); - while (domainModuleIterator.Next()) - { - Module * pModule = domainModuleIterator.GetModule(); - ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); - } + Module * pModule = domainModuleIterator.GetModule(); + ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); + } - if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } + if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) + { + ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); } } - + // DC Start or Load Jit Method events if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoadOrDCStartAny) { @@ -7353,10 +7311,8 @@ VOID ETW::EnumerationLog::EnumerationHelper(Module *moduleFilter, BaseDomain *do ETW::EnumerationLog::IterateAppDomain(pDomain, enumerationOptions); } } - - ETW::EnumerationLog::IterateDomain(SharedDomain::GetDomain(), enumerationOptions); - } - } + } + } } #endif // !FEATURE_REDHAWK diff --git a/src/coreclr/src/vm/genmeth.cpp b/src/coreclr/src/vm/genmeth.cpp index f142fb4..8f282fa 100644 --- a/src/coreclr/src/vm/genmeth.cpp +++ b/src/coreclr/src/vm/genmeth.cpp @@ -356,72 +356,6 @@ InstantiatedMethodDesc::NewInstantiatedMethodDesc(MethodTable *pExactMT, // Crst goes out of scope here // We don't need to hold the crst while we build the MethodDesc, but we reacquire it later } - -#ifdef FEATURE_PREJIT - // This section is the search for an instantiation in the various NGEN images - // where we may have precompiled the instantiation. - // Never use dyn link zap items during ngen time. We will independently decide later - // whether we want to store the item into ngen image or not. - if ((pNewMD == NULL) && !IsCompilationProcess()) - { - // We need to know which domain the item must live in (DomainNeutral or AppDomain) - // We can't use pDomain because at NGEN - // time this may not be accurate - this must be cleaned up as part of getting - // rid of GetLoaderModule() altogether.... - BaseDomain * pRequiredDomain = BaseDomain::ComputeBaseDomain( - pExactMT->GetDomain(), - pExactMT->GetInstantiation(), - methodInst); - - // Next look in each ngen'ed image in turn - AppDomain::AssemblyIterator assemblyIterator = GetAppDomain()->IterateAssembliesEx((AssemblyIterationFlags)( - kIncludeLoaded | kIncludeExecution)); - CollectibleAssemblyHolder pDomainAssembly; - while ((pNewMD == NULL) && assemblyIterator.Next(pDomainAssembly.This())) - { - // Make sure the domain of the NGEN'd images associated with the assembly matches... - // No need to check this when NGEN'ing - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); - if (GetAppDomain()->IsCompilationDomain() || (pAssembly->GetDomain() == pRequiredDomain)) - { - DomainAssembly::ModuleIterator i = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while ((pNewMD == NULL) && i.Next()) - { - Module * pModule = i.GetLoadedModule(); - if (!pModule->HasNativeImage()) - continue; - _ASSERTE(!pModule->IsCollectible()); - - // We don't need to track references to normal (non-collectible) assemblies - pNewMD = (InstantiatedMethodDesc *)pModule->GetInstMethodHashTable()->FindMethodDesc( - TypeHandle(pExactMT), - pGenericMDescInRepMT->GetMemberDef(), - FALSE /* not forceBoxedEntryPoint */, - methodInst, - getWrappedCode); - if (pNewMD == NULL) - continue; -#ifdef _DEBUG -#ifndef DACCESS_COMPILE - if (LoggingOn(LF_CLASSLOADER, LL_INFO10000)) - { - StackSString methodName; - pNewMD->CheckRestore(); - TypeString::AppendMethodDebug(methodName, pNewMD); - LOG((LF_CLASSLOADER, LL_INFO10000, "Found method %S in non-preferred zap module %S\n", methodName.GetUnicode(), pModule->GetPath().GetUnicode())); - } -#endif //!DACCESS_COMPILE -#endif //_DEBUG - } - } - else - { - LOG((LF_CLASSLOADER, LL_INFO10000, "Skipping assembly %S due to domain mismatch when searching for prejitted instantiation\n", - pAssembly->GetDebugName())); - } - } - } -#endif // FEATURE_PREJIT if (pNewMD != NULL) { diff --git a/src/coreclr/src/vm/ilstubresolver.cpp b/src/coreclr/src/vm/ilstubresolver.cpp index 913c767..5b2f8a4 100644 --- a/src/coreclr/src/vm/ilstubresolver.cpp +++ b/src/coreclr/src/vm/ilstubresolver.cpp @@ -56,14 +56,7 @@ LPCUTF8 ILStubResolver::GetStubClassName(MethodDesc* pMD) } CONTRACTL_END; - if (pMD->GetDomain()->IsSharedDomain()) - { - return "DomainNeutralILStubClass"; - } - else - { - return "DomainBoundILStubClass"; - } + return "ILStubClass"; } LPCUTF8 ILStubResolver::GetStubMethodName() diff --git a/src/coreclr/src/vm/invokeutil.cpp b/src/coreclr/src/vm/invokeutil.cpp index c5295c9..d09d875 100644 --- a/src/coreclr/src/vm/invokeutil.cpp +++ b/src/coreclr/src/vm/invokeutil.cpp @@ -970,10 +970,9 @@ void InvokeUtil::SetValidField(CorElementType fldType, else { pDeclMT->EnsureInstanceActive(); - pDeclMT->CheckRunClassInitThrowing(); + pDeclMT->CheckRunClassInitThrowing(); - if (declaringType.IsDomainNeutral() == FALSE) - *pDomainInitialized = TRUE; + *pDomainInitialized = TRUE; } } EX_CATCH_THROWABLE(&Throwable); @@ -1181,8 +1180,7 @@ OBJECTREF InvokeUtil::GetFieldValue(FieldDesc* pField, TypeHandle fieldType, OBJ pDeclMT->EnsureInstanceActive(); pDeclMT->CheckRunClassInitThrowing(); - if (!declaringType.IsDomainNeutral()) - *pDomainInitialized = TRUE; + *pDomainInitialized = TRUE; } } EX_CATCH_THROWABLE(&Throwable); diff --git a/src/coreclr/src/vm/jitinterface.cpp b/src/coreclr/src/vm/jitinterface.cpp index 266f0c8..77054f9 100644 --- a/src/coreclr/src/vm/jitinterface.cpp +++ b/src/coreclr/src/vm/jitinterface.cpp @@ -10957,23 +10957,7 @@ void CEEJitInfo::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom,CORINFO_MO Module *dependency = (Module *)moduleTo; _ASSERTE(!dependency->IsSystem()); - if (m_pMethodBeingCompiled->IsLCGMethod()) - { - // The context module of the m_pMethodBeingCompiled is irrelevant. Rather than tracking - // the dependency, we just do immediate activation. - dependency->EnsureActive(); - } - else - { -#ifdef FEATURE_LOADER_OPTIMIZATION - Module *context = (Module *)moduleFrom; - - // Record active dependency for loader. - context->AddActiveDependency(dependency, FALSE); -#else - dependency->EnsureActive(); -#endif - } + dependency->EnsureActive(); // EE_TO_JIT_TRANSITION(); } diff --git a/src/coreclr/src/vm/loaderallocator.cpp b/src/coreclr/src/vm/loaderallocator.cpp index 52de8c5..314f5cb 100644 --- a/src/coreclr/src/vm/loaderallocator.cpp +++ b/src/coreclr/src/vm/loaderallocator.cpp @@ -1588,18 +1588,6 @@ BOOL GlobalLoaderAllocator::CanUnload() return FALSE; } -BOOL AppDomainLoaderAllocator::CanUnload() -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - SO_TOLERANT; - } CONTRACTL_END; - - return FALSE; -} - BOOL AssemblyLoaderAllocator::CanUnload() { LIMITED_METHOD_CONTRACT; diff --git a/src/coreclr/src/vm/loaderallocator.hpp b/src/coreclr/src/vm/loaderallocator.hpp index 0dded91..f2d7290 100644 --- a/src/coreclr/src/vm/loaderallocator.hpp +++ b/src/coreclr/src/vm/loaderallocator.hpp @@ -26,7 +26,6 @@ enum LoaderAllocatorType { LAT_Invalid, LAT_Global, - LAT_AppDomain, LAT_Assembly }; @@ -71,7 +70,6 @@ protected: LoaderAllocatorType m_type; union { - AppDomain* m_pAppDomain; DomainAssembly* m_pDomainAssembly; void* m_pValue; }; @@ -85,11 +83,9 @@ public: m_pValue = value; }; VOID Init(); - VOID Init(AppDomain* pAppDomain); LoaderAllocatorType GetType(); VOID AddDomainAssembly(DomainAssembly* pDomainAssembly); DomainAssemblyIterator GetDomainAssemblyIterator(); - AppDomain* GetAppDomain(); BOOL Equals(LoaderAllocatorID* pId); COUNT_T Hash(); }; @@ -557,23 +553,6 @@ public: typedef VPTR(GlobalLoaderAllocator) PTR_GlobalLoaderAllocator; - -class AppDomainLoaderAllocator : public LoaderAllocator -{ - VPTR_VTABLE_CLASS(AppDomainLoaderAllocator, LoaderAllocator) - VPTR_UNIQUE(VPTRU_LoaderAllocator+2) - -protected: - LoaderAllocatorID m_Id; -public: - AppDomainLoaderAllocator() : m_Id(LAT_AppDomain) { LIMITED_METHOD_CONTRACT;}; - void Init(AppDomain *pAppDomain); - virtual LoaderAllocatorID* Id(); - virtual BOOL CanUnload(); -}; - -typedef VPTR(AppDomainLoaderAllocator) PTR_AppDomainLoaderAllocator; - class ShuffleThunkCache; class AssemblyLoaderAllocator : public LoaderAllocator diff --git a/src/coreclr/src/vm/loaderallocator.inl b/src/coreclr/src/vm/loaderallocator.inl index 327dd3e..8543916 100644 --- a/src/coreclr/src/vm/loaderallocator.inl +++ b/src/coreclr/src/vm/loaderallocator.inl @@ -22,19 +22,6 @@ inline void GlobalLoaderAllocator::Init(BaseDomain *pDomain) LoaderAllocator::Init(pDomain, m_ExecutableHeapInstance); } -inline void AppDomainLoaderAllocator::Init(AppDomain *pAppDomain) -{ - WRAPPER_NO_CONTRACT; - m_Id.Init(pAppDomain); - LoaderAllocator::Init((BaseDomain *)pAppDomain); -} - -inline void LoaderAllocatorID::Init(AppDomain *pAppDomain) -{ - m_type = LAT_AppDomain; - m_pAppDomain = pAppDomain; -} - inline void AssemblyLoaderAllocator::Init(AppDomain* pAppDomain) { m_Id.Init(); @@ -94,13 +81,6 @@ inline DomainAssemblyIterator LoaderAllocatorID::GetDomainAssemblyIterator() return DomainAssemblyIterator(m_pDomainAssembly); } -inline AppDomain *LoaderAllocatorID::GetAppDomain() -{ - LIMITED_METHOD_DAC_CONTRACT; - _ASSERTE(m_type == LAT_AppDomain); - return m_pAppDomain; -} - inline LoaderAllocatorID* AssemblyLoaderAllocator::Id() { LIMITED_METHOD_DAC_CONTRACT; @@ -113,12 +93,6 @@ inline LoaderAllocatorID* GlobalLoaderAllocator::Id() return &m_Id; } -inline LoaderAllocatorID* AppDomainLoaderAllocator::Id() -{ - LIMITED_METHOD_DAC_CONTRACT; - return &m_Id; -} - /* static */ FORCEINLINE BOOL LoaderAllocator::GetHandleValueFast(LOADERHANDLE handle, OBJECTREF *pValue) { diff --git a/src/coreclr/src/vm/method.cpp b/src/coreclr/src/vm/method.cpp index 939cf77..3c2ba7d 100644 --- a/src/coreclr/src/vm/method.cpp +++ b/src/coreclr/src/vm/method.cpp @@ -218,15 +218,7 @@ BaseDomain *MethodDesc::GetDomain() } CONTRACTL_END - if (HasMethodInstantiation() && !IsGenericMethodDefinition()) - { - return BaseDomain::ComputeBaseDomain(GetMethodTable()->GetDomain(), - GetMethodInstantiation()); - } - else - { - return GetMethodTable()->GetDomain(); - } + return AppDomain::GetCurrentDomain(); } #ifndef DACCESS_COMPILE diff --git a/src/coreclr/src/vm/methoditer.cpp b/src/coreclr/src/vm/methoditer.cpp index 103bfaf..94f4620 100644 --- a/src/coreclr/src/vm/methoditer.cpp +++ b/src/coreclr/src/vm/methoditer.cpp @@ -47,81 +47,42 @@ BOOL LoadedMethodDescIterator::Next( // This is the 1st time we've called Next(). must Initialize iterator if (m_mainMD == NULL) { - m_mainMD = m_module->LookupMethodDef(m_md); - } - + m_mainMD = m_module->LookupMethodDef(m_md); + } + // note m_mainMD should be sufficiently restored to allow us to get // at the method table, flags and token etc. if (m_mainMD == NULL) { *pDomainAssemblyHolder = NULL; return FALSE; - } + } // Needs to work w/ non-generic methods too. - // NOTE: this behavior seems odd. We appear to return the non-generic method even if - // that method doesn't reside in the set of assemblies defined by m_assemblyIterationMode. - // Presumably all the callers expect or at least cope with this so I'm just commenting without - // changing anything right now. if (!m_mainMD->HasClassOrMethodInstantiation()) { *pDomainAssemblyHolder = NULL; return TRUE; } - if (m_assemblyIterationMode == kModeSharedDomainAssemblies) - { - // Nothing to do... m_sharedAssemblyIterator is initialized on construction - } - else - { - m_assemIterator = m_pAppDomain->IterateAssembliesEx(m_assemIterationFlags); - } + m_assemIterator = m_pAppDomain->IterateAssembliesEx(m_assemIterationFlags); ADVANCE_ASSEMBLY: - if (m_assemblyIterationMode == kModeSharedDomainAssemblies) + if (!m_assemIterator.Next(pDomainAssemblyHolder)) { - if (!m_sharedAssemblyIterator.Next()) - return FALSE; - - m_sharedModuleIterator = m_sharedAssemblyIterator.GetAssembly()->IterateModules(); + _ASSERTE(*pDomainAssemblyHolder == NULL); + return FALSE; } - else - { - if (!m_assemIterator.Next(pDomainAssemblyHolder)) - { - _ASSERTE(*pDomainAssemblyHolder == NULL); - return FALSE; - } - - if (m_assemblyIterationMode == kModeUnsharedADAssemblies) - { - // We're supposed to ignore shared assemblies, so check for them now - if ((*pDomainAssemblyHolder)->GetAssembly()->IsDomainNeutral()) - { - goto ADVANCE_ASSEMBLY; - } - } #ifdef _DEBUG - dbg_m_pDomainAssembly = *pDomainAssemblyHolder; + dbg_m_pDomainAssembly = *pDomainAssemblyHolder; #endif //_DEBUG - m_moduleIterator = (*pDomainAssemblyHolder)->IterateModules(m_moduleIterationFlags); - } - - + m_moduleIterator = (*pDomainAssemblyHolder)->IterateModules(m_moduleIterationFlags); + ADVANCE_MODULE: - if (m_assemblyIterationMode == kModeSharedDomainAssemblies) - { - if (!NextSharedModule()) - goto ADVANCE_ASSEMBLY; - } - else - { - if (!m_moduleIterator.Next()) - goto ADVANCE_ASSEMBLY; - } + if (!m_moduleIterator.Next()) + goto ADVANCE_ASSEMBLY; if (GetCurrentModule()->IsResource()) goto ADVANCE_MODULE; @@ -215,8 +176,7 @@ ADVANCE_METHOD: // Note: We don't need to keep the assembly alive in DAC - see code:CollectibleAssemblyHolder#CAH_DAC #ifndef DACCESS_COMPILE _ASSERTE_MSG( - ((m_assemblyIterationMode == kModeSharedDomainAssemblies) || - (*pDomainAssemblyHolder == dbg_m_pDomainAssembly)), + *pDomainAssemblyHolder == dbg_m_pDomainAssembly, "Caller probably modified the assembly holder, which he shouldn't - see method comment."); #endif //DACCESS_COMPILE @@ -234,43 +194,9 @@ Module * LoadedMethodDescIterator::GetCurrentModule() } CONTRACTL_END - if (m_assemblyIterationMode == kModeSharedDomainAssemblies) - { - return m_sharedModuleIterator.GetModule(); - } return m_moduleIterator.GetLoadedModule(); } - -BOOL LoadedMethodDescIterator::NextSharedModule() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_PREEMPTIVE; - } - CONTRACTL_END - - _ASSERTE(m_assemblyIterationMode == kModeSharedDomainAssemblies); - - while (m_sharedModuleIterator.Next()) - { - // NOTE: If this code is to be shared with the dbgapi, the dbgapi - // will probably want to substitute its own test for "loadedness" - // here. -#ifdef PROFILING_SUPPORTED - Module * pModule = m_sharedModuleIterator.GetModule(); - if (!pModule->IsProfilerNotified()) - continue; -#endif // PROFILING_SUPPORTED - - // If we made it this far, pModule is suitable for iterating over - return TRUE; - } - return FALSE; -} - MethodDesc *LoadedMethodDescIterator::Current() { CONTRACTL @@ -308,7 +234,6 @@ LoadedMethodDescIterator::Start( AppDomain * pAppDomain, Module *pModule, mdMethodDef md, - AssemblyIterationMode assemblyIterationMode, AssemblyIterationFlags assemblyIterationFlags, ModuleIterationOption moduleIterationFlags) { @@ -321,18 +246,6 @@ LoadedMethodDescIterator::Start( } CONTRACTL_END; - // Specifying different assembly/module iteration flags has only been tested for UnsharedADAssemblies mode so far. - // It probably doesn't work as you would expect in other modes. In particular the shared assembly iterator - // doesn't use flags, and the logic in this iterator does a hard-coded filter that roughly matches the unshared - // mode if you had specified these flags: - // Assembly: Loading | Loaded | Execution - // Module: kModIterIncludeAvailableToProfilers - _ASSERTE((assemblyIterationMode == kModeUnsharedADAssemblies) || - (assemblyIterationFlags == (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution))); - _ASSERTE((assemblyIterationMode == kModeUnsharedADAssemblies) || - (moduleIterationFlags == kModIterIncludeLoaded)); - - m_assemblyIterationMode = assemblyIterationMode; m_assemIterationFlags = assemblyIterationFlags; m_moduleIterationFlags = moduleIterationFlags; m_mainMD = NULL; @@ -341,9 +254,7 @@ LoadedMethodDescIterator::Start( m_pAppDomain = pAppDomain; m_fFirstTime = TRUE; - // If we're not iterating through the SharedDomain, caller must specify the - // pAppDomain to search. - _ASSERTE((assemblyIterationMode == kModeSharedDomainAssemblies) || (pAppDomain != NULL)); + _ASSERTE(pAppDomain != NULL); _ASSERTE(TypeFromToken(m_md) == mdtMethodDef); } @@ -356,7 +267,7 @@ LoadedMethodDescIterator::Start( mdMethodDef md, MethodDesc *pMethodDesc) { - Start(pAppDomain, pModule, md, kModeAllADAssemblies); + Start(pAppDomain, pModule, md); m_mainMD = pMethodDesc; } diff --git a/src/coreclr/src/vm/methoditer.h b/src/coreclr/src/vm/methoditer.h index 9d605ec..05fbb0a 100644 --- a/src/coreclr/src/vm/methoditer.h +++ b/src/coreclr/src/vm/methoditer.h @@ -49,10 +49,6 @@ class LoadedMethodDescIterator AssemblyIterationFlags m_assemIterationFlags; ModuleIterationOption m_moduleIterationFlags; - // These are used when iterating over the SharedDomain - SharedDomain::SharedAssemblyIterator m_sharedAssemblyIterator; - Assembly::ModuleIterator m_sharedModuleIterator; - EETypeHashTable::Iterator m_typeIterator; EETypeHashEntry * m_typeIteratorEntry; BOOL m_startedNonGenericType; @@ -66,28 +62,6 @@ class LoadedMethodDescIterator #endif //_DEBUG public: - // Defines the set of assemblies that LoadedMethodDescIterator should consider. - // Typical usages: - // * Debugger controller (for setting breakpoint) just uses kModeAllADAssemblies. - // * RejitManager uses the iterator once with kModeSharedDomainAssemblies, and - // then a bunch of times (once per AD) with kModeUnsharedADAssemblies to - // ensure all assemblies in all ADs are considered, and to avoid unnecessary - // dupes for domain-neutral assemblies. - enum AssemblyIterationMode - { - // Default, used by debugger's breakpoint controller. Iterates through all - // Assemblies associated with the specified AppDomain - kModeAllADAssemblies, - - // Iterate through only the *unshared* assemblies associated with the specified - // AppDomain. - kModeUnsharedADAssemblies, - - // Rather than iterating through Assemblies associated with an AppDomain, just - // iterate over all Assemblies associated with the SharedDomain - kModeSharedDomainAssemblies, - }; - // Iterates next MethodDesc. Updates the holder only if the assembly differs from the previous one. // Caller should not release (i.e. change) the holder explicitly between calls, otherwise collectible // assembly might be without a reference and get deallocated (even the native part). @@ -96,7 +70,6 @@ public: void Start(AppDomain * pAppDomain, Module *pModule, mdMethodDef md, - AssemblyIterationMode assemblyIterationMode, AssemblyIterationFlags assemIterationFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution), ModuleIterationOption moduleIterationFlags = kModIterIncludeLoaded); void Start(AppDomain * pAppDomain, Module *pModule, mdMethodDef md, MethodDesc *pDesc); @@ -105,21 +78,16 @@ public: AppDomain * pAppDomain, Module *pModule, mdMethodDef md, - AssemblyIterationMode assemblyIterationMode = kModeAllADAssemblies, AssemblyIterationFlags assemblyIterationFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution), ModuleIterationOption moduleIterationFlags = kModIterIncludeLoaded) { LIMITED_METHOD_CONTRACT; - Start(pAppDomain, pModule, md, assemblyIterationMode, assemblyIterationFlags, moduleIterationFlags); + Start(pAppDomain, pModule, md, assemblyIterationFlags, moduleIterationFlags); } LoadedMethodDescIterator(void); protected: - AssemblyIterationMode m_assemblyIterationMode; - BOOL m_fSharedDomain; - Module * GetCurrentModule(); - BOOL NextSharedModule(); }; // class LoadedMethodDescIterator diff --git a/src/coreclr/src/vm/methodtable.cpp b/src/coreclr/src/vm/methodtable.cpp index 7b1974c..d83e62d 100644 --- a/src/coreclr/src/vm/methodtable.cpp +++ b/src/coreclr/src/vm/methodtable.cpp @@ -644,8 +644,7 @@ WORD MethodTable::GetNumMethods() PTR_BaseDomain MethodTable::GetDomain() { LIMITED_METHOD_DAC_CONTRACT; - g_IBCLogger.LogMethodTableAccess(this); - return GetLoaderModule()->GetDomain(); + return dac_cast(AppDomain::GetCurrentDomain()); } //========================================================================================== diff --git a/src/coreclr/src/vm/pefile.h b/src/coreclr/src/vm/pefile.h index 4596743..0baaaea 100644 --- a/src/coreclr/src/vm/pefile.h +++ b/src/coreclr/src/vm/pefile.h @@ -331,10 +331,6 @@ public: #ifdef FEATURE_PREJIT BOOL CanUseNativeImage() { LIMITED_METHOD_CONTRACT; return m_fCanUseNativeImage; } void SetCannotUseNativeImage() { LIMITED_METHOD_CONTRACT; m_fCanUseNativeImage = FALSE; } - void SetNativeImageUsedExclusively() { LIMITED_METHOD_CONTRACT; m_flags|=PEFILE_NATIVE_IMAGE_USED_EXCLUSIVELY; } - BOOL IsNativeImageUsedExclusively() { LIMITED_METHOD_CONTRACT; return m_flags&PEFILE_NATIVE_IMAGE_USED_EXCLUSIVELY; } - void SetSafeToHardBindTo() { LIMITED_METHOD_CONTRACT; m_flags|=PEFILE_SAFE_TO_HARDBINDTO; } - BOOL IsSafeToHardBindTo() { LIMITED_METHOD_CONTRACT; return m_flags&PEFILE_SAFE_TO_HARDBINDTO; } BOOL IsNativeLoaded(); PEImage *GetNativeImageWithRef(); @@ -428,9 +424,7 @@ protected: #ifdef FEATURE_PREJIT PEFILE_HAS_NATIVE_IMAGE_METADATA = 0x200, - PEFILE_NATIVE_IMAGE_USED_EXCLUSIVELY =0x1000, - PEFILE_SAFE_TO_HARDBINDTO = 0x4000, // NGEN-only flag -#endif +#endif }; // ------------------------------------------------------------ diff --git a/src/coreclr/src/vm/profilingenumerators.cpp b/src/coreclr/src/vm/profilingenumerators.cpp index b5c1e57..b0f0c1a 100644 --- a/src/coreclr/src/vm/profilingenumerators.cpp +++ b/src/coreclr/src/vm/profilingenumerators.cpp @@ -510,38 +510,6 @@ HRESULT ProfilerModuleEnum::Init() return hr; } - // Next, find all SHARED modules that have a corresponding DomainModule loaded into - // at least one AppDomain with a load level high enough that it should be visible to - // profilers. For each such shared module, add it once to the enumerator. Note that - // enumerating assemblies/modules from the SharedDomain uses different internal CLR - // interators than enumerating DomainAssemblies/DomainModules from AppDomains. So we - // need to special case the iteration here. We could probably factor the following - // into yet more iterator helpers the same way we've already done for the - // DomainAssembly/DomainModule iterators above, but it's unclear how useful that - // would be. - SharedDomain::SharedAssemblyIterator sharedAssemblyIterator; - while (sharedAssemblyIterator.Next()) - { - Assembly * pAssembly = sharedAssemblyIterator.GetAssembly(); - Assembly::ModuleIterator moduleIterator = pAssembly->IterateModules(); - while (moduleIterator.Next()) - { - Module * pModule = moduleIterator.GetModule(); - - // Create an instance of this helper class (IterateAppDomainsForSharedModule) - // to remember which Module we're testing. This will be used as our callback - // for when we iterate AppDomains trying to find at least one AD that has loaded - // pModule enough that pModule would be made visible to profilers. - IterateAppDomainsForSharedModule iterateAppDomainsForSharedModule(&m_elements, pModule); - hr = IterateAppDomains( - &iterateAppDomainsForSharedModule, - &IterateAppDomainsForSharedModule::AddSharedModuleForAppDomain); - if (FAILED(hr)) - { - return hr; - } - } - } return S_OK; } diff --git a/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp index 6cf30c4..e0a1dab 100644 --- a/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp @@ -5695,8 +5695,6 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainInfo(AppDomainID appDomainId, LPCWSTR szFriendlyName; if (pDomain == SystemDomain::System()) szFriendlyName = g_pwBaseLibrary; - else if (pDomain == SharedDomain::GetDomain()) - szFriendlyName = W("EE Shared Assembly Repository"); else szFriendlyName = ((AppDomain*)pDomain)->GetFriendlyNameForDebugger(); diff --git a/src/coreclr/src/vm/runtimehandles.cpp b/src/coreclr/src/vm/runtimehandles.cpp index 913ca1f..722603c 100644 --- a/src/coreclr/src/vm/runtimehandles.cpp +++ b/src/coreclr/src/vm/runtimehandles.cpp @@ -504,17 +504,6 @@ FCIMPL1(AssemblyBaseObject*, RuntimeTypeHandle::GetAssembly, ReflectClassBaseObj Module *pModule = refType->GetType().GetAssembly()->GetManifestModule(); pDomainFile = pModule->FindDomainFile(GetAppDomain()); -#ifdef FEATURE_LOADER_OPTIMIZATION - if (pDomainFile == NULL) - { - HELPER_METHOD_FRAME_BEGIN_RET_1(refType); - - pDomainFile = GetAppDomain()->LoadDomainNeutralModuleDependency(pModule, FILE_LOADED); - - HELPER_METHOD_FRAME_END(); - } -#endif // FEATURE_LOADER_OPTIMIZATION - FC_RETURN_ASSEMBLY_OBJECT((DomainAssembly *)pDomainFile, refType); } @@ -1118,7 +1107,7 @@ PVOID QCALLTYPE RuntimeTypeHandle::GetGCHandle(EnregisteredTypeHandle pTypeHandl TypeHandle th = TypeHandle::FromPtr(pTypeHandle); assert(handleType >= HNDTYPE_WEAK_SHORT && handleType <= HNDTYPE_WEAK_WINRT); - objHandle = th.GetDomain()->CreateTypedHandle(NULL, static_cast(handleType)); + objHandle = AppDomain::GetCurrentDomain()->CreateTypedHandle(NULL, static_cast(handleType)); th.GetLoaderAllocator()->RegisterHandleForCleanup(objHandle); END_QCALL; diff --git a/src/coreclr/src/vm/typedesc.cpp b/src/coreclr/src/vm/typedesc.cpp index d547905..bac52f5 100644 --- a/src/coreclr/src/vm/typedesc.cpp +++ b/src/coreclr/src/vm/typedesc.cpp @@ -136,25 +136,7 @@ PTR_BaseDomain TypeDesc::GetDomain() } CONTRACTL_END - Module *pZapModule = GetZapModule(); - if (pZapModule != NULL) - { - return pZapModule->GetDomain(); - } - - if (HasTypeParam()) - { - return GetBaseTypeParam().GetDomain(); - } - if (IsGenericVariable()) - { - PTR_TypeVarTypeDesc asVar = dac_cast(this); - return asVar->GetModule()->GetDomain(); - } - _ASSERTE(GetInternalCorElementType() == ELEMENT_TYPE_FNPTR); - PTR_FnPtrTypeDesc asFnPtr = dac_cast(this); - return BaseDomain::ComputeBaseDomain(asFnPtr->GetRetAndArgTypesPointer()[0].GetDomain(), - Instantiation(asFnPtr->GetRetAndArgTypesPointer(), asFnPtr->GetNumArgs()+1)); + return dac_cast(AppDomain::GetCurrentDomain()); } PTR_Module TypeDesc::GetModule() { diff --git a/src/coreclr/src/vm/virtualcallstub.cpp b/src/coreclr/src/vm/virtualcallstub.cpp index c6fa852..ef11c6e 100644 --- a/src/coreclr/src/vm/virtualcallstub.cpp +++ b/src/coreclr/src/vm/virtualcallstub.cpp @@ -1050,18 +1050,6 @@ VirtualCallStubManager *VirtualCallStubManager::FindStubManager(PCODE stubAddres } // - // See if we are managed by the shared domain - // - pCur = SharedDomain::GetDomain()->GetLoaderAllocator()->GetVirtualCallStubManager(); - kind = pCur->getStubKind(stubAddress, usePredictStubKind); - if (kind != SK_UNKNOWN) - { - if (wbStubKind) - *wbStubKind = kind; - return pCur; - } - - // // See if we are managed by a collectible loader allocator // if (pDomain->GetCollectibleVSDRanges()->IsInRange(stubAddress, reinterpret_cast(&pCur))) @@ -4000,16 +3988,6 @@ VirtualCallStubManager *VirtualCallStubManagerManager::FindVirtualCallStubManage return pMgr; } } - // Check the shared domain - { - BaseDomain *pDom = SharedDomain::GetDomain(); - VirtualCallStubManager *pMgr = pDom->GetLoaderAllocator()->GetVirtualCallStubManager(); - if (pMgr->CheckIsStub_Internal(stubAddress)) - { - m_pCacheElem = pMgr; - return pMgr; - } - } } } #endif -- 2.7.4