diff options
author | Steve MacLean <stmaclea@microsoft.com> | 2018-12-03 12:49:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 12:49:31 -0500 |
commit | 411f9787617f6bdc64c8393a51ac3b7a0d6e35f4 (patch) | |
tree | 618cf332ea7a4daf5feb802b4672a19bdd84a16b | |
parent | f54494af07aec0d927962846eb4394c118a2fef8 (diff) | |
download | coreclr-411f9787617f6bdc64c8393a51ac3b7a0d6e35f4.tar.gz coreclr-411f9787617f6bdc64c8393a51ac3b7a0d6e35f4.tar.bz2 coreclr-411f9787617f6bdc64c8393a51ac3b7a0d6e35f4.zip |
Remove IsNeutralDomain() (#21318)
* Remove IsNeutralDomain()
* PR feedback
36 files changed, 128 insertions, 503 deletions
diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp index 27f9c58ca2..3abe606d69 100644 --- a/src/ToolBox/SOS/Strike/util.cpp +++ b/src/ToolBox/SOS/Strike/util.cpp @@ -1177,16 +1177,6 @@ void GetStaticFieldPTR(DWORD_PTR* pOutPtr, DacpDomainLocalModuleData* pDLMD, Dac } else { - if (pFlags && pMTD->bIsShared) - { - BYTE flags; - DWORD_PTR pTargetFlags = (DWORD_PTR) pDLMD->pClassData + RidFromToken(pMTD->cl) - 1; - move_xp (flags, pTargetFlags); - - *pFlags = flags; - } - - *pOutPtr = dwTmp; } return; @@ -1314,7 +1304,7 @@ void DisplaySharedStatic(ULONG64 dwModuleDomainID, DacpMethodTableData* pMT, Dac ExtOut(" <<\n"); } -void DisplayThreadStatic (DacpModuleData* pModule, DacpMethodTableData* pMT, DacpFieldDescData *pFD, BOOL fIsShared) +void DisplayThreadStatic(DacpModuleData* pModule, DacpMethodTableData* pMT, DacpFieldDescData *pFD) { SIZE_T dwModuleIndex = (SIZE_T)pModule->dwModuleIndex; SIZE_T dwModuleDomainID = (SIZE_T)pModule->dwModuleID; @@ -1341,25 +1331,12 @@ void DisplayThreadStatic (DacpModuleData* pModule, DacpMethodTableData* pMT, Dac // It's annoying that we have to issue one request for // domain-neutral modules and domain-specific modules. DacpDomainLocalModuleData vDomainLocalModule; - if (fIsShared) - { - if (g_sos->GetDomainLocalModuleDataFromAppDomain(appDomainAddr, (int)dwModuleDomainID, &vDomainLocalModule) != S_OK) - { - // Not initialized, go to next thread - // and continue looping - CurThread = vThread.nextThread; - continue; - } - } - else + if (g_sos->GetDomainLocalModuleDataFromModule(pMT->Module, &vDomainLocalModule) != S_OK) { - if (g_sos->GetDomainLocalModuleDataFromModule(pMT->Module, &vDomainLocalModule) != S_OK) - { - // Not initialized, go to next thread - // and continue looping - CurThread = vThread.nextThread; - continue; - } + // Not initialized, go to next thread + // and continue looping + CurThread = vThread.nextThread; + continue; } // Get the TLM @@ -1506,8 +1483,6 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT numInstanceFields = 0; } - BOOL fIsShared = pMTD->bIsShared; - if (pMTD->ParentMethodTable) { DacpMethodTableData vParentMethTable; @@ -1555,7 +1530,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT dwAddr = vFieldDesc.NextField; DWORD offset = vFieldDesc.dwOffset; - if(!((vFieldDesc.bIsThreadLocal || fIsShared) && vFieldDesc.bIsStatic)) + if(!(vFieldDesc.bIsThreadLocal && vFieldDesc.bIsStatic)) { if (!bValueClass) { @@ -1597,10 +1572,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT if (vFieldDesc.bIsStatic && vFieldDesc.bIsThreadLocal) { numStaticFields ++; - if (fIsShared) - ExtOut("%8s %" POINTERSIZE "s", "shared", vFieldDesc.bIsThreadLocal ? "TLstatic" : "CLstatic"); - else - ExtOut("%8s ", vFieldDesc.bIsThreadLocal ? "TLstatic" : "CLstatic"); + ExtOut("%8s ", vFieldDesc.bIsThreadLocal ? "TLstatic" : "CLstatic"); NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); ExtOut(" %S\n", g_mdName); @@ -1616,7 +1588,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT DacpModuleData vModule; if (vModule.Request(g_sos,pMTD->Module) == S_OK) { - DisplayThreadStatic(&vModule, pMTD, &vFieldDesc, fIsShared); + DisplayThreadStatic(&vModule, pMTD, &vFieldDesc); } } } @@ -1626,47 +1598,24 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT { numStaticFields ++; - if (fIsShared) - { - ExtOut("%8s %" POINTERSIZE "s", "shared", "static"); + ExtOut("%8s ", "static"); - NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); - ExtOut(" %S\n", g_mdName); + DacpDomainLocalModuleData vDomainLocalModule; - if (IsMiniDumpFile()) - { - ExtOut(" <no information>\n"); - } - else - { - DacpModuleData vModule; - if (vModule.Request(g_sos,pMTD->Module) == S_OK) - { - DisplaySharedStatic(vModule.dwModuleID, pMTD, &vFieldDesc); - } - } + // The MethodTable isn't shared, so the module must not be loaded domain neutral. We can + // get the specific DomainLocalModule instance without needing to know the AppDomain in advance. + if (g_sos->GetDomainLocalModuleDataFromModule(pMTD->Module, &vDomainLocalModule) != S_OK) + { + ExtOut(" <no information>\n"); } else { - ExtOut("%8s ", "static"); - - DacpDomainLocalModuleData vDomainLocalModule; - - // The MethodTable isn't shared, so the module must not be loaded domain neutral. We can - // get the specific DomainLocalModule instance without needing to know the AppDomain in advance. - if (g_sos->GetDomainLocalModuleDataFromModule(pMTD->Module, &vDomainLocalModule) != S_OK) - { - ExtOut(" <no information>\n"); - } - else - { - DWORD_PTR dwTmp; - GetStaticFieldPTR(&dwTmp, &vDomainLocalModule, pMTD, &vFieldDesc); - DisplayDataMember(&vFieldDesc, dwTmp); + DWORD_PTR dwTmp; + GetStaticFieldPTR(&dwTmp, &vDomainLocalModule, pMTD, &vFieldDesc); + DisplayDataMember(&vFieldDesc, dwTmp); - NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); - ExtOut(" %S\n", g_mdName); - } + NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false); + ExtOut(" %S\n", g_mdName); } } else diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp index 73c4517186..fbc1d432b3 100644 --- a/src/debug/daccess/request.cpp +++ b/src/debug/daccess/request.cpp @@ -1735,7 +1735,7 @@ ClrDataAccess::GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData MTData->cl = pMT->GetCl(); MTData->dwAttrClass = pMT->GetAttrClass(); MTData->bContainsPointers = pMT->ContainsPointers(); - MTData->bIsShared = (pMT->IsDomainNeutral() ? TRUE : FALSE); // flags & enum_flag_DomainNeutral + MTData->bIsShared = FALSE; MTData->bIsDynamic = pMT->IsDynamicStatics(); } } @@ -2614,12 +2614,9 @@ ClrDataAccess::GetAssemblyData(CLRDATA_ADDRESS cdBaseDomainPtr, CLRDATA_ADDRESS assemblyData->ParentDomain = HOST_CDADDR(pAssembly->GetDomain()); assemblyData->isDynamic = pAssembly->IsDynamic(); assemblyData->ModuleCount = 0; - assemblyData->isDomainNeutral = pAssembly->IsDomainNeutral(); + assemblyData->isDomainNeutral = FALSE; - if (pAssembly->GetManifestFile()) - { - - } + pAssembly->GetManifestFile(); ModuleIterator mi = pAssembly->IterateModules(); while (mi.Next()) @@ -3198,28 +3195,17 @@ ClrDataAccess::GetDomainLocalModuleDataFromModule(CLRDATA_ADDRESS addr, struct D SOSDacEnter(); Module* pModule = PTR_Module(TO_TADDR(addr)); - if( pModule->GetAssembly()->IsDomainNeutral() ) + DomainLocalModule* pLocalModule = PTR_DomainLocalModule(pModule->GetDomainLocalModule(NULL)); + if (!pLocalModule) { - // The module is loaded domain-neutral, then we need to know the specific AppDomain in order to - // choose a DomainLocalModule instance. Rather than try and guess an AppDomain (eg. based on - // whatever the current debugger thread is in), we'll fail and force the debugger to explicitly use - // a specific AppDomain. hr = E_INVALIDARG; } else - { - DomainLocalModule* pLocalModule = PTR_DomainLocalModule(pModule->GetDomainLocalModule(NULL)); - if (!pLocalModule) - { - hr = E_INVALIDARG; - } - else - { - pLocalModuleData->pGCStaticDataStart = TO_CDADDR(PTR_TO_TADDR(pLocalModule->GetPrecomputedGCStaticsBasePointer())); - pLocalModuleData->pNonGCStaticDataStart = TO_CDADDR(pLocalModule->GetPrecomputedNonGCStaticsBasePointer()); - pLocalModuleData->pDynamicClassTable = PTR_CDADDR(pLocalModule->m_pDynamicClassTable.Load()); - pLocalModuleData->pClassData = (TADDR) (PTR_HOST_MEMBER_TADDR(DomainLocalModule, pLocalModule, m_pDataBlob)); - } + { + pLocalModuleData->pGCStaticDataStart = TO_CDADDR(PTR_TO_TADDR(pLocalModule->GetPrecomputedGCStaticsBasePointer())); + pLocalModuleData->pNonGCStaticDataStart = TO_CDADDR(pLocalModule->GetPrecomputedNonGCStaticsBasePointer()); + pLocalModuleData->pDynamicClassTable = PTR_CDADDR(pLocalModule->m_pDynamicClassTable.Load()); + pLocalModuleData->pClassData = (TADDR) (PTR_HOST_MEMBER_TADDR(DomainLocalModule, pLocalModule, m_pDataBlob)); } SOSDacLeave(); diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index 8946e3a913..ce6004312f 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -5386,15 +5386,7 @@ DebuggerModule* Debugger::LookupOrCreateModule(Module* pModule, AppDomain *pAppD if (m_pModules != NULL) { - if (pModule->GetAssembly()->IsDomainNeutral()) - { - // We have to make sure to lookup the module with the app domain parameter if the module lives in a shared assembly - dmod = m_pModules->GetModule(pModule, pAppDomain); - } - else - { - dmod = m_pModules->GetModule(pModule); - } + dmod = m_pModules->GetModule(pModule); } // If it doesn't exist, create it. @@ -10039,11 +10031,7 @@ void Debugger::UnloadModule(Module* pRuntimeModule, // Remove all patches that apply to this module/AppDomain combination AppDomain* domainToRemovePatchesIn = NULL; // all domains by default - if( pRuntimeModule->GetAssembly()->IsDomainNeutral() ) - { - // Deactivate all the patches specific to the AppDomain being unloaded - domainToRemovePatchesIn = pAppDomain; - } + // Note that we'll explicitly NOT delete DebuggerControllers, so that // the Right Side can delete them later. DebuggerController::RemovePatchesFromModule(pRuntimeModule, domainToRemovePatchesIn); @@ -10051,27 +10039,24 @@ void Debugger::UnloadModule(Module* pRuntimeModule, // Deactive all JMC functions in this module. We don't do this for shared assemblies // because JMC status is not maintained on a per-AppDomain basis and we don't // want to change the JMC behavior of the module in other domains. - if( !pRuntimeModule->GetAssembly()->IsDomainNeutral() ) + LOG((LF_CORDB, LL_EVERYTHING, "Setting all JMC methods to false:\n")); + DebuggerDataLockHolder debuggerDataLockHolder(this); + DebuggerMethodInfoTable * pTable = GetMethodInfoTable(); + if (pTable != NULL) { - LOG((LF_CORDB, LL_EVERYTHING, "Setting all JMC methods to false:\n")); - DebuggerDataLockHolder debuggerDataLockHolder(this); - DebuggerMethodInfoTable * pTable = GetMethodInfoTable(); - if (pTable != NULL) - { - HASHFIND info; + HASHFIND info; - for (DebuggerMethodInfo *dmi = pTable->GetFirstMethodInfo(&info); - dmi != NULL; - dmi = pTable->GetNextMethodInfo(&info)) + for (DebuggerMethodInfo *dmi = pTable->GetFirstMethodInfo(&info); + dmi != NULL; + dmi = pTable->GetNextMethodInfo(&info)) + { + if (dmi->m_module == pRuntimeModule) { - if (dmi->m_module == pRuntimeModule) - { - dmi->SetJMCStatus(false); - } + dmi->SetJMCStatus(false); } } - LOG((LF_CORDB, LL_EVERYTHING, "Done clearing JMC methods!\n")); } + LOG((LF_CORDB, LL_EVERYTHING, "Done clearing JMC methods!\n")); // Delete the Left Side representation of the module. if (m_pModules != NULL) diff --git a/src/debug/ee/debuggermodule.cpp b/src/debug/ee/debuggermodule.cpp index 8a20939947..57ef616817 100644 --- a/src/debug/ee/debuggermodule.cpp +++ b/src/debug/ee/debuggermodule.cpp @@ -80,15 +80,7 @@ void DebuggerModule::PickPrimaryModule() if (m->GetRuntimeModule() == this->GetRuntimeModule()) { // Make sure we're picking another primary module. - if (m->GetPrimaryModule() == m) - { - // If we find another one, it must be domain neutral - _ASSERTE( m_pRuntimeModule->GetAssembly()->IsDomainNeutral() ); - - m_pPrimaryModule = m; - LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=0x%p, primary=0x%p\n", this, m)); - return; - } + _ASSERTE(m->GetPrimaryModule() != m); } } // end for @@ -248,106 +240,12 @@ void DebuggerModuleTable::RemoveModule(Module* module, AppDomain *pAppDomain) } CONTRACTL_END; - _ASSERTE(module != NULL); - _ASSERTE(ThreadHoldsLock()); - - DebuggerModule * pDeletedModule = NULL; - - LOG((LF_CORDB, LL_EVERYTHING, "DMT::RM: mod:0x%x AD:0x%x neutral:0x%x\n", - module, pAppDomain, module->GetAssembly()->IsDomainNeutral() )); - // If this is a domain neutral module, then scan the complete list of DebuggerModules looking // for the one with a matching appdomain id. // Note: we have to make sure to lookup the module with the app domain parameter if the module lives in a shared // assembly or the system assembly. <BUGNUM>Bugs 65943 & 81728.</BUGNUM> - _ASSERTE( SystemDomain::SystemAssembly()->IsDomainNeutral() ); - if (module->GetAssembly()->IsDomainNeutral()) - { - // This module is being unloaded from a specific AppDomain, but may still exist in other AppDomains - - HASHFIND findmodule; - DebuggerModuleEntry *moduleentry; - - for (moduleentry = (DebuggerModuleEntry*) FindFirstEntry(&findmodule); - moduleentry != NULL; - moduleentry = (DebuggerModuleEntry*) FindNextEntry(&findmodule)) - { - DebuggerModule *pModule = moduleentry->module; - - if ((pModule->GetRuntimeModule() == module) && - (pModule->GetAppDomain() == pAppDomain)) - { - LOG((LF_CORDB, LL_EVERYTHING, "DMT::RM: found 0x%x (DM:0x%x)\n", - moduleentry, moduleentry->module)); - - pDeletedModule = pModule; - - // Remove from table - Delete(HASH(module), (HASHENTRY *)moduleentry); - - break; - } - } - // we should always find the module!! - _ASSERTE (moduleentry != NULL); - } - else - { - // This module is not shared among multiple AppDomains + _ASSERTE( FALSE ); - DebuggerModuleEntry *entry - = (DebuggerModuleEntry *) Find(HASH(module), KEY(module)); - - _ASSERTE(entry != NULL); // it had better be in there! - - if (entry != NULL) // if its not, we fail gracefully in a free build - { - LOG((LF_CORDB, LL_EVERYTHING, "DMT::RM: found 0x%x (DM:0x%x)\n", - entry, entry->module)); - - pDeletedModule = entry->module; - - // Remove from table - Delete(HASH(module), (HASHENTRY *)entry); - - // There should not be any other entry in the table for the same module - _ASSERTE( Find(HASH(module), KEY(module)) == NULL ); - } - } - - _ASSERTE(pDeletedModule != NULL); - - // Update the primary module pointers. If any other module had this as a - // primary module, then we have to update that pointer (since we can't - // have our primary module be deleted!) - { - HASHFIND findmodule; - DebuggerModuleEntry *moduleentry; - - DebuggerModule * pNewPrimary = NULL; - - for (moduleentry = (DebuggerModuleEntry*) FindFirstEntry(&findmodule); - moduleentry != NULL; - moduleentry = (DebuggerModuleEntry*) FindNextEntry(&findmodule)) - { - DebuggerModule *pOther = moduleentry->module; - _ASSERTE(pOther != NULL); - _ASSERTE(pOther != pDeletedModule); - - // If pOther's primary was just deleted, then update it. - if (pOther->GetPrimaryModule() == pDeletedModule) - { - if (pNewPrimary == NULL) - { - pNewPrimary = pOther; - LOG((LF_CORDB, LL_INFO1000, "DMT::RM changed primary module from 0x%p to 0x%p\n", pDeletedModule, pNewPrimary)); - } - pOther->SetPrimaryModule(pNewPrimary); - } - } // end for - } - - DeleteInteropSafe(pDeletedModule); } diff --git a/src/inc/dacprivate.h b/src/inc/dacprivate.h index 47e79a131f..978d8a8c51 100644 --- a/src/inc/dacprivate.h +++ b/src/inc/dacprivate.h @@ -299,7 +299,7 @@ struct MSLAYOUT DacpMethodTableData : ZeroInit<DacpMethodTableData> DWORD ComponentSize; mdTypeDef cl; // Metadata token DWORD dwAttrClass; // cached metadata - BOOL bIsShared; // flags & enum_flag_DomainNeutral + BOOL bIsShared; // Always false, preserved for backward compatibility BOOL bIsDynamic; BOOL bContainsPointers; @@ -472,7 +472,7 @@ struct MSLAYOUT DacpAssemblyData : ZeroInit<DacpAssemblyData> BOOL isDynamic; UINT ModuleCount; UINT LoadContext; - BOOL isDomainNeutral; + BOOL isDomainNeutral; // Always false, preserved for backward compatibility DWORD dwLocationFlags; HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr, CLRDATA_ADDRESS baseDomainPtr) diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 1f978256fa..509b4849bf 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -1001,7 +1001,7 @@ void AppDomain::DeleteNativeCodeRanges() while (i.Next(pDomainAssembly.This())) { Assembly * assembly = pDomainAssembly->m_pAssembly; - if ((assembly != NULL) && !assembly->IsDomainNeutral()) + if ((assembly != NULL)) assembly->DeleteNativeCodeRanges(); } } @@ -1036,7 +1036,7 @@ void AppDomain::ShutdownAssemblies() // loaded to at least the FILE_LOAD_ALLOCATE level. Since domain shutdown can take place // asynchronously this property cannot be guaranteed. Access the m_pAssembly field directly instead. Assembly * assembly = pDomainAssembly->m_pAssembly; - if (assembly && !assembly->IsDomainNeutral()) + if (assembly) assembly->Terminate(); } @@ -1178,8 +1178,7 @@ void AppDomain::ReleaseFiles() } else { - if (!pAsm->GetCurrentAssembly()->IsDomainNeutral()) - pAsm->ReleaseFiles(); + pAsm->ReleaseFiles(); } } } // AppDomain::ReleaseFiles diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index d263e37f62..ecba83456d 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -154,26 +154,17 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat } else { - if (!IsDomainNeutral()) + if (!IsCollectible()) { - if (!IsCollectible()) - { - // pLoaderAllocator will only be non-null for reflection emit assemblies - _ASSERTE((pLoaderAllocator == NULL) || (pLoaderAllocator == GetDomain()->AsAppDomain()->GetLoaderAllocator())); - m_pLoaderAllocator = GetDomain()->AsAppDomain()->GetLoaderAllocator(); - } - else - { - _ASSERTE(pLoaderAllocator != NULL); // ppLoaderAllocator must be non-null for collectible assemblies - - m_pLoaderAllocator = pLoaderAllocator; - } + // pLoaderAllocator will only be non-null for reflection emit assemblies + _ASSERTE((pLoaderAllocator == NULL) || (pLoaderAllocator == GetDomain()->AsAppDomain()->GetLoaderAllocator())); + m_pLoaderAllocator = GetDomain()->AsAppDomain()->GetLoaderAllocator(); } else { - _ASSERTE(pLoaderAllocator == NULL); // pLoaderAllocator may only be non-null for collectible types - // use global loader heaps - m_pLoaderAllocator = SystemDomain::GetGlobalLoaderAllocator(); + _ASSERTE(pLoaderAllocator != NULL); // ppLoaderAllocator must be non-null for collectible assemblies + + m_pLoaderAllocator = pLoaderAllocator; } } _ASSERTE(m_pLoaderAllocator != NULL); diff --git a/src/vm/assembly.hpp b/src/vm/assembly.hpp index 83d7ee698d..24f2547bde 100644 --- a/src/vm/assembly.hpp +++ b/src/vm/assembly.hpp @@ -448,8 +448,6 @@ public: OBJECTHANDLE GetLoaderAllocatorObjectHandle() { WRAPPER_NO_CONTRACT; return GetLoaderAllocator()->GetLoaderAllocatorObjectHandle(); } #endif // FEATURE_COLLECTIBLE_TYPES - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } - BOOL IsSIMDVectorAssembly() { LIMITED_METHOD_DAC_CONTRACT; return m_fIsSIMDVectorAssembly; } #ifdef FEATURE_PREJIT diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index b89351f36a..1672240b79 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -91,7 +91,7 @@ FCIMPL7(Object*, AssemblyNative::Load, AssemblyNameBaseObject* assemblyNameUNSAF // Shared or collectible assemblies should not be used for the parent in the // late-bound case. - if (pRefAssembly && (!pRefAssembly->IsDomainNeutral()) && (!pRefAssembly->IsCollectible())) + if (pRefAssembly && (!pRefAssembly->IsCollectible())) { pParentAssembly= pRefAssembly->GetDomainAssembly(); } diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index eb54b95a4e..058f4a4017 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -1098,9 +1098,6 @@ void Module::SetDebuggerInfoBits(DebuggerAssemblyControlFlags newBits) #ifdef DEBUGGING_SUPPORTED BOOL setEnC = ((newBits & DACF_ENC_ENABLED) != 0) && IsEditAndContinueCapable(); - // IsEditAndContinueCapable should already check !GetAssembly()->IsDomainNeutral - _ASSERTE(!setEnC || !GetAssembly()->IsDomainNeutral()); - // The only way can change Enc is through debugger override. if (setEnC) { @@ -1165,9 +1162,6 @@ Module *Module::Create(Assembly *pAssembly, mdFile moduleRef, PEFile *file, Allo #ifdef EnC_SUPPORTED if (IsEditAndContinueCapable(pAssembly, file)) { - // IsEditAndContinueCapable should already check !pAssembly->IsDomainNeutral - _ASSERTE(!pAssembly->IsDomainNeutral()); - // if file is EnCCapable, always create an EnC-module, but EnC won't necessarily be enabled. // Debugger enables this by calling SetJITCompilerFlags on LoadModule callback. @@ -1830,7 +1824,6 @@ BOOL Module::IsEditAndContinueCapable(Assembly *pAssembly, PEFile *file) // Some modules are never EnC-capable return ! (pAssembly->GetDebuggerInfoBits() & DACF_ALLOW_JIT_OPTS || - pAssembly->IsDomainNeutral() || file->IsSystem() || file->IsResource() || file->HasNativeImage() || @@ -2877,39 +2870,32 @@ void Module::FreeModuleIndex() MODE_ANY; } CONTRACTL_END; - if (GetAssembly()->IsDomainNeutral()) - { - // We do not recycle ModuleIndexes used by domain neutral Modules. - } - else + if (m_ModuleID != NULL) { - if (m_ModuleID != NULL) - { - // Module's m_ModuleID should not contain the ID, it should - // contain a pointer to the DLM - _ASSERTE(!Module::IsEncodedModuleIndex((SIZE_T)m_ModuleID)); - _ASSERTE(m_ModuleIndex == m_ModuleID->GetModuleIndex()); + // Module's m_ModuleID should not contain the ID, it should + // contain a pointer to the DLM + _ASSERTE(!Module::IsEncodedModuleIndex((SIZE_T)m_ModuleID)); + _ASSERTE(m_ModuleIndex == m_ModuleID->GetModuleIndex()); #ifndef CROSSGEN_COMPILE - if (IsCollectible()) + if (IsCollectible()) + { + ThreadStoreLockHolder tsLock; + Thread *pThread = NULL; + while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL) { - ThreadStoreLockHolder tsLock; - Thread *pThread = NULL; - while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL) - { - pThread->DeleteThreadStaticData(m_ModuleIndex); - } + pThread->DeleteThreadStaticData(m_ModuleIndex); } + } #endif // CROSSGEN_COMPILE - // Get the ModuleIndex from the DLM and free it - Module::FreeModuleIndex(m_ModuleIndex); - } - else - { - // This was an empty, short-lived Module object that - // was never assigned a ModuleIndex... - } + // Get the ModuleIndex from the DLM and free it + Module::FreeModuleIndex(m_ModuleIndex); + } + else + { + // This was an empty, short-lived Module object that + // was never assigned a ModuleIndex... } } @@ -4698,7 +4684,6 @@ void Module::AddActiveDependency(Module *pModule, BOOL unconditional) PRECONDITION(CheckPointer(pModule)); PRECONDITION(pModule != this); PRECONDITION(!IsSystem()); - PRECONDITION(!GetAssembly()->IsDomainNeutral() || pModule->GetAssembly()->IsDomainNeutral() || GetAppDomain()->IsDefaultDomain()); // Postcondition about activation } CONTRACT_END; diff --git a/src/vm/ceeload.inl b/src/vm/ceeload.inl index c961c1fdc7..07d657bcaa 100644 --- a/src/vm/ceeload.inl +++ b/src/vm/ceeload.inl @@ -469,7 +469,7 @@ inline BOOL Module::IsEditAndContinueCapable() // for now, Module::IsReflection is equivalent to m_file->IsDynamic, // which is checked by IsEditAndContinueCapable(m_pAssembly, m_file) - _ASSERTE(!isEnCCapable || (!this->IsReflection() && !GetAssembly()->IsDomainNeutral())); + _ASSERTE(!isEnCCapable || (!this->IsReflection())); return isEnCCapable; } diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index 91b9dd5092..90fb070518 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -110,23 +110,13 @@ PTR_Module ClassLoader::ComputeLoaderModuleWorker( #endif // FEATURE_PREJIT #endif // #ifndef DACCESS_COMPILE - Module *pFirstNonSharedLoaderModule = NULL; - Module *pFirstNonSystemSharedModule = NULL; Module *pLoaderModule = NULL; if (pDefinitionModule) { if (pDefinitionModule->IsCollectible()) goto ComputeCollectibleLoaderModule; - if (!pDefinitionModule->GetAssembly()->IsDomainNeutral()) - { - pFirstNonSharedLoaderModule = pDefinitionModule; - } - else - if (!pDefinitionModule->IsSystem()) - { - pFirstNonSystemSharedModule = pDefinitionModule; - } + pLoaderModule = pDefinitionModule; } for (DWORD i = 0; i < classInst.GetNumArgs(); i++) @@ -136,17 +126,8 @@ PTR_Module ClassLoader::ComputeLoaderModuleWorker( Module* pModule = classArg.GetLoaderModule(); if (pModule->IsCollectible()) goto ComputeCollectibleLoaderModule; - if (!pModule->GetAssembly()->IsDomainNeutral()) - { - if (pFirstNonSharedLoaderModule == NULL) - pFirstNonSharedLoaderModule = pModule; - } - else - if (!pModule->IsSystem()) - { - if (pFirstNonSystemSharedModule == NULL) - pFirstNonSystemSharedModule = pModule; - } + if (pLoaderModule == NULL) + pLoaderModule = pModule; } for (DWORD i = 0; i < methodInst.GetNumArgs(); i++) @@ -156,32 +137,11 @@ PTR_Module ClassLoader::ComputeLoaderModuleWorker( Module *pModule = methodArg.GetLoaderModule(); if (pModule->IsCollectible()) goto ComputeCollectibleLoaderModule; - if (!pModule->GetAssembly()->IsDomainNeutral()) - { - if (pFirstNonSharedLoaderModule == NULL) - pFirstNonSharedLoaderModule = pModule; - } - else - if (!pModule->IsSystem()) - { - if (pFirstNonSystemSharedModule == NULL) - pFirstNonSystemSharedModule = pModule; - } + if (pLoaderModule == NULL) + pLoaderModule = pModule; } - // RULE: Prefer modules in non-shared assemblies. - // This ensures safety of app-domain unloading. - if (pFirstNonSharedLoaderModule != NULL) - { - pLoaderModule = pFirstNonSharedLoaderModule; - } - else if (pFirstNonSystemSharedModule != NULL) - { - // Use pFirstNonSystemSharedModule just so C<object> ends up in module C - it - // shouldn't actually matter at all though. - pLoaderModule = pFirstNonSystemSharedModule; - } - else + if (pLoaderModule == NULL) { CONSISTENCY_CHECK(MscorlibBinder::GetModule() && MscorlibBinder::GetModule()->IsSystem()); diff --git a/src/vm/comdynamic.cpp b/src/vm/comdynamic.cpp index 432555917e..a8e8b5fa4a 100644 --- a/src/vm/comdynamic.cpp +++ b/src/vm/comdynamic.cpp @@ -897,9 +897,6 @@ void QCALLTYPE COMDynamicWrite::DefineCustomAttribute(QCall::ModuleHandle pModul Assembly* pAssembly = pModule->GetAssembly(); DomainAssembly* pDomainAssembly = pAssembly->GetDomainAssembly(); - // Dynamic assemblies should be 1:1 with DomainAssemblies. - _ASSERTE(!pAssembly->IsDomainNeutral()); - DWORD actualFlags; actualFlags = ((DWORD)pDomainAssembly->GetDebuggerInfoBits() & mask) | flags; pDomainAssembly->SetDebuggerInfoBits((DebuggerAssemblyControlFlags)actualFlags); diff --git a/src/vm/custommarshalerinfo.cpp b/src/vm/custommarshalerinfo.cpp index 7201e106b8..98484876cc 100644 --- a/src/vm/custommarshalerinfo.cpp +++ b/src/vm/custommarshalerinfo.cpp @@ -383,7 +383,6 @@ EEHashEntry_t * EECMHelperHashtableHelper::AllocateEntry(EECMHelperHashtableKey pEntryKey->m_Instantiation = Instantiation( (TypeHandle *) (pEntryKey->m_strCookie + pEntryKey->m_cCookieStrBytes), pKey->GetMarshalerInstantiation().GetNumArgs()); - pEntryKey->m_bSharedHelper = pKey->IsSharedHelper(); memcpy((void*)pEntryKey->m_strMarshalerTypeName, pKey->GetMarshalerTypeName(), pKey->GetMarshalerTypeNameByteCount()); memcpy((void*)pEntryKey->m_strCookie, pKey->GetCookieString(), pKey->GetCookieStringByteCount()); memcpy((void*)pEntryKey->m_Instantiation.GetRawArgs(), pKey->GetMarshalerInstantiation().GetRawArgs(), @@ -402,7 +401,6 @@ EEHashEntry_t * EECMHelperHashtableHelper::AllocateEntry(EECMHelperHashtableKey pEntryKey->m_cCookieStrBytes = pKey->GetCookieStringByteCount(); pEntryKey->m_strCookie = pKey->GetCookieString(); pEntryKey->m_Instantiation = Instantiation(pKey->GetMarshalerInstantiation()); - pEntryKey->m_bSharedHelper = pKey->IsSharedHelper(); } return pEntry; @@ -438,9 +436,6 @@ BOOL EECMHelperHashtableHelper::CompareKeys(EEHashEntry_t *pEntry, EECMHelperHas EECMHelperHashtableKey *pEntryKey = (EECMHelperHashtableKey *) pEntry->Key; - if (pEntryKey->IsSharedHelper() != pKey->IsSharedHelper()) - return FALSE; - if (pEntryKey->GetMarshalerTypeNameByteCount() != pKey->GetMarshalerTypeNameByteCount()) return FALSE; @@ -474,8 +469,7 @@ DWORD EECMHelperHashtableHelper::Hash(EECMHelperHashtableKey *pKey) return (DWORD) (HashBytes((const BYTE *) pKey->GetMarshalerTypeName(), pKey->GetMarshalerTypeNameByteCount()) + HashBytes((const BYTE *) pKey->GetCookieString(), pKey->GetCookieStringByteCount()) + - HashBytes((const BYTE *) pKey->GetMarshalerInstantiation().GetRawArgs(), pKey->GetMarshalerInstantiation().GetNumArgs() * sizeof(LPVOID)) + - (pKey->IsSharedHelper() ? 1 : 0)); + HashBytes((const BYTE *) pKey->GetMarshalerInstantiation().GetRawArgs(), pKey->GetMarshalerInstantiation().GetNumArgs() * sizeof(LPVOID))); } diff --git a/src/vm/custommarshalerinfo.h b/src/vm/custommarshalerinfo.h index 01af33cc0e..aecedf4201 100644 --- a/src/vm/custommarshalerinfo.h +++ b/src/vm/custommarshalerinfo.h @@ -118,13 +118,12 @@ typedef SList<CustomMarshalerInfo, true> CMINFOLIST; class EECMHelperHashtableKey { public: - EECMHelperHashtableKey(DWORD cMarshalerTypeNameBytes, LPCSTR strMarshalerTypeName, DWORD cCookieStrBytes, LPCSTR strCookie, Instantiation instantiation, BOOL bSharedHelper) + EECMHelperHashtableKey(DWORD cMarshalerTypeNameBytes, LPCSTR strMarshalerTypeName, DWORD cCookieStrBytes, LPCSTR strCookie, Instantiation instantiation) : m_cMarshalerTypeNameBytes(cMarshalerTypeNameBytes) , m_strMarshalerTypeName(strMarshalerTypeName) , m_cCookieStrBytes(cCookieStrBytes) , m_strCookie(strCookie) , m_Instantiation(instantiation) - , m_bSharedHelper(bSharedHelper) { LIMITED_METHOD_CONTRACT; } @@ -154,19 +153,12 @@ public: LIMITED_METHOD_CONTRACT; return m_Instantiation; } - inline BOOL IsSharedHelper() const - { - LIMITED_METHOD_CONTRACT; - return m_bSharedHelper; - } - DWORD m_cMarshalerTypeNameBytes; LPCSTR m_strMarshalerTypeName; DWORD m_cCookieStrBytes; LPCSTR m_strCookie; Instantiation m_Instantiation; - BOOL m_bSharedHelper; }; diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index 664d10e690..19adf33ce1 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -274,8 +274,7 @@ void DomainFile::SetError(Exception *ex) SetProfilerNotified(); #ifdef PROFILING_SUPPORTED - if (GetCurrentModule() != NULL - && !GetCurrentModule()->GetAssembly()->IsDomainNeutral()) + if (GetCurrentModule() != NULL) { // Only send errors for non-shared assemblies; other assemblies might be successfully completed // in another app domain later. @@ -1314,7 +1313,7 @@ DomainAssembly::~DomainAssembly() delete i.GetDomainFile(); } - if (m_pAssembly != NULL && !m_pAssembly->IsDomainNeutral()) + if (m_pAssembly != NULL) { delete m_pAssembly; } @@ -1605,7 +1604,6 @@ void DomainAssembly::FindNativeImage() } #endif // FEATURE_PREJIT -// This is where the decision whether an assembly is DomainNeutral (shared) nor not is made. void DomainAssembly::Allocate() { CONTRACTL diff --git a/src/vm/encee.cpp b/src/vm/encee.cpp index 2c484c624e..86d9736e65 100644 --- a/src/vm/encee.cpp +++ b/src/vm/encee.cpp @@ -1088,7 +1088,6 @@ EnCAddedField *EnCAddedField::Allocate(OBJECTREF thisPointer, EnCFieldDesc *pFD) EnCAddedField *pEntry = new EnCAddedField; pEntry->m_pFieldDesc = pFD; - _ASSERTE(!pFD->GetApproxEnclosingMethodTable()->IsDomainNeutral()); AppDomain *pDomain = (AppDomain*) pFD->GetApproxEnclosingMethodTable()->GetDomain(); // We need to associate the contents of the new field with the object it is attached to @@ -1398,7 +1397,6 @@ EnCAddedStaticField *EnCAddedStaticField::Allocate(EnCFieldDesc *pFD) } CONTRACTL_END; - _ASSERTE(!pFD->GetEnclosingMethodTable()->IsDomainNeutral()); AppDomain *pDomain = (AppDomain*) pFD->GetApproxEnclosingMethodTable()->GetDomain(); // Compute the size of the fieldData entry diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 7a45cb17fb..7b3c6aedcf 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -5720,15 +5720,13 @@ VOID ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions PCWSTR szDtraceOutput1=W(""); BOOL bIsDynamicAssembly = pAssembly->IsDynamic(); BOOL bIsCollectibleAssembly = pAssembly->IsCollectible(); - BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral() ; BOOL bHasNativeImage = pAssembly->GetManifestFile()->HasNativeImage(); BOOL bIsReadyToRun = pAssembly->GetManifestFile()->IsILImageReadyToRun(); ULONGLONG ullAssemblyId = (ULONGLONG)pAssembly; ULONGLONG ullDomainId = (ULONGLONG)pAssembly->GetDomain(); ULONGLONG ullBindingID = 0; - ULONG ulAssemblyFlags = ((bIsDomainNeutral ? ETW::LoaderLog::LoaderStructs::DomainNeutralAssembly : 0) | - (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicAssembly : 0) | + ULONG ulAssemblyFlags = ((bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicAssembly : 0) | (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeAssembly : 0) | (bIsCollectibleAssembly ? ETW::LoaderLog::LoaderStructs::CollectibleAssembly : 0) | (bIsReadyToRun ? ETW::LoaderLog::LoaderStructs::ReadyToRunAssembly : 0)); @@ -6042,7 +6040,6 @@ VOID ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL ULONGLONG ullAppDomainId = 0; // This is used only with DomainModule events ULONGLONG ullModuleId = (ULONGLONG)(TADDR) pModule; ULONGLONG ullAssemblyId = (ULONGLONG)pModule->GetAssembly(); - BOOL bIsDomainNeutral = pModule->GetAssembly()->IsDomainNeutral(); BOOL bIsIbcOptimized = FALSE; if(bHasNativeImage) { @@ -6050,8 +6047,7 @@ VOID ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL } BOOL bIsReadyToRun = pModule->IsReadyToRun(); ULONG ulReservedFlags = 0; - ULONG ulFlags = ((bIsDomainNeutral ? ETW::LoaderLog::LoaderStructs::DomainNeutralModule : 0) | - (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeModule : 0) | + ULONG ulFlags = ((bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeModule : 0) | (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicModule : 0) | (bIsManifestModule ? ETW::LoaderLog::LoaderStructs::ManifestModule : 0) | (bIsIbcOptimized ? ETW::LoaderLog::LoaderStructs::IbcOptimized : 0) | @@ -7042,9 +7038,6 @@ VOID ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp while (assemblyIterator.Next(pDomainAssembly.This())) { CollectibleAssemblyHolder<Assembly *> pAssembly = pDomainAssembly->GetLoadedAssembly(); - BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); - if (bIsDomainNeutral) - continue; if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); @@ -7110,7 +7103,6 @@ VOID ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAlloca while (!domainAssemblyIt.end()) { Assembly *pAssembly = domainAssemblyIt->GetAssembly(); // TODO: handle iterator - _ASSERTE(!pAssembly->IsDomainNeutral()); // Collectible Assemblies are not domain neutral. DomainModuleIterator domainModuleIterator = domainAssemblyIt->IterateModules(kModIterIncludeLoaded); while (domainModuleIterator.Next()) diff --git a/src/vm/generics.cpp b/src/vm/generics.cpp index 06cde91394..1d98d98d0e 100644 --- a/src/vm/generics.cpp +++ b/src/vm/generics.cpp @@ -590,7 +590,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( // Check we've set up the flags correctly on the new method table _ASSERTE(!fContainsGenericVariables == !pMT->ContainsGenericVariables()); _ASSERTE(!fHasGenericsStaticsInfo == !pMT->HasGenericsStaticsInfo()); - _ASSERTE(!pLoaderModule->GetAssembly()->IsDomainNeutral() == !pMT->IsDomainNeutral()); #ifdef FEATURE_COMINTEROP _ASSERTE(!fHasDynamicInterfaceMap == !pMT->HasDynamicInterfaceMap()); _ASSERTE(!fHasRCWPerTypeData == !pMT->HasRCWPerTypeData()); diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 77054f9782..376bc2a260 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -1582,8 +1582,7 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, fieldAccessor = intrinsicAccessor; } else - if (// Domain neutral access. - m_pMethodBeingCompiled->IsDomainNeutral() || m_pMethodBeingCompiled->IsZapped() || IsCompilingForNGen() || + if (m_pMethodBeingCompiled->IsZapped() || IsCompilingForNGen() || // Static fields are not pinned in collectible types. We will always access // them using a helper since the address cannot be embeded into the code. pFieldMT->Collectible() || @@ -4120,12 +4119,12 @@ CorInfoInitClassResult CEEInfo::initClass( MethodDesc *methodBeingCompiled = m_pMethodBeingCompiled; - BOOL fMethodDomainNeutral = methodBeingCompiled->IsDomainNeutral() || methodBeingCompiled->IsZapped() || IsCompilingForNGen(); + BOOL fMethodZappedOrNGen = methodBeingCompiled->IsZapped() || IsCompilingForNGen(); MethodTable *pTypeToInitMT = typeToInitTH.AsMethodTable(); // This should be the most common early-out case. - if (fMethodDomainNeutral) + if (fMethodZappedOrNGen) { if (pTypeToInitMT->IsClassPreInited()) { @@ -4242,7 +4241,7 @@ CorInfoInitClassResult CEEInfo::initClass( } } - if (fMethodDomainNeutral) + if (fMethodZappedOrNGen) { // Well, because of code sharing we can't do anything at coge generation time. // We have to do it at runtime. diff --git a/src/vm/loaderallocator.cpp b/src/vm/loaderallocator.cpp index d51af51347..e3092ff9f3 100644 --- a/src/vm/loaderallocator.cpp +++ b/src/vm/loaderallocator.cpp @@ -849,7 +849,7 @@ LOADERHANDLE LoaderAllocator::AllocateHandle(OBJECTREF value) else { OBJECTREF* pRef = GetDomain()->AllocateObjRefPtrsInLargeTable(1); - SetObjectReference(pRef, gc.value, IsDomainNeutral() ? NULL : GetDomain()->AsAppDomain()); + SetObjectReference(pRef, gc.value, GetDomain()->AsAppDomain()); retVal = (((UINT_PTR)pRef) + 1); } @@ -934,7 +934,7 @@ OBJECTREF LoaderAllocator::CompareExchangeValueInHandle(LOADERHANDLE handle, OBJ gc.previous = *ptr; if ((*ptr) == gc.compare) { - SetObjectReference(ptr, gc.value, IsDomainNeutral() ? NULL : GetDomain()->AsAppDomain()); + SetObjectReference(ptr, gc.value, GetDomain()->AsAppDomain()); } } else @@ -981,7 +981,7 @@ void LoaderAllocator::SetHandleValue(LOADERHANDLE handle, OBJECTREF value) if ((((UINT_PTR)handle) & 1) != 0) { OBJECTREF *ptr = (OBJECTREF *)(((UINT_PTR)handle) - 1); - SetObjectReference(ptr, value, IsDomainNeutral() ? NULL : GetDomain()->AsAppDomain()); + SetObjectReference(ptr, value, GetDomain()->AsAppDomain()); } else { diff --git a/src/vm/loaderallocator.hpp b/src/vm/loaderallocator.hpp index a283721c37..7237359666 100644 --- a/src/vm/loaderallocator.hpp +++ b/src/vm/loaderallocator.hpp @@ -485,7 +485,6 @@ public: virtual ~LoaderAllocator(); BaseDomain *GetDomain() { LIMITED_METHOD_CONTRACT; return m_pDomain; } virtual BOOL CanUnload() = 0; - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } void Init(BaseDomain *pDomain, BYTE *pExecutableHeapMemory = NULL); void Terminate(); virtual void ReleaseManagedAssemblyLoadContext() {} diff --git a/src/vm/method.hpp b/src/vm/method.hpp index 8b136e6fd3..1821b2aed4 100644 --- a/src/vm/method.hpp +++ b/src/vm/method.hpp @@ -508,8 +508,6 @@ public: // and the loader allocator in the current domain for non-collectable types LoaderAllocator * GetDomainSpecificLoaderAllocator(); - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } - Module* GetLoaderModule(); Module* GetZapModule(); diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp index cf7ddccfc7..fe4a18ba4b 100644 --- a/src/vm/methodtable.cpp +++ b/src/vm/methodtable.cpp @@ -6133,20 +6133,7 @@ void MethodTable::Restore() EnsureWritablePages(pWriteableData, sizeof(MethodTableWriteableData) + sizeof(CrossModuleGenericsStaticsInfo)); - if (IsDomainNeutral()) - { - // 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. - Module * pModuleForStatics = Module::GetPreferredZapModuleForMethodTable(this); - - pInfo->m_pModuleForStatics = pModuleForStatics; - pInfo->m_DynamicTypeID = pModuleForStatics->AllocateDynamicEntry(this); - } - else - { - pInfo->m_pModuleForStatics = GetLoaderModule(); - } + pInfo->m_pModuleForStatics = GetLoaderModule(); } LOG((LF_ZAP, LL_INFO10000, diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index 72482f29fe..c80384da79 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -699,9 +699,6 @@ public: PTR_DomainLocalModule GetDomainLocalModule(); #endif - // Return whether the type lives in the shared domain. - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } - MethodTable *LoadEnclosingMethodTable(ClassLoadLevel targetLevel = CLASS_DEPENDENCIES_LOADED); LPCWSTR GetPathForErrorMessages(); diff --git a/src/vm/mlinfo.cpp b/src/vm/mlinfo.cpp index 608d2b7fc6..f9439e7396 100644 --- a/src/vm/mlinfo.cpp +++ b/src/vm/mlinfo.cpp @@ -428,22 +428,8 @@ CustomMarshalerHelper *SetupCustomMarshalerHelper(LPCUTF8 strMarshalerTypeName, EEMarshalingData *pMarshalingData = NULL; - // Retrieve the marshalling data for the current app domain. - if (pAssembly->IsDomainNeutral()) - { - // If the assembly is shared, then it should only reference other domain neutral assemblies. - // This assumption MUST be true for the current custom marshaling scheme to work. - // This implies that the type of the managed parameter must be a shared type. - _ASSERTE(hndManagedType.GetAssembly()->IsDomainNeutral()); - - // The assembly is shared so we need to use the system domain's marshaling data. - pMarshalingData = SystemDomain::System()->GetMarshalingData(); - } - else - { - // The assembly is not shared so we use the current app domain's marshaling data. - pMarshalingData = GetThread()->GetDomain()->GetMarshalingData(); - } + // The assembly is not shared so we use the current app domain's marshaling data. + pMarshalingData = GetThread()->GetDomain()->GetMarshalingData(); // Retrieve the custom marshaler helper from the EE marshaling data. RETURN pMarshalingData->GetCustomMarshalerHelper(pAssembly, hndManagedType, strMarshalerTypeName, cMarshalerTypeNameBytes, strCookie, cCookieStrBytes); @@ -1188,11 +1174,10 @@ CustomMarshalerHelper *EEMarshalingData::GetCustomMarshalerHelper(Assembly *pAss CustomMarshalerHelper* pNewCMHelper = NULL; NewHolder<CustomMarshalerInfo> pNewCMInfo(NULL); - BOOL bSharedHelper = pAssembly->IsDomainNeutral(); TypeHandle hndCustomMarshalerType; // Create the key that will be used to lookup in the hashtable. - EECMHelperHashtableKey Key(cMarshalerTypeNameBytes, strMarshalerTypeName, cCookieStrBytes, strCookie, hndManagedType.GetInstantiation(), bSharedHelper); + EECMHelperHashtableKey Key(cMarshalerTypeNameBytes, strMarshalerTypeName, cCookieStrBytes, strCookie, hndManagedType.GetInstantiation()); // Lookup the custom marshaler helper in the hashtable. if (m_CMHelperHashtable.GetValue(&Key, (HashDatum*)&pCMHelper)) @@ -1223,19 +1208,11 @@ CustomMarshalerHelper *EEMarshalingData::GetCustomMarshalerHelper(Assembly *pAss pAssembly = NULL; - if (bSharedHelper) - { - // Create the custom marshaler helper in the specified heap. - pNewCMHelper = new (m_pHeap) SharedCustomMarshalerHelper(pAssembly, hndManagedType, strMarshalerTypeName, cMarshalerTypeNameBytes, strCookie, cCookieStrBytes); - } - else - { - // Create the custom marshaler info in the specified heap. - pNewCMInfo = new (m_pHeap) CustomMarshalerInfo(m_pDomain, hndCustomMarshalerType, hndManagedType, strCookie, cCookieStrBytes); + // Create the custom marshaler info in the specified heap. + pNewCMInfo = new (m_pHeap) CustomMarshalerInfo(m_pDomain, hndCustomMarshalerType, hndManagedType, strCookie, cCookieStrBytes); - // Create the custom marshaler helper in the specified heap. - pNewCMHelper = new (m_pHeap) NonSharedCustomMarshalerHelper(pNewCMInfo); - } + // Create the custom marshaler helper in the specified heap. + pNewCMHelper = new (m_pHeap) NonSharedCustomMarshalerHelper(pNewCMInfo); } // Take the app domain lock before we insert the custom marshaler info into the hashtable. diff --git a/src/vm/object.cpp b/src/vm/object.cpp index 0d0d2de1a3..d497b59c12 100644 --- a/src/vm/object.cpp +++ b/src/vm/object.cpp @@ -326,27 +326,21 @@ void Object::SetAppDomain(AppDomain *pDomain) CONTRACTL_END; #ifndef _DEBUG - if (!GetMethodTable()->IsDomainNeutral()) - { - // - // If we have a per-app-domain method table, we can - // infer the app domain from the method table, so - // there is no reason to mark the object. - // - // But we don't do this in a debug build, because - // we want to be able to detect the case when the - // domain was unloaded from underneath an object (and - // the MethodTable will be toast in that case.) - // - - _ASSERTE(pDomain == GetMethodTable()->GetDomain()); - } - else + // + // If we have a per-app-domain method table, we can + // infer the app domain from the method table, so + // there is no reason to mark the object. + // + // But we don't do this in a debug build, because + // we want to be able to detect the case when the + // domain was unloaded from underneath an object (and + // the MethodTable will be toast in that case.) + // + _ASSERTE(pDomain == GetMethodTable()->GetDomain()); +#else + ADIndex index = pDomain->GetIndex(); + GetHeader()->SetAppDomainIndex(index); #endif - { - ADIndex index = pDomain->GetIndex(); - GetHeader()->SetAppDomainIndex(index); - } _ASSERTE(GetHeader()->GetAppDomainIndex().m_dwIndex != 0); } @@ -388,8 +382,7 @@ AppDomain *Object::GetAppDomain() } CONTRACTL_END; #ifndef _DEBUG - if (!GetMethodTable()->IsDomainNeutral()) - return (AppDomain*) GetMethodTable()->GetDomain(); + return (AppDomain*) GetMethodTable()->GetDomain(); #endif ADIndex index = GetHeader()->GetAppDomainIndex(); diff --git a/src/vm/object.inl b/src/vm/object.inl index dd167d806c..c9b7abd9b0 100644 --- a/src/vm/object.inl +++ b/src/vm/object.inl @@ -27,10 +27,9 @@ inline ADIndex Object::GetAppDomainIndex() WRAPPER_NO_CONTRACT; #ifndef _DEBUG // ok to cast to AppDomain because we know it's a real AppDomain if it's not shared - if (!GetGCSafeMethodTable()->IsDomainNeutral()) - return (dac_cast<PTR_AppDomain>(GetGCSafeMethodTable()->GetDomain())->GetIndex()); + return (dac_cast<PTR_AppDomain>(GetGCSafeMethodTable()->GetDomain())->GetIndex()); #endif - return GetHeader()->GetAppDomainIndex(); + return GetHeader()->GetAppDomainIndex(); } inline DWORD Object::GetNumComponents() diff --git a/src/vm/profilingenumerators.cpp b/src/vm/profilingenumerators.cpp index b0f0c1ac21..14305bdd5d 100644 --- a/src/vm/profilingenumerators.cpp +++ b/src/vm/profilingenumerators.cpp @@ -282,12 +282,6 @@ HRESULT IterateUnsharedModules(AppDomain * pAppDomain, _ASSERTE(pDomainAssembly != NULL); _ASSERTE(pDomainAssembly->GetAssembly() != NULL); - // We're only adding unshared assemblies / modules - if (pDomainAssembly->GetAssembly()->IsDomainNeutral()) - { - continue; - } - // #ProfilerEnumModules (See also code:#ProfilerEnumGeneral) // // When enumerating modules, ensure this timeline: diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp index 09dd119de4..d2d2180cd2 100644 --- a/src/vm/reflectioninvocation.cpp +++ b/src/vm/reflectioninvocation.cpp @@ -731,10 +731,6 @@ static BOOL IsActivationNeededForMethodInvoke(MethodDesc * pMD) if (!pMD->IsStatic() && !pMD->HasMethodInstantiation() && !pMD->IsInterface()) return FALSE; - // We need to activate each time for domain neutral types - if (pMD->IsDomainNeutral()) - return TRUE; - // We need to activate the instance at least once pMD->EnsureActive(); return FALSE; diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp index 47922c2277..98742c945f 100644 --- a/src/vm/syncblk.cpp +++ b/src/vm/syncblk.cpp @@ -2591,18 +2591,11 @@ BOOL ObjHeader::Validate (BOOL bVerifySyncBlkIndex) //but thread ID doesn't have to be valid because the lock could be orphanend ASSERT_AND_CHECK (lockThreadId != 0 || recursionLevel == 0 ); +#ifndef _DEBUG DWORD adIndex = (bits >> SBLK_APPDOMAIN_SHIFT) & SBLK_MASK_APPDOMAININDEX; - if (adIndex!= 0) - { -#ifndef _DEBUG - //in non debug build, only objects of domain neutral type have appdomain index in header - ASSERT_AND_CHECK (obj->GetGCSafeMethodTable()->IsDomainNeutral()); + //in non debug build, objects do not have appdomain index in header + ASSERT_AND_CHECK (adIndex == 0); #endif //!_DEBUG - //todo: validate the AD index. - //The trick here is agile objects could have a invalid AD index. Ideally we should call - //Object::GetAppDomain to do all the agile validation but it has side effects like mark the object to - //be agile and it only does the check if g_pConfig->AppDomainLeaks() is on - } } return TRUE; diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index fbd917186f..ec383ecd62 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -1540,13 +1540,6 @@ Thread::Thread() m_State = (ThreadState) (m_State | TS_GCOnTransitions); } - //m_pSharedStaticData = NULL; - //m_pUnsharedStaticData = NULL; - //m_pStaticDataHash = NULL; - //m_pSDHCrst = NULL; - - m_fSecurityStackwalk = FALSE; - m_AbortType = EEPolicy::TA_None; m_AbortInfo = 0; m_AbortEndTime = MAXULONGLONG; diff --git a/src/vm/threads.h b/src/vm/threads.h index c57d8487e5..630a21eb21 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -2482,19 +2482,6 @@ public: // ClearContext are to be called only during shutdown void ClearContext(); - // Used by security to prevent recursive stackwalking. - BOOL IsSecurityStackwalkInProgess() - { - LIMITED_METHOD_CONTRACT; - return m_fSecurityStackwalk; - } - - void SetSecurityStackwalkInProgress(BOOL fSecurityStackwalk) - { - LIMITED_METHOD_CONTRACT; - m_fSecurityStackwalk = fSecurityStackwalk; - } - private: void ReturnToContextAndThrow(ContextTransitionFrame* pFrame, EEException* pEx, BOOL* pContextSwitched); void ReturnToContextAndOOM(ContextTransitionFrame* pFrame); @@ -2503,8 +2490,6 @@ private: // don't ever call these except when creating thread!!!!! void InitContext(); - BOOL m_fSecurityStackwalk; - public: PTR_AppDomain GetDomain(INDEBUG(BOOL fMidContextTransitionOK = FALSE)) { @@ -2516,9 +2501,6 @@ public: Frame *IsRunningIn(AppDomain* pDomain, int *count); Frame *GetFirstTransitionInto(AppDomain *pDomain, int *count); - // Get outermost (oldest) AppDomain for this thread. - AppDomain *GetInitialDomain(); - //--------------------------------------------------------------- // Track use of the thread block. See the general comments on // thread destruction in threads.cpp, for details. diff --git a/src/vm/typedesc.h b/src/vm/typedesc.h index f901f523d8..06b544b79c 100644 --- a/src/vm/typedesc.h +++ b/src/vm/typedesc.h @@ -201,7 +201,6 @@ public: // i.e. are domain-bound. If any of the parts are domain-bound // then they will all belong to the same domain. PTR_BaseDomain GetDomain(); - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } PTR_LoaderAllocator GetLoaderAllocator() { diff --git a/src/vm/typehandle.h b/src/vm/typehandle.h index 15b99ca18c..f704c3e487 100644 --- a/src/vm/typehandle.h +++ b/src/vm/typehandle.h @@ -470,8 +470,6 @@ public: PTR_LoaderAllocator GetLoaderAllocator() const; - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } - // Get the class token, assuming the type handle represents a named type, // i.e. a class, a value type, a generic instantiation etc. inline mdTypeDef GetCl() const; diff --git a/src/vm/typeparse.cpp b/src/vm/typeparse.cpp index a6190dd668..dd7ce535de 100644 --- a/src/vm/typeparse.cpp +++ b/src/vm/typeparse.cpp @@ -1823,7 +1823,7 @@ DomainAssembly * LoadDomainAssembly( { spec.SetHostBinder(pPrivHostBinder); } - else if (pRequestingAssembly && (!pRequestingAssembly->IsDomainNeutral()) && (!pRequestingAssembly->IsCollectible())) + else if (pRequestingAssembly && (!pRequestingAssembly->IsCollectible())) { GCX_PREEMP(); spec.SetParentAssembly(pRequestingAssembly->GetDomainAssembly()); |