diff options
-rw-r--r-- | src/vm/appdomain.cpp | 21 | ||||
-rw-r--r-- | src/vm/appdomain.hpp | 1 | ||||
-rw-r--r-- | src/vm/assemblynative.cpp | 4 | ||||
-rw-r--r-- | src/vm/assemblyspec.cpp | 26 | ||||
-rw-r--r-- | src/vm/assemblyspec.hpp | 15 |
5 files changed, 7 insertions, 60 deletions
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 0be5fd26d0..21161763ef 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -1175,27 +1175,6 @@ void AppDomain::ShutdownNativeDllSearchDirectories() m_NativeDllSearchDirectories.Clear(); } -void AppDomain::ReleaseDomainBoundInfo() -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END;; - // Shutdown assemblies - m_AssemblyCache.OnAppDomainUnload(); - - AssemblyIterator i = IterateAssembliesEx( (AssemblyIterationFlags)(kIncludeFailedToLoad) ); - CollectibleAssemblyHolder<DomainAssembly *> pDomainAssembly; - - while (i.Next(pDomainAssembly.This())) - { - pDomainAssembly->ReleaseManagedData(); - } -} - void AppDomain::ReleaseFiles() { STANDARD_VM_CONTRACT; diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index 90627d4d09..e6655246eb 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -1827,7 +1827,6 @@ public: void ShutdownAssemblies(); void ShutdownFreeLoaderAllocators(BOOL bFromManagedCode); - void ReleaseDomainBoundInfo(); void ReleaseFiles(); diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index d0f1418fe4..30ee95b35f 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -83,9 +83,7 @@ FCIMPL6(Object*, AssemblyNative::Load, AssemblyNameBaseObject* assemblyNameUNSAF pRefAssembly = gc.requestingAssembly->GetAssembly(); } - // Shared or collectible assemblies should not be used for the parent in the - // late-bound case. - if (pRefAssembly && (!pRefAssembly->IsCollectible())) + if (pRefAssembly) { pParentAssembly= pRefAssembly->GetDomainAssembly(); } diff --git a/src/vm/assemblyspec.cpp b/src/vm/assemblyspec.cpp index 85d26c6e4b..a2323afe6b 100644 --- a/src/vm/assemblyspec.cpp +++ b/src/vm/assemblyspec.cpp @@ -1223,27 +1223,6 @@ void AssemblySpecBindingCache::Clear() m_map.Clear(); } -void AssemblySpecBindingCache::OnAppDomainUnload() -{ - CONTRACTL - { - DESTRUCTOR_CHECK; - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - PtrHashMap::PtrIterator i = m_map.begin(); - while (!i.end()) - { - AssemblyBinding *b = (AssemblyBinding*) i.GetValue(); - b->OnAppDomainUnload(); - - ++i; - } -} - void AssemblySpecBindingCache::Init(CrstBase *pCrst, LoaderHeap *pHeap) { WRAPPER_NO_CONTRACT; @@ -1872,6 +1851,11 @@ VOID DomainAssemblyCache::InsertEntry(AssemblySpec* pSpec, LPVOID pData1, LPVOID pEntry->spec.CopyFrom(pSpec); pEntry->spec.CloneFieldsToLoaderHeap(AssemblySpec::ALL_OWNED, m_pDomain->GetLowFrequencyHeap(), pamTracker); + + // Clear the parent assembly, it is not needed for the AssemblySpec in the cache entry and it could contain stale + // pointer when the parent was a collectible assembly that was collected. + pEntry->spec.SetParentAssembly(NULL); + pEntry->pData[0] = pData1; pEntry->pData[1] = pData2; DWORD hashValue = pEntry->Hash(); diff --git a/src/vm/assemblyspec.hpp b/src/vm/assemblyspec.hpp index 2960aea95a..798f73c250 100644 --- a/src/vm/assemblyspec.hpp +++ b/src/vm/assemblyspec.hpp @@ -423,19 +423,8 @@ class AssemblySpecBindingCache delete m_pException; }; - void OnAppDomainUnload() - { - LIMITED_METHOD_CONTRACT; - if (m_exceptionType == EXTYPE_EE) - { - m_exceptionType = EXTYPE_NONE; - delete m_pException; - m_pException = NULL; - } - }; - inline DomainAssembly* GetAssembly(){ LIMITED_METHOD_CONTRACT; return m_pAssembly;}; - inline void SetAssembly(DomainAssembly* pAssembly){ LIMITED_METHOD_CONTRACT; m_pAssembly=pAssembly;}; + inline void SetAssembly(DomainAssembly* pAssembly){ LIMITED_METHOD_CONTRACT; m_pAssembly=pAssembly;}; inline PEAssembly* GetFile(){ LIMITED_METHOD_CONTRACT; return m_pFile;}; inline BOOL IsError(){ LIMITED_METHOD_CONTRACT; return (m_exceptionType!=EXTYPE_NONE);}; @@ -579,8 +568,6 @@ class AssemblySpecBindingCache void Init(CrstBase *pCrst, LoaderHeap *pHeap = NULL); void Clear(); - void OnAppDomainUnload(); - BOOL Contains(AssemblySpec *pSpec); DomainAssembly *LookupAssembly(AssemblySpec *pSpec, BOOL fThrow=TRUE); |