From 3c066d8a5b8064158b77c407083ae980f0bf0be7 Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Sun, 6 Oct 2024 00:26:09 +0300 Subject: [PATCH] Move more helpers from DomainAssembly to Assembly --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 26 ++--- src/coreclr/debug/ee/debugger.cpp | 12 +-- src/coreclr/vm/appdomain.cpp | 4 +- src/coreclr/vm/appdomain.hpp | 4 +- src/coreclr/vm/assembly.cpp | 3 +- src/coreclr/vm/assembly.hpp | 25 ++--- src/coreclr/vm/assemblyspec.hpp | 37 +++++-- src/coreclr/vm/ceeload.cpp | 6 +- src/coreclr/vm/domainassembly.cpp | 41 +------- src/coreclr/vm/domainassembly.h | 120 +---------------------- src/coreclr/vm/eventtrace.cpp | 2 +- src/coreclr/vm/loaderallocator.cpp | 4 +- src/coreclr/vm/loaderallocator.inl | 2 +- 13 files changed, 77 insertions(+), 209 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 770e81a9480e14..4788dd322d2e1e 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -672,7 +672,7 @@ void DacDbiInterfaceImpl::GetCompilerFlags ( } // Get the underlying module - none of this is AppDomain specific - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); DWORD dwBits = pModule->GetDebuggerInfoBits(); *pfAllowJITOpts = !CORDisableJITOptimizations(dwBits); *pfEnableEnC = pModule->IsEditAndContinueEnabled(); @@ -721,7 +721,7 @@ HRESULT DacDbiInterfaceImpl::SetCompilerFlags(VMPTR_DomainAssembly vmDomainAssem DWORD dwBits = 0; DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); HRESULT hr = S_OK; @@ -821,7 +821,7 @@ SIZE_T DacDbiInterfaceImpl::GetArgCount(MethodDesc * pMD) return 0; } - MetaSig msig(pCallSig, cbCallSigSize, pMD->GetModule(), NULL, MetaSig::sigMember); + MetaSig msig(pCallSig, cbCallSigSize, pMD->GetAssembly()->GetModule(), NULL, MetaSig::sigMember); // Get the arg count. UINT32 NumArguments = msig.NumFixedArgs(); @@ -1019,7 +1019,7 @@ void DacDbiInterfaceImpl::GetSequencePoints(MethodDesc * pMethodDesc, #endif // if there is a profiler load-time mapping and not a rejit mapping, apply that instead InstrumentedILOffsetMapping loadTimeMapping = - pMethodDesc->GetModule()->GetInstrumentedILOffsetMapping(pMethodDesc->GetMemberDef()); + pMethodDesc->GetAssembly()->GetModule()->GetInstrumentedILOffsetMapping(pMethodDesc->GetMemberDef()); ComposeMapping(&loadTimeMapping, mapCopy, &entryCount); #ifdef FEATURE_REJIT } @@ -1091,7 +1091,7 @@ void DacDbiInterfaceImpl::GetILCodeAndSig(VMPTR_DomainAssembly vmDomainAssembly, DD_ENTER_MAY_THROW; DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); RVA methodRVA = 0; DWORD implFlags; @@ -1330,7 +1330,7 @@ void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainAssembly vmDomai pCodeInfo->Clear(); DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); MethodDesc* pMethodDesc = FindLoadedMethodRefOrDef(pModule, functionToken); pCodeInfo->vmNativeCodeMethodDescToken.SetHostPtr(pMethodDesc); @@ -2866,7 +2866,7 @@ TypeHandle DacDbiInterfaceImpl::GetClassOrValueTypeHandle(DebuggerIPCE_BasicType else { DomainAssembly * pDomainAssembly = pData->vmDomainAssembly.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); typeHandle = ClassLoader::LookupTypeDefOrRefInModule(pModule, pData->metadataToken); if (typeHandle.IsNull()) @@ -3842,7 +3842,7 @@ FieldDesc * DacDbiInterfaceImpl::GetEnCFieldDesc(const EnCHangingFieldInfo * pEn FieldDesc * pFD = NULL; DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainAssembly.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); // get the type handle for the object TypeHandle typeHandle = ClassLoader::LookupTypeDefOrRefInModule(pModule, @@ -3881,7 +3881,7 @@ PTR_CBYTE DacDbiInterfaceImpl::GetPtrToEnCField(FieldDesc * pFD, const EnCHangin PTR_EditAndContinueModule pEnCModule; DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainAssembly.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); // make sure we actually have an EditAndContinueModule _ASSERTE(pModule->IsEditAndContinueCapable()); @@ -4053,7 +4053,7 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, { DD_ENTER_MAY_THROW; DomainAssembly * pDomainAssembly = pTypeRefInfo->vmDomainAssembly.GetDacPtr(); - Module * pReferencingModule = pDomainAssembly->GetModule(); + Module * pReferencingModule = pDomainAssembly->GetAssembly()->GetModule(); BOOL fSuccess = FALSE; // Resolve the type ref @@ -4317,7 +4317,7 @@ void DacDbiInterfaceImpl::GetModuleForDomainAssembly(VMPTR_DomainAssembly vmDoma _ASSERTE(pModule != NULL); DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); - pModule->SetHostPtr(pDomainAssembly->GetModule()); + pModule->SetHostPtr(pDomainAssembly->GetAssembly()->GetModule()); } @@ -4446,7 +4446,7 @@ void DacDbiInterfaceImpl::EnumerateModulesInAssembly( DomainAssembly * pDomainAssembly = vmAssembly.GetDacPtr(); // Debugger isn't notified of Resource / Inspection-only modules. - if (pDomainAssembly->GetModule()->IsVisibleToDebugger()) + if (pDomainAssembly->GetAssembly()->GetModule()->IsVisibleToDebugger()) { // If domain assembly isn't yet loaded, just return if (!pDomainAssembly->GetAssembly()->IsLoaded()) @@ -4469,7 +4469,7 @@ VMPTR_DomainAssembly DacDbiInterfaceImpl::ResolveAssembly( DomainAssembly * pDomainAssembly = vmScope.GetDacPtr(); - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 9159080ded6dd6..7015d6010f1664 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -5134,8 +5134,8 @@ DebuggerModule * Debugger::LookupOrCreateModule(DomainAssembly * pDomainAssembly { _ASSERTE(pDomainAssembly != NULL); LOG((LF_CORDB, LL_INFO1000, "D::LOCM df=%p\n", pDomainAssembly)); - DebuggerModule * pDModule = LookupOrCreateModule(pDomainAssembly->GetModule()); - LOG((LF_CORDB, LL_INFO1000, "D::LOCM m=%p ad=%p -> dm=%p\n", pDomainAssembly->GetModule(), AppDomain::GetCurrentDomain(), pDModule)); + DebuggerModule * pDModule = LookupOrCreateModule(pDomainAssembly->GetAssembly()->GetModule()); + LOG((LF_CORDB, LL_INFO1000, "D::LOCM m=%p ad=%p -> dm=%p\n", pDomainAssembly->GetAssembly()->GetModule(), AppDomain::GetCurrentDomain(), pDModule)); _ASSERTE(pDModule != NULL); _ASSERTE(pDModule->GetDomainAssembly() == pDomainAssembly); @@ -5235,7 +5235,7 @@ DebuggerModule* Debugger::AddDebuggerModule(DomainAssembly * pDomainAssembly) LOG((LF_CORDB, LL_INFO1000, "D::ADM df=0x%x\n", pDomainAssembly)); DebuggerDataLockHolder chInfo(this); - Module * pRuntimeModule = pDomainAssembly->GetModule(); + Module * pRuntimeModule = pDomainAssembly->GetAssembly()->GetModule(); HRESULT hr = CheckInitModuleTable(); IfFailThrow(hr); @@ -8041,7 +8041,7 @@ BOOL Debugger::ShouldSendCustomNotification(DomainAssembly *pAssembly, mdTypeDef } CONTRACTL_END; - Module *pModule = pAssembly->GetModule(); + Module *pModule = pAssembly->GetAssembly()->GetModule(); TypeInModule tim(pModule, typeDef); return !(m_pCustomNotificationTable->Lookup(tim).IsNull()); } @@ -9402,7 +9402,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, // We should simply things when we actually get rid of DebuggerModule, possibly by just passing the // DomainAssembly around. _ASSERTE(module->GetDomainAssembly() == pDomainAssembly); - _ASSERTE(module->GetRuntimeModule() == pDomainAssembly->GetModule()); + _ASSERTE(module->GetRuntimeModule() == pDomainAssembly->GetAssembly()->GetModule()); // Send a load module event to the Right Side. ipce = m_pRCThread->GetIPCEventSendBuffer(); @@ -10830,7 +10830,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) // unexpected in an OOM situation. Quickly just sanity check them. // Thread * pThread = pEvent->SetIP.vmThreadToken.GetRawPtr(); - Module * pModule = pEvent->SetIP.vmDomainAssembly.GetRawPtr()->GetModule(); + Module * pModule = pEvent->SetIP.vmDomainAssembly.GetRawPtr()->GetAssembly()->GetModule(); // Get the DJI for this function DebuggerMethodInfo * pDMI = GetOrCreateMethodInfo(pModule, pEvent->SetIP.mdMethod); diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 34f1f6b0dea8a5..ce933c43739a11 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2472,7 +2472,7 @@ Assembly *AppDomain::LoadAssemblyInternal(AssemblySpec* pIdentity, // Set the assembly module to be tenured now that we know it won't be deleted pDomainAssembly->GetAssembly()->SetIsTenured(); - if (pDomainAssembly->IsCollectible()) + if (pDomainAssembly->GetAssembly()->IsCollectible()) { // We add the assembly to the LoaderAllocator only when we are sure that it can be added // and won't be deleted in case of a concurrent load from the same ALC @@ -4427,7 +4427,7 @@ AppDomain::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, bool enumThis) while (assem.Next(pAssembly.This())) { - pAssembly->GetDomainAssembly()->EnumMemoryRegions(flags); + pAssembly->EnumMemoryRegions(flags); } } diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 248d37f203a104..b5938414511b6f 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -544,12 +544,12 @@ class CollectibleAssemblyHolderBase LoaderAllocator * GetLoaderAllocator(DomainAssembly * pDomainAssembly) { WRAPPER_NO_CONTRACT; - return pDomainAssembly->GetLoaderAllocator(); + return pDomainAssembly->GetAssembly()->GetLoaderAllocator(); } BOOL IsCollectible(DomainAssembly * pDomainAssembly) { WRAPPER_NO_CONTRACT; - return pDomainAssembly->IsCollectible(); + return pDomainAssembly->GetAssembly()->IsCollectible(); } LoaderAllocator * GetLoaderAllocator(Assembly * pAssembly) { diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 9c2b72036df4c5..c2a50394adad89 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -142,6 +142,7 @@ Assembly::Assembly(PEAssembly* pPEAssembly, LoaderAllocator *pLoaderAllocator) #endif , m_debuggerFlags{DACF_NONE} , m_hExposedObject{} + , m_NextAssemblyInSameALC(NULL) { CONTRACTL { @@ -490,7 +491,7 @@ Assembly *Assembly::CreateDynamic(AssemblyBinder* pBinder, NativeAssemblyNamePar pDomainAssembly = new DomainAssembly(pPEAssembly, pLoaderAllocator, pamTracker); pAssem = pDomainAssembly->GetAssembly(); pAssem->m_isDynamic = true; - if (pDomainAssembly->IsCollectible()) + if (pAssem->IsCollectible()) { // We add the assembly to the LoaderAllocator only when we are sure that it can be added // and won't be deleted in case of a concurrent load from the same ALC diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index f95d3596f29677..150a22af78dfec 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -4,13 +4,11 @@ /*============================================================ ** ** Header: Assembly.hpp -** - ** ** Purpose: Implements assembly (loader domain) architecture ** -** ===========================================================*/ + #ifndef _ASSEMBLY_H #define _ASSEMBLY_H @@ -23,13 +21,6 @@ #include "cordbpriv.h" #include "assemblyspec.hpp" -class AppDomain; -class DomainAssembly; -class SystemDomain; -class ClassLoader; -class AssemblyNative; -class AssemblySpec; -class AllocMemTracker; class FriendAssemblyDescriptor; // Bits in m_dwDynamicAssemblyAccess (see System.Reflection.Emit.AssemblyBuilderAccess.cs) @@ -324,10 +315,20 @@ class Assembly m_debuggerFlags = flags; } + DomainAssembly* GetNextAssemblyInSameALC() + { + return m_NextAssemblyInSameALC; + } + + void SetNextAssemblyInSameALC(DomainAssembly* assembly) + { + _ASSERTE(m_NextAssemblyInSameALC == NULL); + m_NextAssemblyInSameALC = assembly; + } + private: DebuggerAssemblyControlFlags ComputeDebuggingConfig(void); HRESULT GetDebuggingCustomAttributes(DWORD* pdwFlags); - public: // On failure: // if loadFlag == Loader::Load => throw @@ -530,6 +531,8 @@ class Assembly DebuggerAssemblyControlFlags m_debuggerFlags; LOADERHANDLE m_hExposedObject; + + DomainAssembly* m_NextAssemblyInSameALC; }; #ifndef DACCESS_COMPILE diff --git a/src/coreclr/vm/assemblyspec.hpp b/src/coreclr/vm/assemblyspec.hpp index 97aab7aa4f5551..ac86f220fd5f43 100644 --- a/src/coreclr/vm/assemblyspec.hpp +++ b/src/coreclr/vm/assemblyspec.hpp @@ -6,23 +6,44 @@ ** Header: AssemblySpec.hpp ** ** Purpose: Implements classes used to bind to assemblies -** -** - - ** ===========================================================*/ + #ifndef _ASSEMBLYSPEC_H #define _ASSEMBLYSPEC_H + #include "hash.h" #include "assemblyspecbase.h" #include "domainassembly.h" #include "holder.h" -class AppDomain; -class Assembly; -class DomainAssembly; -enum FileLoadLevel; +enum FileLoadLevel +{ + // These states are tracked by FileLoadLock + + // Note: This enum must match the static array fileLoadLevelName[] + // which contains the printable names of the enum values + + // Note that semantics here are description is the LAST step done, not what is + // currently being done. + + FILE_LOAD_CREATE, + FILE_LOAD_BEGIN, + FILE_LOAD_BEFORE_TYPE_LOAD, + FILE_LOAD_EAGER_FIXUPS, + FILE_LOAD_DELIVER_EVENTS, + FILE_LOAD_VTABLE_FIXUPS, + FILE_LOADED, // Loaded by not yet active + FILE_ACTIVE // Fully active (constructors run & security checked) +}; + +enum NotificationStatus +{ + NOT_NOTIFIED=0, + PROFILER_NOTIFIED=1, + DEBUGGER_NEEDNOTIFICATION=2, + DEBUGGER_NOTIFIED=4 +}; class AssemblySpec : public BaseAssemblySpec { diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 1932bb14d71e00..f4d075b126e139 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -2917,7 +2917,7 @@ BOOL Module::NotifyDebuggerLoad(DomainAssembly * pDomainAssembly, int flags, BOO // Always capture metadata, even if no debugger is attached. If a debugger later attaches, it will use // this data. { - Module * pModule = pDomainAssembly->GetModule(); + Module * pModule = pDomainAssembly->GetAssembly()->GetModule(); pModule->UpdateDynamicMetadataIfNeeded(); } @@ -4502,10 +4502,6 @@ void Module::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, EMEM_OUT(("MEM: %p Module\n", dac_cast(this))); } - if (m_pDomainAssembly.IsValid()) - { - m_pDomainAssembly->EnumMemoryRegions(flags); - } if (m_pPEAssembly.IsValid()) { m_pPEAssembly->EnumMemoryRegions(flags); diff --git a/src/coreclr/vm/domainassembly.cpp b/src/coreclr/vm/domainassembly.cpp index 0dfa2d8a90b99a..b359f211ab52c1 100644 --- a/src/coreclr/vm/domainassembly.cpp +++ b/src/coreclr/vm/domainassembly.cpp @@ -26,11 +26,6 @@ #ifndef DACCESS_COMPILE DomainAssembly::DomainAssembly(PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator, AllocMemTracker* memTracker) : m_pAssembly(NULL) - , m_pPEAssembly(pPEAssembly) - , m_pModule(NULL) - , m_fCollectible(pLoaderAllocator->IsCollectible()) - , m_NextDomainAssemblyInSameALC(NULL) - , m_pLoaderAllocator(pLoaderAllocator) { CONTRACTL { @@ -48,7 +43,6 @@ DomainAssembly::DomainAssembly(PEAssembly* pPEAssembly, LoaderAllocator* pLoader NewHolder assembly = Assembly::Create(pPEAssembly, memTracker, pLoaderAllocator); m_pAssembly = assembly.Extract(); - m_pModule = m_pAssembly->GetModule(); m_pAssembly->SetDomainAssembly(this); @@ -67,8 +61,6 @@ DomainAssembly::~DomainAssembly() } CONTRACTL_END; - m_pPEAssembly->Release(); - if (m_pAssembly != NULL) { delete m_pAssembly; @@ -648,7 +640,7 @@ BOOL Assembly::NotifyDebuggerLoad(int flags, BOOL attaching) if( ShouldNotifyDebugger()) { - result|=m_pModule->NotifyDebuggerLoad(GetDomainAssembly(), ATTACH_MODULE_LOAD, attaching); + result |= m_pModule->NotifyDebuggerLoad(GetDomainAssembly(), ATTACH_MODULE_LOAD, attaching); SetDebuggerNotified(); } @@ -671,34 +663,7 @@ void Assembly::NotifyDebuggerUnload() #endif // #ifndef DACCESS_COMPILE -#ifdef DACCESS_COMPILE - -void DomainAssembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) +PEAssembly* DomainAssembly::GetPEAssembly() { - SUPPORTS_DAC; - - DAC_ENUM_DTHIS(); - - // Modules are needed for all minidumps, but they are enumerated elsewhere - // so we don't need to duplicate effort; thus we do noting with m_pModule. - - // For MiniDumpNormal, we only want the file name. - if (m_pPEAssembly.IsValid()) - { - m_pPEAssembly->EnumMemoryRegions(flags); - } - - if (flags == CLRDATA_ENUM_MEM_HEAP2) - { - GetLoaderAllocator()->EnumMemoryRegions(flags); - } - else if (flags != CLRDATA_ENUM_MEM_MINI && flags != CLRDATA_ENUM_MEM_TRIAGE) - { - if (m_pAssembly.IsValid()) - { - m_pAssembly->EnumMemoryRegions(flags); - } - } + return PTR_PEAssembly(m_pAssembly->GetPEAssembly()); } - -#endif // #ifdef DACCESS_COMPILE diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index d776edba627392..2a482537a375dc 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -4,53 +4,9 @@ // DomainAssembly.h // -// -------------------------------------------------------------------------------- - - #ifndef _DOMAINASSEMBLY_H_ #define _DOMAINASSEMBLY_H_ -// -------------------------------------------------------------------------------- -// Required headers -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Forward class declarations -// -------------------------------------------------------------------------------- -class AppDomain; -class DomainAssembly; -class Assembly; -class Module; -class DynamicMethodTable; - -enum FileLoadLevel -{ - // These states are tracked by FileLoadLock - - // Note: This enum must match the static array fileLoadLevelName[] - // which contains the printable names of the enum values - - // Note that semantics here are description is the LAST step done, not what is - // currently being done. - - FILE_LOAD_CREATE, - FILE_LOAD_BEGIN, - FILE_LOAD_BEFORE_TYPE_LOAD, - FILE_LOAD_EAGER_FIXUPS, - FILE_LOAD_DELIVER_EVENTS, - FILE_LOAD_VTABLE_FIXUPS, - FILE_LOADED, // Loaded by not yet active - FILE_ACTIVE // Fully active (constructors run & security checked) -}; - -enum NotificationStatus -{ - NOT_NOTIFIED=0, - PROFILER_NOTIFIED=1, - DEBUGGER_NEEDNOTIFICATION=2, - DEBUGGER_NOTIFIED=4 -}; - // -------------------------------------------------------------------------------- // DomainAssembly represents an assembly loaded (or being loaded) into an app domain. It // is guaranteed to be unique per file per app domain. @@ -69,11 +25,7 @@ class DomainAssembly final DomainAssembly() {LIMITED_METHOD_CONTRACT;}; #endif - PEAssembly *GetPEAssembly() - { - LIMITED_METHOD_DAC_CONTRACT; - return PTR_PEAssembly(m_pPEAssembly); - } + PEAssembly* GetPEAssembly(); Assembly* GetAssembly() { @@ -81,65 +33,6 @@ class DomainAssembly final return m_pAssembly; } - - Module* GetModule() - { - LIMITED_METHOD_CONTRACT; - - return m_pModule; - } - - LPCUTF8 GetSimpleName() - { - WRAPPER_NO_CONTRACT; - return GetPEAssembly()->GetSimpleName(); - } - -#ifdef LOGGING - LPCUTF8 GetDebugName() - { - WRAPPER_NO_CONTRACT; - return GetPEAssembly()->GetDebugName(); - } -#endif - - BOOL IsCollectible() - { - LIMITED_METHOD_CONTRACT; - return m_fCollectible; - } - - // ------------------------------------------------------------ - // Other public APIs - // ------------------------------------------------------------ - -#ifndef DACCESS_COMPILE - BOOL Equals(DomainAssembly *pAssembly) { WRAPPER_NO_CONTRACT; return GetPEAssembly()->Equals(pAssembly->GetPEAssembly()); } - BOOL Equals(PEAssembly *pPEAssembly) { WRAPPER_NO_CONTRACT; return GetPEAssembly()->Equals(pPEAssembly); } -#endif // DACCESS_COMPILE - -#ifdef DACCESS_COMPILE - void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); -#endif - - DomainAssembly* GetNextDomainAssemblyInSameALC() - { - return m_NextDomainAssemblyInSameALC; - } - - void SetNextDomainAssemblyInSameALC(DomainAssembly* domainAssembly) - { - _ASSERTE(m_NextDomainAssemblyInSameALC == NULL); - m_NextDomainAssemblyInSameALC = domainAssembly; - } - - LoaderAllocator* GetLoaderAllocator() - { - LIMITED_METHOD_CONTRACT; - return m_pLoaderAllocator; - } - - private: // ------------------------------------------------------------ // Loader API // ------------------------------------------------------------ @@ -149,18 +42,7 @@ class DomainAssembly final DomainAssembly(PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator, AllocMemTracker* memTracker); -private: - // ------------------------------------------------------------ - // Instance data - // ------------------------------------------------------------ - PTR_Assembly m_pAssembly; - PTR_PEAssembly m_pPEAssembly; - PTR_Module m_pModule; - - BOOL m_fCollectible; - DomainAssembly* m_NextDomainAssemblyInSameALC; - PTR_LoaderAllocator m_pLoaderAllocator; }; #endif // _DOMAINASSEMBLY_H_ diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 726205a15e7bc9..535a44f96dffb7 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -5438,7 +5438,7 @@ VOID ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAlloca { Assembly *pAssembly = domainAssemblyIt->GetAssembly(); // TODO: handle iterator - Module* pModule = domainAssemblyIt->GetModule(); + Module* pModule = domainAssemblyIt->GetAssembly()->GetModule(); ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 3611ee834d8c49..e4463d734e0640 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -1704,13 +1704,13 @@ BOOL AssemblyLoaderAllocator::CanUnload() DomainAssemblyIterator::DomainAssemblyIterator(DomainAssembly* pFirstAssembly) { pCurrentAssembly = pFirstAssembly; - pNextAssembly = pCurrentAssembly ? pCurrentAssembly->GetNextDomainAssemblyInSameALC() : NULL; + pNextAssembly = pCurrentAssembly ? pCurrentAssembly->GetAssembly()->GetNextAssemblyInSameALC() : NULL; } void DomainAssemblyIterator::operator++() { pCurrentAssembly = pNextAssembly; - pNextAssembly = pCurrentAssembly ? pCurrentAssembly->GetNextDomainAssemblyInSameALC() : NULL; + pNextAssembly = pCurrentAssembly ? pCurrentAssembly->GetAssembly()->GetNextAssemblyInSameALC() : NULL; } #ifndef DACCESS_COMPILE diff --git a/src/coreclr/vm/loaderallocator.inl b/src/coreclr/vm/loaderallocator.inl index 374e19902fd329..c70fb52396c15e 100644 --- a/src/coreclr/vm/loaderallocator.inl +++ b/src/coreclr/vm/loaderallocator.inl @@ -52,7 +52,7 @@ inline void LoaderAllocatorID::AddDomainAssembly(DomainAssembly* pAssembly) // Link domain assembly together if (m_pDomainAssembly != NULL) { - pAssembly->SetNextDomainAssemblyInSameALC(m_pDomainAssembly); + pAssembly->GetAssembly()->SetNextAssemblyInSameALC(m_pDomainAssembly); } m_pDomainAssembly = pAssembly; }