mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 15:55:04 -10:00
Remove IsNeutralDomain() (dotnet/coreclr#21318)
* Remove IsNeutralDomain() * PR feedback Commit migrated from https://github.com/dotnet/coreclr/commit/411f9787617f6bdc64c8393a51ac3b7a0d6e35f4
This commit is contained in:
1 parent
6f9ee3d88b
commit
03c2dd4c80
36 files changed
+129
-504
No files matched your search
@@ -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->GetDomainLocalModuleDataFromModule(pMT->Module, &vDomainLocalModule) != S_OK)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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 ", "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("%8s %" POINTERSIZE "s", "shared", "static");
|
||||
|
||||
NameForToken_s(TokenFromRid(vFieldDesc.mb, mdtFieldDef), pImport, g_mdName, mdNameLen, false);
|
||||
ExtOut(" %S\n", g_mdName);
|
||||
|
||||
if (IsMiniDumpFile())
|
||||
{
|
||||
ExtOut(" <no information>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
DacpModuleData vModule;
|
||||
if (vModule.Request(g_sos,pMTD->Module) == S_OK)
|
||||
{
|
||||
DisplaySharedStatic(vModule.dwModuleID, pMTD, &vFieldDesc);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
if (m_ModuleID != NULL)
|
||||
{
|
||||
// We do not recycle ModuleIndexes used by domain neutral Modules.
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in new issue
Block a user