Skip to content

Commit

Permalink
Rename Module::IsReflection and PEAssembly::IsDynamic to `IsRefle…
Browse files Browse the repository at this point in the history
…ctionEmit` (#103999)

* Module::IsReflection -> Module::IsReflectionEmit

* PEAssembly::IsDynamic -> PEAssembly::IsReflectionEmit
  • Loading branch information
elinor-fung authored Jun 26, 2024
1 parent e4caa8d commit f6e5e24
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 77 deletions.
6 changes: 3 additions & 3 deletions src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ mdSignature DacDbiInterfaceImpl::GetILCodeAndSigHelper(Module * pModule,
// Method not overridden - get the original copy of the IL by going to the PE file/RVA
// If this is in a dynamic module then don't even attempt this since ReflectionModule::GetIL isn't
// implemented for DAC.
if (pTargetIL == 0 && !pModule->IsReflection())
if (pTargetIL == 0 && !pModule->IsReflectionEmit())
{
pTargetIL = (TADDR)pModule->GetIL(methodRVA);
}
Expand Down Expand Up @@ -4281,7 +4281,7 @@ void DacDbiInterfaceImpl::GetMetadata(VMPTR_Module vmModule, TargetBuffer * pTar
_ASSERTE(pModule->IsVisibleToDebugger());

// For dynamic modules, metadata is stored as an eagerly-serialized buffer hanging off the Reflection Module.
if (pModule->IsReflection())
if (pModule->IsReflectionEmit())
{
// Here is the fetch.
ReflectionModule * pReflectionModule = pModule->GetReflectionModule();
Expand Down Expand Up @@ -4383,7 +4383,7 @@ void DacDbiInterfaceImpl::GetModuleData(VMPTR_Module vmModule, ModuleInfo * pDat
pData->vmAssembly.SetHostPtr(pModule->GetAssembly());

// Is it dynamic?
BOOL fIsDynamic = pModule->IsReflection();
BOOL fIsDynamic = pModule->IsReflectionEmit();
pData->fIsDynamic = fIsDynamic;

// Get PE BaseAddress and Size
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1724,16 +1724,16 @@ ClrDataAccess::GetModuleData(CLRDATA_ADDRESS addr, struct DacpModuleData *Module
ModuleData->Address = addr;
ModuleData->PEAssembly = addr; // Module address in .NET 9+ - correspondingly, SOS-DAC APIs for PE assemblies expect a module address
COUNT_T metadataSize = 0;
if (!pModule->GetPEAssembly()->IsDynamic())
if (!pModule->IsReflectionEmit())
{
ModuleData->ilBase = TO_CDADDR(dac_cast<TADDR>(pModule->GetPEAssembly()->GetLoadedLayout()->GetBase()));
}

ModuleData->metadataStart = (CLRDATA_ADDRESS)dac_cast<TADDR>(pModule->GetPEAssembly()->GetLoadedMetadata(&metadataSize));
ModuleData->metadataSize = (SIZE_T) metadataSize;

ModuleData->bIsReflection = pModule->IsReflection();
ModuleData->bIsPEFile = !pModule->GetPEAssembly()->IsDynamic();
ModuleData->bIsReflection = pModule->IsReflectionEmit();
ModuleData->bIsPEFile = !pModule->IsReflectionEmit();
ModuleData->Assembly = HOST_CDADDR(pModule->GetAssembly());
ModuleData->dwModuleID = 0; // CoreCLR no longer has this concept
ModuleData->dwModuleIndex = 0; // CoreCLR no longer has this concept
Expand Down Expand Up @@ -2140,7 +2140,7 @@ ClrDataAccess::GetPEFileName(CLRDATA_ADDRESS moduleAddr, unsigned int count, _In
if (!pPEAssembly->GetPath().DacGetUnicode(count, fileName, pNeeded))
hr = E_FAIL;
}
else if (!pPEAssembly->IsDynamic())
else if (!pPEAssembly->IsReflectionEmit())
{
StackSString displayName;
pPEAssembly->GetDisplayName(displayName, 0);
Expand Down Expand Up @@ -2194,7 +2194,7 @@ ClrDataAccess::GetPEFileBase(CLRDATA_ADDRESS moduleAddr, CLRDATA_ADDRESS *base)
PEAssembly* pPEAssembly = pModule->GetPEAssembly();

// More fields later?
if (!pPEAssembly->IsDynamic())
if (!pPEAssembly->IsReflectionEmit())
{
*base = TO_CDADDR(dac_cast<TADDR>(pPEAssembly->GetLoadedLayout()->GetBase()));
}
Expand Down Expand Up @@ -2709,7 +2709,7 @@ ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, _In
else if (name)
name[count-1] = 0;
}
else if (!pAssembly->GetPEAssembly()->IsDynamic())
else if (!pAssembly->GetPEAssembly()->IsReflectionEmit())
{
StackSString displayName;
pAssembly->GetPEAssembly()->GetDisplayName(displayName, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/daccess/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,7 @@ ClrDataModule::GetFlags(
{
*flags = 0;

if (m_module->IsReflection())
if (m_module->IsReflectionEmit())
{
(*flags) |= CLRDATA_MODULE_IS_DYNAMIC;
}
Expand Down Expand Up @@ -2706,7 +2706,7 @@ ClrDataModule::RequestGetModuleData(
PEAssembly *pPEAssembly = pModule->GetPEAssembly();

outGMD->PEAssembly = TO_CDADDR(PTR_HOST_TO_TADDR(pModule));
outGMD->IsDynamic = pModule->IsReflection();
outGMD->IsDynamic = pModule->IsReflectionEmit();

if (pPEAssembly != NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9770,7 +9770,7 @@ void Debugger::SendClassLoadUnloadEvent (mdTypeDef classMetadataToken,

DebuggerIPCEvent * pEvent = m_pRCThread->GetIPCEventSendBuffer();

BOOL fIsReflection = pClassDebuggerModule->GetRuntimeModule()->IsReflection();
BOOL fIsReflection = pClassDebuggerModule->GetRuntimeModule()->IsReflectionEmit();

if (fIsLoadEvent == TRUE)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/ee/debugger.inl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ inline DebuggerModule::DebuggerModule(Module * pRuntimeModule,

// Dynamic modules must receive ClassLoad callbacks in order to receive metadata updates as the module
// evolves. So we force this on here and refuse to change it for all dynamic modules.
if (pRuntimeModule->IsReflection())
if (pRuntimeModule->IsReflectionEmit())
{
EnableClassLoadCallbacks(TRUE);
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
// make sure the PE is loaded or R2R will be disabled.
pPEAssembly->EnsureLoaded();

if (pPEAssembly->IsDynamic())
if (pPEAssembly->IsReflectionEmit())
// manifest modules of dynamic assemblies are always transient
m_pModule = ReflectionModule::Create(this, pPEAssembly, pamTracker, REFEMIT_MANIFEST_MODULE_NAME);
else
Expand All @@ -199,7 +199,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
// loading it entirely.
//CacheFriendAssemblyInfo();

if (IsCollectible() && !pPEAssembly->IsDynamic())
if (IsCollectible() && !pPEAssembly->IsReflectionEmit())
{
COUNT_T size;
BYTE* start = (BYTE*)pPEAssembly->GetLoadedImageContents(&size);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/assemblynative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ FCIMPL1(FC_BOOL_RET, AssemblyNative::IsDynamic, AssemblyBaseObject* pAssemblyUNS
if (refAssembly == NULL)
FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle"));

FC_RETURN_BOOL(refAssembly->GetDomainAssembly()->GetPEAssembly()->IsDynamic());
FC_RETURN_BOOL(refAssembly->GetDomainAssembly()->GetPEAssembly()->IsReflectionEmit());
}
FCIMPLEND

Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/vm/ceeload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ static BOOL IsEditAndContinueCapable(Assembly *pAssembly, PEAssembly *pPEAssembl
// Some modules are never EnC-capable
return ! (pAssembly->GetDebuggerInfoBits() & DACF_ALLOW_JIT_OPTS ||
pPEAssembly->IsSystem() ||
pPEAssembly->IsDynamic());
pPEAssembly->IsReflectionEmit());
}

/* static */
Expand Down Expand Up @@ -1187,7 +1187,7 @@ void Module::AllocateMaps()

PTR_TADDR pTable = NULL;

if (IsReflection())
if (IsReflectionEmit())
{
// For dynamic modules, it is essential that we at least have a TypeDefToMethodTable
// map with an initial block. Otherwise, all the iterators will abort on an
Expand Down Expand Up @@ -1646,7 +1646,7 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void)
if (GetInMemorySymbolStream() )
{

if( IsReflection() )
if( IsReflectionEmit() )
{
// If this is Reflection.Emit, we must clone the stream because another thread may
// update it when someone is using the reader we create here leading to AVs.
Expand Down Expand Up @@ -1999,7 +1999,7 @@ PTR_VOID Module::GetRvaField(DWORD rva)
CHECK Module::CheckRvaField(RVA field)
{
WRAPPER_NO_CONTRACT;
if (!IsReflection())
if (!IsReflectionEmit())
CHECK(m_pPEAssembly->CheckRvaField(field));
CHECK_OK;
}
Expand All @@ -2013,7 +2013,7 @@ CHECK Module::CheckRvaField(RVA field, COUNT_T size)
}
CONTRACTL_END;

if (!IsReflection())
if (!IsReflectionEmit())
CHECK(m_pPEAssembly->CheckRvaField(field, size));
CHECK_OK;
}
Expand Down Expand Up @@ -2840,7 +2840,7 @@ void Module::UpdateDynamicMetadataIfNeeded()
CONTRACTL_END;

// Only need to serializing metadata for dynamic modules. For non-dynamic modules, metadata is already available.
if (!IsReflection())
if (!IsReflectionEmit())
{
return;
}
Expand Down Expand Up @@ -3727,7 +3727,7 @@ ReflectionModule *ReflectionModule::Create(Assembly *pAssembly, PEAssembly *pPEA
STANDARD_VM_CHECK;
PRECONDITION(CheckPointer(pAssembly));
PRECONDITION(CheckPointer(pPEAssembly));
PRECONDITION(pPEAssembly->IsDynamic());
PRECONDITION(pPEAssembly->IsReflectionEmit());
POSTCONDITION(CheckPointer(RETVAL));
}
CONTRACT_END;
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/ceeload.h
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ class Module : public ModuleBase
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;

_ASSERTE(IsReflection());
_ASSERTE(IsReflectionEmit());
return dac_cast<PTR_ReflectionModule>(this);
}

Expand All @@ -886,7 +886,7 @@ class Module : public ModuleBase
CodeVersionManager * GetCodeVersionManager();
#endif

BOOL IsReflection() const { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; return GetPEAssembly()->IsDynamic(); }
BOOL IsReflectionEmit() const { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; return GetPEAssembly()->IsReflectionEmit(); }
BOOL IsSystem() { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; return m_pPEAssembly->IsSystem(); }
// Returns true iff the debugger can see this module.
BOOL IsVisibleToDebugger();
Expand Down Expand Up @@ -959,7 +959,7 @@ class Module : public ModuleBase
SUPPORTS_DAC;

#ifdef DACCESS_COMPILE
if (IsReflection())
if (IsReflectionEmit())
{
return DacGetMDImport(GetReflectionModule(), true);
}
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/clsload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,7 @@ TypeHandle ClassLoader::LoadTypeDefThrowing(Module *pModule,
#endif
TRIGGERSGC();

if (pModule->IsReflection())
if (pModule->IsReflectionEmit())
{
// Don't try to load types that are not in available table, when this
// is an in-memory module. Raise the type-resolve event instead.
Expand Down Expand Up @@ -2151,7 +2151,7 @@ TypeHandle ClassLoader::LoadTypeDefOrRefThrowing(ModuleBase *pModule,
nameHandle.SetTokenNotToLoad(tokenNotToLoad);
typeHnd = pFoundModule->GetClassLoader()->
LoadTypeHandleThrowIfFailed(&nameHandle, level,
pFoundModule->IsFullModule() ? (static_cast<Module*>(pFoundModule)->IsReflection() ? NULL : static_cast<Module*>(pFoundModule)) : NULL);
pFoundModule->IsFullModule() ? (static_cast<Module*>(pFoundModule)->IsReflectionEmit() ? NULL : static_cast<Module*>(pFoundModule)) : NULL);
}
}

Expand Down Expand Up @@ -2326,7 +2326,7 @@ ClassLoader::ResolveNameToTypeDefThrowing(
&pFoundModule,
&foundExportedType,
NULL,
pSourceModule->IsReflection() ? NULL : pSourceModule,
pSourceModule->IsReflectionEmit() ? NULL : pSourceModule,
loadFlag))
{
RETURN FALSE;
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/vm/commodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ extern "C" void QCALLTYPE RuntimeModule_GetFullyQualifiedName(QCall::ModuleHandl

HRESULT hr = S_OK;

if (!pModule->GetPEAssembly()->IsDynamic())
if (!pModule->IsReflectionEmit())
{
LPCWSTR fileName = pModule->GetPath();
if (*fileName != W('\0'))
Expand Down Expand Up @@ -662,8 +662,7 @@ extern "C" HINSTANCE QCALLTYPE MarshalNative_GetHINSTANCE(QCall::ModuleHandle pM

// This returns the base address
// Other modules should have zero base
PEAssembly *pPEAssembly = pModule->GetPEAssembly();
if (!pPEAssembly->IsDynamic())
if (!pModule->IsReflectionEmit())
{
hMod = (HMODULE) pModule->GetPEAssembly()->GetManagedFileContents();
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/debugdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal,
pLoadedPeSize[iNumValidFrames] = (CLR_I4)peSize;

// Set flag indicating PE file in memory has the on disk layout
if (!pPEAssembly->IsDynamic())
if (!pPEAssembly->IsReflectionEmit())
{
// This flag is only available for non-dynamic assemblies.
CLR_U1 *pIsFileLayout = (CLR_U1 *)((BOOLARRAYREF)pStackFrameHelper->rgiIsFileLayout)->GetDirectPointerToNonObjectElements();
Expand Down
8 changes: 2 additions & 6 deletions src/coreclr/vm/dwbucketmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,16 +642,12 @@ void BaseBucketParamsManager::GetModuleTimeStamp(_Out_writes_(maxLength) WCHAR*
{
EX_TRY
{
// We only store the IL timestamp in the native image for the
// manifest module. We should consider fixing this for Orcas.
PTR_PEAssembly pFile = pModule->GetAssembly()->GetModule()->GetPEAssembly();

// for dynamic modules use 0 as the time stamp
ULONG ulTimeStamp = 0;

if (!pFile->IsDynamic())
if (!pModule->IsReflectionEmit())
{
ulTimeStamp = pFile->GetPEImageTimeDateStamp();
ulTimeStamp = pModule->GetPEAssembly()->GetPEImageTimeDateStamp();
_ASSERTE(ulTimeStamp != 0);
}

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/eventtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3253,7 +3253,7 @@ HRESULT ETW::CodeSymbolLog::GetInMemorySymbolsLength(
//This method would work fine on reflection.emit, but there would be no way to know
//if some other thread was changing the size of the symbols before this method returned.
//Adding events or locks to detect/prevent changes would make the scenario workable
if (pModule->IsReflection())
if (pModule->IsReflectionEmit())
{
return COR_PRF_MODULE_DYNAMIC;
}
Expand Down Expand Up @@ -3339,7 +3339,7 @@ HRESULT ETW::CodeSymbolLog::ReadInMemorySymbols(
//This method would work fine on reflection.emit, but there would be no way to know
//if some other thread was changing the size of the symbols before this method returned.
//Adding events or locks to detect/prevent changes would make the scenario workable
if (pModule->IsReflection())
if (pModule->IsReflectionEmit())
{
return COR_PRF_MODULE_DYNAMIC;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base)
Module* pModule = GetModule();
PTR_VOID ret = pModule->GetRvaField(GetOffset());

_ASSERTE(pModule->GetPEAssembly()->IsDynamic() || !pModule->IsRvaFieldTls(GetOffset()));
_ASSERTE(pModule->IsReflectionEmit() || !pModule->IsRvaFieldTls(GetOffset()));

return(ret);
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,7 @@ void MethodDesc::Reset()

_ASSERTE(InEnCEnabledModule() || // The process is frozen by the debugger
IsDynamicMethod() || // These are used in a very restricted way
GetLoaderModule()->IsReflection()); // Rental methods
GetLoaderModule()->IsReflectionEmit()); // Rental methods

// Reset any flags relevant to the old code
ClearFlagsOnUpdate();
Expand All @@ -2248,7 +2248,7 @@ void MethodDesc::Reset()
else
{
// We should go here only for the rental methods
_ASSERTE(GetLoaderModule()->IsReflection());
_ASSERTE(GetLoaderModule()->IsReflectionEmit());

InterlockedUpdateFlags3(enum_flag3_HasStableEntryPoint | enum_flag3_HasPrecode, FALSE);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/multicorejitplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ bool MulticoreJitManager::IsSupportedModule(Module * pModule, bool fMethodJit)
PEAssembly * pPEAssembly = pModule->GetPEAssembly();

// dynamic module.
if (pPEAssembly->IsDynamic()) // Ignore dynamic modules
if (pPEAssembly->IsReflectionEmit()) // Ignore dynamic modules
{
return false;
}
Expand Down
Loading

0 comments on commit f6e5e24

Please sign in to comment.