Skip to content

Commit

Permalink
Move more helpers from DomainAssembly to Assembly (#108568)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Oct 7, 2024
1 parent 3774ead commit ba28992
Show file tree
Hide file tree
Showing 13 changed files with 668 additions and 813 deletions.
26 changes: 13 additions & 13 deletions src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;


Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
}


Expand Down Expand Up @@ -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())
Expand All @@ -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();

Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -4427,7 +4427,7 @@ AppDomain::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, bool enumThis)

while (assem.Next(pAssembly.This()))
{
pAssembly->GetDomainAssembly()->EnumMemoryRegions(flags);
pAssembly->EnumMemoryRegions(flags);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit ba28992

Please sign in to comment.