From: Jan Kotas Date: Tue, 27 Nov 2018 01:55:10 +0000 (-0800) Subject: Disable domain neutral loading (dotnet/coreclr#21156) X-Git-Tag: submit/tizen/20210909.063632~11030^2~3249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f117f041d8dbde0abad6fa7fcb224c7a19e77066;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Disable domain neutral loading (dotnet/coreclr#21156) Commit migrated from https://github.com/dotnet/coreclr/commit/c928bf4f3cf411bc775d5ec5098a122eada48ba9 --- diff --git a/src/coreclr/src/vm/appdomain.cpp b/src/coreclr/src/vm/appdomain.cpp index 8516f29..ce57ee0 100644 --- a/src/coreclr/src/vm/appdomain.cpp +++ b/src/coreclr/src/vm/appdomain.cpp @@ -2971,17 +2971,6 @@ void SystemDomain::SetThreadAptState (Thread::ApartmentState state) } #endif // defined(FEATURE_COMINTEROP_APARTMENT_SUPPORT) && !defined(CROSSGEN_COMPILE) -// Looks in all the modules for the DefaultDomain attribute -// The order is assembly and then the modules. It is first -// come, first serve. -BOOL SystemDomain::SetGlobalSharePolicyUsingAttribute(IMDInternalImport* pScope, mdMethodDef mdMethod) -{ - STANDARD_VM_CONTRACT; - - - return FALSE; -} - // Helper function to load an assembly. This is called from LoadCOMClass. /* static */ @@ -3665,12 +3654,6 @@ AppDomain::AppDomain() m_cRef=1; - // Initialize Shared state. Assemblies are loaded - // into each domain by default. -#ifdef FEATURE_LOADER_OPTIMIZATION - m_SharePolicy = SHARE_POLICY_UNSPECIFIED; -#endif - m_pRootAssembly = NULL; m_pwDynamicDir = NULL; @@ -5563,12 +5546,6 @@ DomainFile *AppDomain::LoadDomainNeutralModuleDependency(Module *pModule, FileLo RETURN pDomainFile; } -AppDomain::SharePolicy AppDomain::GetSharePolicy() -{ - LIMITED_METHOD_CONTRACT; - - return SHARE_POLICY_NEVER; -} #endif // FEATURE_LOADER_OPTIMIZATION @@ -7800,12 +7777,7 @@ BOOL SharedDomain::CompareSharedAssembly(UPTR u1, UPTR u2) // This is the value stored in the table Assembly *pAssembly = (Assembly *) u2; if (pLocator->GetType()==SharedAssemblyLocator::DOMAINASSEMBLY) - { - if (!pAssembly->GetManifestFile()->Equals(pLocator->GetDomainAssembly()->GetFile())) - return FALSE; - - return pAssembly->CanBeShared(pLocator->GetDomainAssembly()); - } + return FALSE; else if (pLocator->GetType()==SharedAssemblyLocator::PEASSEMBLY) return pAssembly->GetManifestFile()->Equals(pLocator->GetPEAssembly()); diff --git a/src/coreclr/src/vm/appdomain.hpp b/src/coreclr/src/vm/appdomain.hpp index 3c60748..fd28316 100644 --- a/src/coreclr/src/vm/appdomain.hpp +++ b/src/coreclr/src/vm/appdomain.hpp @@ -2355,26 +2355,6 @@ public: BOOL ContainsAssembly(Assembly * assem); -#ifdef FEATURE_LOADER_OPTIMIZATION - enum SharePolicy - { - // Attributes to control when to use domain neutral assemblies - SHARE_POLICY_UNSPECIFIED, // Use the current default policy (LoaderOptimization.NotSpecified) - SHARE_POLICY_NEVER, // Do not share anything, except the system assembly (LoaderOptimization.SingleDomain) - SHARE_POLICY_ALWAYS, // Share everything possible (LoaderOptimization.MultiDomain) - SHARE_POLICY_GAC, // Share only GAC-bound assemblies (LoaderOptimization.MultiDomainHost) - - SHARE_POLICY_COUNT, - SHARE_POLICY_MASK = 0x3, - - // NOTE that previously defined was a bit 0x40 which might be set on this value - // in custom attributes. - SHARE_POLICY_DEFAULT = SHARE_POLICY_NEVER, - }; - - SharePolicy GetSharePolicy(); -#endif // FEATURE_LOADER_OPTIMIZATION - //**************************************************************************************** // // Reference count. When an appdomain is first created the reference is bump @@ -3304,15 +3284,6 @@ private: OBJECTHANDLE m_ExposedObject; -#ifdef FEATURE_LOADER_OPTIMIZATION - // Indicates where assemblies will be loaded for - // this domain. By default all assemblies are loaded into the domain. - // There are two additional settings, all - // assemblies can be loaded into the shared domain or assemblies - // that are strong named are loaded into the shared area. - SharePolicy m_SharePolicy; -#endif - IUnknown *m_pComIPForExposedObject; // Hash table that maps a clsid to a type @@ -3918,8 +3889,6 @@ public: static Thread::ApartmentState GetEntryPointThreadAptState(IMDInternalImport* pScope, mdMethodDef mdMethod); static void SetThreadAptState(Thread::ApartmentState state); #endif - static BOOL SetGlobalSharePolicyUsingAttribute(IMDInternalImport* pScope, mdMethodDef mdMethod); - //**************************************************************************************** // diff --git a/src/coreclr/src/vm/assembly.cpp b/src/coreclr/src/vm/assembly.cpp index 0f12539..d263e37 100644 --- a/src/coreclr/src/vm/assembly.cpp +++ b/src/coreclr/src/vm/assembly.cpp @@ -121,7 +121,6 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pFile, DebuggerAssemblyContr m_winMDStatus(WinMDStatus_Unknown), m_pManifestWinMDImport(NULL), #endif // FEATURE_COMINTEROP - m_fIsDomainNeutral(pDomain == SharedDomain::GetDomain()), m_debuggerFlags(debuggerFlags), m_fTerminated(FALSE) #ifdef FEATURE_COMINTEROP @@ -2131,39 +2130,6 @@ GetAssembliesByName(LPCWSTR szAppBase, return hr; }// Used by the IMetadata API's to access an assemblies metadata. -#ifdef FEATURE_LOADER_OPTIMIZATION - -BOOL Assembly::CanBeShared(DomainAssembly *pDomainAssembly) -{ - PTR_PEAssembly pFile=pDomainAssembly->GetFile(); - - if(pFile == NULL) - return FALSE; - - if(pFile->IsDynamic()) - return FALSE; - - if(IsSystem() && pFile->IsSystem()) - return TRUE; - - if ((pDomainAssembly->GetDebuggerInfoBits()&~(DACF_PDBS_COPIED|DACF_IGNORE_PDBS|DACF_OBSOLETE_TRACK_JIT_INFO)) - != (m_debuggerFlags&~(DACF_PDBS_COPIED|DACF_IGNORE_PDBS|DACF_OBSOLETE_TRACK_JIT_INFO))) - { - LOG((LF_CODESHARING, - LL_INFO100, - "We can't share it, desired debugging flags %x are different than %x\n", - pDomainAssembly->GetDebuggerInfoBits(), (m_debuggerFlags&~(DACF_PDBS_COPIED|DACF_IGNORE_PDBS|DACF_OBSOLETE_TRACK_JIT_INFO)))); - STRESS_LOG2(LF_CODESHARING, LL_INFO100,"Flags diff= %08x [%08x/%08x]",pDomainAssembly->GetDebuggerInfoBits(), - m_debuggerFlags); - return FALSE; - } - - return TRUE; -} - - -#endif // FEATURE_LOADER_OPTIMIZATION - void DECLSPEC_NORETURN Assembly::ThrowTypeLoadException(LPCUTF8 pszFullName, UINT resIDWhy) { WRAPPER_NO_CONTRACT; diff --git a/src/coreclr/src/vm/assembly.hpp b/src/coreclr/src/vm/assembly.hpp index d55d31e..83d7ee6 100644 --- a/src/coreclr/src/vm/assembly.hpp +++ b/src/coreclr/src/vm/assembly.hpp @@ -448,10 +448,7 @@ public: OBJECTHANDLE GetLoaderAllocatorObjectHandle() { WRAPPER_NO_CONTRACT; return GetLoaderAllocator()->GetLoaderAllocatorObjectHandle(); } #endif // FEATURE_COLLECTIBLE_TYPES - BOOL CanBeShared(DomainAssembly *pAsAssembly); - - void SetDomainNeutral() { LIMITED_METHOD_CONTRACT; m_fIsDomainNeutral = TRUE; } - BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return m_fIsDomainNeutral; } + BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } BOOL IsSIMDVectorAssembly() { LIMITED_METHOD_DAC_CONTRACT; return m_fIsSIMDVectorAssembly; } @@ -615,8 +612,6 @@ private: IWinMDImport *m_pManifestWinMDImport; #endif // FEATURE_COMINTEROP - BOOL m_fIsDomainNeutral; - DebuggerAssemblyControlFlags m_debuggerFlags; BOOL m_fTerminated; diff --git a/src/coreclr/src/vm/ceeload.cpp b/src/coreclr/src/vm/ceeload.cpp index bebd400..9124013 100644 --- a/src/coreclr/src/vm/ceeload.cpp +++ b/src/coreclr/src/vm/ceeload.cpp @@ -4078,7 +4078,7 @@ ILStubCache* Module::GetILStubCache() // Use per-AD cache for domain specific modules when not NGENing BaseDomain *pDomain = GetDomain(); - if (!pDomain->IsSharedDomain() && !pDomain->AsAppDomain()->IsCompilationDomain()) + if (!IsSystem() && !pDomain->IsSharedDomain() && !pDomain->AsAppDomain()->IsCompilationDomain()) return pDomain->AsAppDomain()->GetILStubCache(); if (m_pILStubCache == NULL) diff --git a/src/coreclr/src/vm/domainfile.cpp b/src/coreclr/src/vm/domainfile.cpp index a5b7a77..8f19137 100644 --- a/src/coreclr/src/vm/domainfile.cpp +++ b/src/coreclr/src/vm/domainfile.cpp @@ -1452,8 +1452,6 @@ DomainAssembly::DomainAssembly(AppDomain *pDomain, PEFile *pFile, LoaderAllocato m_fDebuggerUnloadStarted(FALSE), m_fCollectible(pLoaderAllocator->IsCollectible()), m_fHostAssemblyPublished(false), - m_fCalculatedShouldLoadDomainNeutral(false), - m_fShouldLoadDomainNeutral(false), m_pLoaderAllocator(pLoaderAllocator), m_NextDomainAssemblyInSameALC(NULL) { @@ -1790,18 +1788,13 @@ void DomainAssembly::FindNativeImage() Module * pNativeModule = pNativeImage->GetLoadedLayout()->GetPersistedModuleImage(); EnsureWritablePages(pNativeModule); PEFile ** ppNativeFile = (PEFile **) (PBYTE(pNativeModule) + Module::GetFileOffset()); - BOOL bExpectedToBeShared= ShouldLoadDomainNeutral(); - if (!bExpectedToBeShared) - { - GetFile()->SetNativeImageUsedExclusively(); - } + GetFile()->SetNativeImageUsedExclusively(); PEAssembly * pFile = (PEAssembly *)FastInterlockCompareExchangePointer((void **)ppNativeFile, (void *)GetFile(), (void *)NULL); STRESS_LOG3(LF_ZAP,LL_INFO100,"Attempted to set new native file %p, old file was %p, location in the image=%p\n",GetFile(),pFile,ppNativeFile); if (pFile!=NULL && !IsSystem() && - ( !bExpectedToBeShared || - pFile == PEFile::Dummy() || + ( pFile == PEFile::Dummy() || pFile->IsNativeImageUsedExclusively() || !(GetFile()->GetPath().Equals(pFile->GetPath()))) @@ -1858,63 +1851,6 @@ void DomainAssembly::FindNativeImage() } #endif // FEATURE_PREJIT -BOOL DomainAssembly::ShouldLoadDomainNeutral() -{ - STANDARD_VM_CONTRACT; - - if (m_fCalculatedShouldLoadDomainNeutral) - return m_fShouldLoadDomainNeutral; - - m_fShouldLoadDomainNeutral = !!ShouldLoadDomainNeutralHelper(); - m_fCalculatedShouldLoadDomainNeutral = true; - - return m_fShouldLoadDomainNeutral; -} - -BOOL DomainAssembly::ShouldLoadDomainNeutralHelper() -{ - STANDARD_VM_CONTRACT; - -#ifdef FEATURE_LOADER_OPTIMIZATION - - - if (IsSystem()) - return TRUE; - - if (IsSingleAppDomain()) - return FALSE; - - if (GetFile()->IsDynamic()) - return FALSE; - -#ifdef FEATURE_COMINTEROP - if (GetFile()->IsWindowsRuntime()) - return FALSE; -#endif - - switch(this->GetAppDomain()->GetSharePolicy()) { - case AppDomain::SHARE_POLICY_ALWAYS: - return TRUE; - - case AppDomain::SHARE_POLICY_GAC: - return IsSystem(); - - case AppDomain::SHARE_POLICY_NEVER: - return FALSE; - - case AppDomain::SHARE_POLICY_UNSPECIFIED: - case AppDomain::SHARE_POLICY_COUNT: - break; - } - - return FALSE; // No meaning in doing costly closure walk for CoreCLR. - - -#else // FEATURE_LOADER_OPTIMIZATION - return IsSystem(); -#endif // FEATURE_LOADER_OPTIMIZATION -} - // This is where the decision whether an assembly is DomainNeutral (shared) nor not is made. void DomainAssembly::Allocate() { @@ -1936,97 +1872,13 @@ void DomainAssembly::Allocate() //! If you decide to remove "if" do not remove this brace: order is important here - in the case of an exception, //! the Assembly holder must destruct before the AllocMemTracker declared above. - NewHolder assemblyHolder(NULL); - - // Determine whether we are supposed to load the assembly as a shared - // assembly or into the app domain. - if (ShouldLoadDomainNeutral()) - { - -#ifdef FEATURE_LOADER_OPTIMIZATION - - - // Try to find an existing shared version of the assembly which - // is compatible with our domain. - - SharedDomain * pSharedDomain = SharedDomain::GetDomain(); + // We can now rely on the fact that our MDImport will not change so we can stop refcounting it. + GetFile()->MakeMDImportPersistent(); - SIZE_T nInitialShareableAssemblyCount = pSharedDomain->GetShareableAssemblyCount(); - DWORD dwSwitchCount = 0; - - SharedFileLockHolder pFileLock(pSharedDomain, GetFile(), FALSE); - - if (IsSystem()) - { - pAssembly=SystemDomain::SystemAssembly(); - } - else - { - SharedAssemblyLocator locator(this); - pAssembly = pSharedDomain->FindShareableAssembly(&locator); - - if (pAssembly == NULL) - { - pFileLock.Acquire(); - pAssembly = pSharedDomain->FindShareableAssembly(&locator); - } - } - - if (pAssembly == NULL) - { - - // We can now rely on the fact that our MDImport will not change so we can stop refcounting it. - GetFile()->MakeMDImportPersistent(); - - // Go ahead and create new shared version of the assembly if possible - // We will need to pass a valid OBJECREF* here in the future when we implement SCU - assemblyHolder = pAssembly = Assembly::Create(pSharedDomain, GetFile(), GetDebuggerInfoBits(), this->IsCollectible(), pamTracker, this->IsCollectible() ? this->GetLoaderAllocator() : NULL); - - // Compute the closure assembly dependencies - // of the code & layout of given assembly. - // - // An assembly has direct dependencies listed in its manifest. - // - // We do not in general also have all of those dependencies' dependencies in the manifest. - // After all, we may be only using a small portion of the assembly. - // - // However, since all dependent assemblies must also be shared (so that - // the shared data in this assembly can refer to it), we are in - // effect forced to behave as though we do have all of their dependencies. - // This is because the resulting shared assembly that we will depend on - // DOES have those dependencies, but we won't be able to validly share that - // assembly unless we match all of ITS dependencies, too. - // Sets the tenured bit atomically with the hash insert. - pSharedDomain->AddShareableAssembly(pAssembly); - } -#else // FEATURE_LOADER_OPTIMIZATION - _ASSERTE(IsSystem()); - if (SystemDomain::SystemAssembly()) - { - pAssembly = SystemDomain::SystemAssembly(); - } - else - { - // We can now rely on the fact that our MDImport will not change so we can stop refcounting it. - GetFile()->MakeMDImportPersistent(); - - // We will need to pass a valid OBJECTREF* here in the future when we implement SCU - SharedDomain * pSharedDomain = SharedDomain::GetDomain(); - assemblyHolder = pAssembly = Assembly::Create(pSharedDomain, GetFile(), GetDebuggerInfoBits(), this->IsCollectible(), pamTracker, this->IsCollectible() ? this->GetLoaderAllocator() : NULL); - pAssembly->SetIsTenured(); - } -#endif // FEATURE_LOADER_OPTIMIZATION - } - else - { - // We can now rely on the fact that our MDImport will not change so we can stop refcounting it. - GetFile()->MakeMDImportPersistent(); - - // We will need to pass a valid OBJECTREF* here in the future when we implement SCU - assemblyHolder = pAssembly = Assembly::Create(m_pDomain, GetFile(), GetDebuggerInfoBits(), this->IsCollectible(), pamTracker, this->IsCollectible() ? this->GetLoaderAllocator() : NULL); - assemblyHolder->SetIsTenured(); - } + NewHolder assemblyHolder(NULL); + assemblyHolder = pAssembly = Assembly::Create(m_pDomain, GetFile(), GetDebuggerInfoBits(), this->IsCollectible(), pamTracker, this->IsCollectible() ? this->GetLoaderAllocator() : NULL); + assemblyHolder->SetIsTenured(); //@todo! This is too early to be calling SuppressRelease. The right place to call it is below after // the CANNOTTHROWCOMPLUSEXCEPTION. Right now, we have to do this to unblock OOM injection testing quickly diff --git a/src/coreclr/src/vm/domainfile.h b/src/coreclr/src/vm/domainfile.h index 5870651..9673c65 100644 --- a/src/coreclr/src/vm/domainfile.h +++ b/src/coreclr/src/vm/domainfile.h @@ -761,11 +761,6 @@ private: public: ULONG HashIdentity(); - private: - - BOOL ShouldLoadDomainNeutral(); - BOOL ShouldLoadDomainNeutralHelper(); - // ------------------------------------------------------------ // Instance data // ------------------------------------------------------------ @@ -779,8 +774,6 @@ private: BOOL m_fDebuggerUnloadStarted; BOOL m_fCollectible; Volatile m_fHostAssemblyPublished; - Volatile m_fCalculatedShouldLoadDomainNeutral; - Volatile m_fShouldLoadDomainNeutral; PTR_LoaderAllocator m_pLoaderAllocator; DomainAssembly* m_NextDomainAssemblyInSameALC; diff --git a/src/coreclr/src/vm/eventtrace.cpp b/src/coreclr/src/vm/eventtrace.cpp index 59925f3..7528322 100644 --- a/src/coreclr/src/vm/eventtrace.cpp +++ b/src/coreclr/src/vm/eventtrace.cpp @@ -5637,7 +5637,7 @@ VOID ETW::LoaderLog::SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptio BOOL bIsAppDomain = pBaseDomain->IsAppDomain(); BOOL bIsExecutable = bIsAppDomain ? !(pBaseDomain->AsAppDomain()->IsPassiveDomain()) : FALSE; BOOL bIsSharedDomain = pBaseDomain->IsSharedDomain(); - UINT32 uSharingPolicy = bIsAppDomain?(pBaseDomain->AsAppDomain()->GetSharePolicy()):0; + UINT32 uSharingPolicy = 0; ULONGLONG ullDomainId = (ULONGLONG)pBaseDomain; ULONG ulDomainFlags = ((bIsDefaultDomain ? ETW::LoaderLog::LoaderStructs::DefaultDomain : 0) | diff --git a/src/coreclr/src/vm/ilstubcache.cpp b/src/coreclr/src/vm/ilstubcache.cpp index 4e5ce12..93eb330 100644 --- a/src/coreclr/src/vm/ilstubcache.cpp +++ b/src/coreclr/src/vm/ilstubcache.cpp @@ -337,7 +337,7 @@ MethodTable* ILStubCache::GetOrCreateStubMethodTable(Module* pModule) CONTRACT_END; #ifdef _DEBUG - if (pModule->GetDomain()->IsSharedDomain() || pModule->GetDomain()->AsAppDomain()->IsCompilationDomain()) + if (pModule->IsSystem() || pModule->GetDomain()->IsSharedDomain() || pModule->GetDomain()->AsAppDomain()->IsCompilationDomain()) { // in the shared domain and compilation AD we are associated with the module CONSISTENCY_CHECK(pModule->GetILStubCache() == this); diff --git a/src/coreclr/src/vm/loaderallocator.cpp b/src/coreclr/src/vm/loaderallocator.cpp index fd065e5..d9af299 100644 --- a/src/coreclr/src/vm/loaderallocator.cpp +++ b/src/coreclr/src/vm/loaderallocator.cpp @@ -1604,18 +1604,6 @@ BOOL AssemblyLoaderAllocator::CanUnload() return TRUE; } -BOOL LoaderAllocator::IsDomainNeutral() -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - SO_TOLERANT; - } CONTRACTL_END; - - return GetDomain()->IsSharedDomain(); -} - DomainAssemblyIterator::DomainAssemblyIterator(DomainAssembly* pFirstAssembly) { pCurrentAssembly = pFirstAssembly; diff --git a/src/coreclr/src/vm/loaderallocator.hpp b/src/coreclr/src/vm/loaderallocator.hpp index beaa3e8..c560c14 100644 --- a/src/coreclr/src/vm/loaderallocator.hpp +++ b/src/coreclr/src/vm/loaderallocator.hpp @@ -469,7 +469,7 @@ public: virtual ~LoaderAllocator(); BaseDomain *GetDomain() { LIMITED_METHOD_CONTRACT; return m_pDomain; } virtual BOOL CanUnload() = 0; - BOOL IsDomainNeutral(); + BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } void Init(BaseDomain *pDomain, BYTE *pExecutableHeapMemory = NULL); void Terminate(); virtual void ReleaseManagedAssemblyLoadContext() {} diff --git a/src/coreclr/src/vm/method.hpp b/src/coreclr/src/vm/method.hpp index fe55217..529064d 100644 --- a/src/coreclr/src/vm/method.hpp +++ b/src/coreclr/src/vm/method.hpp @@ -508,7 +508,7 @@ public: // and the loader allocator in the current domain for non-collectable types LoaderAllocator * GetDomainSpecificLoaderAllocator(); - inline BOOL IsDomainNeutral(); + BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } Module* GetLoaderModule(); diff --git a/src/coreclr/src/vm/method.inl b/src/coreclr/src/vm/method.inl index 88491f5..ca9a17a 100644 --- a/src/coreclr/src/vm/method.inl +++ b/src/coreclr/src/vm/method.inl @@ -22,12 +22,6 @@ inline InstantiatedMethodDesc* MethodDesc::AsInstantiatedMethodDesc() const return dac_cast(this); } -inline BOOL MethodDesc::IsDomainNeutral() -{ - WRAPPER_NO_CONTRACT; - return !IsLCGMethod() && GetDomain()->IsSharedDomain(); -} - inline BOOL MethodDesc::IsZapped() { WRAPPER_NO_CONTRACT; diff --git a/src/coreclr/src/vm/methodtable.cpp b/src/coreclr/src/vm/methodtable.cpp index 7491bfd..7b1974c 100644 --- a/src/coreclr/src/vm/methodtable.cpp +++ b/src/coreclr/src/vm/methodtable.cpp @@ -649,23 +649,6 @@ PTR_BaseDomain MethodTable::GetDomain() } //========================================================================================== -BOOL MethodTable::IsDomainNeutral() -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_SUPPORTS_DAC; - - BOOL ret = GetLoaderModule()->GetAssembly()->IsDomainNeutral(); -#ifndef DACCESS_COMPILE - _ASSERTE(!ret == !GetLoaderAllocator()->IsDomainNeutral()); -#endif - - return ret; -} - -//========================================================================================== BOOL MethodTable::HasSameTypeDefAs(MethodTable *pMT) { LIMITED_METHOD_DAC_CONTRACT; diff --git a/src/coreclr/src/vm/methodtable.h b/src/coreclr/src/vm/methodtable.h index 557c2fb..b0dc5e7 100644 --- a/src/coreclr/src/vm/methodtable.h +++ b/src/coreclr/src/vm/methodtable.h @@ -700,7 +700,7 @@ public: #endif // Return whether the type lives in the shared domain. - BOOL IsDomainNeutral(); + BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } MethodTable *LoadEnclosingMethodTable(ClassLoadLevel targetLevel = CLASS_DEPENDENCIES_LOADED); diff --git a/src/coreclr/src/vm/typedesc.cpp b/src/coreclr/src/vm/typedesc.cpp index 1b3d5f5..d547905 100644 --- a/src/coreclr/src/vm/typedesc.cpp +++ b/src/coreclr/src/vm/typedesc.cpp @@ -189,19 +189,6 @@ PTR_Module TypeDesc::GetModule() { return GetLoaderModule(); } -BOOL TypeDesc::IsDomainNeutral() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - FORBID_FAULT; - } - CONTRACTL_END - - return GetDomain()->IsSharedDomain(); -} - BOOL ParamTypeDesc::OwnsTemplateMethodTable() { CONTRACTL diff --git a/src/coreclr/src/vm/typedesc.h b/src/coreclr/src/vm/typedesc.h index 81cc340..f901f52 100644 --- a/src/coreclr/src/vm/typedesc.h +++ b/src/coreclr/src/vm/typedesc.h @@ -201,7 +201,7 @@ 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(); + BOOL IsDomainNeutral() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; } PTR_LoaderAllocator GetLoaderAllocator() { diff --git a/src/coreclr/src/vm/typehandle.cpp b/src/coreclr/src/vm/typehandle.cpp index 1d34f07..5004ab9 100644 --- a/src/coreclr/src/vm/typehandle.cpp +++ b/src/coreclr/src/vm/typehandle.cpp @@ -1364,16 +1364,6 @@ CorElementType TypeHandle::GetInternalCorElementType() const return AsMethodTable()->GetInternalCorElementType(); } -BOOL TypeHandle::IsDomainNeutral() const -{ - LIMITED_METHOD_CONTRACT; - - if (IsTypeDesc()) - return AsTypeDesc()->IsDomainNeutral(); - else - return AsMethodTable()->IsDomainNeutral(); -} - BOOL TypeHandle::HasInstantiation() const { LIMITED_METHOD_DAC_CONTRACT; diff --git a/src/coreclr/src/vm/typehandle.h b/src/coreclr/src/vm/typehandle.h index 3ac1f30..15b99ca 100644 --- a/src/coreclr/src/vm/typehandle.h +++ b/src/coreclr/src/vm/typehandle.h @@ -470,7 +470,7 @@ public: PTR_LoaderAllocator GetLoaderAllocator() const; - BOOL IsDomainNeutral() 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.