From 7c3b570df86d19a6ba5ed4e6cc193138a907d75d Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 14:36:41 -0800 Subject: [PATCH 01/25] GetManifestFile() --> GetPEAssembly() --- src/coreclr/debug/daccess/request.cpp | 14 ++++---- src/coreclr/debug/daccess/task.cpp | 2 +- src/coreclr/nativeaot/Runtime/eventtrace.cpp | 6 ++-- src/coreclr/vm/appdomain.cpp | 2 +- src/coreclr/vm/appdomain.hpp | 2 +- src/coreclr/vm/assembly.cpp | 28 ++++++++-------- src/coreclr/vm/assembly.hpp | 34 ++++++++++---------- src/coreclr/vm/assemblynative.cpp | 4 +-- src/coreclr/vm/eventtrace.cpp | 4 +-- src/coreclr/vm/excep.cpp | 4 +-- src/coreclr/vm/multicorejit.cpp | 2 +- src/coreclr/vm/nativelibrary.cpp | 6 ++-- src/coreclr/vm/perfmap.cpp | 2 +- src/coreclr/vm/typeparse.cpp | 2 +- 14 files changed, 55 insertions(+), 57 deletions(-) diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp index 1e327721f4a92..edac0a100c3f0 100644 --- a/src/coreclr/debug/daccess/request.cpp +++ b/src/coreclr/debug/daccess/request.cpp @@ -2607,8 +2607,6 @@ ClrDataAccess::GetAssemblyData(CLRDATA_ADDRESS cdBaseDomainPtr, CLRDATA_ADDRESS assemblyData->ModuleCount = 0; assemblyData->isDomainNeutral = FALSE; - pAssembly->GetManifestFile(); - ModuleIterator mi = pAssembly->IterateModules(); while (mi.Next()) { @@ -2628,17 +2626,17 @@ ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, _In if (name) name[0] = 0; - if (!pAssembly->GetManifestFile()->GetPath().IsEmpty()) + if (!pAssembly->GetPEAssembly()->GetPath().IsEmpty()) { - if (!pAssembly->GetManifestFile()->GetPath().DacGetUnicode(count, name, pNeeded)) + if (!pAssembly->GetPEAssembly()->GetPath().DacGetUnicode(count, name, pNeeded)) hr = E_FAIL; else if (name) name[count-1] = 0; } - else if (!pAssembly->GetManifestFile()->IsDynamic()) + else if (!pAssembly->GetPEAssembly()->IsDynamic()) { StackSString displayName; - pAssembly->GetManifestFile()->GetDisplayName(displayName, 0); + pAssembly->GetPEAssembly()->GetDisplayName(displayName, 0); const WCHAR *val = displayName.GetUnicode(); @@ -2673,9 +2671,9 @@ ClrDataAccess::GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, _Inout_u Assembly* pAssembly = PTR_Assembly(TO_TADDR(assembly)); // Turn from bytes to wide characters - if (!pAssembly->GetManifestFile()->GetPath().IsEmpty()) + if (!pAssembly->GetPEAssembly()->GetPath().IsEmpty()) { - if (!pAssembly->GetManifestFile()->GetPath(). + if (!pAssembly->GetPEAssembly()->GetPath(). DacGetUnicode(count, location, pNeeded)) { hr = E_FAIL; diff --git a/src/coreclr/debug/daccess/task.cpp b/src/coreclr/debug/daccess/task.cpp index 30abc5e090cc9..67f293fb34466 100644 --- a/src/coreclr/debug/daccess/task.cpp +++ b/src/coreclr/debug/daccess/task.cpp @@ -1170,7 +1170,7 @@ ClrDataAssembly::GetFileName( { COUNT_T _nameLen; - if (m_assembly->GetManifestFile()->GetPath(). + if (m_assembly->GetPEAssembly()->GetPath(). DacGetUnicode(bufLen, name, &_nameLen)) { if (nameLen) diff --git a/src/coreclr/nativeaot/Runtime/eventtrace.cpp b/src/coreclr/nativeaot/Runtime/eventtrace.cpp index 23dd9726b5ed2..dff30f07ae890 100644 --- a/src/coreclr/nativeaot/Runtime/eventtrace.cpp +++ b/src/coreclr/nativeaot/Runtime/eventtrace.cpp @@ -4829,13 +4829,13 @@ void ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions BOOL bIsDynamicAssembly = pAssembly->IsDynamic(); BOOL bIsCollectibleAssembly = pAssembly->IsCollectible(); BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral() ; - BOOL bHasNativeImage = pAssembly->GetManifestFile()->HasNativeImage(); + BOOL bHasNativeImage = pAssembly->GetPEAssembly()->HasNativeImage(); ULONGLONG ullAssemblyId = (ULONGLONG)pAssembly; ULONGLONG ullDomainId = (ULONGLONG)pAssembly->GetDomain(); ULONGLONG ullBindingID = 0; #if (defined FEATURE_PREJIT) && (defined FEATURE_FUSION_DEPRECATE) - ullBindingID = pAssembly->GetManifestFile()->GetBindingID(); + ullBindingID = pAssembly->GetPEAssembly()->GetBindingID(); #endif ULONG ulAssemblyFlags = ((bIsDomainNeutral ? ETW::LoaderLog::LoaderStructs::DomainNeutralAssembly : 0) | (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicAssembly : 0) | @@ -5207,7 +5207,7 @@ void ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL #endif // !FEATURE_PAL if(!bIsDynamicAssembly) { - ModuleILPath = (PWCHAR)pModule->GetAssembly()->GetManifestFile()->GetILimage()->GetPath().GetUnicode(); + ModuleILPath = (PWCHAR)pModule->GetAssembly()->GetPEAssembly()->GetILimage()->GetPath().GetUnicode(); ModuleNativePath = (PWCHAR)pEmptyString; #ifdef FEATURE_PREJIT diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 0194f960809d9..b24818c2d3e3d 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -3827,7 +3827,7 @@ PEAssembly *AppDomain::TryResolveAssemblyUsingEvent(AssemblySpec *pSpec) Assembly *pAssembly = RaiseAssemblyResolveEvent(pSpec); if (pAssembly != nullptr) { - PEAssembly* pPEAssembly = pAssembly->GetManifestFile(); + PEAssembly* pPEAssembly = pAssembly->GetPEAssembly(); pPEAssembly->AddRef(); result = pPEAssembly; } diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index a369823a53937..55e7dca0d2a8d 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -2580,7 +2580,7 @@ class SystemDomain : public BaseDomain // Or, it might be the location of CoreLib if (System()->SystemAssembly() != NULL - && path.EqualsCaseInsensitive(System()->SystemAssembly()->GetManifestFile()->GetPath())) + && path.EqualsCaseInsensitive(System()->SystemAssembly()->GetPEAssembly()->GetPath())) return TRUE; return FALSE; diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 09c6ff22c2f83..76abfec5c4ca8 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -127,7 +127,7 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pPEAssembly, DebuggerAssembl m_pClassLoader(NULL), m_pEntryPoint(NULL), m_pManifest(NULL), - m_pManifestFile(clr::SafeAddRef(pPEAssembly)), + m_pPEAssembly(clr::SafeAddRef(pPEAssembly)), m_pFriendAssemblyDescriptor(NULL), m_isDynamic(false), #ifdef FEATURE_COLLECTIBLE_TYPES @@ -189,7 +189,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat m_pClassLoader = new ClassLoader(this); m_pClassLoader->Init(pamTracker); - PEAssembly* pPEAssembly = GetManifestFile(); + PEAssembly* pPEAssembly = GetPEAssembly(); // "Module::Create" will initialize R2R support, if there is an R2R header. // make sure the PE is loaded or R2R will be disabled. @@ -252,9 +252,9 @@ Assembly::~Assembly() if (m_pFriendAssemblyDescriptor != NULL) m_pFriendAssemblyDescriptor->Release(); - if (m_pManifestFile) + if (m_pPEAssembly) { - m_pManifestFile->Release(); + m_pPEAssembly->Release(); } #ifdef FEATURE_COMINTEROP @@ -516,7 +516,7 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, AssemblyBinder* pBinder, C IfFailThrow(pAssemblyEmit->DefineAssembly(publicKey, publicKey.GetSize(), ulHashAlgId, name, &assemData, dwFlags, &ma)); - pPEAssembly = PEAssembly::Create(pCallerAssembly->GetManifestFile(), pAssemblyEmit); + pPEAssembly = PEAssembly::Create(pCallerAssembly->GetPEAssembly(), pAssemblyEmit); AssemblyBinder* pFallbackBinder = pBinder; @@ -531,7 +531,7 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, AssemblyBinder* pBinder, C // and will have a fallback load context binder associated with it. // There is always a manifest file - wehther working with static or dynamic assemblies. - PEAssembly* pCallerAssemblyManifestFile = pCallerAssembly->GetManifestFile(); + PEAssembly* pCallerAssemblyManifestFile = pCallerAssembly->GetPEAssembly(); _ASSERTE(pCallerAssemblyManifestFile != NULL); if (!pCallerAssemblyManifestFile->IsDynamic()) @@ -1222,7 +1222,7 @@ void Assembly::CacheFriendAssemblyInfo() if (m_pFriendAssemblyDescriptor == NULL) { - ReleaseHolder pFriendAssemblies = FriendAssemblyDescriptor::CreateFriendAssemblyDescriptor(this->GetManifestFile()); + ReleaseHolder pFriendAssemblies = FriendAssemblyDescriptor::CreateFriendAssemblyDescriptor(this->GetPEAssembly()); _ASSERTE(pFriendAssemblies != NULL); CrstHolder friendDescriptorLock(&g_friendAssembliesCrst); @@ -1257,7 +1257,7 @@ void Assembly::UpdateCachedFriendAssemblyInfo() while (true) { - ReleaseHolder pFriendAssemblies = FriendAssemblyDescriptor::CreateFriendAssemblyDescriptor(this->GetManifestFile()); + ReleaseHolder pFriendAssemblies = FriendAssemblyDescriptor::CreateFriendAssemblyDescriptor(this->GetPEAssembly()); FriendAssemblyDescriptor* pFriendAssemblyDescriptorNextLoop = NULL; { @@ -1699,7 +1699,7 @@ MethodDesc* Assembly::GetEntryPoint() if (m_pEntryPoint) RETURN m_pEntryPoint; - mdToken mdEntry = m_pManifestFile->GetEntryPointToken(); + mdToken mdEntry = m_pPEAssembly->GetEntryPointToken(); if (IsNilToken(mdEntry)) RETURN NULL; @@ -1715,7 +1715,7 @@ MethodDesc* Assembly::GetEntryPoint() break; case mdtMethodDef: - if (m_pManifestFile->GetMDImport()->IsValidToken(mdEntry)) + if (m_pPEAssembly->GetMDImport()->IsValidToken(mdEntry)) pModule = m_pManifest; break; } @@ -1874,7 +1874,7 @@ BOOL Assembly::IsInstrumentedHelper() return false; // We must have a native image in order to perform IBC instrumentation - if (!GetManifestFile()->IsReadyToRun()) + if (!GetPEAssembly()->IsReadyToRun()) return false; // @Consider using the full name instead of the short form @@ -2001,7 +2001,7 @@ mdAssemblyRef Assembly::AddAssemblyRef(Assembly *refedAssembly, IMetaDataAssembl SafeComHolder emitHolder; AssemblySpec spec; - spec.InitializeSpec(refedAssembly->GetManifestFile()); + spec.InitializeSpec(refedAssembly->GetPEAssembly()); if (refedAssembly->IsCollectible()) { @@ -2242,9 +2242,9 @@ Assembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) { m_pManifest->EnumMemoryRegions(flags, true); } - if (m_pManifestFile.IsValid()) + if (m_pPEAssembly.IsValid()) { - m_pManifestFile->EnumMemoryRegions(flags); + m_pPEAssembly->EnumMemoryRegions(flags); } } diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index f8de5c162e752..ef444f089d7ef 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -88,7 +88,7 @@ class Assembly static Assembly *Create(BaseDomain *pDomain, PEAssembly *pPEAssembly, DebuggerAssemblyControlFlags debuggerFlags, BOOL fIsCollectible, AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocator); static void Initialize(); - BOOL IsSystem() { WRAPPER_NO_CONTRACT; return m_pManifestFile->IsSystem(); } + BOOL IsSystem() { WRAPPER_NO_CONTRACT; return m_pPEAssembly->IsSystem(); } static Assembly *CreateDynamic(AppDomain *pDomain, AssemblyBinder* pBinder, CreateDynamicAssemblyArgs *args); @@ -231,50 +231,50 @@ class Assembly LPCWSTR GetDebugName() { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetDebugName(); + return GetPEAssembly()->GetDebugName(); } #endif LPCUTF8 GetSimpleName() { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetSimpleName(); + return GetPEAssembly()->GetSimpleName(); } BOOL IsStrongNamed() { WRAPPER_NO_CONTRACT; - return GetManifestFile()->IsStrongNamed(); + return GetPEAssembly()->IsStrongNamed(); } const void *GetPublicKey(DWORD *pcbPK) { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetPublicKey(pcbPK); + return GetPEAssembly()->GetPublicKey(pcbPK); } ULONG GetHashAlgId() { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetHashAlgId(); + return GetPEAssembly()->GetHashAlgId(); } HRESULT GetVersion(USHORT *pMajor, USHORT *pMinor, USHORT *pBuild, USHORT *pRevision) { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetVersion(pMajor, pMinor, pBuild, pRevision); + return GetPEAssembly()->GetVersion(pMajor, pMinor, pBuild, pRevision); } LPCUTF8 GetLocale() { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetLocale(); + return GetPEAssembly()->GetLocale(); } DWORD GetFlags() { WRAPPER_NO_CONTRACT; - return GetManifestFile()->GetFlags(); + return GetPEAssembly()->GetFlags(); } PTR_LoaderHeap GetLowFrequencyHeap(); @@ -288,18 +288,18 @@ class Assembly return m_pManifest; } - PTR_PEAssembly GetManifestFile() + PTR_PEAssembly GetPEAssembly() { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - return m_pManifestFile; + return m_pPEAssembly; } IMDInternalImport* GetManifestImport() { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; - return m_pManifestFile->GetMDImport(); + return m_pPEAssembly->GetMDImport(); } HRESULT GetCustomAttribute(mdToken parentToken, @@ -324,7 +324,7 @@ class Assembly { WRAPPER_NO_CONTRACT; - return m_pManifestFile->GetDisplayName(result, flags); + return m_pPEAssembly->GetDisplayName(result, flags); } #endif // DACCESS_COMPILE @@ -332,7 +332,7 @@ class Assembly { WRAPPER_NO_CONTRACT; - return m_pManifestFile->GetCodeBase(result); + return m_pPEAssembly->GetCodeBase(result); } OBJECTREF GetExposedObject(); @@ -360,7 +360,7 @@ class Assembly ULONG HashIdentity() { - return GetManifestFile()->HashIdentity(); + return GetPEAssembly()->HashIdentity(); } //**************************************************************************************** @@ -558,7 +558,7 @@ class Assembly PTR_MethodDesc m_pEntryPoint; // Method containing the entry point PTR_Module m_pManifest; - PTR_PEAssembly m_pManifestFile; + PTR_PEAssembly m_pPEAssembly; FriendAssemblyDescriptor *m_pFriendAssemblyDescriptor; @@ -673,7 +673,7 @@ class FriendAssemblyDescriptor static bool IsAssemblyOnList(Assembly *pAssembly, const ArrayList &alAssemblyNames) { - return IsAssemblyOnList(pAssembly->GetManifestFile(), alAssemblyNames); + return IsAssemblyOnList(pAssembly->GetPEAssembly(), alAssemblyNames); } static diff --git a/src/coreclr/vm/assemblynative.cpp b/src/coreclr/vm/assemblynative.cpp index a51280e21e4a3..18c908fadbeb5 100644 --- a/src/coreclr/vm/assemblynative.cpp +++ b/src/coreclr/vm/assemblynative.cpp @@ -107,7 +107,7 @@ extern "C" void QCALLTYPE AssemblyNative_InternalLoad(QCall::ObjectHandleOnStack { // If the requesting assembly has Fallback LoadContext binder available, // then set it up in the AssemblySpec. - PEAssembly *pRefAssemblyManifestFile = pRefAssembly->GetManifestFile(); + PEAssembly *pRefAssemblyManifestFile = pRefAssembly->GetPEAssembly(); spec.SetFallbackBinderForRequestingAssembly(pRefAssemblyManifestFile->GetFallbackBinder()); } @@ -271,7 +271,7 @@ extern "C" void QCALLTYPE AssemblyNative_LoadFromStream(INT_PTR ptrNativeAssembl // we created above. We need pointer comparison instead of pe image equivalence // to avoid mixed binaries/PDB pairs of other images. // This applies to both Desktop CLR and CoreCLR, with or without fusion. - BOOL fIsSameAssembly = (pLoadedAssembly->GetManifestFile()->GetPEImage() == pILImage); + BOOL fIsSameAssembly = (pLoadedAssembly->GetPEAssembly()->GetPEImage() == pILImage); // Setting the PDB info is only applicable for our original assembly. // This applies to both Desktop CLR and CoreCLR, with or without fusion. diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index e5473b1104177..9e1fc9560b746 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -6047,7 +6047,7 @@ VOID ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions PCWSTR szDtraceOutput1=W(""); BOOL bIsDynamicAssembly = pAssembly->IsDynamic(); BOOL bIsCollectibleAssembly = pAssembly->IsCollectible(); - BOOL bIsReadyToRun = pAssembly->GetManifestFile()->IsReadyToRun(); + BOOL bIsReadyToRun = pAssembly->GetPEAssembly()->IsReadyToRun(); ULONGLONG ullAssemblyId = (ULONGLONG)pAssembly; ULONGLONG ullDomainId = (ULONGLONG)pAssembly->GetDomain(); @@ -6338,7 +6338,7 @@ VOID ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL if(!bIsDynamicAssembly) { - ModuleILPath = (PWCHAR)pModule->GetAssembly()->GetManifestFile()->GetPEImage()->GetPath().GetUnicode(); + ModuleILPath = (PWCHAR)pModule->GetAssembly()->GetPEAssembly()->GetPEImage()->GetPath().GetUnicode(); ModuleNativePath = (PWCHAR)pEmptyString; } diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index fa2b8ffc7dfe3..9f02ab928785e 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -12136,8 +12136,8 @@ VOID CheckAndThrowSameTypeAndAssemblyInvalidCastException(TypeHandle thCastFrom, _ASSERTE(pAssemblyTypeFrom != NULL); _ASSERTE(pAssemblyTypeTo != NULL); - PEAssembly *pPEAssemblyTypeFrom = pAssemblyTypeFrom->GetManifestFile(); - PEAssembly *pPEAssemblyTypeTo = pAssemblyTypeTo->GetManifestFile(); + PEAssembly *pPEAssemblyTypeFrom = pAssemblyTypeFrom->GetPEAssembly(); + PEAssembly *pPEAssemblyTypeTo = pAssemblyTypeTo->GetPEAssembly(); _ASSERTE(pPEAssemblyTypeFrom != NULL); _ASSERTE(pPEAssemblyTypeTo != NULL); diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index b747608a18478..c616503436792 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -310,7 +310,7 @@ bool RecorderModuleInfo::SetModule(Module * pMod) SString sAssemblyName; StackScratchBuffer scratch; - pMod->GetAssembly()->GetManifestFile()->GetDisplayName(sAssemblyName); + pMod->GetAssembly()->GetPEAssembly()->GetDisplayName(sAssemblyName); LPCUTF8 pAssemblyName = sAssemblyName.GetUTF8(scratch); unsigned lenAssemblyName = sAssemblyName.GetCount(); diff --git a/src/coreclr/vm/nativelibrary.cpp b/src/coreclr/vm/nativelibrary.cpp index d5a91b4863c2f..9528e246dfdd5 100644 --- a/src/coreclr/vm/nativelibrary.cpp +++ b/src/coreclr/vm/nativelibrary.cpp @@ -318,7 +318,7 @@ namespace #endif // !TARGET_UNIX NATIVE_LIBRARY_HANDLE hmod = NULL; - PEAssembly *pManifestFile = pAssembly->GetManifestFile(); + PEAssembly *pManifestFile = pAssembly->GetPEAssembly(); PTR_AssemblyBinder pBinder = pManifestFile->GetAssemblyBinder(); //Step 0: Check if the assembly was bound using TPA. @@ -363,7 +363,7 @@ namespace { STANDARD_VM_CONTRACT; - PTR_AssemblyBinder pBinder = pAssembly->GetManifestFile()->GetAssemblyBinder(); + PTR_AssemblyBinder pBinder = pAssembly->GetPEAssembly()->GetAssemblyBinder(); return pBinder->GetManagedAssemblyLoadContext(); } @@ -461,7 +461,7 @@ namespace NATIVE_LIBRARY_HANDLE hmod = NULL; - SString path = pAssembly->GetManifestFile()->GetPath(); + SString path = pAssembly->GetPEAssembly()->GetPath(); SString::Iterator lastPathSeparatorIter = path.End(); if (PEAssembly::FindLastPathSeparator(path, lastPathSeparatorIter)) diff --git a/src/coreclr/vm/perfmap.cpp b/src/coreclr/vm/perfmap.cpp index 30708584c3f72..5e004f6ed0c1f 100644 --- a/src/coreclr/vm/perfmap.cpp +++ b/src/coreclr/vm/perfmap.cpp @@ -393,7 +393,7 @@ NativeImagePerfMap::NativeImagePerfMap(Assembly * pAssembly, BSTR pDestPath) // Get the native image signature (GUID). // Used to ensure that we match symbols to the correct NGEN image. WCHAR wszSignature[39]; - GetNativeImageSignature(pAssembly->GetManifestFile(), wszSignature, ARRAY_SIZE(wszSignature)); + GetNativeImageSignature(pAssembly->GetPEAssembly(), wszSignature, ARRAY_SIZE(wszSignature)); // Build the path to the perfmap file, which consists of .ni..map. // Example: /tmp/System.Private.CoreLib.ni.{GUID}.map diff --git a/src/coreclr/vm/typeparse.cpp b/src/coreclr/vm/typeparse.cpp index 524a9e595bc24..ddeb7082cd137 100644 --- a/src/coreclr/vm/typeparse.cpp +++ b/src/coreclr/vm/typeparse.cpp @@ -1427,7 +1427,7 @@ DomainAssembly * LoadDomainAssembly( { // If the requesting assembly has Fallback LoadContext binder available, // then set it up in the AssemblySpec. - PEAssembly *pRequestingAssemblyManifestFile = pRequestingAssembly->GetManifestFile(); + PEAssembly *pRequestingAssemblyManifestFile = pRequestingAssembly->GetPEAssembly(); spec.SetFallbackBinderForRequestingAssembly(pRequestingAssemblyManifestFile->GetFallbackBinder()); } From 1bfed857444e6ce2803b0969f92f37aed788c5f6 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 15:09:41 -0800 Subject: [PATCH 02/25] GetManifestImport() -> GetMDImport() --- src/coreclr/vm/assembly.cpp | 14 +++++++------- src/coreclr/vm/assembly.hpp | 2 +- src/coreclr/vm/assemblynative.cpp | 6 +++--- src/coreclr/vm/ceeload.cpp | 12 ++++-------- src/coreclr/vm/classhash.cpp | 2 +- src/coreclr/vm/clsload.cpp | 10 +++++----- src/coreclr/vm/commodule.cpp | 6 +++--- src/coreclr/vm/domainfile.inl | 1 + src/coreclr/vm/interoputil.cpp | 6 +++--- src/coreclr/vm/nativeimage.cpp | 2 +- src/coreclr/vm/peassembly.cpp | 2 +- src/coreclr/vm/runtimehandles.cpp | 2 +- 12 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 76abfec5c4ca8..e0fbc58e42fa2 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -334,7 +334,7 @@ void Assembly::Terminate( BOOL signalProfiler ) Assembly * Assembly::Create( BaseDomain * pDomain, - PEAssembly * pFile, + PEAssembly * pPEAssembly, DebuggerAssemblyControlFlags debuggerFlags, BOOL fIsCollectible, AllocMemTracker * pamTracker, @@ -342,7 +342,7 @@ Assembly * Assembly::Create( { STANDARD_VM_CONTRACT; - NewHolder pAssembly (new Assembly(pDomain, pFile, debuggerFlags, fIsCollectible)); + NewHolder pAssembly (new Assembly(pDomain, pPEAssembly, debuggerFlags, fIsCollectible)); #ifdef PROFILING_SUPPORTED { @@ -798,9 +798,9 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, mdToken mdLinkRef; mdToken mdBinding; - IMDInternalImport *pManifestImport = GetManifestImport(); + IMDInternalImport *pMDImport = GetMDImport(); - IfFailThrow(pManifestImport->GetExportedTypeProps( + IfFailThrow(pMDImport->GetExportedTypeProps( mdType, NULL, NULL, @@ -809,7 +809,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, NULL)); // dwflags // Don't trust the returned tokens. - if (!pManifestImport->IsValidToken(mdLinkRef)) + if (!pMDImport->IsValidToken(mdLinkRef)) { if (loadFlag != Loader::Load) { @@ -1137,13 +1137,13 @@ void Assembly::CacheManifestExportedTypes(AllocMemTracker *pamTracker) mdToken mdExportedType; - HENUMInternalHolder phEnum(GetManifestImport()); + HENUMInternalHolder phEnum(GetMDImport()); phEnum.EnumInit(mdtExportedType, mdTokenNil); ClassLoader::AvailableClasses_LockHolder lh(m_pClassLoader); - for(int i = 0; GetManifestImport()->EnumNext(&phEnum, &mdExportedType); i++) + for(int i = 0; GetMDImport()->EnumNext(&phEnum, &mdExportedType); i++) m_pClassLoader->AddExportedTypeHaveLock(GetManifestModule(), mdExportedType, pamTracker); diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index ef444f089d7ef..36a58a232f37a 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -295,7 +295,7 @@ class Assembly return m_pPEAssembly; } - IMDInternalImport* GetManifestImport() + IMDInternalImport* GetMDImport() { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; diff --git a/src/coreclr/vm/assemblynative.cpp b/src/coreclr/vm/assemblynative.cpp index 18c908fadbeb5..b7f5a08d02239 100644 --- a/src/coreclr/vm/assemblynative.cpp +++ b/src/coreclr/vm/assemblynative.cpp @@ -727,7 +727,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetExportedTypes(QCall::AssemblyHandle Assembly * pAsm = pAssembly->GetAssembly(); - IMDInternalImport *pImport = pAsm->GetManifestImport(); + IMDInternalImport *pImport = pAsm->GetMDImport(); { HENUMTypeDefInternalHolder phTDEnum(pImport); @@ -847,7 +847,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetForwardedTypes(QCall::AssemblyHandle Assembly * pAsm = pAssembly->GetAssembly(); - IMDInternalImport *pImport = pAsm->GetManifestImport(); + IMDInternalImport *pImport = pAsm->GetMDImport(); // enumerate the ExportedTypes table { @@ -979,7 +979,7 @@ FCIMPL1(Object*, AssemblyNative::GetReferencedAssemblies, AssemblyBaseObject * p HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - IMDInternalImport *pImport = pAssembly->GetAssembly()->GetManifestImport(); + IMDInternalImport *pImport = pAssembly->GetAssembly()->GetMDImport(); MethodTable* pAsmNameClass = CoreLibBinder::GetClass(CLASS__ASSEMBLY_NAME); diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 87876cded4d57..084aa7038c839 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1629,9 +1629,7 @@ BOOL Module::IsNoStringInterning() HRESULT hr; - // This flag applies to assembly, but it is stored on module so it can be cached in ngen image - // Thus, we should ever need it for manifest module only. - IMDInternalImport *mdImport = GetAssembly()->GetManifestImport(); + IMDInternalImport *mdImport = GetAssembly()->GetMDImport(); _ASSERTE(mdImport); mdToken token; @@ -1736,9 +1734,7 @@ BOOL Module::IsRuntimeWrapExceptions() HRESULT hr; BOOL fRuntimeWrapExceptions = FALSE; - // This flag applies to assembly, but it is stored on module so it can be cached in ngen image - // Thus, we should ever need it for manifest module only. - IMDInternalImport *mdImport = GetAssembly()->GetManifestImport(); + IMDInternalImport *mdImport = GetAssembly()->GetMDImport(); mdToken token; IfFailGo(mdImport->GetAssemblyFromScope(&token)); @@ -1822,7 +1818,7 @@ BOOL Module::IsPreV4Assembly() if (!(m_dwPersistedFlags & COMPUTED_IS_PRE_V4_ASSEMBLY)) { - IMDInternalImport *pImport = GetAssembly()->GetManifestImport(); + IMDInternalImport *pImport = GetAssembly()->GetMDImport(); _ASSERTE(pImport); BOOL fIsPreV4Assembly = FALSE; @@ -3543,7 +3539,7 @@ DomainFile *Module::LoadModule(AppDomain *pDomain, mdFile kFile) else { // This is mdtFile - IfFailThrow(GetAssembly()->GetManifestImport()->GetFileProps(kFile, + IfFailThrow(GetAssembly()->GetMDImport()->GetFileProps(kFile, &psModuleName, NULL, NULL, diff --git a/src/coreclr/vm/classhash.cpp b/src/coreclr/vm/classhash.cpp index 28c636f7c9aad..7320f7bae72a7 100644 --- a/src/coreclr/vm/classhash.cpp +++ b/src/coreclr/vm/classhash.cpp @@ -267,7 +267,7 @@ VOID EEClassHashTable::ConstructKeyFromData(PTR_EEClassHashEntry pEntry, // IN mdToken mdtUncompressed = UncompressModuleAndClassDef(Data); if (TypeFromToken(mdtUncompressed) == mdtExportedType) { - IfFailThrow(GetModule()->GetClassLoader()->GetAssembly()->GetManifestImport()->GetExportedTypeProps( + IfFailThrow(GetModule()->GetClassLoader()->GetAssembly()->GetMDImport()->GetExportedTypeProps( mdtUncompressed, (LPCSTR *)&pszNameSpace, (LPCSTR *)&pszName, diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp index a2b0129e2dd71..251807d2ed37c 100644 --- a/src/coreclr/vm/clsload.cpp +++ b/src/coreclr/vm/clsload.cpp @@ -563,7 +563,7 @@ BOOL ClassLoader::IsNested(Module *pModule, mdToken token, mdToken *mdEncloser) (*mdEncloser != mdTypeRefNil)); case mdtExportedType: - IfFailThrow(pModule->GetAssembly()->GetManifestImport()->GetExportedTypeProps( + IfFailThrow(pModule->GetAssembly()->GetMDImport()->GetExportedTypeProps( token, NULL, // namespace NULL, // name @@ -744,7 +744,7 @@ void ClassLoader::GetClassValue(NameHandleTable nhTable, (pBucket = pTable->FindNextNestedClass(pName, pData, &sContext)) != NULL); break; case mdtExportedType: - while ((!CompareNestedEntryWithExportedType(pNameModule->GetAssembly()->GetManifestImport(), + while ((!CompareNestedEntryWithExportedType(pNameModule->GetAssembly()->GetMDImport(), mdEncloser, pCurrentClsModule->GetAvailableClassHash(), pBucket->GetEncloser())) && @@ -858,8 +858,8 @@ void ClassLoader::LazyPopulateCaseSensitiveHashTables() PopulateAvailableClassHashTable(pModule, &amTracker); } - // Add exported types of the manifest module to the hashtable - IMDInternalImport * pManifestImport = GetAssembly()->GetManifestImport(); + // Add exported types to the hashtable + IMDInternalImport * pManifestImport = GetAssembly()->GetMDImport(); HENUMInternalHolder phEnum(pManifestImport); phEnum.EnumInit(mdtExportedType, mdTokenNil); @@ -1498,7 +1498,7 @@ ClassLoader::LoadTypeHandleThrowing( if (typeHnd.IsNull() || !CompareNameHandleWithTypeHandleNoThrow(pName, typeHnd)) { if (SUCCEEDED(pClsLdr->FindTypeDefByExportedType( - pClsLdr->GetAssembly()->GetManifestImport(), + pClsLdr->GetAssembly()->GetMDImport(), FoundExportedType, pFoundModule->GetMDImport(), &FoundCl))) diff --git a/src/coreclr/vm/commodule.cpp b/src/coreclr/vm/commodule.cpp index f19482c2a59f3..fda92a6b84f8d 100644 --- a/src/coreclr/vm/commodule.cpp +++ b/src/coreclr/vm/commodule.cpp @@ -262,7 +262,7 @@ extern "C" INT32 QCALLTYPE ModuleBuilder_GetMemberRef(QCall::ModuleHandle pModul ULONG cbNewSig; IfFailThrow( pRefedModule->GetMDImport()->TranslateSigWithScope( - pRefedAssembly->GetManifestImport(), + pRefedAssembly->GetMDImport(), NULL, 0, // hash value pvComSig, cbComSig, @@ -349,7 +349,7 @@ extern "C" INT32 QCALLTYPE ModuleBuilder_GetMemberRefOfMethodInfo(QCall::ModuleH } IfFailThrow( pMeth->GetMDImport()->TranslateSigWithScope( - pRefedAssembly->GetManifestImport(), + pRefedAssembly->GetMDImport(), NULL, 0, // hash blob value pvComSig, cbComSig, @@ -428,7 +428,7 @@ extern "C" mdMemberRef QCALLTYPE ModuleBuilder_GetMemberRefOfFieldInfo(QCall::Mo ULONG cbNewSig; IfFailThrow( pRefedMDImport->TranslateSigWithScope( - pRefedAssembly->GetManifestImport(), + pRefedAssembly->GetMDImport(), NULL, 0, // hash value pvComSig, cbComSig, diff --git a/src/coreclr/vm/domainfile.inl b/src/coreclr/vm/domainfile.inl index a87d9aaef1309..474b066a39c4e 100644 --- a/src/coreclr/vm/domainfile.inl +++ b/src/coreclr/vm/domainfile.inl @@ -35,6 +35,7 @@ inline Module* DomainFile::GetModule() return m_pModule; } +//TODO: VS remove? inline Assembly* DomainAssembly::GetCurrentAssembly() { LIMITED_METHOD_CONTRACT; diff --git a/src/coreclr/vm/interoputil.cpp b/src/coreclr/vm/interoputil.cpp index 3bf1abcfcfbee..c0b3ff484649a 100644 --- a/src/coreclr/vm/interoputil.cpp +++ b/src/coreclr/vm/interoputil.cpp @@ -2501,8 +2501,8 @@ HRESULT GetTypeLibGuidForAssembly(Assembly *pAssembly, GUID *pGuid) CQuickArray rName; // String for guid. ULONG cbData; // Size of the string in bytes. - // Get GUID from Assembly, else from Manifest Module, else Generate from name. - hr = pAssembly->GetManifestImport()->GetItemGuid(TokenFromRid(1, mdtAssembly), pGuid); + // Get GUID from Assembly, else Generate from name. + hr = pAssembly->GetMDImport()->GetItemGuid(TokenFromRid(1, mdtAssembly), pGuid); if (*pGuid == GUID_NULL) { @@ -2548,7 +2548,7 @@ HRESULT GetTypeLibVersionForAssembly( ULONG cbData = 0; // Check to see if the TypeLibVersionAttribute is set. - IfFailRet(pAssembly->GetManifestImport()->GetCustomAttributeByName(TokenFromRid(1, mdtAssembly), INTEROP_TYPELIBVERSION_TYPE, (const void**)&pbData, &cbData)); + IfFailRet(pAssembly->GetMDImport()->GetCustomAttributeByName(TokenFromRid(1, mdtAssembly), INTEROP_TYPELIBVERSION_TYPE, (const void**)&pbData, &cbData)); // For attribute contents, see https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.typelibversionattribute if (cbData >= (2 + 2 * sizeof(UINT32))) diff --git a/src/coreclr/vm/nativeimage.cpp b/src/coreclr/vm/nativeimage.cpp index 3bb47cff1acb3..2664a44ad2d18 100644 --- a/src/coreclr/vm/nativeimage.cpp +++ b/src/coreclr/vm/nativeimage.cpp @@ -289,7 +289,7 @@ void NativeImage::CheckAssemblyMvid(Assembly *assembly) const } GUID assemblyMvid; - assembly->GetManifestImport()->GetScopeProps(NULL, &assemblyMvid); + assembly->GetMDImport()->GetScopeProps(NULL, &assemblyMvid); const byte *pImageBase = (const BYTE *)m_pImageLayout->GetBase(); const GUID *componentMvid = (const GUID *)&pImageBase[m_pComponentAssemblyMvids->VirtualAddress] + assemblyNameIndex->Index; diff --git a/src/coreclr/vm/peassembly.cpp b/src/coreclr/vm/peassembly.cpp index 9f228fdb5af82..ef396bc8e702e 100644 --- a/src/coreclr/vm/peassembly.cpp +++ b/src/coreclr/vm/peassembly.cpp @@ -552,7 +552,7 @@ BOOL PEAssembly::GetResource(LPCSTR szName, DWORD *cbResource, pDomainAssembly = pAssembly->GetDomainAssembly(); pPEAssembly = pDomainAssembly->GetPEAssembly(); - if (FAILED(pAssembly->GetManifestImport()->FindManifestResourceByName( + if (FAILED(pAssembly->GetMDImport()->FindManifestResourceByName( szName, &mdResource))) { diff --git a/src/coreclr/vm/runtimehandles.cpp b/src/coreclr/vm/runtimehandles.cpp index 41057e01620d3..fe74c4c35869c 100644 --- a/src/coreclr/vm/runtimehandles.cpp +++ b/src/coreclr/vm/runtimehandles.cpp @@ -2705,7 +2705,7 @@ FCIMPL1(INT32, AssemblyHandle::GetToken, AssemblyBaseObject* pAssemblyUNSAFE) { DomainAssembly *pAssembly = refAssembly->GetDomainAssembly(); mdAssembly token = mdAssemblyNil; - IMDInternalImport *mdImport = pAssembly->GetCurrentAssembly()->GetManifestImport(); + IMDInternalImport *mdImport = pAssembly->GetCurrentAssembly()->GetMDImport(); if (mdImport != 0) { From b99316e060ee86b308401ad8bac5849a367b773f Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 15:25:31 -0800 Subject: [PATCH 03/25] removed GetCurrentAssembly(), GetLoadedAssembly() --- src/coreclr/debug/daccess/dacimpl.h | 2 +- src/coreclr/nativeaot/Runtime/eventtrace.cpp | 2 +- src/coreclr/vm/appdomain.cpp | 6 +++--- src/coreclr/vm/assembly.cpp | 2 +- src/coreclr/vm/ceeload.cpp | 6 +++--- src/coreclr/vm/domainfile.cpp | 2 +- src/coreclr/vm/domainfile.h | 2 -- src/coreclr/vm/domainfile.inl | 18 +----------------- src/coreclr/vm/eventtrace.cpp | 2 +- src/coreclr/vm/loaderallocator.cpp | 8 ++++---- src/coreclr/vm/runtimehandles.cpp | 4 ++-- 11 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/coreclr/debug/daccess/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h index 57a4dc1bbab8f..998cc01be06b4 100644 --- a/src/coreclr/debug/daccess/dacimpl.h +++ b/src/coreclr/debug/daccess/dacimpl.h @@ -545,7 +545,7 @@ struct ProcessModIter } // Note: DAC doesn't need to keep the assembly alive - see code:CollectibleAssemblyHolder#CAH_DAC - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); + CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetAssembly(); return pAssembly; } return NULL; diff --git a/src/coreclr/nativeaot/Runtime/eventtrace.cpp b/src/coreclr/nativeaot/Runtime/eventtrace.cpp index dff30f07ae890..1740f41b61f70 100644 --- a/src/coreclr/nativeaot/Runtime/eventtrace.cpp +++ b/src/coreclr/nativeaot/Runtime/eventtrace.cpp @@ -6184,7 +6184,7 @@ void ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp CollectibleAssemblyHolder pDomainAssembly; while (assemblyIterator.Next(pDomainAssembly.This())) { - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); + CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetAssembly(); BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); if (bIsDomainNeutral) continue; diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index b24818c2d3e3d..80d551590d532 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -1322,7 +1322,7 @@ void SystemDomain::LoadBaseSystemClasses() // Only partially load the system assembly. Other parts of the code will want to access // the globals in this function before finishing the load. - m_pSystemAssembly = DefaultDomain()->LoadDomainAssembly(NULL, m_pSystemPEAssembly, FILE_LOAD_POST_LOADLIBRARY)->GetCurrentAssembly(); + m_pSystemAssembly = DefaultDomain()->LoadDomainAssembly(NULL, m_pSystemPEAssembly, FILE_LOAD_POST_LOADLIBRARY)->GetAssembly(); // Set up binder for CoreLib CoreLibBinder::AttachModule(m_pSystemAssembly->GetManifestModule()); @@ -2174,7 +2174,7 @@ BOOL AppDomain::ContainsAssembly(Assembly * assem) while (i.Next(pDomainAssembly.This())) { - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); + CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetAssembly(); if (pAssembly == assem) return TRUE; } @@ -2889,7 +2889,7 @@ DomainAssembly *AppDomain::LoadDomainAssemblyInternal(AssemblySpec* pIdentity, if (registerNewAssembly) { - pPEAssembly->GetAssemblyBinder()->AddLoadedAssembly(pDomainAssembly->GetCurrentAssembly()); + pPEAssembly->GetAssemblyBinder()->AddLoadedAssembly(pDomainAssembly->GetAssembly()); } } else diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index e0fbc58e42fa2..79d6a34d22a52 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -1072,7 +1072,7 @@ Module * Assembly::FindModuleByTypeRef( if (pDomainAssembly == NULL) RETURN NULL; - pAssembly = pDomainAssembly->GetCurrentAssembly(); + pAssembly = pDomainAssembly->GetAssembly(); if (pAssembly == NULL) { RETURN NULL; diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 084aa7038c839..78de78d019e69 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -3316,7 +3316,7 @@ Module::GetAssemblyIfLoaded( } if (pDomainAssembly && pDomainAssembly->IsLoaded()) - pAssembly = pDomainAssembly->GetCurrentAssembly(); // Do not use GetAssembly - that may force the completion of a load + pAssembly = pDomainAssembly->GetAssembly(); // Do not use GetAssembly - that may force the completion of a load // Only store in the rid map if working with the current AppDomain. if (fCanUseRidMap && pAssembly) @@ -3427,9 +3427,9 @@ DomainAssembly * Module::LoadAssembly(mdAssemblyRef kAssemblyRef) !pDomainAssembly->IsLoaded() || // GetAssemblyIfLoaded will not find not-yet-loaded assemblies GetAssemblyIfLoaded(kAssemblyRef, NULL, FALSE, pDomainAssembly->GetPEAssembly()->GetHostAssembly()->GetBinder()) != NULL); // GetAssemblyIfLoaded should find all remaining cases - if (pDomainAssembly->GetCurrentAssembly() != NULL) + if (pDomainAssembly->GetAssembly() != NULL) { - StoreAssemblyRef(kAssemblyRef, pDomainAssembly->GetCurrentAssembly()); + StoreAssemblyRef(kAssemblyRef, pDomainAssembly->GetAssembly()); } } diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index 22796801543b3..4cf45cc492d2f 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -642,7 +642,7 @@ void DomainFile::Activate() // We cannot execute any code in this assembly until we know what exception plan it is on. // At the point of an exception's stack-crawl it is too late because we cannot tolerate a GC. // See PossiblyUnwrapThrowable and its callers. - _ASSERTE(GetLoadedModule() == GetDomainAssembly()->GetLoadedAssembly()->GetManifestModule()); + _ASSERTE(GetLoadedModule() == GetDomainAssembly()->GetAssembly()->GetManifestModule()); GetLoadedModule()->IsRuntimeWrapExceptions(); } diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index 917af193ceade..5bd5c50547170 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -441,8 +441,6 @@ class DomainAssembly : public DomainFile // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). OBJECTREF GetExposedAssemblyObject(); - Assembly* GetCurrentAssembly(); - Assembly* GetLoadedAssembly(); Assembly* GetAssembly(); #ifdef DACCESS_COMPILE diff --git a/src/coreclr/vm/domainfile.inl b/src/coreclr/vm/domainfile.inl index 474b066a39c4e..a732d7f8c9bc9 100644 --- a/src/coreclr/vm/domainfile.inl +++ b/src/coreclr/vm/domainfile.inl @@ -35,15 +35,7 @@ inline Module* DomainFile::GetModule() return m_pModule; } -//TODO: VS remove? -inline Assembly* DomainAssembly::GetCurrentAssembly() -{ - LIMITED_METHOD_CONTRACT; - - return m_pAssembly; -} - -inline Assembly* DomainAssembly::GetLoadedAssembly() +inline Assembly* DomainAssembly::GetAssembly() { LIMITED_METHOD_DAC_CONTRACT; CONSISTENCY_CHECK(CheckLoaded()); @@ -51,14 +43,6 @@ inline Assembly* DomainAssembly::GetLoadedAssembly() return m_pAssembly; } -inline Assembly* DomainAssembly::GetAssembly() -{ - LIMITED_METHOD_CONTRACT; - - CONSISTENCY_CHECK(CheckLoadLevel(FILE_LOAD_ALLOCATE)); - return m_pAssembly; -} - inline ULONG DomainAssembly::HashIdentity() { WRAPPER_NO_CONTRACT; diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 9e1fc9560b746..6e6f7fbcd066c 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -7246,7 +7246,7 @@ VOID ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp CollectibleAssemblyHolder pDomainAssembly; while (assemblyIterator.Next(pDomainAssembly.This())) { - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); + CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetAssembly(); if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 5b5c9d142c89d..657ff7b2b40ce 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -360,7 +360,7 @@ LoaderAllocator * LoaderAllocator::GCLoaderAllocators_RemoveAssemblies(AppDomain while (iData.Next_Unlocked(pDomainAssembly.This())) { // The assembly could be collected (ref-count = 0), do not use holder which calls add-ref - Assembly * pAssembly = pDomainAssembly->GetLoadedAssembly(); + Assembly * pAssembly = pDomainAssembly->GetAssembly(); if (pAssembly != NULL) { @@ -393,7 +393,7 @@ LoaderAllocator * LoaderAllocator::GCLoaderAllocators_RemoveAssemblies(AppDomain while (i.Next_Unlocked(pDomainAssembly.This())) { // The assembly could be collected (ref-count = 0), do not use holder which calls add-ref - Assembly * pAssembly = pDomainAssembly->GetLoadedAssembly(); + Assembly * pAssembly = pDomainAssembly->GetAssembly(); if (pAssembly != NULL) { @@ -420,7 +420,7 @@ LoaderAllocator * LoaderAllocator::GCLoaderAllocators_RemoveAssemblies(AppDomain while (i.Next_Unlocked(pDomainAssembly.This())) { // The assembly could be collected (ref-count = 0), do not use holder which calls add-ref - Assembly * pAssembly = pDomainAssembly->GetLoadedAssembly(); + Assembly * pAssembly = pDomainAssembly->GetAssembly(); if (pAssembly != NULL) { @@ -672,7 +672,7 @@ BOOL LoaderAllocator::Destroy(QCall::LoaderAllocatorHandle pLoaderAllocator) DomainAssembly* pDomainAssembly = (DomainAssembly*)(pID->GetDomainAssemblyIterator()); if (pDomainAssembly != NULL) { - Assembly *pAssembly = pDomainAssembly->GetCurrentAssembly(); + Assembly *pAssembly = pDomainAssembly->GetAssembly(); pLoaderAllocator->m_pFirstDomainAssemblyFromSameALCToDelete = pAssembly->GetDomainAssembly(); } diff --git a/src/coreclr/vm/runtimehandles.cpp b/src/coreclr/vm/runtimehandles.cpp index fe74c4c35869c..e88e71c6502d0 100644 --- a/src/coreclr/vm/runtimehandles.cpp +++ b/src/coreclr/vm/runtimehandles.cpp @@ -2667,7 +2667,7 @@ FCIMPL1(ReflectModuleBaseObject*, AssemblyHandle::GetManifestModule, AssemblyBas FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); DomainAssembly *pAssembly = refAssembly->GetDomainAssembly(); - Assembly* currentAssembly = pAssembly->GetCurrentAssembly(); + Assembly* currentAssembly = pAssembly->GetAssembly(); Module *pModule = currentAssembly->GetManifestModule(); DomainFile * pDomainFile = pModule->GetDomainFile(); @@ -2705,7 +2705,7 @@ FCIMPL1(INT32, AssemblyHandle::GetToken, AssemblyBaseObject* pAssemblyUNSAFE) { DomainAssembly *pAssembly = refAssembly->GetDomainAssembly(); mdAssembly token = mdAssemblyNil; - IMDInternalImport *mdImport = pAssembly->GetCurrentAssembly()->GetMDImport(); + IMDInternalImport *mdImport = pAssembly->GetAssembly()->GetMDImport(); if (mdImport != 0) { From b907403f1a4021ce70419997ed445734987874a8 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 15:48:28 -0800 Subject: [PATCH 04/25] removed GetCurrentModule(), GetLoadedModule() --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 10 ++++----- src/coreclr/debug/ee/debugger.cpp | 2 +- src/coreclr/vm/assembly.cpp | 4 ++-- src/coreclr/vm/assemblynative.cpp | 2 +- src/coreclr/vm/domainfile.cpp | 26 +++++++++++----------- src/coreclr/vm/domainfile.h | 7 ------ src/coreclr/vm/domainfile.inl | 28 +----------------------- src/coreclr/vm/methoditer.cpp | 8 +++---- src/coreclr/vm/methoditer.h | 2 +- 9 files changed, 28 insertions(+), 61 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 4efcd8a8323b4..2b4261ebb5d81 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -720,7 +720,7 @@ HRESULT DacDbiInterfaceImpl::SetCompilerFlags(VMPTR_DomainFile vmDomainFile, DWORD dwBits = 0; DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetCurrentModule(); + Module * pModule = pDomainFile->GetModule(); HRESULT hr = S_OK; @@ -1090,7 +1090,7 @@ void DacDbiInterfaceImpl::GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, DD_ENTER_MAY_THROW; DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetCurrentModule(); + Module * pModule = pDomainFile->GetModule(); RVA methodRVA = 0; DWORD implFlags; @@ -1335,7 +1335,7 @@ void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainFile vmDomainFil pCodeInfo->Clear(); DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetCurrentModule(); + Module * pModule = pDomainFile->GetModule(); MethodDesc* pMethodDesc = FindLoadedMethodRefOrDef(pModule, functionToken); pCodeInfo->vmNativeCodeMethodDescToken.SetHostPtr(pMethodDesc); @@ -4091,7 +4091,7 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, { DD_ENTER_MAY_THROW; DomainFile * pDomainFile = pTypeRefInfo->vmDomainFile.GetDacPtr(); - Module * pReferencingModule = pDomainFile->GetCurrentModule(); + Module * pReferencingModule = pDomainFile->GetModule(); BOOL fSuccess = FALSE; // Resolve the type ref @@ -4528,7 +4528,7 @@ VMPTR_DomainAssembly DacDbiInterfaceImpl::ResolveAssembly( DomainFile * pDomainFile = vmScope.GetDacPtr(); AppDomain * pAppDomain = pDomainFile->GetAppDomain(); - Module * pModule = pDomainFile->GetCurrentModule(); + Module * pModule = pDomainFile->GetModule(); VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 1e326e724250b..9a09c4e9b59cc 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -5317,7 +5317,7 @@ DebuggerModule* Debugger::AddDebuggerModule(DomainFile * pDomainFile) LOG((LF_CORDB, LL_INFO1000, "D::ADM df=0x%x\n", pDomainFile)); DebuggerDataLockHolder chInfo(this); - Module * pRuntimeModule = pDomainFile->GetCurrentModule(); + Module * pRuntimeModule = pDomainFile->GetModule(); AppDomain * pAppDomain = pDomainFile->GetAppDomain(); HRESULT hr = CheckInitModuleTable(); diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 79d6a34d22a52..073488d566ad1 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -837,7 +837,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, GetManifestModule()->LoadAssembly(mdLinkRef); PREFIX_ASSUME(pDomainAssembly != NULL); - RETURN pDomainAssembly->GetCurrentModule(); + RETURN pDomainAssembly->GetModule(); #else _ASSERTE(!"DAC shouldn't attempt to trigger loading"); return NULL; @@ -894,7 +894,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, RETURN NULL; else { - pModule = pDomainModule->GetCurrentModule(); + pModule = pDomainModule->GetModule(); if (pModule == NULL) { _ASSERTE(loadFlag!=Loader::Load); diff --git a/src/coreclr/vm/assemblynative.cpp b/src/coreclr/vm/assemblynative.cpp index b7f5a08d02239..76e7fd2eb6aa0 100644 --- a/src/coreclr/vm/assemblynative.cpp +++ b/src/coreclr/vm/assemblynative.cpp @@ -1106,7 +1106,7 @@ FCIMPL1(ReflectModuleBaseObject *, AssemblyNative::GetInMemoryAssemblyModule, As DomainAssembly *pAssembly = refAssembly->GetDomainAssembly(); - FC_RETURN_MODULE_OBJECT(pAssembly->GetCurrentModule(), refAssembly); + FC_RETURN_MODULE_OBJECT(pAssembly->GetModule(), refAssembly); } FCIMPLEND diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index 4cf45cc492d2f..aab66da605de7 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -211,18 +211,18 @@ void DomainFile::SetError(Exception *ex) m_pError = new ExInfo(ex->DomainBoundClone()); - GetCurrentModule()->NotifyEtwLoadFinished(ex->GetHR()); + GetModule()->NotifyEtwLoadFinished(ex->GetHR()); if (!IsProfilerNotified()) { SetProfilerNotified(); #ifdef PROFILING_SUPPORTED - if (GetCurrentModule() != NULL) + if (GetModule() != NULL) { // Only send errors for non-shared assemblies; other assemblies might be successfully completed // in another app domain later. - GetCurrentModule()->NotifyProfilerLoadFinished(ex->GetHR()); + GetModule()->NotifyProfilerLoadFinished(ex->GetHR()); } #endif } @@ -557,7 +557,7 @@ void DomainFile::PostLoadLibrary() if (!IsProfilerNotified()) { SetProfilerNotified(); - GetCurrentModule()->NotifyProfilerLoadFinished(S_OK); + GetModule()->NotifyProfilerLoadFinished(S_OK); } #endif @@ -573,18 +573,18 @@ void DomainFile::EagerFixups() WRAPPER_NO_CONTRACT; #ifdef FEATURE_READYTORUN - if (GetCurrentModule()->IsReadyToRun()) + if (GetModule()->IsReadyToRun()) { - GetCurrentModule()->RunEagerFixups(); + GetModule()->RunEagerFixups(); - PEImageLayout * pLayout = GetCurrentModule()->GetReadyToRunInfo()->GetImage(); + PEImageLayout * pLayout = GetModule()->GetReadyToRunInfo()->GetImage(); TADDR base = dac_cast(pLayout->GetBase()); ExecutionManager::AddCodeRange(base, base + (TADDR)pLayout->GetVirtualSize(), ExecutionManager::GetReadyToRunJitManager(), RangeSection::RANGE_SECTION_READYTORUN, - GetCurrentModule() /* (void *)pLayout */); + GetModule() /* (void *)pLayout */); } #endif // FEATURE_READYTORUN } @@ -593,7 +593,7 @@ void DomainFile::VtableFixups() { WRAPPER_NO_CONTRACT; - GetCurrentModule()->FixupVTables(); + GetModule()->FixupVTables(); } void DomainFile::FinishLoad() @@ -642,8 +642,8 @@ void DomainFile::Activate() // We cannot execute any code in this assembly until we know what exception plan it is on. // At the point of an exception's stack-crawl it is too late because we cannot tolerate a GC. // See PossiblyUnwrapThrowable and its callers. - _ASSERTE(GetLoadedModule() == GetDomainAssembly()->GetAssembly()->GetManifestModule()); - GetLoadedModule()->IsRuntimeWrapExceptions(); + _ASSERTE(GetModule() == GetDomainAssembly()->GetAssembly()->GetManifestModule()); + GetModule()->IsRuntimeWrapExceptions(); } // Now activate any dependencies. @@ -946,14 +946,14 @@ void DomainAssembly::DeliverSyncEvents() } CONTRACTL_END; - GetCurrentModule()->NotifyEtwLoadFinished(S_OK); + GetModule()->NotifyEtwLoadFinished(S_OK); // We may be notified from inside the loader lock if we are delivering IJW events, so keep track. #ifdef PROFILING_SUPPORTED if (!IsProfilerNotified()) { SetProfilerNotified(); - GetCurrentModule()->NotifyProfilerLoadFinished(S_OK); + GetModule()->NotifyProfilerLoadFinished(S_OK); } #endif diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index 5bd5c50547170..1f748727cb2e2 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -249,8 +249,6 @@ class DomainFile BOOL Equals(PEAssembly *pPEAssembly) { WRAPPER_NO_CONTRACT; return GetPEAssembly()->Equals(pPEAssembly); } #endif // DACCESS_COMPILE - Module* GetCurrentModule(); - Module* GetLoadedModule(); Module* GetModule(); #ifdef DACCESS_COMPILE @@ -485,11 +483,6 @@ class DomainAssembly : public DomainFile WRAPPER_NO_CONTRACT; return GetDomainFile()->GetModule(); } - Module *GetLoadedModule() - { - WRAPPER_NO_CONTRACT; - return GetDomainFile()->GetLoadedModule(); - } DomainFile *GetDomainFile() { WRAPPER_NO_CONTRACT; diff --git a/src/coreclr/vm/domainfile.inl b/src/coreclr/vm/domainfile.inl index a732d7f8c9bc9..517d6ea2e4ff9 100644 --- a/src/coreclr/vm/domainfile.inl +++ b/src/coreclr/vm/domainfile.inl @@ -1,36 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// - -inline Module* DomainFile::GetCurrentModule() -{ - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - return m_pModule; -} - -inline Module* DomainFile::GetLoadedModule() -{ - LIMITED_METHOD_CONTRACT; - CONSISTENCY_CHECK(CheckLoaded()); - - return m_pModule; -} - inline Module* DomainFile::GetModule() { LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - { - // While executing the consistency check, we will take a lock. - // But since this is debug-only, we'll allow the lock violation so that - // CANNOT_TAKE_LOCK callers aren't penalized - CONTRACT_VIOLATION(TakesLockViolation); - CONSISTENCY_CHECK(CheckLoadLevel(FILE_LOAD_ALLOCATE)); - } + CONSISTENCY_CHECK(CheckLoaded()); return m_pModule; } diff --git a/src/coreclr/vm/methoditer.cpp b/src/coreclr/vm/methoditer.cpp index 841b3214d2e2d..b0bcc8780787e 100644 --- a/src/coreclr/vm/methoditer.cpp +++ b/src/coreclr/vm/methoditer.cpp @@ -95,7 +95,7 @@ BOOL LoadedMethodDescIterator::Next( ADVANCE_TYPE: if (m_mainMD->HasClassInstantiation()) { - if (!GetCurrentModule()->GetAvailableParamTypes()->FindNext(&m_typeIterator, &m_typeIteratorEntry)) + if (!GetModule()->GetAvailableParamTypes()->FindNext(&m_typeIterator, &m_typeIteratorEntry)) goto ADVANCE_MODULE; if (CORCOMPILE_IS_POINTER_TAGGED(m_typeIteratorEntry->GetTypeHandle().AsTAddr())) goto ADVANCE_TYPE; @@ -149,7 +149,7 @@ BOOL LoadedMethodDescIterator::Next( ADVANCE_METHOD: if (m_mainMD->HasMethodInstantiation()) { - if (!GetCurrentModule()->GetInstMethodHashTable()->FindNext(&m_methodIterator, &m_methodIteratorEntry)) + if (!GetModule()->GetInstMethodHashTable()->FindNext(&m_methodIterator, &m_methodIteratorEntry)) goto ADVANCE_TYPE; if (CORCOMPILE_IS_POINTER_TAGGED(dac_cast(m_methodIteratorEntry->GetMethod()))) goto ADVANCE_METHOD; @@ -178,7 +178,7 @@ BOOL LoadedMethodDescIterator::Next( } // LoadedMethodDescIterator::Next -Module * LoadedMethodDescIterator::GetCurrentModule() +Module * LoadedMethodDescIterator::GetModule() { CONTRACTL { @@ -188,7 +188,7 @@ Module * LoadedMethodDescIterator::GetCurrentModule() } CONTRACTL_END - return m_moduleIterator.GetLoadedModule(); + return m_moduleIterator.GetModule(); } MethodDesc *LoadedMethodDescIterator::Current() diff --git a/src/coreclr/vm/methoditer.h b/src/coreclr/vm/methoditer.h index 71192be2e0c01..25e88e349c5da 100644 --- a/src/coreclr/vm/methoditer.h +++ b/src/coreclr/vm/methoditer.h @@ -86,7 +86,7 @@ class LoadedMethodDescIterator LoadedMethodDescIterator(void); protected: - Module * GetCurrentModule(); + Module * GetModule(); }; // class LoadedMethodDescIterator From 0f1c732d536d761833551931b4bfe0aab0b8c2f6 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:49:31 -0800 Subject: [PATCH 05/25] fix --- src/coreclr/vm/domainfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index aab66da605de7..25585ee80efd0 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -491,7 +491,7 @@ BOOL DomainFile::DoIncrementalLoad(FileLoadLevel level) #ifdef FEATURE_MULTICOREJIT { - Module * pModule = GetModule(); + Module * pModule = m_pModule; if (pModule != NULL) // Should not triggle assert when module is NULL { From 82f2ffabf248d95c0aae265c2d849319ece10bc5 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 19:25:04 -0800 Subject: [PATCH 06/25] removed DomainFile::ModuleIterator --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 19 +--- src/coreclr/debug/ee/debugger.cpp | 10 +- src/coreclr/vm/assembly.hpp | 1 + src/coreclr/vm/ceeload.cpp | 6 +- src/coreclr/vm/codeversion.cpp | 5 +- src/coreclr/vm/domainfile.cpp | 27 ++---- src/coreclr/vm/domainfile.h | 90 +---------------- src/coreclr/vm/eventtrace.cpp | 118 ++++++++++------------- src/coreclr/vm/methoditer.cpp | 16 +-- src/coreclr/vm/methoditer.h | 11 +-- src/coreclr/vm/multicorejit.cpp | 17 +--- src/coreclr/vm/profilingenumerators.cpp | 17 +--- src/coreclr/vm/rejit.cpp | 42 ++++---- 13 files changed, 103 insertions(+), 276 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 2b4261ebb5d81..ea8d0d650c905 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -4494,24 +4494,13 @@ void DacDbiInterfaceImpl::EnumerateModulesInAssembly( DomainAssembly * pDomainAssembly = vmAssembly.GetDacPtr(); - // If the domain is not yet fully-loaded, don't advertise it yet. - // It's not ready to be inspected. - DomainModuleIterator iterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - - while (iterator.Next()) + // Debugger isn't notified of Resource / Inspection-only modules. + if (pDomainAssembly->GetModule()->IsVisibleToDebugger()) { - DomainFile * pDomainFile = iterator.GetDomainFile(); - - // Debugger isn't notified of Resource / Inspection-only modules. - if (!pDomainFile->GetModule()->IsVisibleToDebugger()) - { - continue; - } - - _ASSERTE(pDomainFile->IsLoaded()); + _ASSERTE(pDomainAssembly->IsLoaded()); VMPTR_DomainFile vmDomainFile = VMPTR_DomainFile::NullPtr(); - vmDomainFile.SetHostPtr(pDomainFile); + vmDomainFile.SetHostPtr(pDomainAssembly); fpCallback(vmDomainFile, pUserData); } diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 9a09c4e9b59cc..2dc2f5406fb3e 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -14725,16 +14725,12 @@ HRESULT Debugger::IterateAppDomainsForPdbs() if (!pDomainAssembly->IsVisibleToDebugger()) continue; - DomainAssembly::ModuleIterator j = pDomainAssembly->IterateModules(kModIterIncludeLoading); - while (j.Next()) + if (pDomainAssembly->ShouldNotifyDebugger()) { - DomainFile * pDomainFile = j.GetDomainFile(); - if (!pDomainFile->ShouldNotifyDebugger()) - continue; - - Module* pRuntimeModule = pDomainFile->GetModule(); + Module* pRuntimeModule = pDomainAssembly->GetModule(); CopyModulePdb(pRuntimeModule); } + if (pDomainAssembly->ShouldNotifyDebugger()) { CopyModulePdb(pDomainAssembly->GetModule()); diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index 36a58a232f37a..bde7aaf3a075f 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -188,6 +188,7 @@ class Assembly } }; + // TODO: VS ModuleIterator IterateModules() { WRAPPER_NO_CONTRACT; diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 78de78d019e69..fd71b794e88da 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -6474,11 +6474,7 @@ void Module::WriteAllModuleProfileData(bool cleanup) while (assemblyIterator.Next(pDomainAssembly.This())) { - DomainModuleIterator i = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while (i.Next()) - { - /*hr=*/i.GetModule()->WriteMethodProfileDataLogFile(cleanup); - } + pDomainAssembly->GetModule()->WriteMethodProfileDataLogFile(cleanup); } } } diff --git a/src/coreclr/vm/codeversion.cpp b/src/coreclr/vm/codeversion.cpp index 8fa82da46db6e..d59e13d45d45d 100644 --- a/src/coreclr/vm/codeversion.cpp +++ b/src/coreclr/vm/codeversion.cpp @@ -2036,18 +2036,15 @@ HRESULT CodeVersionManager::EnumerateDomainClosedMethodDescs( // these are the default flags which won't actually be used in shared mode other than // asserting they were specified with their default values AssemblyIterationFlags assemFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution); - ModuleIterationOption moduleFlags = (ModuleIterationOption)kModIterIncludeLoaded; if (pAppDomainToSearch != NULL) { assemFlags = (AssemblyIterationFlags)(kIncludeAvailableToProfilers | kIncludeExecution); - moduleFlags = (ModuleIterationOption)kModIterIncludeAvailableToProfilers; } LoadedMethodDescIterator it( pAppDomainToSearch, pModuleContainingMethodDef, methodDef, - assemFlags, - moduleFlags); + assemFlags); CollectibleAssemblyHolder pDomainAssembly; while (it.Next(pDomainAssembly.This())) { diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index 25585ee80efd0..354db36404af1 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -725,13 +725,6 @@ DomainAssembly::~DomainAssembly() UnregisterFromHostAssembly(); } - ModuleIterator i = IterateModules(kModIterIncludeLoading); - while (i.Next()) - { - if (i.GetDomainFile() != this) - delete i.GetDomainFile(); - } - if (m_pAssembly != NULL) { delete m_pAssembly; @@ -1162,16 +1155,12 @@ BOOL DomainAssembly::NotifyDebuggerLoad(int flags, BOOL attaching) result = TRUE; } - DomainModuleIterator i = IterateModules(kModIterIncludeLoading); - while (i.Next()) + if(this->ShouldNotifyDebugger()) { - DomainFile * pDomainFile = i.GetDomainFile(); - if(pDomainFile->ShouldNotifyDebugger()) - { - result = result || - pDomainFile->GetModule()->NotifyDebuggerLoad(this->GetAppDomain(), pDomainFile, flags, attaching); - } + result = result || + this->GetModule()->NotifyDebuggerLoad(this->GetAppDomain(), this, flags, attaching); } + if( ShouldNotifyDebugger()) { result|=m_pModule->NotifyDebuggerLoad(m_pDomain, this, ATTACH_MODULE_LOAD, attaching); @@ -1195,13 +1184,9 @@ void DomainAssembly::NotifyDebuggerUnload() m_fDebuggerUnloadStarted = TRUE; - // Dispatch module unloads for all modules. Debugger is resilient in case we haven't dispatched + // Dispatch module unload for the module. Debugger is resilient in case we haven't dispatched // a previous load event (such as if debugger attached after the modules was loaded). - DomainModuleIterator i = IterateModules(kModIterIncludeLoading); - while (i.Next()) - { - i.GetDomainFile()->GetModule()->NotifyDebuggerUnload(this->GetAppDomain()); - } + this->GetModule()->NotifyDebuggerUnload(this->GetAppDomain()); g_pDebugInterface->UnloadAssembly(this); diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index 1f748727cb2e2..8e5049d01cf80 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -383,22 +383,6 @@ class DomainFile BOOL m_bDisableActivationCheck; }; -//--------------------------------------------------------------------------------------- -// One of these values is specified when requesting a module iterator to customize which -// modules should appear in the enumeration -enum ModuleIterationOption -{ - // include only modules that are already loaded (m_level >= FILE_LOAD_DELIVER_EVENTS) - kModIterIncludeLoaded = 1, - - // include all modules, even those that are still in the process of loading (all m_level values) - kModIterIncludeLoading = 2, - - // include only modules loaded just enough that profilers are notified of them. - // (m_level >= FILE_LOAD_LOADLIBRARY). See comment at code:DomainFile::IsAvailableToProfilers - kModIterIncludeAvailableToProfilers = 3, -}; - // -------------------------------------------------------------------------------- // DomainAssembly is a subclass of DomainFile which specifically represents a assembly. // -------------------------------------------------------------------------------- @@ -445,77 +429,6 @@ class DomainAssembly : public DomainFile virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif - // ------------------------------------------------------------ - // Modules - // ------------------------------------------------------------ - class ModuleIterator - { - ArrayList::Iterator m_i; - ModuleIterationOption m_moduleIterationOption; - - public: - BOOL Next() - { - WRAPPER_NO_CONTRACT; - while (m_i.Next()) - { - if (m_i.GetElement() == NULL) - { - continue; - } - if (GetDomainFile()->IsError()) - { - continue; - } - if (m_moduleIterationOption == kModIterIncludeLoading) - return TRUE; - if ((m_moduleIterationOption == kModIterIncludeLoaded) && - GetDomainFile()->IsLoaded()) - return TRUE; - if ((m_moduleIterationOption == kModIterIncludeAvailableToProfilers) && - GetDomainFile()->IsAvailableToProfilers()) - return TRUE; - } - return FALSE; - } - Module *GetModule() - { - WRAPPER_NO_CONTRACT; - return GetDomainFile()->GetModule(); - } - DomainFile *GetDomainFile() - { - WRAPPER_NO_CONTRACT; - return dac_cast(m_i.GetElement()); - } - SIZE_T GetIndex() - { - WRAPPER_NO_CONTRACT; - return m_i.GetIndex(); - } - - private: - friend class DomainAssembly; - // Cannot have constructor so this iterator can be used inside a union - static ModuleIterator Create(DomainAssembly * pDomainAssembly, ModuleIterationOption moduleIterationOption) - { - WRAPPER_NO_CONTRACT; - ModuleIterator i; - - i.m_i = pDomainAssembly->m_Modules.Iterate(); - i.m_moduleIterationOption = moduleIterationOption; - - return i; - } - }; - friend class ModuleIterator; - - ModuleIterator IterateModules(ModuleIterationOption moduleIterationOption) - { - WRAPPER_NO_CONTRACT; - return ModuleIterator::Create(this, moduleIterationOption); - } - // ------------------------------------------------------------ // Resource access // ------------------------------------------------------------ @@ -593,6 +506,7 @@ class DomainAssembly : public DomainFile LOADERHANDLE m_hExposedAssemblyObject; PTR_Assembly m_pAssembly; DebuggerAssemblyControlFlags m_debuggerFlags; + ArrayList m_Modules; BOOL m_fDebuggerUnloadStarted; BOOL m_fCollectible; @@ -613,6 +527,4 @@ class DomainAssembly : public DomainFile } }; -typedef DomainAssembly::ModuleIterator DomainModuleIterator; - #endif // _DOMAINFILE_H_ diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 6e6f7fbcd066c..88fe4891f1ce1 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -1524,69 +1524,64 @@ void BulkStaticsLogger::LogAllStatics() continue; CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetAssembly(); - DomainModuleIterator modIter = pDomainAssembly->IterateModules(kModIterIncludeLoaded); + // Get the domain module from the module/appdomain pair. + Module *module = pDomainAssembly->GetModule(); + if (module == NULL) + continue; - while (modIter.Next()) - { - // Get the domain module from the module/appdomain pair. - Module *module = modIter.GetModule(); - if (module == NULL) - continue; + DomainFile *domainFile = module->GetDomainFile(); + if (domainFile == NULL) + continue; - DomainFile *domainFile = module->GetDomainFile(); - if (domainFile == NULL) - continue; + // Ensure the module has fully loaded. + if (!domainFile->IsActive()) + continue; - // Ensure the module has fully loaded. - if (!domainFile->IsActive()) + DomainLocalModule *domainModule = module->GetDomainLocalModule(); + if (domainModule == NULL) + continue; + + // Now iterate all types with + LookupMap::Iterator mtIter = module->EnumerateTypeDefs(); + while (mtIter.Next()) + { + // I don't think mt can be null here, but the dac does a null check... + // IsFullyLoaded should be equivalent to 'GetLoadLevel() == CLASS_LOADED' + MethodTable *mt = mtIter.GetElement(); + if (mt == NULL || !mt->IsFullyLoaded()) continue; - DomainLocalModule *domainModule = module->GetDomainLocalModule(); - if (domainModule == NULL) + EEClass *cls = mt->GetClass(); + _ASSERTE(cls != NULL); + + if (cls->GetNumStaticFields() <= 0) continue; - // Now iterate all types with - LookupMap::Iterator mtIter = module->EnumerateTypeDefs(); - while (mtIter.Next()) + ApproxFieldDescIterator fieldIter(mt, ApproxFieldDescIterator::STATIC_FIELDS); + for (FieldDesc *field = fieldIter.Next(); field != NULL; field = fieldIter.Next()) { - // I don't think mt can be null here, but the dac does a null check... - // IsFullyLoaded should be equivalent to 'GetLoadLevel() == CLASS_LOADED' - MethodTable *mt = mtIter.GetElement(); - if (mt == NULL || !mt->IsFullyLoaded()) + // Don't want thread local + _ASSERTE(field->IsStatic()); + if (field->IsSpecialStatic() || field->IsEnCNew()) + continue; + + // Static valuetype values are boxed. + CorElementType fieldType = field->GetFieldType(); + if (fieldType != ELEMENT_TYPE_CLASS && fieldType != ELEMENT_TYPE_VALUETYPE) continue; - EEClass *cls = mt->GetClass(); - _ASSERTE(cls != NULL); + BYTE *base = field->GetBaseInDomainLocalModule(domainModule); + if (base == NULL) + continue; - if (cls->GetNumStaticFields() <= 0) + Object **address = (Object**)field->GetStaticAddressHandle(base); + Object *obj = NULL; + if (address == NULL || ((obj = *address) == NULL)) continue; - ApproxFieldDescIterator fieldIter(mt, ApproxFieldDescIterator::STATIC_FIELDS); - for (FieldDesc *field = fieldIter.Next(); field != NULL; field = fieldIter.Next()) - { - // Don't want thread local - _ASSERTE(field->IsStatic()); - if (field->IsSpecialStatic() || field->IsEnCNew()) - continue; - - // Static valuetype values are boxed. - CorElementType fieldType = field->GetFieldType(); - if (fieldType != ELEMENT_TYPE_CLASS && fieldType != ELEMENT_TYPE_VALUETYPE) - continue; - - BYTE *base = field->GetBaseInDomainLocalModule(domainModule); - if (base == NULL) - continue; - - Object **address = (Object**)field->GetStaticAddressHandle(base); - Object *obj = NULL; - if (address == NULL || ((obj = *address) == NULL)) - continue; - - WriteEntry(domain, address, *address, field); - } // foreach static field - } - } // foreach domain module + WriteEntry(domain, address, *address, field); + } // foreach static field + } } // foreach domain assembly } // foreach AppDomain } // BulkStaticsLogger::LogAllStatics @@ -7252,12 +7247,8 @@ VOID ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); } - DomainModuleIterator domainModuleIterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while (domainModuleIterator.Next()) - { - Module * pModule = domainModuleIterator.GetModule(); - ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); - } + Module * pModule = pDomainAssembly->GetModule(); + ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) @@ -7313,12 +7304,8 @@ VOID ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAlloca { Assembly *pAssembly = domainAssemblyIt->GetAssembly(); // TODO: handle iterator - DomainModuleIterator domainModuleIterator = domainAssemblyIt->IterateModules(kModIterIncludeLoaded); - while (domainModuleIterator.Next()) - { - Module *pModule = domainModuleIterator.GetModule(); - ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); - } + Module* pModule = domainAssemblyIt->GetModule(); + ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) { @@ -7362,11 +7349,8 @@ VOID ETW::EnumerationLog::IterateAssembly(Assembly *pAssembly, DWORD enumeration { if(pAssembly->GetDomain()->IsAppDomain()) { - DomainModuleIterator dmIterator = pAssembly->GetDomainAssembly()->IterateModules(kModIterIncludeLoaded); - while (dmIterator.Next()) - { - ETW::LoaderLog::SendModuleEvent(dmIterator.GetModule(), enumerationOptions, TRUE); - } + Module* pModule = pAssembly->GetDomainAssembly()->GetModule(); + ETW::LoaderLog::SendModuleEvent(pModule, enumerationOptions, TRUE); } } diff --git a/src/coreclr/vm/methoditer.cpp b/src/coreclr/vm/methoditer.cpp index b0bcc8780787e..41b22aa0032b1 100644 --- a/src/coreclr/vm/methoditer.cpp +++ b/src/coreclr/vm/methoditer.cpp @@ -77,11 +77,7 @@ BOOL LoadedMethodDescIterator::Next( dbg_m_pDomainAssembly = *pDomainAssemblyHolder; #endif //_DEBUG - m_moduleIterator = (*pDomainAssemblyHolder)->IterateModules(m_moduleIterationFlags); - -ADVANCE_MODULE: - if (!m_moduleIterator.Next()) - goto ADVANCE_ASSEMBLY; + m_currentModule = (*pDomainAssemblyHolder)->GetModule(); if (m_mainMD->HasClassInstantiation()) { @@ -96,7 +92,7 @@ BOOL LoadedMethodDescIterator::Next( if (m_mainMD->HasClassInstantiation()) { if (!GetModule()->GetAvailableParamTypes()->FindNext(&m_typeIterator, &m_typeIteratorEntry)) - goto ADVANCE_MODULE; + goto ADVANCE_ASSEMBLY; if (CORCOMPILE_IS_POINTER_TAGGED(m_typeIteratorEntry->GetTypeHandle().AsTAddr())) goto ADVANCE_TYPE; @@ -130,7 +126,7 @@ BOOL LoadedMethodDescIterator::Next( } else if (m_startedNonGenericType) { - goto ADVANCE_MODULE; + goto ADVANCE_ASSEMBLY; } else { @@ -188,7 +184,7 @@ Module * LoadedMethodDescIterator::GetModule() } CONTRACTL_END - return m_moduleIterator.GetModule(); + return m_currentModule; } MethodDesc *LoadedMethodDescIterator::Current() @@ -228,8 +224,7 @@ LoadedMethodDescIterator::Start( AppDomain * pAppDomain, Module *pModule, mdMethodDef md, - AssemblyIterationFlags assemblyIterationFlags, - ModuleIterationOption moduleIterationFlags) + AssemblyIterationFlags assemblyIterationFlags) { CONTRACTL { @@ -241,7 +236,6 @@ LoadedMethodDescIterator::Start( CONTRACTL_END; m_assemIterationFlags = assemblyIterationFlags; - m_moduleIterationFlags = moduleIterationFlags; m_mainMD = NULL; m_module = pModule; m_md = md; diff --git a/src/coreclr/vm/methoditer.h b/src/coreclr/vm/methoditer.h index 25e88e349c5da..7f4fd520a1d01 100644 --- a/src/coreclr/vm/methoditer.h +++ b/src/coreclr/vm/methoditer.h @@ -44,9 +44,8 @@ class LoadedMethodDescIterator // These are used when iterating over an AppDomain AppDomain::AssemblyIterator m_assemIterator; - DomainModuleIterator m_moduleIterator; + Module* m_currentModule; AssemblyIterationFlags m_assemIterationFlags; - ModuleIterationOption m_moduleIterationFlags; EETypeHashTable::Iterator m_typeIterator; EETypeHashEntry * m_typeIteratorEntry; @@ -69,19 +68,17 @@ class LoadedMethodDescIterator void Start(AppDomain * pAppDomain, Module *pModule, mdMethodDef md, - AssemblyIterationFlags assemIterationFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution), - ModuleIterationOption moduleIterationFlags = kModIterIncludeLoaded); + AssemblyIterationFlags assemIterationFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)); void Start(AppDomain * pAppDomain, Module *pModule, mdMethodDef md, MethodDesc *pDesc); LoadedMethodDescIterator( AppDomain * pAppDomain, Module *pModule, mdMethodDef md, - AssemblyIterationFlags assemblyIterationFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution), - ModuleIterationOption moduleIterationFlags = kModIterIncludeLoaded) + AssemblyIterationFlags assemblyIterationFlags = (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)) { LIMITED_METHOD_CONTRACT; - Start(pAppDomain, pModule, md, assemblyIterationFlags, moduleIterationFlags); + Start(pAppDomain, pModule, md, assemblyIterationFlags); } LoadedMethodDescIterator(void); diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index c616503436792..52a2e0a6c3364 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -770,21 +770,8 @@ HRESULT MulticoreJitModuleEnumerator::HandleAssembly(DomainAssembly * pAssembly) { STANDARD_VM_CONTRACT; - DomainAssembly::ModuleIterator modIt = pAssembly->IterateModules(kModIterIncludeLoaded); - - HRESULT hr = S_OK; - - while (modIt.Next() && SUCCEEDED(hr)) - { - Module * pModule = modIt.GetModule(); - - if (pModule != NULL) - { - hr = OnModule(pModule); - } - } - - return hr; + Module * pModule = pAssembly->GetModule(); + return OnModule(pModule); } diff --git a/src/coreclr/vm/profilingenumerators.cpp b/src/coreclr/vm/profilingenumerators.cpp index 609b57cf4ee3a..86f9bcb45c92d 100644 --- a/src/coreclr/vm/profilingenumerators.cpp +++ b/src/coreclr/vm/profilingenumerators.cpp @@ -282,21 +282,14 @@ HRESULT IterateUnsharedModules(AppDomain * pAppDomain, // < Module NOT available from catch-up enumeration // < ModuleUnloadStarted issued // - // The IterateModules parameter below ensures only modules at level >= - // code:FILE_LOAD_LOADLIBRARY will be included in the iteration. - // // Details for module callbacks are the same as those for assemblies, so see // code:#ProfilerEnumAssemblies for info on how the timing works. - DomainModuleIterator domainModuleIterator = - pDomainAssembly->IterateModules(kModIterIncludeAvailableToProfilers); - while (domainModuleIterator.Next()) + + // Call user-supplied callback, and cancel iteration if requested + HRESULT hr = (callbackObj->*callbackMethod)(pDomainAssembly->GetModule()); + if (hr != S_OK) { - // Call user-supplied callback, and cancel iteration if requested - HRESULT hr = (callbackObj->*callbackMethod)(domainModuleIterator.GetModule()); - if (hr != S_OK) - { - return hr; - } + return hr; } } diff --git a/src/coreclr/vm/rejit.cpp b/src/coreclr/vm/rejit.cpp index aaf335390764c..80f05489ad3b2 100644 --- a/src/coreclr/vm/rejit.cpp +++ b/src/coreclr/vm/rejit.cpp @@ -811,35 +811,31 @@ HRESULT ReJitManager::UpdateNativeInlinerActiveILVersions( _ASSERTE(pDomainAssembly != NULL); _ASSERTE(pDomainAssembly->GetAssembly() != NULL); - DomainModuleIterator domainModuleIterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while (domainModuleIterator.Next()) + Module * pModule = pDomainAssembly->GetModule(); + if (pModule->HasReadyToRunInlineTrackingMap()) { - Module * pCurModule = domainModuleIterator.GetModule(); - if (pCurModule->HasReadyToRunInlineTrackingMap()) - { - inlinerIter.Reset(pCurModule, pInlinee); + inlinerIter.Reset(pModule, pInlinee); - MethodDesc *pInliner = NULL; - while (inlinerIter.Next()) + MethodDesc *pInliner = NULL; + while (inlinerIter.Next()) + { + pInliner = inlinerIter.GetMethodDesc(); { - pInliner = inlinerIter.GetMethodDesc(); + CodeVersionManager *pCodeVersionManager = pModule->GetCodeVersionManager(); + CodeVersionManager::LockHolder codeVersioningLockHolder; + ILCodeVersion ilVersion = pCodeVersionManager->GetActiveILCodeVersion(pInliner); + if (!ilVersion.HasDefaultIL()) { - CodeVersionManager *pCodeVersionManager = pCurModule->GetCodeVersionManager(); - CodeVersionManager::LockHolder codeVersioningLockHolder; - ILCodeVersion ilVersion = pCodeVersionManager->GetActiveILCodeVersion(pInliner); - if (!ilVersion.HasDefaultIL()) - { - // This method has already been ReJITted, no need to request another ReJIT at this point. - // The ReJITted method will be in the JIT inliner check below. - continue; - } + // This method has already been ReJITted, no need to request another ReJIT at this point. + // The ReJITted method will be in the JIT inliner check below. + continue; } + } - hr = UpdateActiveILVersion(pMgrToCodeActivationBatch, pInliner->GetModule(), pInliner->GetMemberDef(), fIsRevert, flags); - if (FAILED(hr)) - { - ReportReJITError(pInliner->GetModule(), pInliner->GetMemberDef(), NULL, hr); - } + hr = UpdateActiveILVersion(pMgrToCodeActivationBatch, pInliner->GetModule(), pInliner->GetMemberDef(), fIsRevert, flags); + if (FAILED(hr)) + { + ReportReJITError(pInliner->GetModule(), pInliner->GetMemberDef(), NULL, hr); } } } From bc797ba6b9124fab93db295db119c4a03de070ed Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 24 Dec 2021 20:13:37 -0800 Subject: [PATCH 07/25] renamed Assembly::GetManifestModule() --> GetModule() --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 2 +- src/coreclr/debug/ee/debugger.cpp | 2 +- src/coreclr/vm/appdomain.cpp | 6 +-- src/coreclr/vm/appdomain.hpp | 2 +- src/coreclr/vm/assembly.cpp | 56 ++++++++++++------------ src/coreclr/vm/assembly.hpp | 28 ++++++------ src/coreclr/vm/assemblynative.cpp | 10 ++--- src/coreclr/vm/ceeload.cpp | 18 ++++---- src/coreclr/vm/ceeload.h | 1 + src/coreclr/vm/ceeload.inl | 10 ++--- src/coreclr/vm/clsload.cpp | 6 +-- src/coreclr/vm/commodule.cpp | 6 +-- src/coreclr/vm/domainfile.cpp | 6 +-- src/coreclr/vm/dwbucketmanager.hpp | 4 +- src/coreclr/vm/excep.cpp | 4 +- src/coreclr/vm/interoputil.cpp | 2 +- src/coreclr/vm/nativelibrary.cpp | 2 +- src/coreclr/vm/prestub.cpp | 2 +- src/coreclr/vm/proftoeeinterfaceimpl.cpp | 2 +- src/coreclr/vm/runtimehandles.cpp | 4 +- src/coreclr/vm/typeparse.cpp | 2 +- src/coreclr/vm/zapsig.cpp | 4 +- 22 files changed, 90 insertions(+), 89 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index ea8d0d650c905..5d51b1f2760a1 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -4066,7 +4066,7 @@ BOOL DacDbiInterfaceImpl::GetAssemblyPath( // Get the manifest module for this assembly Assembly * pAssembly = vmAssembly.GetDacPtr(); - Module * pManifestModule = pAssembly->GetManifestModule(); + Module * pManifestModule = pAssembly->GetModule(); // Get the path for the manifest module. // since we no longer support Win9x, we assume all paths will be in unicode format already diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 2dc2f5406fb3e..44646d08ab5f5 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -9461,7 +9461,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, { // The loader lookups may throw or togggle GC mode, so do them inside a TRY/Catch and // outside any debugger locks. - Module * pManifestModule = pRuntimeModule->GetAssembly()->GetManifestModule(); + Module * pManifestModule = pRuntimeModule->GetAssembly()->GetModule(); _ASSERTE(pManifestModule != pRuntimeModule); _ASSERTE(pManifestModule->IsManifest()); diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 80d551590d532..c143d8a3da403 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -1325,7 +1325,7 @@ void SystemDomain::LoadBaseSystemClasses() m_pSystemAssembly = DefaultDomain()->LoadDomainAssembly(NULL, m_pSystemPEAssembly, FILE_LOAD_POST_LOADLIBRARY)->GetAssembly(); // Set up binder for CoreLib - CoreLibBinder::AttachModule(m_pSystemAssembly->GetManifestModule()); + CoreLibBinder::AttachModule(m_pSystemAssembly->GetModule()); // Load Object g_pObjectClass = CoreLibBinder::GetClass(CLASS__OBJECT); @@ -2626,7 +2626,7 @@ CHECK AppDomain::CheckCanLoadTypes(Assembly *pAssembly) MODE_ANY; } CONTRACTL_END; - CHECK_MSG(CheckValidModule(pAssembly->GetManifestModule()), + CHECK_MSG(CheckValidModule(pAssembly->GetModule()), "Type loading can occur only when executing in the assembly's app domain"); CHECK_OK; } @@ -4903,7 +4903,7 @@ AppDomain::AssemblyIterator::Next_Unlocked( // Un-tenured collectible assemblies should not be returned. (This can only happen in a brief // window during collectible assembly creation. No thread should need to have a pointer // to the just allocated DomainAssembly at this stage.) - if (!pDomainAssembly->GetAssembly()->GetManifestModule()->IsTenured()) + if (!pDomainAssembly->GetAssembly()->GetModule()->IsTenured()) { continue; // reject } diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 55e7dca0d2a8d..85bf3ef869c9b 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -2453,7 +2453,7 @@ class SystemDomain : public BaseDomain { WRAPPER_NO_CONTRACT; - return SystemAssembly()->GetManifestModule(); + return SystemAssembly()->GetModule(); } static BOOL IsSystemLoaded() diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 073488d566ad1..d5ecbad98e56c 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -126,7 +126,7 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pPEAssembly, DebuggerAssembl m_pDomain(pDomain), m_pClassLoader(NULL), m_pEntryPoint(NULL), - m_pManifest(NULL), + m_pModule(NULL), m_pPEAssembly(clr::SafeAddRef(pPEAssembly)), m_pFriendAssemblyDescriptor(NULL), m_isDynamic(false), @@ -197,17 +197,17 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat if (pPEAssembly->IsDynamic()) // manifest modules of dynamic assemblies are always transient - m_pManifest = ReflectionModule::Create(this, pPEAssembly, pamTracker, REFEMIT_MANIFEST_MODULE_NAME); + m_pModule = ReflectionModule::Create(this, pPEAssembly, pamTracker, REFEMIT_MANIFEST_MODULE_NAME); else - m_pManifest = Module::Create(this, mdFileNil, pPEAssembly, pamTracker); + m_pModule = Module::Create(this, mdFileNil, pPEAssembly, pamTracker); FastInterlockIncrement((LONG*)&g_cAssemblies); - PrepareModuleForAssembly(m_pManifest, pamTracker); + PrepareModuleForAssembly(m_pModule, pamTracker); CacheManifestFiles(); - if (!m_pManifest->IsReadyToRun()) + if (!m_pModule->IsReadyToRun()) CacheManifestExportedTypes(pamTracker); // We'll load the friend assembly information lazily. For the ngen case we should avoid @@ -231,7 +231,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat FAULT_FORBID(); //Cannot fail after this point. - PublishModuleIntoAssembly(m_pManifest); + PublishModuleIntoAssembly(m_pModule); return; // Explicit return to let you know you are NOT welcome to add code after the CANNOTTHROW/FAULT_FORBID expires } @@ -625,7 +625,7 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, AssemblyBinder* pBinder, C // Assembly::Create will call SuppressRelease on the NewHolder that holds the LoaderAllocator when it transfers ownership pAssem = Assembly::Create(pDomain, pPEAssembly, pDomainAssembly->GetDebuggerInfoBits(), pLoaderAllocator->IsCollectible(), pamTracker, pLoaderAllocator); - ReflectionModule* pModule = (ReflectionModule*) pAssem->GetManifestModule(); + ReflectionModule* pModule = (ReflectionModule*) pAssem->GetModule(); pModule->SetCreatingAssembly( pCallerAssembly ); @@ -696,7 +696,7 @@ void Assembly::SetDomainAssembly(DomainAssembly *pDomainAssembly) } CONTRACTL_END; - GetManifestModule()->SetDomainFile(pDomainAssembly); + GetModule()->SetDomainFile(pDomainAssembly); } // Assembly::SetDomainAssembly @@ -705,7 +705,7 @@ void Assembly::SetDomainAssembly(DomainAssembly *pDomainAssembly) DomainAssembly *Assembly::GetDomainAssembly() { LIMITED_METHOD_DAC_CONTRACT; - return GetManifestModule()->GetDomainAssembly(); + return GetModule()->GetDomainAssembly(); } PTR_LoaderHeap Assembly::GetLowFrequencyHeap() @@ -834,7 +834,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, #ifndef DACCESS_COMPILE // LoadAssembly never returns NULL DomainAssembly * pDomainAssembly = - GetManifestModule()->LoadAssembly(mdLinkRef); + GetModule()->LoadAssembly(mdLinkRef); PREFIX_ASSUME(pDomainAssembly != NULL); RETURN pDomainAssembly->GetModule(); @@ -844,17 +844,17 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, #endif // !DACCESS_COMPILE }; case Loader::DontLoad: - pAssembly = GetManifestModule()->GetAssemblyIfLoaded(mdLinkRef); + pAssembly = GetModule()->GetAssemblyIfLoaded(mdLinkRef); break; case Loader::SafeLookup: - pAssembly = GetManifestModule()->LookupAssemblyRef(mdLinkRef); + pAssembly = GetModule()->LookupAssemblyRef(mdLinkRef); break; default: _ASSERTE(FALSE); } if (pAssembly) - RETURN pAssembly->GetManifestModule(); + RETURN pAssembly->GetModule(); else RETURN NULL; @@ -871,7 +871,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, // Note that we don't want to attempt a LoadModule if a GetModuleIfLoaded will // succeed, because it has a stronger contract. - Module *pModule = GetManifestModule()->GetModuleIfLoaded(mdLinkRef); + Module *pModule = GetModule()->GetModuleIfLoaded(mdLinkRef); #ifdef DACCESS_COMPILE return pModule; #else @@ -887,7 +887,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, DomainFile* pDomainModule = NULL; if (loadFlag == Loader::Load) { - pDomainModule = GetManifestModule()->LoadModule(::GetAppDomain(), mdLinkRef); + pDomainModule = GetModule()->LoadModule(::GetAppDomain(), mdLinkRef); } if (pDomainModule == NULL) @@ -1054,7 +1054,7 @@ Module * Assembly::FindModuleByTypeRef( if (pAssembly != NULL) { - RETURN pAssembly->m_pManifest; + RETURN pAssembly->m_pModule; } #ifdef DACCESS_COMPILE @@ -1079,7 +1079,7 @@ Module * Assembly::FindModuleByTypeRef( } else { - RETURN pAssembly->m_pManifest; + RETURN pAssembly->m_pModule; } #endif //!DACCESS_COMPILE } @@ -1114,9 +1114,9 @@ Module *Assembly::FindModuleByName(LPCSTR pszModuleName) ThrowHR(COR_E_UNAUTHORIZEDACCESS); if (this == SystemDomain::SystemAssembly()) - RETURN m_pManifest->GetModuleIfLoaded(kFile); + RETURN m_pModule->GetModuleIfLoaded(kFile); else - RETURN m_pManifest->LoadModule(::GetAppDomain(), kFile)->GetModule(); + RETURN m_pModule->LoadModule(::GetAppDomain(), kFile)->GetModule(); } void Assembly::CacheManifestExportedTypes(AllocMemTracker *pamTracker) @@ -1132,7 +1132,7 @@ void Assembly::CacheManifestExportedTypes(AllocMemTracker *pamTracker) // Prejitted assemblies are expected to have their table prebuilt. // If not, we do it here at load time (as if we would jit the assembly). - if (m_pManifest->IsPersistedObject(m_pManifest->m_pAvailableClasses)) + if (m_pModule->IsPersistedObject(m_pModule->m_pAvailableClasses)) RETURN; mdToken mdExportedType; @@ -1144,7 +1144,7 @@ void Assembly::CacheManifestExportedTypes(AllocMemTracker *pamTracker) ClassLoader::AvailableClasses_LockHolder lh(m_pClassLoader); for(int i = 0; GetMDImport()->EnumNext(&phEnum, &mdExportedType); i++) - m_pClassLoader->AddExportedTypeHaveLock(GetManifestModule(), + m_pClassLoader->AddExportedTypeHaveLock(GetModule(), mdExportedType, pamTracker); @@ -1186,7 +1186,7 @@ void Assembly::PrepareModuleForAssembly(Module* module, AllocMemTracker *pamTrac module->GetDebuggerInfoBits())); #endif // DEBUGGING_SUPPORTED - m_pManifest->EnsureFileCanBeStored(module->GetModuleRef()); + m_pModule->EnsureFileCanBeStored(module->GetModuleRef()); } // This is the final step of publishing a Module into an Assembly. This step cannot fail. @@ -1200,7 +1200,7 @@ void Assembly::PublishModuleIntoAssembly(Module *module) } CONTRACTL_END - GetManifestModule()->EnsuredStoreFile(module->GetModuleRef(), module); + GetModule()->EnsuredStoreFile(module->GetModuleRef(), module); FastInterlockIncrement((LONG*)&m_pClassLoader->m_cUnhashedModules); } @@ -1706,7 +1706,7 @@ MethodDesc* Assembly::GetEntryPoint() Module *pModule = NULL; switch(TypeFromToken(mdEntry)) { case mdtFile: - pModule = m_pManifest->LoadModule(::GetAppDomain(), mdEntry)->GetModule(); + pModule = m_pModule->LoadModule(::GetAppDomain(), mdEntry)->GetModule(); mdEntry = pModule->GetEntryPointToken(); if ( (TypeFromToken(mdEntry) != mdtMethodDef) || @@ -1716,7 +1716,7 @@ MethodDesc* Assembly::GetEntryPoint() case mdtMethodDef: if (m_pPEAssembly->GetMDImport()->IsValidToken(mdEntry)) - pModule = m_pManifest; + pModule = m_pModule; break; } @@ -2059,7 +2059,7 @@ void Assembly::AddExportedType(mdExportedType cl) CONTRACTL_END AllocMemTracker amTracker; - m_pClassLoader->AddExportedTypeDontHaveLock(GetManifestModule(), + m_pClassLoader->AddExportedTypeDontHaveLock(GetModule(), cl, &amTracker); amTracker.SuppressRelease(); @@ -2238,9 +2238,9 @@ Assembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) { m_pClassLoader->EnumMemoryRegions(flags); } - if (m_pManifest.IsValid()) + if (m_pModule.IsValid()) { - m_pManifest->EnumMemoryRegions(flags, true); + m_pModule->EnumMemoryRegions(flags, true); } if (m_pPEAssembly.IsValid()) { diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index bde7aaf3a075f..e30c23d6a0de0 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -64,7 +64,7 @@ struct CreateDynamicAssemblyArgs : CreateDynamicAssemblyArgsGC // // So in general an assemly is a list of code:Module, where a code:Module is 1-1 with a DLL or EXE file. // -// One of the modules the code:Assembly.m_pManifest is special in that it knows about all the other +// One of the modules the code:Assembly.m_pModule is special in that it knows about all the other // modules in an assembly (often it is the only one). // class Assembly @@ -108,7 +108,7 @@ class Assembly void SetIsTenured() { WRAPPER_NO_CONTRACT; - m_pManifest->SetIsTenured(); + m_pModule->SetIsTenured(); } // CAUTION: This should only be used as backout code if an assembly is unsuccessfully @@ -116,7 +116,7 @@ class Assembly void UnsetIsTenured() { WRAPPER_NO_CONTRACT; - m_pManifest->UnsetIsTenured(); + m_pModule->UnsetIsTenured(); } #endif // DACCESS_COMPILE @@ -136,7 +136,7 @@ class Assembly class ModuleIterator { - Module* m_pManifest; + Module* m_pModule; DWORD m_i; public: @@ -155,7 +155,7 @@ class Assembly LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - m_pManifest = NULL; + m_pModule = NULL; m_i = (DWORD) -1; } @@ -164,7 +164,7 @@ class Assembly LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - m_pManifest = pAssembly->GetManifestModule(); + m_pModule = pAssembly->GetModule(); m_i = (DWORD) -1; } @@ -172,7 +172,7 @@ class Assembly { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - while (++m_i <= m_pManifest->GetFileMax()) + while (++m_i <= m_pModule->GetFileMax()) { if (GetModule() != NULL) return TRUE; @@ -184,7 +184,7 @@ class Assembly { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - return m_pManifest->LookupFile(TokenFromRid(m_i, mdtFile)); + return m_pModule->LookupFile(TokenFromRid(m_i, mdtFile)); } }; @@ -282,11 +282,11 @@ class Assembly PTR_LoaderHeap GetHighFrequencyHeap(); PTR_LoaderHeap GetStubHeap(); - PTR_Module GetManifestModule() + PTR_Module GetModule() { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; - return m_pManifest; + return m_pModule; } PTR_PEAssembly GetPEAssembly() @@ -310,7 +310,7 @@ class Assembly { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; - return GetManifestModule()->GetCustomAttribute(parentToken, attribute, ppData, pcbData); + return GetModule()->GetCustomAttribute(parentToken, attribute, ppData, pcbData); } mdAssembly GetManifestToken() @@ -521,9 +521,9 @@ class Assembly int mask = INTEROP_ATTRIBUTE_UNSET; - if (GetManifestModule()->GetCustomAttribute(TokenFromRid(1, mdtAssembly), WellKnownAttribute::ImportedFromTypeLib, NULL, 0) == S_OK) + if (GetModule()->GetCustomAttribute(TokenFromRid(1, mdtAssembly), WellKnownAttribute::ImportedFromTypeLib, NULL, 0) == S_OK) mask |= INTEROP_ATTRIBUTE_IMPORTED_FROM_TYPELIB; - if (GetManifestModule()->GetCustomAttribute(TokenFromRid(1, mdtAssembly), WellKnownAttribute::PrimaryInteropAssembly, NULL, 0) == S_OK) + if (GetModule()->GetCustomAttribute(TokenFromRid(1, mdtAssembly), WellKnownAttribute::PrimaryInteropAssembly, NULL, 0) == S_OK) mask |= INTEROP_ATTRIBUTE_PRIMARY_INTEROP_ASSEMBLY; if (!IsDynamic()) @@ -558,7 +558,7 @@ class Assembly PTR_MethodDesc m_pEntryPoint; // Method containing the entry point - PTR_Module m_pManifest; + PTR_Module m_pModule; PTR_PEAssembly m_pPEAssembly; FriendAssemblyDescriptor *m_pFriendAssemblyDescriptor; diff --git a/src/coreclr/vm/assemblynative.cpp b/src/coreclr/vm/assemblynative.cpp index 76e7fd2eb6aa0..cb7776ad34040 100644 --- a/src/coreclr/vm/assemblynative.cpp +++ b/src/coreclr/vm/assemblynative.cpp @@ -282,7 +282,7 @@ extern "C" void QCALLTYPE AssemblyNative_LoadFromStream(INT_PTR ptrNativeAssembl if (ptrSymbolArray != NULL) { PBYTE pSymbolArray = reinterpret_cast(ptrSymbolArray); - pLoadedAssembly->GetManifestModule()->SetSymbolBytes(pSymbolArray, (DWORD)cbSymbolArrayLength); + pLoadedAssembly->GetModule()->SetSymbolBytes(pSymbolArray, (DWORD)cbSymbolArrayLength); } #endif // DEBUGGING_SUPPORTED } @@ -404,7 +404,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetForwardedType(QCall::AssemblyHandle mdToken mdImpl; Assembly * pAsm = pAssembly->GetAssembly(); - Module *pManifestModule = pAsm->GetManifestModule(); + Module *pManifestModule = pAsm->GetModule(); IfFailThrow(pManifestModule->GetMDImport()->GetExportedTypeProps(mdtExternalType, &pszNameSpace, &pszClassName, &mdImpl, NULL, NULL)); if (TypeFromToken(mdImpl) == mdtAssemblyRef) { @@ -755,7 +755,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetExportedTypes(QCall::AssemblyHandle if (IsTdPublic(dwFlags)) { - TypeHandle typeHnd = ClassLoader::LoadTypeDefThrowing(pAsm->GetManifestModule(), mdTD, + TypeHandle typeHnd = ClassLoader::LoadTypeDefThrowing(pAsm->GetModule(), mdTD, ClassLoader::ThrowIfNotFound, ClassLoader::PermitUninstDefOrRef); types.Append(typeHnd); @@ -803,7 +803,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetExportedTypes(QCall::AssemblyHandle IsTdPublic(dwFlags)) { NameHandle typeName(pszNameSpace, pszClassName); - typeName.SetTypeToken(pAsm->GetManifestModule(), mdCT); + typeName.SetTypeToken(pAsm->GetModule(), mdCT); TypeHandle typeHnd = pAsm->GetLoader()->LoadTypeHandleThrowIfFailed(&typeName); types.Append(typeHnd); @@ -873,7 +873,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetForwardedTypes(QCall::AssemblyHandle if ((TypeFromToken(mdImpl) == mdtAssemblyRef) && (mdImpl != mdAssemblyRefNil)) { NameHandle typeName(pszNameSpace, pszClassName); - typeName.SetTypeToken(pAsm->GetManifestModule(), mdCT); + typeName.SetTypeToken(pAsm->GetModule(), mdCT); TypeHandle typeHnd = pAsm->GetLoader()->LoadTypeHandleThrowIfFailed(&typeName); types.Append(typeHnd); diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index fd71b794e88da..51f1873daede9 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1041,7 +1041,7 @@ BOOL Module::IsEditAndContinueCapable(Assembly *pAssembly, PEAssembly *pPEAssemb BOOL Module::IsManifest() { WRAPPER_NO_CONTRACT; - return dac_cast(GetAssembly()->GetManifestModule()) == + return dac_cast(GetAssembly()->GetModule()) == dac_cast(this); } @@ -3470,7 +3470,7 @@ Module *Module::GetModuleIfLoaded(mdFile kFile) if (kFile == mdTokenNil) RETURN NULL; - RETURN GetAssembly()->GetManifestModule()->GetModuleIfLoaded(kFile); + RETURN GetAssembly()->GetModule()->GetModuleIfLoaded(kFile); } Module *pModule = LookupFile(kFile); @@ -3479,7 +3479,7 @@ Module *Module::GetModuleIfLoaded(mdFile kFile) if (IsManifest()) { if (kFile == mdFileNil) - pModule = GetAssembly()->GetManifestModule(); + pModule = GetAssembly()->GetModule(); } else { @@ -3493,7 +3493,7 @@ Module *Module::GetModuleIfLoaded(mdFile kFile) { if (kMatch == mdFileNil) { - pModule = pAssembly->GetManifestModule(); + pModule = pAssembly->GetModule(); } else { @@ -3501,7 +3501,7 @@ Module *Module::GetModuleIfLoaded(mdFile kFile) } } else - pModule = pAssembly->GetManifestModule()->LookupFile(kMatch); + pModule = pAssembly->GetModule()->LookupFile(kMatch); } #ifndef DACCESS_COMPILE @@ -3578,7 +3578,7 @@ PTR_Module Module::LookupModule(mdToken kFile) if (kFileLocal == mdTokenNil) COMPlusThrowHR(COR_E_BADIMAGEFORMAT); - RETURN GetAssembly()->GetManifestModule()->LookupModule(kFileLocal); + RETURN GetAssembly()->GetModule()->LookupModule(kFileLocal); } PTR_Module pModule = LookupFile(kFile); @@ -3589,12 +3589,12 @@ PTR_Module Module::LookupModule(mdToken kFile) mdFile kMatch = pAssembly->GetManifestFileToken(GetMDImport(), kFile); if (IsNilToken(kMatch)) { if (kMatch == mdFileNil) - pModule = pAssembly->GetManifestModule(); + pModule = pAssembly->GetModule(); else COMPlusThrowHR(COR_E_BADIMAGEFORMAT); } else - pModule = pAssembly->GetManifestModule()->LookupFile(kMatch); + pModule = pAssembly->GetModule()->LookupFile(kMatch); } RETURN pModule; } @@ -4591,7 +4591,7 @@ Module *Module::GetModuleFromIndex(DWORD ix) Assembly *pAssembly = this->LookupAssemblyRef(mdAssemblyRefToken); if (pAssembly) { - RETURN pAssembly->GetManifestModule(); + RETURN pAssembly->GetModule(); } else { diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index 2b9198b811732..312376569d4e9 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -923,6 +923,7 @@ class Module // a compressed format for NGen that makes up for it. LookupMap m_GenericTypeDefToCanonMethodTableMap; + //TODO: VS // Mapping from File token to Module * LookupMap m_FileReferencesMap; diff --git a/src/coreclr/vm/ceeload.inl b/src/coreclr/vm/ceeload.inl index ca770297a4bc9..fee8a8f4fcc33 100644 --- a/src/coreclr/vm/ceeload.inl +++ b/src/coreclr/vm/ceeload.inl @@ -297,25 +297,25 @@ inline Assembly *Module::LookupAssemblyRef(mdAssemblyRef token) inline void Module::ForceStoreAssemblyRef(mdAssemblyRef token, Assembly *value) { WRAPPER_NO_CONTRACT; // THROWS/GC_NOTRIGGER/INJECT_FAULT()/MODE_ANY - _ASSERTE(value->GetManifestModule()); + _ASSERTE(value->GetModule()); _ASSERTE(TypeFromToken(token) == mdtAssemblyRef); - m_ManifestModuleReferencesMap.AddElement(this, RidFromToken(token), value->GetManifestModule()); + m_ManifestModuleReferencesMap.AddElement(this, RidFromToken(token), value->GetModule()); } inline void Module::StoreAssemblyRef(mdAssemblyRef token, Assembly *value) { WRAPPER_NO_CONTRACT; - _ASSERTE(value->GetManifestModule()); + _ASSERTE(value->GetModule()); _ASSERTE(TypeFromToken(token) == mdtAssemblyRef); - m_ManifestModuleReferencesMap.TrySetElement(RidFromToken(token), value->GetManifestModule()); + m_ManifestModuleReferencesMap.TrySetElement(RidFromToken(token), value->GetModule()); } inline mdAssemblyRef Module::FindAssemblyRef(Assembly *targetAssembly) { WRAPPER_NO_CONTRACT; - return m_ManifestModuleReferencesMap.Find(targetAssembly->GetManifestModule()) | mdtAssemblyRef; + return m_ManifestModuleReferencesMap.Find(targetAssembly->GetModule()) | mdtAssemblyRef; } #endif //DACCESS_COMPILE diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp index 251807d2ed37c..2990631d5a8e2 100644 --- a/src/coreclr/vm/clsload.cpp +++ b/src/coreclr/vm/clsload.cpp @@ -865,7 +865,7 @@ void ClassLoader::LazyPopulateCaseSensitiveHashTables() mdToken mdExportedType; while (pManifestImport->EnumNext(&phEnum, &mdExportedType)) - AddExportedTypeHaveLock(GetAssembly()->GetManifestModule(), mdExportedType, &amTracker); + AddExportedTypeHaveLock(GetAssembly()->GetModule(), mdExportedType, &amTracker); amTracker.SuppressRelease(); } @@ -882,7 +882,7 @@ void ClassLoader::LazyPopulateCaseInsensitiveHashTables() } CONTRACTL_END; - if (GetAssembly()->GetManifestModule()->GetAvailableClassHash() == NULL) + if (GetAssembly()->GetModule()->GetAvailableClassHash() == NULL) { // This is a R2R assembly, and a case insensitive type lookup was triggered. // Construct the case-sensitive table first, since the case-insensitive table @@ -1860,7 +1860,7 @@ void ClassLoader::FreeModules() CONTRACTL_END; Module *pManifest = NULL; - if (GetAssembly() && (NULL != (pManifest = GetAssembly()->GetManifestModule()))) { + if (GetAssembly() && (NULL != (pManifest = GetAssembly()->GetModule()))) { // Unload the manifest last, since it contains the module list in its rid map ModuleIterator i = GetAssembly()->IterateModules(); while (i.Next()) { diff --git a/src/coreclr/vm/commodule.cpp b/src/coreclr/vm/commodule.cpp index fda92a6b84f8d..8a630352e5655 100644 --- a/src/coreclr/vm/commodule.cpp +++ b/src/coreclr/vm/commodule.cpp @@ -256,7 +256,7 @@ extern "C" INT32 QCALLTYPE ModuleBuilder_GetMemberRef(QCall::ModuleHandle pModul } SafeComHolderPreemp pAssemblyEmit; - IfFailThrow( pRefingAssembly->GetManifestModule()->GetEmitter()->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pAssemblyEmit) ); + IfFailThrow( pRefingAssembly->GetModule()->GetEmitter()->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pAssemblyEmit) ); CQuickBytes qbNewSig; ULONG cbNewSig; @@ -335,7 +335,7 @@ extern "C" INT32 QCALLTYPE ModuleBuilder_GetMemberRefOfMethodInfo(QCall::ModuleH Assembly * pRefingAssembly = pModule->GetAssembly(); SafeComHolderPreemp pAssemblyEmit; - IfFailThrow( pRefingAssembly->GetManifestModule()->GetEmitter()->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pAssemblyEmit) ); + IfFailThrow( pRefingAssembly->GetModule()->GetEmitter()->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pAssemblyEmit) ); CQuickBytes qbNewSig; ULONG cbNewSig; @@ -421,7 +421,7 @@ extern "C" mdMemberRef QCALLTYPE ModuleBuilder_GetMemberRefOfFieldInfo(QCall::Mo COMPlusThrow(kNotSupportedException, W("NotSupported_CollectibleBoundNonCollectible")); } SafeComHolderPreemp pAssemblyEmit; - IfFailThrow( pRefingAssembly->GetManifestModule()->GetEmitter()->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pAssemblyEmit) ); + IfFailThrow( pRefingAssembly->GetModule()->GetEmitter()->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pAssemblyEmit) ); // Translate the field signature this scope CQuickBytes qbNewSig; diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index 354db36404af1..e4e54c07754bf 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -642,7 +642,7 @@ void DomainFile::Activate() // We cannot execute any code in this assembly until we know what exception plan it is on. // At the point of an exception's stack-crawl it is too late because we cannot tolerate a GC. // See PossiblyUnwrapThrowable and its callers. - _ASSERTE(GetModule() == GetDomainAssembly()->GetAssembly()->GetManifestModule()); + _ASSERTE(GetModule() == GetDomainAssembly()->GetAssembly()->GetModule()); GetModule()->IsRuntimeWrapExceptions(); } @@ -735,11 +735,11 @@ void DomainAssembly::SetAssembly(Assembly* pAssembly) { STANDARD_VM_CONTRACT; - _ASSERTE(pAssembly->GetManifestModule()->GetPEAssembly()==m_pPEAssembly); + _ASSERTE(pAssembly->GetModule()->GetPEAssembly()==m_pPEAssembly); _ASSERTE(m_pAssembly == NULL); m_pAssembly = pAssembly; - m_pModule = pAssembly->GetManifestModule(); + m_pModule = pAssembly->GetModule(); pAssembly->SetDomainAssembly(this); } diff --git a/src/coreclr/vm/dwbucketmanager.hpp b/src/coreclr/vm/dwbucketmanager.hpp index 2524f706c7ef3..6eb0e9438b5f3 100644 --- a/src/coreclr/vm/dwbucketmanager.hpp +++ b/src/coreclr/vm/dwbucketmanager.hpp @@ -650,7 +650,7 @@ void BaseBucketParamsManager::GetModuleVersion(_Out_writes_(maxLength) WCHAR* ta // if we failed to get a version and this isn't the manifest module then try that if (!gotFileVersion && !pModule->IsManifest()) { - pModule = pModule->GetAssembly()->GetManifestModule(); + pModule = pModule->GetAssembly()->GetModule(); if (pModule) gotFileVersion = GetFileVersionInfoForModule(pModule, major, minor, build, revision); } @@ -701,7 +701,7 @@ void BaseBucketParamsManager::GetModuleTimeStamp(_Out_writes_(maxLength) WCHAR* { // 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()->GetManifestModule()->GetPEAssembly(); + PTR_PEAssembly pFile = pModule->GetAssembly()->GetModule()->GetPEAssembly(); // for dynamic modules use 0 as the time stamp ULONG ulTimeStamp = 0; diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index 9f02ab928785e..dd80bf37ec679 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -500,7 +500,7 @@ OBJECTREF PossiblyUnwrapThrowable(OBJECTREF throwable, Assembly *pAssembly) // Check if we are required to compute the RuntimeWrapExceptions status. BOOL fIsRuntimeWrappedException = ((throwable != NULL) && (throwable->GetMethodTable() == pMT_RuntimeWrappedException)); BOOL fRequiresComputingRuntimeWrapExceptionsStatus = (fIsRuntimeWrappedException && - (!(pAssembly->GetManifestModule()->IsRuntimeWrapExceptionsStatusComputed()))); + (!(pAssembly->GetModule()->IsRuntimeWrapExceptionsStatusComputed()))); CONTRACTL { @@ -513,7 +513,7 @@ OBJECTREF PossiblyUnwrapThrowable(OBJECTREF throwable, Assembly *pAssembly) } CONTRACTL_END; - if (fIsRuntimeWrappedException && (!pAssembly->GetManifestModule()->IsRuntimeWrapExceptions())) + if (fIsRuntimeWrappedException && (!pAssembly->GetModule()->IsRuntimeWrapExceptions())) { // We already created the instance, fetched the field. We know it is // not marshal by ref, or any of the other cases that might trigger GC. diff --git a/src/coreclr/vm/interoputil.cpp b/src/coreclr/vm/interoputil.cpp index c0b3ff484649a..b509a5c221ed1 100644 --- a/src/coreclr/vm/interoputil.cpp +++ b/src/coreclr/vm/interoputil.cpp @@ -1063,7 +1063,7 @@ CorClassIfaceAttr ReadClassInterfaceTypeCustomAttribute(TypeHandle type) { // Check the class interface attribute at the assembly level. Assembly *pAssembly = type.GetAssembly(); - hr = TryParseClassInterfaceAttribute(pAssembly->GetManifestModule(), pAssembly->GetManifestToken(), &attrValueMaybe); + hr = TryParseClassInterfaceAttribute(pAssembly->GetModule(), pAssembly->GetManifestToken(), &attrValueMaybe); if (FAILED(hr)) ThrowHR(hr, BFA_BAD_CLASS_INT_CA_FORMAT); } diff --git a/src/coreclr/vm/nativelibrary.cpp b/src/coreclr/vm/nativelibrary.cpp index 9528e246dfdd5..e397ffd9fa278 100644 --- a/src/coreclr/vm/nativelibrary.cpp +++ b/src/coreclr/vm/nativelibrary.cpp @@ -771,7 +771,7 @@ NATIVE_LIBRARY_HANDLE NativeLibrary::LoadLibraryByName(LPCWSTR libraryName, Asse } else { - GetDllImportSearchPathFlags(callingAssembly->GetManifestModule(), + GetDllImportSearchPathFlags(callingAssembly->GetModule(), &dllImportSearchPathFlags, &searchAssemblyDirectory); } diff --git a/src/coreclr/vm/prestub.cpp b/src/coreclr/vm/prestub.cpp index a4fdb065285dd..681301621f72f 100644 --- a/src/coreclr/vm/prestub.cpp +++ b/src/coreclr/vm/prestub.cpp @@ -520,7 +520,7 @@ PCODE MethodDesc::GetPrecompiledR2RCode(PrepareCodeConfig* pConfig) // Lookup in the entry point assembly for a R2R entrypoint (generics with large version bubble enabled) if (pCode == NULL && HasClassOrMethodInstantiation() && SystemDomain::System()->DefaultDomain()->GetRootAssembly() != NULL) { - pModule = SystemDomain::System()->DefaultDomain()->GetRootAssembly()->GetManifestModule(); + pModule = SystemDomain::System()->DefaultDomain()->GetRootAssembly()->GetModule(); _ASSERT(pModule != NULL); if (pModule->IsReadyToRun() && pModule->IsInSameVersionBubble(GetModule())) diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp index 50e57f8144eef..5162ac38a3bb4 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp @@ -5710,7 +5710,7 @@ HRESULT ProfToEEInterfaceImpl::GetAssemblyInfo(AssemblyID assemblyId, // Find the module the manifest lives in. if (pModuleId) { - *pModuleId = (ModuleID) pAssembly->GetManifestModule(); + *pModuleId = (ModuleID) pAssembly->GetModule(); // This is the case where the profiler has called GetAssemblyInfo // on an assembly that has been completely created yet. diff --git a/src/coreclr/vm/runtimehandles.cpp b/src/coreclr/vm/runtimehandles.cpp index e88e71c6502d0..94d2bdf6a6641 100644 --- a/src/coreclr/vm/runtimehandles.cpp +++ b/src/coreclr/vm/runtimehandles.cpp @@ -354,7 +354,7 @@ FCIMPL1(AssemblyBaseObject*, RuntimeTypeHandle::GetAssembly, ReflectClassBaseObj if (refType == NULL) FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); - Module *pModule = refType->GetType().GetAssembly()->GetManifestModule(); + Module *pModule = refType->GetType().GetAssembly()->GetModule(); DomainAssembly *pDomainAssembly = pModule->GetDomainAssembly(); FC_RETURN_ASSEMBLY_OBJECT(pDomainAssembly, refType); @@ -2669,7 +2669,7 @@ FCIMPL1(ReflectModuleBaseObject*, AssemblyHandle::GetManifestModule, AssemblyBas DomainAssembly *pAssembly = refAssembly->GetDomainAssembly(); Assembly* currentAssembly = pAssembly->GetAssembly(); - Module *pModule = currentAssembly->GetManifestModule(); + Module *pModule = currentAssembly->GetModule(); DomainFile * pDomainFile = pModule->GetDomainFile(); #ifdef _DEBUG diff --git a/src/coreclr/vm/typeparse.cpp b/src/coreclr/vm/typeparse.cpp index ddeb7082cd137..dab28d4703f17 100644 --- a/src/coreclr/vm/typeparse.cpp +++ b/src/coreclr/vm/typeparse.cpp @@ -1273,7 +1273,7 @@ TypeName::GetTypeHaveAssemblyHelper( TypeHandle th = TypeHandle(); SArray & names = GetNames(); - Module * pManifestModule = pAssembly->GetManifestModule(); + Module * pManifestModule = pAssembly->GetModule(); Module * pLookOnlyInModule = NULL; ClassLoader * pClassLoader = pAssembly->GetLoader(); diff --git a/src/coreclr/vm/zapsig.cpp b/src/coreclr/vm/zapsig.cpp index dbdff7a98c8f5..b66c7b1057138 100644 --- a/src/coreclr/vm/zapsig.cpp +++ b/src/coreclr/vm/zapsig.cpp @@ -620,7 +620,7 @@ Module *ZapSig::DecodeModuleFromIndex(Module *fromModule, } } - return pAssembly->GetManifestModule(); + return pAssembly->GetModule(); } Module *ZapSig::DecodeModuleFromIndexIfLoaded(Module *fromModule, @@ -686,7 +686,7 @@ Module *ZapSig::DecodeModuleFromIndexIfLoaded(Module *fromModule, if (pAssembly == NULL) return NULL; - return pAssembly->GetManifestModule(); + return pAssembly->GetModule(); } From f7dae8d1f70278cb4ec97266d7207e5cb3befb11 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 27 Dec 2021 15:23:54 -0800 Subject: [PATCH 08/25] Removed Assembly::ModuleIterator --- src/coreclr/debug/daccess/dacimpl.h | 25 ++-------- src/coreclr/debug/daccess/request.cpp | 16 ++---- src/coreclr/debug/daccess/task.cpp | 22 +++++---- src/coreclr/vm/assembly.cpp | 6 --- src/coreclr/vm/assembly.hpp | 70 -------------------------- src/coreclr/vm/ceeload.h | 1 - src/coreclr/vm/clsload.cpp | 71 ++++++++------------------- src/coreclr/vm/comdynamic.cpp | 8 +-- 8 files changed, 45 insertions(+), 174 deletions(-) diff --git a/src/coreclr/debug/daccess/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h index 998cc01be06b4..ee558710af87c 100644 --- a/src/coreclr/debug/daccess/dacimpl.h +++ b/src/coreclr/debug/daccess/dacimpl.h @@ -509,7 +509,6 @@ struct ProcessModIter bool m_nextDomain; AppDomain::AssemblyIterator m_assemIter; Assembly* m_curAssem; - Assembly::ModuleIterator m_modIter; ProcessModIter(void) : m_domainIter(FALSE) @@ -554,27 +553,13 @@ struct ProcessModIter Module* NextModule(void) { SUPPORTS_DAC; - for (;;) + m_curAssem = NextAssem(); + if (!m_curAssem) { - if (!m_curAssem) - { - m_curAssem = NextAssem(); - if (!m_curAssem) - { - return NULL; - } - - m_modIter = m_curAssem->IterateModules(); - } - - if (!m_modIter.Next()) - { - m_curAssem = NULL; - continue; - } - - return m_modIter.GetModule(); + return NULL; } + + return m_curAssem->GetModule(); } }; diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp index edac0a100c3f0..cd81cde5ac69e 100644 --- a/src/coreclr/debug/daccess/request.cpp +++ b/src/coreclr/debug/daccess/request.cpp @@ -2607,8 +2607,7 @@ ClrDataAccess::GetAssemblyData(CLRDATA_ADDRESS cdBaseDomainPtr, CLRDATA_ADDRESS assemblyData->ModuleCount = 0; assemblyData->isDomainNeutral = FALSE; - ModuleIterator mi = pAssembly->IterateModules(); - while (mi.Next()) + if (pAssembly->GetModule()) { assemblyData->ModuleCount++; } @@ -2701,21 +2700,14 @@ ClrDataAccess::GetAssemblyModuleList(CLRDATA_ADDRESS assembly, unsigned int coun SOSDacEnter(); Assembly* pAssembly = PTR_Assembly(TO_TADDR(assembly)); - ModuleIterator mi = pAssembly->IterateModules(); - unsigned int n = 0; if (modules) { - while (mi.Next() && n < count) - modules[n++] = HOST_CDADDR(mi.GetModule()); - } - else - { - while (mi.Next()) - n++; + if (pAssembly->GetModule() && count > 0) + modules[0] = HOST_CDADDR(pAssembly->GetModule()); } if (pNeeded) - *pNeeded = n; + *pNeeded = 1; SOSDacLeave(); return hr; diff --git a/src/coreclr/debug/daccess/task.cpp b/src/coreclr/debug/daccess/task.cpp index 67f293fb34466..319d3506b9b88 100644 --- a/src/coreclr/debug/daccess/task.cpp +++ b/src/coreclr/debug/daccess/task.cpp @@ -948,6 +948,11 @@ ClrDataAssembly::Release(THIS) return newRefs; } +struct TrivialModuleIterator +{ + Module* m_module; +}; + HRESULT STDMETHODCALLTYPE ClrDataAssembly::StartEnumModules( /* [out] */ CLRDATA_ENUM* handle) @@ -958,11 +963,10 @@ ClrDataAssembly::StartEnumModules( EX_TRY { - Assembly::ModuleIterator* iter = new (nothrow) - Assembly::ModuleIterator; + TrivialModuleIterator* iter = new (nothrow) TrivialModuleIterator; if (iter) { - *iter = m_assembly->IterateModules(); + iter->m_module = m_assembly->GetModule(); *handle = TO_CDENUM(iter); status = S_OK; } @@ -995,12 +999,13 @@ ClrDataAssembly::EnumModule( EX_TRY { - Assembly::ModuleIterator* iter = - FROM_CDENUM(Assembly::ModuleIterator, *handle); - if (iter->Next()) + TrivialModuleIterator* iter = FROM_CDENUM(TrivialModuleIterator, *handle); + if (iter->m_module) { *mod = new (nothrow) - ClrDataModule(m_dac, iter->GetModule()); + ClrDataModule(m_dac, iter->m_module); + + iter->m_module = NULL; status = *mod ? S_OK : E_OUTOFMEMORY; } else @@ -1031,8 +1036,7 @@ ClrDataAssembly::EndEnumModules( EX_TRY { - Assembly::ModuleIterator* iter = - FROM_CDENUM(Assembly::ModuleIterator, handle); + TrivialModuleIterator* iter = FROM_CDENUM(TrivialModuleIterator, handle); delete iter; status = S_OK; } diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index d5ecbad98e56c..bffcfed1464c0 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -205,8 +205,6 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat PrepareModuleForAssembly(m_pModule, pamTracker); - CacheManifestFiles(); - if (!m_pModule->IsReadyToRun()) CacheManifestExportedTypes(pamTracker); @@ -1150,10 +1148,6 @@ void Assembly::CacheManifestExportedTypes(AllocMemTracker *pamTracker) RETURN; } -void Assembly::CacheManifestFiles() -{ -} - //@TODO: if module is not signed it needs to acquire the //permissions from the assembly. diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index e30c23d6a0de0..943f4b7235be5 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -130,73 +130,6 @@ class Assembly return m_pClassLoader; } - // ------------------------------------------------------------ - // Modules - // ------------------------------------------------------------ - - class ModuleIterator - { - Module* m_pModule; - DWORD m_i; - - public: - // The preferred constructor. If you use this, you don't have to - // call Start() yourself - ModuleIterator(Assembly *pAssembly) - { - WRAPPER_NO_CONTRACT; - Start(pAssembly); - } - - // When you don't have the Assembly at contruction time, use this - // constructor, and explicitly call Start() to begin the iteration. - ModuleIterator() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - m_pModule = NULL; - m_i = (DWORD) -1; - } - - void Start(Assembly * pAssembly) - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - m_pModule = pAssembly->GetModule(); - m_i = (DWORD) -1; - } - - BOOL Next() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - while (++m_i <= m_pModule->GetFileMax()) - { - if (GetModule() != NULL) - return TRUE; - } - return FALSE; - } - - Module *GetModule() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - return m_pModule->LookupFile(TokenFromRid(m_i, mdtFile)); - } - }; - - // TODO: VS - ModuleIterator IterateModules() - { - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - return ModuleIterator(this); - } - - //**************************************************************************************** // // Get the domain the assembly lives in. @@ -541,7 +474,6 @@ class Assembly //**************************************************************************************** void CacheManifestExportedTypes(AllocMemTracker *pamTracker); - void CacheManifestFiles(); void CacheFriendAssemblyInfo(); #ifndef DACCESS_COMPILE @@ -591,8 +523,6 @@ class Assembly }; -typedef Assembly::ModuleIterator ModuleIterator; - #ifndef DACCESS_COMPILE //--------------------------------------------------------------------------------------- diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index 312376569d4e9..2b9198b811732 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -923,7 +923,6 @@ class Module // a compressed format for NGen that makes up for it. LookupMap m_GenericTypeDefToCanonMethodTableMap; - //TODO: VS // Mapping from File token to Module * LookupMap m_FileReferencesMap; diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp index 2990631d5a8e2..a1bce6d07d717 100644 --- a/src/coreclr/vm/clsload.cpp +++ b/src/coreclr/vm/clsload.cpp @@ -643,17 +643,11 @@ void ClassLoader::GetClassValue(NameHandleTable nhTable, #endif PTR_Assembly assembly = GetAssembly(); - PREFIX_ASSUME(assembly != NULL); - ModuleIterator i = assembly->IterateModules(); + Module * pCurrentClsModule = assembly->GetModule(); + _ASSERTE(pCurrentClsModule != NULL); - while (i.Next()) + if (!pLookInThisModuleOnly || (pCurrentClsModule == pLookInThisModuleOnly)) { - Module * pCurrentClsModule = i.GetModule(); - PREFIX_ASSUME(pCurrentClsModule != NULL); - - if (pLookInThisModuleOnly && (pCurrentClsModule != pLookInThisModuleOnly)) - continue; - #ifdef FEATURE_READYTORUN if (nhTable == nhCaseSensitive && pCurrentClsModule->IsReadyToRun() && pCurrentClsModule->GetReadyToRunInfo()->HasHashtableOfTypes() && pCurrentClsModule->GetAvailableClassHash() == NULL) @@ -838,16 +832,11 @@ void ClassLoader::LazyPopulateCaseSensitiveHashTables() _ASSERT(m_cUnhashedModules > 0); AllocMemTracker amTracker; - ModuleIterator i = GetAssembly()->IterateModules(); - // Create a case-sensitive hashtable for each module, and fill it with the module's typedef entries - while (i.Next()) + // Create a case-sensitive hashtable for the module, and fill it with the module's typedef entries + Module *pModule = GetAssembly()->GetModule(); + if (pModule->GetAvailableClassHash() == NULL) { - Module *pModule = i.GetModule(); - PREFIX_ASSUME(pModule != NULL); - if (pModule->GetAvailableClassHash() != NULL) - continue; - // Lazy construction of the case-sensitive hashtable of types is *only* a scenario for ReadyToRun images // (either images compiled with an old version of crossgen, or for case-insensitive type lookups in R2R modules) _ASSERT(pModule->IsReadyToRun()); @@ -893,28 +882,23 @@ void ClassLoader::LazyPopulateCaseInsensitiveHashTables() // Add any unhashed modules into our hash tables, and try again. AllocMemTracker amTracker; - ModuleIterator i = GetAssembly()->IterateModules(); - - while (i.Next()) + Module *pModule = GetAssembly()->GetModule(); + if (pModule->GetAvailableClassCaseInsHash() == NULL) { - Module *pModule = i.GetModule(); - if (pModule->GetAvailableClassCaseInsHash() == NULL) - { - EEClassHashTable *pNewClassCaseInsHash = pModule->GetAvailableClassHash()->MakeCaseInsensitiveTable(pModule, &amTracker); + EEClassHashTable *pNewClassCaseInsHash = pModule->GetAvailableClassHash()->MakeCaseInsensitiveTable(pModule, &amTracker); - LOG((LF_CLASSLOADER, LL_INFO10, "%s's classes being added to case insensitive hash table\n", - pModule->GetSimpleName())); + LOG((LF_CLASSLOADER, LL_INFO10, "%s's classes being added to case insensitive hash table\n", + pModule->GetSimpleName())); - { - CANNOTTHROWCOMPLUSEXCEPTION(); - FAULT_FORBID(); + { + CANNOTTHROWCOMPLUSEXCEPTION(); + FAULT_FORBID(); - amTracker.SuppressRelease(); - pModule->SetAvailableClassCaseInsHash(pNewClassCaseInsHash); - FastInterlockDecrement((LONG*)&m_cUnhashedModules); + amTracker.SuppressRelease(); + pModule->SetAvailableClassCaseInsHash(pNewClassCaseInsHash); + FastInterlockDecrement((LONG*)&m_cUnhashedModules); - _ASSERT(m_cUnhashedModules >= 0); - } + _ASSERT(m_cUnhashedModules >= 0); } } } @@ -1860,16 +1844,8 @@ void ClassLoader::FreeModules() CONTRACTL_END; Module *pManifest = NULL; - if (GetAssembly() && (NULL != (pManifest = GetAssembly()->GetModule()))) { - // Unload the manifest last, since it contains the module list in its rid map - ModuleIterator i = GetAssembly()->IterateModules(); - while (i.Next()) { - // Have the module free its various tables and some of the EEClass links - if (i.GetModule() != pManifest) - i.GetModule()->Destruct(); - } - - // Now do the manifest module. + if (GetAssembly() && (NULL != (pManifest = GetAssembly()->GetModule()))) + { pManifest->Destruct(); } @@ -5159,12 +5135,7 @@ ClassLoader::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) if (m_pAssembly.IsValid()) { - ModuleIterator modIter = GetAssembly()->IterateModules(); - - while (modIter.Next()) - { - modIter.GetModule()->EnumMemoryRegions(flags, true); - } + m_pAssembly->GetModule()->EnumMemoryRegions(flags, true); } } diff --git a/src/coreclr/vm/comdynamic.cpp b/src/coreclr/vm/comdynamic.cpp index 4996b53e2e48c..99a6c788b1e4f 100644 --- a/src/coreclr/vm/comdynamic.cpp +++ b/src/coreclr/vm/comdynamic.cpp @@ -900,12 +900,8 @@ void UpdateRuntimeStateForAssemblyCustomAttribute(Module* pModule, mdToken tkCus actualFlags = ((DWORD)pAssembly->GetDebuggerInfoBits() & mask) | flags; pAssembly->SetDebuggerInfoBits((DebuggerAssemblyControlFlags)actualFlags); - ModuleIterator i = pAssembly->IterateModules(); - while (i.Next()) - { - actualFlags = ((DWORD)(i.GetModule()->GetDebuggerInfoBits()) & mask) | flags; - i.GetModule()->SetDebuggerInfoBits((DebuggerAssemblyControlFlags)actualFlags); - } + actualFlags = ((DWORD)(pAssembly->GetModule()->GetDebuggerInfoBits()) & mask) | flags; + pAssembly->GetModule()->SetDebuggerInfoBits((DebuggerAssemblyControlFlags)actualFlags); } // InternalsVisibleTo and IgnoresAccessChecksTo attribute processing From d02dc0897560fb62cc245a3f0315ddfdc638669a Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 27 Dec 2021 16:50:31 -0800 Subject: [PATCH 09/25] move most fields off DomainAssembly --- src/coreclr/vm/domainfile.cpp | 52 +++--------- src/coreclr/vm/domainfile.h | 146 +++++++++++++++++----------------- src/coreclr/vm/domainfile.inl | 6 +- 3 files changed, 85 insertions(+), 119 deletions(-) diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index e4e54c07754bf..87aefb9932bdc 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -30,17 +30,24 @@ #endif // FEATURE_PERFMAP #ifndef DACCESS_COMPILE -DomainFile::DomainFile(AppDomain *pDomain, PEAssembly *pPEAssembly) - : m_pDomain(pDomain), +DomainFile::DomainFile(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator) : + m_pAssembly(NULL), + m_pDomain(pDomain), m_pPEAssembly(pPEAssembly), m_pModule(NULL), + m_fCollectible(pLoaderAllocator->IsCollectible()), + m_NextDomainAssemblyInSameALC(NULL), + m_pLoaderAllocator(pLoaderAllocator), m_level(FILE_LOAD_CREATE), m_pError(NULL), m_notifyflags(NOT_NOTIFIED), m_loading(TRUE), m_pDynamicMethodTable(NULL), m_pUMThunkHash(NULL), - m_bDisableActivationCheck(FALSE) + m_bDisableActivationCheck(FALSE), + m_debuggerFlags(DACF_NONE), + m_fDebuggerUnloadStarted(FALSE), + m_fHostAssemblyPublished(FALSE) { CONTRACTL { @@ -73,30 +80,6 @@ DomainFile::~DomainFile() delete m_pError; } -#endif //!DACCESS_COMPILE - -LoaderAllocator * DomainFile::GetLoaderAllocator() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - Assembly *pAssembly = GetDomainAssembly()->GetAssembly(); - if ((pAssembly != NULL) && (pAssembly->IsCollectible())) - { - return pAssembly->GetLoaderAllocator(); - } - else - { - return this->GetAppDomain()->GetLoaderAllocator(); - } -} - -#ifndef DACCESS_COMPILE - // Optimization intended for EnsureLoadLevel only #include void DomainFile::EnsureLoadLevel(FileLoadLevel targetLevel) @@ -678,14 +661,7 @@ void DomainFile::Activate() //-------------------------------------------------------------------------------- DomainAssembly::DomainAssembly(AppDomain *pDomain, PEAssembly *pPEAssembly, LoaderAllocator *pLoaderAllocator) - : DomainFile(pDomain, pPEAssembly), - m_pAssembly(NULL), - m_debuggerFlags(DACF_NONE), - m_fDebuggerUnloadStarted(FALSE), - m_fCollectible(pLoaderAllocator->IsCollectible()), - m_fHostAssemblyPublished(false), - m_pLoaderAllocator(pLoaderAllocator), - m_NextDomainAssemblyInSameALC(NULL) + : DomainFile(pDomain, pPEAssembly, pLoaderAllocator) { CONTRACTL { @@ -702,9 +678,6 @@ DomainAssembly::DomainAssembly(AppDomain *pDomain, PEAssembly *pPEAssembly, Load m_hExposedAssemblyObject = NULL; SetupDebuggingConfig(); - - // Add a Module iterator entry for this assembly. - IfFailThrow(m_Modules.Append(this)); } DomainAssembly::~DomainAssembly() @@ -1229,9 +1202,6 @@ DomainAssembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) DAC_ENUM_VTHIS(); DomainFile::EnumMemoryRegions(flags); - // For minidumps without full memory, we need to always be able to iterate over m_Modules. - m_Modules.EnumMemoryRegions(flags); - if (flags != CLRDATA_ENUM_MEM_MINI && flags != CLRDATA_ENUM_MEM_TRIAGE) { if (m_pAssembly.IsValid()) diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index 8e5049d01cf80..e325fa4f0a717 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -78,8 +78,6 @@ class DomainFile DomainFile() {LIMITED_METHOD_CONTRACT;}; #endif - virtual LoaderAllocator *GetLoaderAllocator(); - PTR_AppDomain GetAppDomain() { LIMITED_METHOD_CONTRACT; @@ -130,7 +128,15 @@ class DomainFile } #endif - virtual BOOL IsAssembly() = 0; + BOOL IsAssembly() + { + LIMITED_METHOD_DAC_CONTRACT; + return TRUE; + } + + BOOL IsCollectible(); + Assembly* GetAssembly(); + ULONG HashIdentity(); DomainAssembly *GetDomainAssembly(); @@ -202,7 +208,6 @@ class DomainFile return EnsureLoadLevel(FILE_LOAD_ALLOCATE); } - void EnsureLibraryLoaded() { WRAPPER_NO_CONTRACT; @@ -260,6 +265,23 @@ class DomainFile DynamicMethodTable* GetDynamicMethodTable(); #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; + } + protected: // ------------------------------------------------------------ // Loader API @@ -270,7 +292,7 @@ class DomainFile friend class Module; friend class FileLoadLock; - DomainFile(AppDomain *pDomain, PEAssembly *pPEAssembly); + DomainFile(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator); BOOL DoIncrementalLoad(FileLoadLevel targetLevel); void ClearLoading() { LIMITED_METHOD_CONTRACT; m_loading = FALSE; } @@ -298,31 +320,21 @@ class DomainFile void SetDebuggerNotified() { LIMITED_METHOD_CONTRACT; m_notifyflags|=DEBUGGER_NOTIFIED; } void SetShouldNotifyDebugger() { LIMITED_METHOD_CONTRACT; m_notifyflags|=DEBUGGER_NEEDNOTIFICATION; } - // ------------------------------------------------------------ - // Instance data - // ------------------------------------------------------------ - - PTR_AppDomain m_pDomain; - PTR_PEAssembly m_pPEAssembly; - PTR_Module m_pModule; - FileLoadLevel m_level; - LOADERHANDLE m_hExposedModuleObject; - class ExInfo { enum { - ExType_ClrEx, - ExType_HR + ExType_ClrEx, + ExType_HR } m_type; union { - Exception *m_pEx; + Exception* m_pEx; HRESULT m_hr; }; - public: + public: void Throw() { CONTRACTL @@ -332,11 +344,11 @@ class DomainFile MODE_ANY; } CONTRACTL_END; - if (m_type==ExType_ClrEx) + if (m_type == ExType_ClrEx) { - PAL_CPP_THROW(Exception *, m_pEx->DomainBoundClone()); + PAL_CPP_THROW(Exception*, m_pEx->DomainBoundClone()); } - if (m_type==ExType_HR) + if (m_type == ExType_HR) ThrowHR(m_hr); _ASSERTE(!"Bad exception type"); ThrowHR(E_UNEXPECTED); @@ -344,28 +356,28 @@ class DomainFile ExInfo(Exception* pEx) { LIMITED_METHOD_CONTRACT; - m_type=ExType_ClrEx; - m_pEx=pEx; + m_type = ExType_ClrEx; + m_pEx = pEx; }; void ConvertToHResult() { LIMITED_METHOD_CONTRACT; - if(m_type==ExType_HR) + if (m_type == ExType_HR) return; - _ASSERTE(m_type==ExType_ClrEx); - HRESULT hr=m_pEx->GetHR(); + _ASSERTE(m_type == ExType_ClrEx); + HRESULT hr = m_pEx->GetHR(); delete m_pEx; - m_hr=hr; - m_type=ExType_HR; + m_hr = hr; + m_type = ExType_HR; }; ~ExInfo() { LIMITED_METHOD_CONTRACT; - if (m_type==ExType_ClrEx) + if (m_type == ExType_ClrEx) delete m_pEx; } - }* m_pError; + }; void ReleaseManagedData() { @@ -373,14 +385,38 @@ class DomainFile m_pError->ConvertToHResult(); }; - DWORD m_notifyflags; + // ------------------------------------------------------------ + // Instance data + // ------------------------------------------------------------ + + PTR_Assembly m_pAssembly; + PTR_AppDomain m_pDomain; + PTR_PEAssembly m_pPEAssembly; + PTR_Module m_pModule; + + BOOL m_fCollectible; + DomainAssembly *m_NextDomainAssemblyInSameALC; + PTR_LoaderAllocator m_pLoaderAllocator; + + FileLoadLevel m_level; + LOADERHANDLE m_hExposedModuleObject; + + ExInfo *m_pError; + + DWORD m_notifyflags; BOOL m_loading; + // m_pDynamicMethodTable is used by the light code generation to allow method // generation on the fly. They are lazily created when/if a dynamic method is requested // for this specific module DynamicMethodTable *m_pDynamicMethodTable; - class UMThunkHash *m_pUMThunkHash; - BOOL m_bDisableActivationCheck; + class UMThunkHash *m_pUMThunkHash; + BOOL m_bDisableActivationCheck; + + DebuggerAssemblyControlFlags m_debuggerFlags; + + BOOL m_fDebuggerUnloadStarted; + BOOL m_fHostAssemblyPublished; }; // -------------------------------------------------------------------------------- @@ -396,20 +432,8 @@ class DomainAssembly : public DomainFile // Public API // ------------------------------------------------------------ - LoaderAllocator *GetLoaderAllocator() - { - LIMITED_METHOD_CONTRACT; - return m_pLoaderAllocator; - } - void SetAssembly(Assembly* pAssembly); - BOOL IsAssembly() - { - LIMITED_METHOD_DAC_CONTRACT; - return TRUE; - } - OBJECTREF GetExposedAssemblyObjectIfExists() { LIMITED_METHOD_CONTRACT; @@ -423,8 +447,6 @@ class DomainAssembly : public DomainFile // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). OBJECTREF GetExposedAssemblyObject(); - Assembly* GetAssembly(); - #ifdef DACCESS_COMPILE virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif @@ -463,9 +485,6 @@ class DomainAssembly : public DomainFile BOOL NotifyDebuggerLoad(int flags, BOOL attaching); void NotifyDebuggerUnload(); - inline BOOL IsCollectible(); - - private: // ------------------------------------------------------------ @@ -495,36 +514,13 @@ class DomainAssembly : public DomainFile void UnregisterFromHostAssembly(); #endif - public: - ULONG HashIdentity(); - +public: // ------------------------------------------------------------ // Instance data // ------------------------------------------------------------ private: LOADERHANDLE m_hExposedAssemblyObject; - PTR_Assembly m_pAssembly; - DebuggerAssemblyControlFlags m_debuggerFlags; - - ArrayList m_Modules; - BOOL m_fDebuggerUnloadStarted; - BOOL m_fCollectible; - Volatile m_fHostAssemblyPublished; - PTR_LoaderAllocator m_pLoaderAllocator; - DomainAssembly* m_NextDomainAssemblyInSameALC; - - public: - DomainAssembly* GetNextDomainAssemblyInSameALC() - { - return m_NextDomainAssemblyInSameALC; - } - - void SetNextDomainAssemblyInSameALC(DomainAssembly* domainAssembly) - { - _ASSERTE(m_NextDomainAssemblyInSameALC == NULL); - m_NextDomainAssemblyInSameALC = domainAssembly; - } }; #endif // _DOMAINFILE_H_ diff --git a/src/coreclr/vm/domainfile.inl b/src/coreclr/vm/domainfile.inl index 517d6ea2e4ff9..02cebae7ea7a5 100644 --- a/src/coreclr/vm/domainfile.inl +++ b/src/coreclr/vm/domainfile.inl @@ -9,7 +9,7 @@ inline Module* DomainFile::GetModule() return m_pModule; } -inline Assembly* DomainAssembly::GetAssembly() +inline Assembly* DomainFile::GetAssembly() { LIMITED_METHOD_DAC_CONTRACT; CONSISTENCY_CHECK(CheckLoaded()); @@ -17,13 +17,13 @@ inline Assembly* DomainAssembly::GetAssembly() return m_pAssembly; } -inline ULONG DomainAssembly::HashIdentity() +inline ULONG DomainFile::HashIdentity() { WRAPPER_NO_CONTRACT; return GetPEAssembly()->HashIdentity(); } -inline BOOL DomainAssembly::IsCollectible() +inline BOOL DomainFile::IsCollectible() { LIMITED_METHOD_CONTRACT; return m_fCollectible; From 0248e3a1495dabbfdeac171ac8a48ca9a601d09e Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 27 Dec 2021 19:13:56 -0800 Subject: [PATCH 10/25] DomainAssembly is a complete proxy --- src/coreclr/vm/appdomain.hpp | 2 +- src/coreclr/vm/domainfile.cpp | 128 ++++++++++++----------------- src/coreclr/vm/domainfile.h | 146 +++++++++++++++------------------- 3 files changed, 119 insertions(+), 157 deletions(-) diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 85bf3ef869c9b..c79a1433bc5db 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -2119,7 +2119,7 @@ class AppDomain : public BaseDomain private: void RaiseLoadingAssemblyEvent(DomainAssembly* pAssembly); - friend class DomainAssembly; + friend class DomainFile; private: BOOL RaiseUnhandledExceptionEvent(OBJECTREF *pThrowable, BOOL isTerminating); diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index 87aefb9932bdc..1f5e8cc6f1fbf 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -52,15 +52,19 @@ DomainFile::DomainFile(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAlloca CONTRACTL { CONSTRUCTOR_CHECK; - THROWS; // From CreateHandle - GC_NOTRIGGER; + THROWS; // ValidateForExecution + GC_TRIGGERS; // ValidateForExecution MODE_ANY; - FORBID_FAULT; } CONTRACTL_END; m_hExposedModuleObject = NULL; + m_hExposedAssemblyObject = NULL; + pPEAssembly->AddRef(); + pPEAssembly->ValidateForExecution(); + + SetupDebuggingConfig(); } DomainFile::~DomainFile() @@ -77,7 +81,19 @@ DomainFile::~DomainFile() m_pPEAssembly->Release(); if (m_pDynamicMethodTable) m_pDynamicMethodTable->Destroy(); + delete m_pError; + + if (m_fHostAssemblyPublished) + { + // Remove association first. + UnregisterFromHostAssembly(); + } + + if (m_pAssembly != NULL) + { + delete m_pAssembly; + } } // Optimization intended for EnsureLoadLevel only @@ -194,20 +210,20 @@ void DomainFile::SetError(Exception *ex) m_pError = new ExInfo(ex->DomainBoundClone()); - GetModule()->NotifyEtwLoadFinished(ex->GetHR()); - - if (!IsProfilerNotified()) + if (m_pModule) { - SetProfilerNotified(); + m_pModule->NotifyEtwLoadFinished(ex->GetHR()); -#ifdef PROFILING_SUPPORTED - if (GetModule() != NULL) + if (!IsProfilerNotified()) { + SetProfilerNotified(); + +#ifdef PROFILING_SUPPORTED // Only send errors for non-shared assemblies; other assemblies might be successfully completed // in another app domain later. - GetModule()->NotifyProfilerLoadFinished(ex->GetHR()); - } + m_pModule->NotifyProfilerLoadFinished(ex->GetHR()); #endif + } } RETURN; @@ -326,7 +342,7 @@ DomainAssembly *DomainFile::GetDomainAssembly() // to visible, but NOT vice versa. Once a DomainAssmebly is fully initialized, this function should be // immutable for an instance of a module. That ensures that the debugger gets consistent // notifications about it. It this value mutates, than the debugger may miss relevant notifications. -BOOL DomainAssembly::IsVisibleToDebugger() +BOOL DomainFile::IsVisibleToDebugger() { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; @@ -663,21 +679,6 @@ void DomainFile::Activate() DomainAssembly::DomainAssembly(AppDomain *pDomain, PEAssembly *pPEAssembly, LoaderAllocator *pLoaderAllocator) : DomainFile(pDomain, pPEAssembly, pLoaderAllocator) { - CONTRACTL - { - CONSTRUCTOR_CHECK; - STANDARD_VM_CHECK; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - pPEAssembly->ValidateForExecution(); - - // !!! backout - - m_hExposedAssemblyObject = NULL; - - SetupDebuggingConfig(); } DomainAssembly::~DomainAssembly() @@ -691,20 +692,9 @@ DomainAssembly::~DomainAssembly() INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; - - if (m_fHostAssemblyPublished) - { - // Remove association first. - UnregisterFromHostAssembly(); - } - - if (m_pAssembly != NULL) - { - delete m_pAssembly; - } } -void DomainAssembly::SetAssembly(Assembly* pAssembly) +void DomainFile::SetAssembly(Assembly* pAssembly) { STANDARD_VM_CONTRACT; @@ -714,7 +704,7 @@ void DomainAssembly::SetAssembly(Assembly* pAssembly) m_pAssembly = pAssembly; m_pModule = pAssembly->GetModule(); - pAssembly->SetDomainAssembly(this); + pAssembly->SetDomainAssembly((DomainAssembly*)this); } @@ -723,7 +713,7 @@ void DomainAssembly::SetAssembly(Assembly* pAssembly) // Returns managed representation of the assembly (Assembly or AssemblyBuilder). // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). // -OBJECTREF DomainAssembly::GetExposedAssemblyObject() +OBJECTREF DomainFile::GetExposedAssemblyObject() { CONTRACTL { @@ -776,7 +766,7 @@ OBJECTREF DomainAssembly::GetExposedAssemblyObject() GCPROTECT_BEGIN(assemblyObj); assemblyObj = (ASSEMBLYREF)AllocateObject(pMT); - assemblyObj->SetAssembly(this); + assemblyObj->SetAssembly((DomainAssembly*)this); // Attach the reference to the assembly to keep the LoaderAllocator for this collectible type // alive as long as a reference to the assembly is kept alive. @@ -807,22 +797,22 @@ OBJECTREF DomainAssembly::GetExposedAssemblyObject() } return pLoaderAllocator->GetHandleValue(m_hExposedAssemblyObject); -} // DomainAssembly::GetExposedAssemblyObject +} -void DomainAssembly::Begin() +void DomainFile::Begin() { STANDARD_VM_CONTRACT; { AppDomain::LoadLockHolder lock(m_pDomain); - m_pDomain->AddAssembly(this); + m_pDomain->AddAssembly((DomainAssembly*)this); } // Make it possible to find this DomainAssembly object from associated BINDER_SPACE::Assembly. RegisterWithHostAssembly(); m_fHostAssemblyPublished = true; } -void DomainAssembly::RegisterWithHostAssembly() +void DomainFile::RegisterWithHostAssembly() { CONTRACTL { @@ -834,11 +824,11 @@ void DomainAssembly::RegisterWithHostAssembly() if (GetPEAssembly()->HasHostAssembly()) { - GetPEAssembly()->GetHostAssembly()->SetDomainAssembly(this); + GetPEAssembly()->GetHostAssembly()->SetDomainAssembly((DomainAssembly*)this); } } -void DomainAssembly::UnregisterFromHostAssembly() +void DomainFile::UnregisterFromHostAssembly() { CONTRACTL { @@ -854,7 +844,7 @@ void DomainAssembly::UnregisterFromHostAssembly() } } -void DomainAssembly::Allocate() +void DomainFile::Allocate() { CONTRACTL { @@ -884,9 +874,9 @@ void DomainAssembly::Allocate() SetAssembly(pAssembly); -} // DomainAssembly::Allocate +} -void DomainAssembly::DeliverAsyncEvents() +void DomainFile::DeliverAsyncEvents() { CONTRACTL { @@ -898,12 +888,10 @@ void DomainAssembly::DeliverAsyncEvents() CONTRACTL_END; OVERRIDE_LOAD_LEVEL_LIMIT(FILE_ACTIVE); - m_pDomain->RaiseLoadingAssemblyEvent(this); - + m_pDomain->RaiseLoadingAssemblyEvent((DomainAssembly*)this); } - -void DomainAssembly::DeliverSyncEvents() +void DomainFile::DeliverSyncEvents() { CONTRACTL { @@ -934,7 +922,7 @@ void DomainAssembly::DeliverSyncEvents() } #endif // DEBUGGING_SUPPORTED -} // DomainAssembly::DeliverSyncEvents +} /* // The enum for dwLocation from managed code: @@ -946,7 +934,7 @@ void DomainAssembly::DeliverSyncEvents() } */ -BOOL DomainAssembly::GetResource(LPCSTR szName, DWORD *cbResource, +BOOL DomainFile::GetResource(LPCSTR szName, DWORD *cbResource, PBYTE *pbInMemoryResource, DomainAssembly** pAssemblyRef, LPCSTR *szFileName, DWORD *dwLocation, BOOL fSkipRaiseResolveEvent) @@ -967,12 +955,12 @@ BOOL DomainAssembly::GetResource(LPCSTR szName, DWORD *cbResource, szFileName, dwLocation, fSkipRaiseResolveEvent, - this, + (DomainAssembly*)this, this->m_pDomain ); } -DWORD DomainAssembly::ComputeDebuggingConfig() +DWORD DomainFile::ComputeDebuggingConfig() { CONTRACTL { @@ -993,7 +981,7 @@ DWORD DomainAssembly::ComputeDebuggingConfig() #endif // DEBUGGING_SUPPORTED } -void DomainAssembly::SetupDebuggingConfig(void) +void DomainFile::SetupDebuggingConfig(void) { CONTRACTL { @@ -1016,7 +1004,7 @@ void DomainAssembly::SetupDebuggingConfig(void) // For right now, we only check to see if the DebuggableAttribute is present - later may add fields/properties to the // attributes. -HRESULT DomainAssembly::GetDebuggingCustomAttributes(DWORD *pdwFlags) +HRESULT DomainFile::GetDebuggingCustomAttributes(DWORD *pdwFlags) { CONTRACTL { @@ -1098,7 +1086,7 @@ HRESULT DomainAssembly::GetDebuggingCustomAttributes(DWORD *pdwFlags) return hr; } -BOOL DomainAssembly::NotifyDebuggerLoad(int flags, BOOL attaching) +BOOL DomainFile::NotifyDebuggerLoad(int flags, BOOL attaching) { WRAPPER_NO_CONTRACT; @@ -1123,7 +1111,7 @@ BOOL DomainAssembly::NotifyDebuggerLoad(int flags, BOOL attaching) { if (ShouldNotifyDebugger()) { - g_pDebugInterface->LoadAssembly(this); + g_pDebugInterface->LoadAssembly((DomainAssembly*)this); } result = TRUE; } @@ -1145,7 +1133,7 @@ BOOL DomainAssembly::NotifyDebuggerLoad(int flags, BOOL attaching) return result; } -void DomainAssembly::NotifyDebuggerUnload() +void DomainFile::NotifyDebuggerUnload() { LIMITED_METHOD_CONTRACT; @@ -1161,7 +1149,7 @@ void DomainAssembly::NotifyDebuggerUnload() // a previous load event (such as if debugger attached after the modules was loaded). this->GetModule()->NotifyDebuggerUnload(this->GetAppDomain()); - g_pDebugInterface->UnloadAssembly(this); + g_pDebugInterface->UnloadAssembly((DomainAssembly*)this); } @@ -1191,16 +1179,6 @@ DomainFile::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) { m_pDomain->EnumMemoryRegions(flags, true); } -} - -void -DomainAssembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) -{ - SUPPORTS_DAC; - - //sizeof(DomainAssembly) == 0xe0 - DAC_ENUM_VTHIS(); - DomainFile::EnumMemoryRegions(flags); if (flags != CLRDATA_ENUM_MEM_MINI && flags != CLRDATA_ENUM_MEM_TRIAGE) { diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index e325fa4f0a717..e5ee3373db959 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -97,6 +97,19 @@ class DomainFile return m_pPEAssembly->GetMDImport(); } + OBJECTREF GetExposedAssemblyObjectIfExists() + { + LIMITED_METHOD_CONTRACT; + + OBJECTREF objRet = NULL; + GET_LOADERHANDLE_VALUE_FAST(GetLoaderAllocator(), m_hExposedAssemblyObject, &objRet); + return objRet; + } + + // Returns managed representation of the assembly (Assembly or AssemblyBuilder). + // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). + OBJECTREF GetExposedAssemblyObject(); + OBJECTREF GetExposedModuleObjectIfExists() { LIMITED_METHOD_CONTRACT; @@ -140,6 +153,12 @@ class DomainFile DomainAssembly *GetDomainAssembly(); +// ------------------------------------------------------------ +// Public API +// ------------------------------------------------------------ + + void SetAssembly(Assembly* pAssembly); + // ------------------------------------------------------------ // Loading state checks // ------------------------------------------------------------ @@ -282,6 +301,16 @@ class DomainFile return m_pLoaderAllocator; } + +// ------------------------------------------------------------ +// Resource access +// ------------------------------------------------------------ + + BOOL GetResource(LPCSTR szName, DWORD* cbResource, + PBYTE* pbInMemoryResource, DomainAssembly** pAssemblyRef, + LPCSTR* szFileName, DWORD* dwLocation, + BOOL fSkipRaiseResolveEvent); + protected: // ------------------------------------------------------------ // Loader API @@ -299,18 +328,21 @@ class DomainFile void SetLoadLevel(FileLoadLevel level) { LIMITED_METHOD_CONTRACT; m_level = level; } #ifndef DACCESS_COMPILE - virtual void Begin() = 0; - virtual void Allocate() = 0; + void Begin(); + void Allocate(); void AddDependencies(); void PreLoadLibrary(); void LoadLibrary(); void PostLoadLibrary(); void EagerFixups(); void VtableFixups(); - virtual void DeliverSyncEvents() = 0; - virtual void DeliverAsyncEvents() = 0; + void DeliverSyncEvents(); + void DeliverAsyncEvents(); void FinishLoad(); void Activate(); + + void RegisterWithHostAssembly(); + void UnregisterFromHostAssembly(); #endif // This should be used to permanently set the load to fail. Do not use with transient conditions @@ -385,6 +417,33 @@ class DomainFile m_pError->ConvertToHResult(); }; +public: +// ------------------------------------------------------------ +// Debugger control API +// ------------------------------------------------------------ + + DebuggerAssemblyControlFlags GetDebuggerInfoBits(void) + { + LIMITED_METHOD_CONTRACT; + return m_debuggerFlags; + } + + void SetDebuggerInfoBits(DebuggerAssemblyControlFlags newBits) + { + LIMITED_METHOD_CONTRACT; + m_debuggerFlags = newBits; + } + + void SetupDebuggingConfig(void); + DWORD ComputeDebuggingConfig(void); + + HRESULT GetDebuggingCustomAttributes(DWORD* pdwFlags); + + BOOL IsVisibleToDebugger(); + BOOL NotifyDebuggerLoad(int flags, BOOL attaching); + void NotifyDebuggerUnload(); + +protected: // ------------------------------------------------------------ // Instance data // ------------------------------------------------------------ @@ -399,7 +458,9 @@ class DomainFile PTR_LoaderAllocator m_pLoaderAllocator; FileLoadLevel m_level; + LOADERHANDLE m_hExposedModuleObject; + LOADERHANDLE m_hExposedAssemblyObject; ExInfo *m_pError; @@ -428,62 +489,6 @@ class DomainAssembly : public DomainFile VPTR_VTABLE_CLASS(DomainAssembly, DomainFile); public: - // ------------------------------------------------------------ - // Public API - // ------------------------------------------------------------ - - void SetAssembly(Assembly* pAssembly); - - OBJECTREF GetExposedAssemblyObjectIfExists() - { - LIMITED_METHOD_CONTRACT; - - OBJECTREF objRet = NULL; - GET_LOADERHANDLE_VALUE_FAST(GetLoaderAllocator(), m_hExposedAssemblyObject, &objRet); - return objRet; - } - - // Returns managed representation of the assembly (Assembly or AssemblyBuilder). - // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). - OBJECTREF GetExposedAssemblyObject(); - -#ifdef DACCESS_COMPILE - virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); -#endif - - // ------------------------------------------------------------ - // Resource access - // ------------------------------------------------------------ - - BOOL GetResource(LPCSTR szName, DWORD *cbResource, - PBYTE *pbInMemoryResource, DomainAssembly** pAssemblyRef, - LPCSTR *szFileName, DWORD *dwLocation, - BOOL fSkipRaiseResolveEvent); - - // ------------------------------------------------------------ - // Debugger control API - // ------------------------------------------------------------ - - DebuggerAssemblyControlFlags GetDebuggerInfoBits(void) - { - LIMITED_METHOD_CONTRACT; - return m_debuggerFlags; - } - - void SetDebuggerInfoBits(DebuggerAssemblyControlFlags newBits) - { - LIMITED_METHOD_CONTRACT; - m_debuggerFlags = newBits; - } - - void SetupDebuggingConfig(void); - DWORD ComputeDebuggingConfig(void); - - HRESULT GetDebuggingCustomAttributes(DWORD *pdwFlags); - - BOOL IsVisibleToDebugger(); - BOOL NotifyDebuggerLoad(int flags, BOOL attaching); - void NotifyDebuggerUnload(); private: @@ -500,27 +505,6 @@ class DomainAssembly : public DomainFile private: DomainAssembly(AppDomain *pDomain, PEAssembly *pPEAssembly, LoaderAllocator *pLoaderAllocator); #endif - - // ------------------------------------------------------------ - // Internal routines - // ------------------------------------------------------------ - -#ifndef DACCESS_COMPILE - void Begin(); - void Allocate(); - void DeliverSyncEvents(); - void DeliverAsyncEvents(); - void RegisterWithHostAssembly(); - void UnregisterFromHostAssembly(); -#endif - -public: - // ------------------------------------------------------------ - // Instance data - // ------------------------------------------------------------ - - private: - LOADERHANDLE m_hExposedAssemblyObject; }; #endif // _DOMAINFILE_H_ From c793d4e8501e6f539a78308f130eecf640b1ae17 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 28 Dec 2021 13:25:00 -0800 Subject: [PATCH 11/25] some DomainFile --> DomainAssembly renames. --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 80 +++++++++--------- .../debug/daccess/dacdbiimplstackwalk.cpp | 14 ++-- src/coreclr/debug/di/rspriv.h | 2 +- src/coreclr/debug/di/rstype.cpp | 6 +- src/coreclr/debug/ee/debugger.cpp | 82 +++++++++---------- src/coreclr/debug/ee/debugger.h | 10 +-- src/coreclr/debug/ee/debugger.inl | 6 +- src/coreclr/debug/ee/debuggermodule.cpp | 2 +- src/coreclr/debug/inc/dacdbiinterface.h | 2 +- src/coreclr/vm/appdomain.cpp | 62 +++++++------- src/coreclr/vm/appdomain.hpp | 24 +++--- src/coreclr/vm/assembly.cpp | 2 +- src/coreclr/vm/ceeload.cpp | 43 ++++------ src/coreclr/vm/ceeload.h | 8 +- src/coreclr/vm/clsload.cpp | 9 -- src/coreclr/vm/dbginterface.h | 4 +- src/coreclr/vm/debugdebugger.cpp | 4 +- src/coreclr/vm/domainfile.h | 1 + src/coreclr/vm/eventtrace.cpp | 6 +- src/coreclr/vm/jithelpers.cpp | 18 ++-- src/coreclr/vm/jitinterface.cpp | 2 +- src/coreclr/vm/multicorejit.cpp | 6 +- src/coreclr/vm/profilingenumerators.cpp | 4 +- src/coreclr/vm/reflectioninvocation.cpp | 10 +-- src/coreclr/vm/runtimehandles.cpp | 12 +-- 25 files changed, 199 insertions(+), 220 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 5d51b1f2760a1..c6989440a71d6 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -663,15 +663,15 @@ void DacDbiInterfaceImpl::GetCompilerFlags ( { DD_ENTER_MAY_THROW; - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); - if (pDomainFile == NULL) + if (pDomainAssembly == NULL) { ThrowHR(E_FAIL); } // Get the underlying module - none of this is AppDomain specific - Module * pModule = pDomainFile->GetModule(); + Module * pModule = pDomainAssembly->GetModule(); DWORD dwBits = pModule->GetDebuggerInfoBits(); *pfAllowJITOpts = !CORDisableJITOptimizations(dwBits); *pfEnableEnC = pModule->IsEditAndContinueEnabled(); @@ -719,8 +719,8 @@ HRESULT DacDbiInterfaceImpl::SetCompilerFlags(VMPTR_DomainFile vmDomainFile, DD_ENTER_MAY_THROW; DWORD dwBits = 0; - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + Module * pModule = pDomainAssembly->GetModule(); HRESULT hr = S_OK; @@ -1089,8 +1089,8 @@ void DacDbiInterfaceImpl::GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, { DD_ENTER_MAY_THROW; - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + Module * pModule = pDomainAssembly->GetModule(); RVA methodRVA = 0; DWORD implFlags; @@ -1334,8 +1334,8 @@ void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainFile vmDomainFil // pre-initialize: pCodeInfo->Clear(); - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + Module * pModule = pDomainAssembly->GetModule(); MethodDesc* pMethodDesc = FindLoadedMethodRefOrDef(pModule, functionToken); pCodeInfo->vmNativeCodeMethodDescToken.SetHostPtr(pMethodDesc); @@ -1768,9 +1768,9 @@ void DacDbiInterfaceImpl::GetInstantiationFieldInfo (VMPTR_DomainFile { DD_ENTER_MAY_THROW; - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - _ASSERTE(pDomainFile != NULL); - AppDomain * pAppDomain = pDomainFile->GetAppDomain(); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + _ASSERTE(pDomainAssembly != NULL); + AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); TypeHandle thExact; TypeHandle thApprox; @@ -2503,7 +2503,7 @@ void DacDbiInterfaceImpl::GetClassTypeInfo(TypeHandle typeH pTypeInfo->ClassTypeData.vmModule.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule)); if (pAppDomain) { - pTypeInfo->ClassTypeData.vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainFile())); + pTypeInfo->ClassTypeData.vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainAssembly())); } else { @@ -2590,7 +2590,7 @@ void DacDbiInterfaceImpl::TypeHandleToBasicTypeInfo(TypeHandle pTypeInfo->vmModule.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule)); if (pAppDomain) { - pTypeInfo->vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainFile())); + pTypeInfo->vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainAssembly())); } else { @@ -2889,8 +2889,8 @@ TypeHandle DacDbiInterfaceImpl::GetClassOrValueTypeHandle(DebuggerIPCE_BasicType // otherwise, have the loader look it up using the metadata token and domain file else { - DomainFile * pDomainFile = pData->vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = pData->vmDomainFile.GetDacPtr(); + Module * pModule = pDomainAssembly->GetModule(); typeHandle = ClassLoader::LookupTypeDefOrRefInModule(pModule, pData->metadataToken); if (typeHandle.IsNull()) @@ -3322,7 +3322,7 @@ void DacDbiInterfaceImpl::GetSimpleType(VMPTR_AppDomain vmAppDomain, if (pAppDomain) { - pVmDomainFile->SetHostPtr(pModule->GetDomainFile()); + pVmDomainFile->SetHostPtr(pModule->GetDomainAssembly()); if (pVmDomainFile->IsNull()) ThrowHR(CORDBG_E_TARGET_INCONSISTENT); } @@ -3514,7 +3514,7 @@ HRESULT DacDbiInterfaceImpl::GetDelegateFunctionData( if (hr != S_OK) return hr; - ppFunctionDomainFile->SetDacTargetPtr(dac_cast(pMD.GetDacPtr()->GetModule()->GetDomainFile())); + ppFunctionDomainFile->SetDacTargetPtr(dac_cast(pMD.GetDacPtr()->GetModule()->GetDomainAssembly())); *pMethodDef = pMD.GetDacPtr()->GetMemberDef(); return hr; @@ -3725,17 +3725,17 @@ void DacDbiInterfaceImpl::GetStackFramesFromException(VMPTR_Object vmObject, Dac BaseDomain* pBaseDomain = currentElement.pFunc->GetAssembly()->GetDomain(); AppDomain* pDomain = NULL; - DomainFile* pDomainFile = NULL; + DomainFile* pDomainAssembly = NULL; pDomain = pBaseDomain->AsAppDomain(); _ASSERTE(pDomain != NULL); - pDomainFile = pModule->GetDomainFile(); - _ASSERTE(pDomainFile != NULL); + pDomainAssembly = pModule->GetDomainAssembly(); + _ASSERTE(pDomainAssembly != NULL); currentFrame.vmAppDomain.SetHostPtr(pDomain); - currentFrame.vmDomainFile.SetHostPtr(pDomainFile); + currentFrame.vmDomainFile.SetHostPtr(pDomainAssembly); currentFrame.ip = currentElement.ip; currentFrame.methodDef = currentElement.pFunc->GetMemberDef(); currentFrame.isLastForeignExceptionFrame = (currentElement.flags & STEF_LAST_FRAME_FROM_FOREIGN_STACK_TRACE) != 0; @@ -3879,8 +3879,8 @@ FieldDesc * DacDbiInterfaceImpl::GetEnCFieldDesc(const EnCHangingFieldInfo * pEn { FieldDesc * pFD = NULL; - DomainFile * pDomainFile = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); + Module * pModule = pDomainAssembly->GetModule(); // get the type handle for the object TypeHandle typeHandle = ClassLoader::LookupTypeDefOrRefInModule(pModule, @@ -3918,8 +3918,8 @@ PTR_CBYTE DacDbiInterfaceImpl::GetPtrToEnCField(FieldDesc * pFD, const EnCHangin #else PTR_EditAndContinueModule pEnCModule; - DomainFile * pDomainFile = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); + Module * pModule = pDomainAssembly->GetModule(); // make sure we actually have an EditAndContinueModule _ASSERTE(pModule->IsEditAndContinueCapable()); @@ -4090,8 +4090,8 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) { DD_ENTER_MAY_THROW; - DomainFile * pDomainFile = pTypeRefInfo->vmDomainFile.GetDacPtr(); - Module * pReferencingModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = pTypeRefInfo->vmDomainFile.GetDacPtr(); + Module * pReferencingModule = pDomainAssembly->GetModule(); BOOL fSuccess = FALSE; // Resolve the type ref @@ -4117,9 +4117,9 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, _ASSERTE(pTargetModule != NULL); _ASSERTE( TypeFromToken(targetTypeDef) == mdtTypeDef ); - AppDomain * pAppDomain = pDomainFile->GetAppDomain(); + AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); - pTargetRefInfo->vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pTargetModule->GetDomainFile())); + pTargetRefInfo->vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pTargetModule->GetDomainAssembly())); pTargetRefInfo->typeToken = targetTypeDef; } else @@ -4353,8 +4353,8 @@ void DacDbiInterfaceImpl::GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, _ASSERTE(pModule != NULL); - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - pModule->SetHostPtr(pDomainFile->GetModule()); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + pModule->SetHostPtr(pDomainAssembly->GetModule()); } @@ -4367,12 +4367,12 @@ void DacDbiInterfaceImpl::GetDomainFileData(VMPTR_DomainFile vmDomainFile, Domai ZeroMemory(pData, sizeof(*pData)); - DomainFile * pDomainFile = vmDomainFile.GetDacPtr(); - AppDomain * pAppDomain = pDomainFile->GetAppDomain(); + DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); // @dbgtodo - is this efficient DAC usage (perhaps a dac-cop rule)? Are we round-tripping the pointer? // Should we have a GetDomainAssembly() that returns a PTR_DomainAssembly? - pData->vmDomainAssembly.SetHostPtr(pDomainFile->GetDomainAssembly()); + pData->vmDomainAssembly.SetHostPtr(pDomainAssembly->GetDomainAssembly()); pData->vmAppDomain.SetHostPtr(pAppDomain); } @@ -4515,9 +4515,9 @@ VMPTR_DomainAssembly DacDbiInterfaceImpl::ResolveAssembly( DD_ENTER_MAY_THROW; - DomainFile * pDomainFile = vmScope.GetDacPtr(); - AppDomain * pAppDomain = pDomainFile->GetAppDomain(); - Module * pModule = pDomainFile->GetModule(); + DomainFile * pDomainAssembly = vmScope.GetDacPtr(); + AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); + Module * pModule = pDomainAssembly->GetModule(); VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); @@ -7014,7 +7014,7 @@ bool DacDbiInterfaceImpl::IsValidObject(CORDB_ADDRESS addr) } bool DacDbiInterfaceImpl::GetAppDomainForObject(CORDB_ADDRESS addr, OUT VMPTR_AppDomain * pAppDomain, - OUT VMPTR_Module *pModule, OUT VMPTR_DomainFile *pDomainFile) + OUT VMPTR_Module *pModule, OUT VMPTR_DomainFile *pDomainAssembly) { DD_ENTER_MAY_THROW; @@ -7034,7 +7034,7 @@ bool DacDbiInterfaceImpl::GetAppDomainForObject(CORDB_ADDRESS addr, OUT VMPTR_Ap { pAppDomain->SetDacTargetPtr(PTR_HOST_TO_TADDR(baseDomain->AsAppDomain())); pModule->SetDacTargetPtr(PTR_HOST_TO_TADDR(module)); - pDomainFile->SetDacTargetPtr(PTR_HOST_TO_TADDR(module->GetDomainFile())); + pDomainAssembly->SetDacTargetPtr(PTR_HOST_TO_TADDR(module->GetDomainAssembly())); } else { diff --git a/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp b/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp index 251b5dde74fdf..2ee0163977a46 100644 --- a/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp +++ b/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp @@ -514,7 +514,7 @@ void DacDbiInterfaceImpl::EnumerateInternalFrames(VMPTR_Thread #endif // FEATURE_COMINTEROP Module * pModule = (pMD ? pMD->GetModule() : NULL); - DomainFile * pDomainFile = (pModule ? pModule->GetDomainFile() : NULL); + DomainFile * pDomainAssembly = (pModule ? pModule->GetDomainAssembly() : NULL); if (frameData.stubFrame.frameType == STUBFRAME_FUNC_EVAL) { @@ -523,13 +523,13 @@ void DacDbiInterfaceImpl::EnumerateInternalFrames(VMPTR_Thread frameData.stubFrame.funcMetadataToken = pDE->m_methodToken; frameData.stubFrame.vmDomainFile.SetHostPtr( - pDE->m_debuggerModule ? pDE->m_debuggerModule->GetDomainFile() : NULL); + pDE->m_debuggerModule ? pDE->m_debuggerModule->GetDomainAssembly() : NULL); frameData.stubFrame.vmMethodDesc = VMPTR_MethodDesc::NullPtr(); } else { frameData.stubFrame.funcMetadataToken = (pMD == NULL ? NULL : pMD->GetMemberDef()); - frameData.stubFrame.vmDomainFile.SetHostPtr(pDomainFile); + frameData.stubFrame.vmDomainFile.SetHostPtr(pDomainAssembly); frameData.stubFrame.vmMethodDesc.SetHostPtr(pMD); } @@ -702,11 +702,11 @@ void DacDbiInterfaceImpl::InitFrameData(StackFrameIterator * pIter, // Although MiniDumpNormal tries to dump all AppDomains, it's possible // target corruption will keep one from being present. This should mean // we'll just fail later, but struggle on for now. - DomainFile *pDomainFile = NULL; + DomainFile *pDomainAssembly = NULL; EX_TRY_ALLOW_DATATARGET_MISSING_MEMORY { - pDomainFile = (pModule ? pModule->GetDomainFile() : NULL); - _ASSERTE(pDomainFile != NULL); + pDomainAssembly = (pModule ? pModule->GetDomainAssembly() : NULL); + _ASSERTE(pDomainAssembly != NULL); } EX_END_CATCH_ALLOW_DATATARGET_MISSING_MEMORY @@ -783,7 +783,7 @@ void DacDbiInterfaceImpl::InitFrameData(StackFrameIterator * pIter, // pFuncData->funcMetadataToken = pMD->GetMemberDef(); - pFuncData->vmDomainFile.SetHostPtr(pDomainFile); + pFuncData->vmDomainFile.SetHostPtr(pDomainAssembly); // PERF: this is expensive to get so I stopped fetching it eagerly // It is only needed if we haven't already got a cached copy diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h index 690917c2795a9..d927dbf3d6d6c 100644 --- a/src/coreclr/debug/di/rspriv.h +++ b/src/coreclr/debug/di/rspriv.h @@ -4806,7 +4806,7 @@ class CordbType : public CordbBase, public ICorDebugType, public ICorDebugType2 void DestNaryType(Instantiation *pInst); CorElementType GetElementType() { return m_elementType; } - VMPTR_DomainFile GetDomainFile(); + VMPTR_DomainFile GetDomainAssembly(); VMPTR_Module GetModule(); // If this is a ptr type, get the CordbType that it points to. diff --git a/src/coreclr/debug/di/rstype.cpp b/src/coreclr/debug/di/rstype.cpp index 3d807bb2434f5..0605dcf09f607 100644 --- a/src/coreclr/debug/di/rstype.cpp +++ b/src/coreclr/debug/di/rstype.cpp @@ -1876,7 +1876,7 @@ CordbType::GetUnboxedObjectSize(ULONG32 *pObjectSize) } } -VMPTR_DomainFile CordbType::GetDomainFile() +VMPTR_DomainFile CordbType::GetDomainAssembly() { if (m_pClass != NULL) { @@ -1950,7 +1950,7 @@ HRESULT CordbType::TypeToBasicTypeData(DebuggerIPCE_BasicTypeData *data) _ASSERTE(m_pClass != NULL); data->elementType = m_pClass->IsValueClassNoInit() ? ELEMENT_TYPE_VALUETYPE : ELEMENT_TYPE_CLASS; data->metadataToken = m_pClass->MDToken(); - data->vmDomainFile = GetDomainFile(); + data->vmDomainFile = GetDomainAssembly(); data->vmTypeHandle = m_typeHandleExact; if (m_pClass->HasTypeParams() && data->vmTypeHandle.IsNull()) { @@ -2001,7 +2001,7 @@ void CordbType::TypeToExpandedTypeData(DebuggerIPCE_ExpandedTypeData *data) { data->elementType = m_pClass->IsValueClassNoInit() ? ELEMENT_TYPE_VALUETYPE : ELEMENT_TYPE_CLASS; data->ClassTypeData.metadataToken = m_pClass->GetToken(); - data->ClassTypeData.vmDomainFile = GetDomainFile(); + data->ClassTypeData.vmDomainFile = GetDomainAssembly(); data->ClassTypeData.vmModule = GetModule(); data->ClassTypeData.typeHandle = VMPTR_TypeHandle::NullPtr(); diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 44646d08ab5f5..e64f4778f72c0 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -5187,10 +5187,10 @@ void Debugger::SendSyncCompleteIPCEvent(bool isEESuspendedForGC) } // -// Lookup or create a DebuggerModule for the given pDomainFile. +// Lookup or create a DebuggerModule for the given pDomainAssembly. // // Arguments: -// pDomainFile - non-null domain file. +// pDomainAssembly - non-null domain file. // // Returns: // DebuggerModule instance for the given domain file. May be lazily created. @@ -5199,14 +5199,14 @@ void Debugger::SendSyncCompleteIPCEvent(bool isEESuspendedForGC) // @dbgtodo JMC - this should go away when we get rid of DebuggerModule. // -DebuggerModule * Debugger::LookupOrCreateModule(DomainFile * pDomainFile) +DebuggerModule * Debugger::LookupOrCreateModule(DomainFile * pDomainAssembly) { - _ASSERTE(pDomainFile != NULL); - LOG((LF_CORDB, LL_INFO1000, "D::LOCM df=0x%x\n", pDomainFile)); - DebuggerModule * pDModule = LookupOrCreateModule(pDomainFile->GetModule(), pDomainFile->GetAppDomain()); - LOG((LF_CORDB, LL_INFO1000, "D::LOCM m=0x%x ad=0x%x -> dm=0x%x\n", pDomainFile->GetModule(), pDomainFile->GetAppDomain(), pDModule)); + _ASSERTE(pDomainAssembly != NULL); + LOG((LF_CORDB, LL_INFO1000, "D::LOCM df=0x%x\n", pDomainAssembly)); + DebuggerModule * pDModule = LookupOrCreateModule(pDomainAssembly->GetModule(), pDomainAssembly->GetAppDomain()); + LOG((LF_CORDB, LL_INFO1000, "D::LOCM m=0x%x ad=0x%x -> dm=0x%x\n", pDomainAssembly->GetModule(), pDomainAssembly->GetAppDomain(), pDModule)); _ASSERTE(pDModule != NULL); - _ASSERTE(pDModule->GetDomainFile() == pDomainFile); + _ASSERTE(pDModule->GetDomainAssembly() == pDomainAssembly); return pDModule; } @@ -5223,12 +5223,12 @@ DebuggerModule * Debugger::LookupOrCreateModule(DomainFile * pDomainFile) // VMPTR comes from IPC events DebuggerModule * Debugger::LookupOrCreateModule(VMPTR_DomainFile vmDomainFile) { - DomainFile * pDomainFile = vmDomainFile.GetRawPtr(); - if (pDomainFile == NULL) + DomainFile * pDomainAssembly = vmDomainFile.GetRawPtr(); + if (pDomainAssembly == NULL) { return NULL; } - return LookupOrCreateModule(pDomainFile); + return LookupOrCreateModule(pDomainAssembly); } // Lookup or create a DebuggerModule for the given (Module, AppDomain) pair. @@ -5281,9 +5281,9 @@ DebuggerModule* Debugger::LookupOrCreateModule(Module* pModule, AppDomain *pAppD HRESULT hr = S_OK; EX_TRY { - DomainFile * pDomainFile = pModule->GetDomainFile(); - SIMPLIFYING_ASSUMPTION(pDomainFile != NULL); - dmod = AddDebuggerModule(pDomainFile); // throws + DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); + SIMPLIFYING_ASSUMPTION(pDomainAssembly != NULL); + dmod = AddDebuggerModule(pDomainAssembly); // throws } EX_CATCH_HRESULT(hr); SIMPLIFYING_ASSUMPTION(dmod != NULL); // may not be true in OOM cases; but LS doesn't handle OOM. @@ -5293,19 +5293,19 @@ DebuggerModule* Debugger::LookupOrCreateModule(Module* pModule, AppDomain *pAppD _ASSERTE( (dmod == NULL) || (dmod->GetAppDomain() == pAppDomain) ); LOG((LF_CORDB, LL_INFO1000, "D::LOCM m=0x%x ad=0x%x -> dm=0x%x(Mod=0x%x, DomFile=0x%x, AD=0x%x)\n", - pModule, pAppDomain, dmod, dmod->GetRuntimeModule(), dmod->GetDomainFile(), dmod->GetAppDomain())); + pModule, pAppDomain, dmod, dmod->GetRuntimeModule(), dmod->GetDomainAssembly(), dmod->GetAppDomain())); return dmod; } // Create a new DebuggerModule object // // Arguments: -// pDomainFile- runtime domain file to create debugger module object around +// pDomainAssembly- runtime domain file to create debugger module object around // // Returns: // New instnace of a DebuggerModule. Throws on failure. // -DebuggerModule* Debugger::AddDebuggerModule(DomainFile * pDomainFile) +DebuggerModule* Debugger::AddDebuggerModule(DomainFile * pDomainAssembly) { CONTRACTL { @@ -5314,16 +5314,16 @@ DebuggerModule* Debugger::AddDebuggerModule(DomainFile * pDomainFile) } CONTRACTL_END; - LOG((LF_CORDB, LL_INFO1000, "D::ADM df=0x%x\n", pDomainFile)); + LOG((LF_CORDB, LL_INFO1000, "D::ADM df=0x%x\n", pDomainAssembly)); DebuggerDataLockHolder chInfo(this); - Module * pRuntimeModule = pDomainFile->GetModule(); - AppDomain * pAppDomain = pDomainFile->GetAppDomain(); + Module * pRuntimeModule = pDomainAssembly->GetModule(); + AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); HRESULT hr = CheckInitModuleTable(); IfFailThrow(hr); - DebuggerModule* pModule = new (interopsafe) DebuggerModule(pRuntimeModule, pDomainFile, pAppDomain); + DebuggerModule* pModule = new (interopsafe) DebuggerModule(pRuntimeModule, pDomainAssembly, pAppDomain); _ASSERTE(pModule != NULL); // throws on oom TRACE_ALLOC(pModule); @@ -5332,7 +5332,7 @@ DebuggerModule* Debugger::AddDebuggerModule(DomainFile * pDomainFile) // @dbgtodo inspection/exceptions - this may leak module in OOM case. LS is not OOM resilient; and we // expect to get rid of DebuggerModule anyways. - LOG((LF_CORDB, LL_INFO1000, "D::ADM df=0x%x -> dm=0x%x\n", pDomainFile, pModule)); + LOG((LF_CORDB, LL_INFO1000, "D::ADM df=0x%x -> dm=0x%x\n", pDomainAssembly, pModule)); return pModule; } @@ -6246,7 +6246,7 @@ void Debugger::LockAndSendEnCRemapEvent(DebuggerJitInfo * dji, SIZE_T currentIP, Module *pRuntimeModule = pFD->GetModule(); DebuggerModule * pDModule = LookupOrCreateModule(pRuntimeModule, thread->GetDomain()); - ipce->EnCRemap.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainFile() : NULL)); + ipce->EnCRemap.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); LOG((LF_CORDB, LL_INFO10000, "D::LASEnCRE: %s::%s " "dmod:0x%x, methodDef:0x%x \n", @@ -6315,7 +6315,7 @@ void Debugger::LockAndSendEnCRemapCompleteEvent(MethodDesc *pFD) Module *pRuntimeModule = pFD->GetModule(); DebuggerModule * pDModule = LookupOrCreateModule(pRuntimeModule, thread->GetDomain()); - ipce->EnCRemapComplete.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainFile() : NULL)); + ipce->EnCRemapComplete.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); LOG((LF_CORDB, LL_INFO10000, "D::LASEnCRC: %s::%s " @@ -6381,7 +6381,7 @@ void Debugger::SendEnCUpdateEvent(DebuggerIPCEventType eventType, _ASSERTE(pModule->GetDomain()->IsAppDomain()); DebuggerModule * pDModule = LookupOrCreateModule(pModule, pModule->GetDomain()->AsAppDomain()); - event->EnCUpdate.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainFile() : NULL)); + event->EnCUpdate.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); m_pRCThread->SendIPCEvent(); @@ -9426,7 +9426,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, DWORD dwModuleName, // length of pszModuleName in chars, not including null. Assembly *pAssembly, AppDomain *pAppDomain, - DomainFile * pDomainFile, + DomainFile * pDomainAssembly, BOOL fAttaching) { @@ -9467,7 +9467,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, _ASSERTE(pManifestModule->IsManifest()); _ASSERTE(pManifestModule->GetAssembly() == pRuntimeModule->GetAssembly()); - DomainFile * pManifestDomainFile = pManifestModule->GetDomainFile(); + DomainFile * pManifestDomainFile = pManifestModule->GetDomainAssembly(); DebuggerLockHolder dbgLockHolder(this); @@ -9499,7 +9499,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, // The RS has logic to ignore duplicate ModuleLoad events. We have to send what could possibly be a dup, though, // due to some really nasty issues with getting proper assembly and module load events from the loader when dealing // with shared assemblies. - module = LookupOrCreateModule(pDomainFile); + module = LookupOrCreateModule(pDomainAssembly); _ASSERTE(module != NULL); @@ -9512,15 +9512,15 @@ void Debugger::LoadModule(Module* pRuntimeModule, // @dbgtodo inspection - Check whether the DomainFile we get is consistent with the Module and AppDomain we get. // We should simply things when we actually get rid of DebuggerModule, possibly by just passing the // DomainFile around. - _ASSERTE(module->GetDomainFile() == pDomainFile); - _ASSERTE(module->GetAppDomain() == pDomainFile->GetAppDomain()); - _ASSERTE(module->GetRuntimeModule() == pDomainFile->GetModule()); + _ASSERTE(module->GetDomainAssembly() == pDomainAssembly); + _ASSERTE(module->GetAppDomain() == pDomainAssembly->GetAppDomain()); + _ASSERTE(module->GetRuntimeModule() == pDomainAssembly->GetModule()); // Send a load module event to the Right Side. ipce = m_pRCThread->GetIPCEventSendBuffer(); InitIPCEvent(ipce,DB_IPCE_LOAD_MODULE, pThread, pAppDomain); - ipce->LoadModuleData.vmDomainFile.SetRawPtr(pDomainFile); + ipce->LoadModuleData.vmDomainFile.SetRawPtr(pDomainAssembly); m_pRCThread->SendIPCEvent(); @@ -9588,7 +9588,7 @@ void Debugger::SendRawUpdateModuleSymsEvent(Module *pRuntimeModule, AppDomain *p g_pEEInterface->GetThread(), pAppDomain); - ipce->UpdateModuleSymsData.vmDomainFile.SetRawPtr((module ? module->GetDomainFile() : NULL)); + ipce->UpdateModuleSymsData.vmDomainFile.SetRawPtr((module ? module->GetDomainAssembly() : NULL)); m_pRCThread->SendIPCEvent(); } @@ -9695,8 +9695,8 @@ void Debugger::UnloadModule(Module* pRuntimeModule, STRESS_LOG6(LF_CORDB, LL_INFO10000, "D::UM: Unloading RTMod:%#08x (DomFile: %#08x, IsISStream:%#08x); DMod:%#08x(RTMod:%#08x DomFile: %#08x)\n", - pRuntimeModule, pRuntimeModule->GetDomainFile(), false, - module, module->GetRuntimeModule(), module->GetDomainFile()); + pRuntimeModule, pRuntimeModule->GetDomainAssembly(), false, + module, module->GetRuntimeModule(), module->GetDomainAssembly()); // Note: the appdomain the module was loaded in must match the appdomain we're unloading it from. If it doesn't, // then we've either found the wrong DebuggerModule in LookupModule or we were passed bad data. @@ -9705,7 +9705,7 @@ void Debugger::UnloadModule(Module* pRuntimeModule, // Send the unload module event to the Right Side. DebuggerIPCEvent* ipce = m_pRCThread->GetIPCEventSendBuffer(); InitIPCEvent(ipce, DB_IPCE_UNLOAD_MODULE, thread, pAppDomain); - ipce->UnloadModuleData.vmDomainFile.SetRawPtr((module ? module->GetDomainFile() : NULL)); + ipce->UnloadModuleData.vmDomainFile.SetRawPtr((module ? module->GetDomainAssembly() : NULL)); ipce->UnloadModuleData.debuggerAssemblyToken.Set(pRuntimeModule->GetClassLoader()->GetAssembly()); m_pRCThread->SendIPCEvent(); @@ -9877,7 +9877,7 @@ void Debugger::SendClassLoadUnloadEvent (mdTypeDef classMetadataToken, InitIPCEvent(pEvent, DB_IPCE_LOAD_CLASS, g_pEEInterface->GetThread(), pAppDomain); pEvent->LoadClass.classMetadataToken = classMetadataToken; - pEvent->LoadClass.vmDomainFile.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainFile() : NULL)); + pEvent->LoadClass.vmDomainFile.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainAssembly() : NULL)); pEvent->LoadClass.classDebuggerAssemblyToken.Set(pAssembly); @@ -9889,7 +9889,7 @@ void Debugger::SendClassLoadUnloadEvent (mdTypeDef classMetadataToken, InitIPCEvent(pEvent, DB_IPCE_UNLOAD_CLASS, g_pEEInterface->GetThread(), pAppDomain); pEvent->UnloadClass.classMetadataToken = classMetadataToken; - pEvent->UnloadClass.vmDomainFile.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainFile() : NULL)); + pEvent->UnloadClass.vmDomainFile.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainAssembly() : NULL)); pEvent->UnloadClass.classDebuggerAssemblyToken.Set(pAssembly); } @@ -9943,7 +9943,7 @@ BOOL Debugger::SendSystemClassLoadUnloadEvent(mdTypeDef classMetadataToken, // triggers too early in the loading process. FindDomainFile will not become // non-NULL until the module is fully loaded into the domain which is what we // want. - if (classModule->GetDomainFile() != NULL ) + if (classModule->GetDomainAssembly() != NULL ) { // Find the Left Side module that this class belongs in. DebuggerModule* pModule = LookupOrCreateModule(classModule, pAppDomain); @@ -11828,7 +11828,7 @@ void Debugger::TypeHandleToBasicTypeInfo(AppDomain *pAppDomain, TypeHandle th, D // only set if instantiated res->metadataToken = th.GetCl(); DebuggerModule * pDModule = LookupOrCreateModule(th.GetModule(), pAppDomain); - res->vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainFile() : NULL)); + res->vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); break; } @@ -11907,7 +11907,7 @@ void Debugger::TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, res->ClassTypeData.typeHandle = th.HasInstantiation() ? WrapTypeHandle(th) : VMPTR_TypeHandle::NullPtr(); // only set if instantiated res->ClassTypeData.metadataToken = th.GetCl(); DebuggerModule * pModule = LookupOrCreateModule(th.GetModule(), pAppDomain); - res->ClassTypeData.vmDomainFile.SetRawPtr((pModule ? pModule->GetDomainFile() : NULL)); + res->ClassTypeData.vmDomainFile.SetRawPtr((pModule ? pModule->GetDomainAssembly() : NULL)); _ASSERTE(!res->ClassTypeData.vmDomainFile.IsNull()); break; } diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h index 084f1da6a5c93..57621605cb556 100644 --- a/src/coreclr/debug/ee/debugger.h +++ b/src/coreclr/debug/ee/debugger.h @@ -472,7 +472,7 @@ typedef DPTR(class DebuggerModule) PTR_DebuggerModule; class DebuggerModule { public: - DebuggerModule(Module * pRuntimeModule, DomainFile * pDomainFile, AppDomain * pAppDomain); + DebuggerModule(Module * pRuntimeModule, DomainFile * pDomainAssembly, AppDomain * pAppDomain); // Do we have any optimized code in the module? // JMC-probes aren't emitted in optimized code, @@ -510,7 +510,7 @@ class DebuggerModule // workaround to facilitate the removal of DebuggerModule. // DebuggerModule * GetPrimaryModule(); - DomainFile * GetDomainFile() + DomainFile * GetDomainAssembly() { LIMITED_METHOD_DAC_CONTRACT; return m_pRuntimeDomainFile; @@ -1893,9 +1893,9 @@ class Debugger : public DebugInterface DWORD dwModuleName, Assembly *pAssembly, AppDomain *pAppDomain, - DomainFile * pDomainFile, + DomainFile * pDomainAssembly, BOOL fAttaching); - DebuggerModule * AddDebuggerModule(DomainFile * pDomainFile); + DebuggerModule * AddDebuggerModule(DomainFile * pDomainAssembly); void UnloadModule(Module* pRuntimeModule, @@ -2069,7 +2069,7 @@ class Debugger : public DebugInterface bool HandleIPCEvent(DebuggerIPCEvent* event); DebuggerModule * LookupOrCreateModule(VMPTR_DomainFile vmDomainFile); - DebuggerModule * LookupOrCreateModule(DomainFile * pDomainFile); + DebuggerModule * LookupOrCreateModule(DomainFile * pDomainAssembly); DebuggerModule * LookupOrCreateModule(Module * pModule, AppDomain * pAppDomain); HRESULT GetAndSendInterceptCommand(DebuggerIPCEvent *event); diff --git a/src/coreclr/debug/ee/debugger.inl b/src/coreclr/debug/ee/debugger.inl index 0eba7edccf87d..2f76e5ee26138 100644 --- a/src/coreclr/debug/ee/debugger.inl +++ b/src/coreclr/debug/ee/debugger.inl @@ -52,16 +52,16 @@ inline DebuggerModuleTable * Debugger::GetModuleTable() // @dbgtodo inspection - get rid of this entire class as we move things out-of-proc. //----------------------------------------------------------------------------- inline DebuggerModule::DebuggerModule(Module * pRuntimeModule, - DomainFile * pDomainFile, + DomainFile * pDomainAssembly, AppDomain * pAppDomain) : m_enableClassLoadCallbacks(FALSE), m_pPrimaryModule(NULL), m_pRuntimeModule(pRuntimeModule), - m_pRuntimeDomainFile(pDomainFile), + m_pRuntimeDomainFile(pDomainAssembly), m_pAppDomain(pAppDomain) { LOG((LF_CORDB,LL_INFO10000, "DM::DM this:0x%x Module:0x%x DF:0x%x AD:0x%x\n", - this, pRuntimeModule, pDomainFile, pAppDomain)); + this, pRuntimeModule, pDomainAssembly, pAppDomain)); // Pick a primary module. // Arguably, this could be in DebuggerModuleTable::AddModule diff --git a/src/coreclr/debug/ee/debuggermodule.cpp b/src/coreclr/debug/ee/debuggermodule.cpp index fb6fa53652fbe..633567f0dd85f 100644 --- a/src/coreclr/debug/ee/debuggermodule.cpp +++ b/src/coreclr/debug/ee/debuggermodule.cpp @@ -253,7 +253,7 @@ void DebuggerModuleTable::RemoveModule(Module* pModule, AppDomain *pAppDomain) if ((pRuntimeModule == pModule) && (pDM->GetAppDomain() == pAppDomain)) { LOG((LF_CORDB, LL_INFO1000, "DMT::RM Removing DebuggerMod:0x%x - Module:0x%x DF:0x%x AD:0x%x\n", - pDM, pModule, pDM->GetDomainFile(), pAppDomain)); + pDM, pModule, pDM->GetDomainAssembly(), pAppDomain)); TRACE_FREE(pDM); DeleteInteropSafe(pDM); Delete(HASH(pRuntimeModule), (HASHENTRY *) pDME); diff --git a/src/coreclr/debug/inc/dacdbiinterface.h b/src/coreclr/debug/inc/dacdbiinterface.h index 0bda865bd0f59..85eab88e3f5ed 100644 --- a/src/coreclr/debug/inc/dacdbiinterface.h +++ b/src/coreclr/debug/inc/dacdbiinterface.h @@ -2459,7 +2459,7 @@ class IDacDbiInterface virtual bool GetAppDomainForObject(CORDB_ADDRESS obj, OUT VMPTR_AppDomain * pApp, OUT VMPTR_Module * pModule, - OUT VMPTR_DomainFile * pDomainFile) = 0; + OUT VMPTR_DomainFile * pDomainAssembly) = 0; // Reference Walking. diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index c143d8a3da403..39e47d0a7d86d 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2239,7 +2239,7 @@ DispIDCache* AppDomain::SetupRefDispIDCache() #endif // FEATURE_COMINTEROP -FileLoadLock *FileLoadLock::Create(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainFile *pDomainFile) +FileLoadLock *FileLoadLock::Create(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainFile *pDomainAssembly) { CONTRACTL { @@ -2252,7 +2252,7 @@ FileLoadLock *FileLoadLock::Create(PEFileListLock *pLock, PEAssembly * pPEAssemb } CONTRACTL_END; - NewHolder result(new FileLoadLock(pLock, pPEAssembly, pDomainFile)); + NewHolder result(new FileLoadLock(pLock, pPEAssembly, pDomainAssembly)); pLock->AddElement(result); result->AddRef(); // Add one ref on behalf of the ListLock's reference. The corresponding Release() happens in FileLoadLock::CompleteLoadLevel. @@ -2272,10 +2272,10 @@ FileLoadLock::~FileLoadLock() ((PEAssembly *) m_data)->Release(); } -DomainFile *FileLoadLock::GetDomainFile() +DomainFile *FileLoadLock::GetDomainAssembly() { LIMITED_METHOD_CONTRACT; - return m_pDomainFile; + return m_pDomainAssembly; } FileLoadLevel FileLoadLock::GetLoadLevel() @@ -2357,7 +2357,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) if (level > m_level) { // Must complete each level in turn, unless we have an error - CONSISTENCY_CHECK(m_pDomainFile->IsError() || (level == (m_level+1))); + CONSISTENCY_CHECK(m_pDomainAssembly->IsError() || (level == (m_level+1))); // Remove the lock from the list if the load is completed if (level >= FILE_ACTIVE) { @@ -2371,7 +2371,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) m_pList->Unlink(this); _ASSERTE(fDbgOnly_SuccessfulUnlink); - m_pDomainFile->ClearLoading(); + m_pDomainAssembly->ClearLoading(); CONSISTENCY_CHECK(m_dwRefCount >= 2); // Caller (LoadDomainFile) should have 1 refcount and m_pList should have another which was acquired in FileLoadLock::Create. @@ -2382,7 +2382,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) // we depend on the DomainFile's load level being up to date. Hence we must update the load // level while the m_pList lock is held. if (success) - m_pDomainFile->SetLoadLevel(level); + m_pDomainAssembly->SetLoadLevel(level); } @@ -2394,7 +2394,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) m_level = (FileLoadLevel)level; if (success) - m_pDomainFile->SetLoadLevel(level); + m_pDomainAssembly->SetLoadLevel(level); } #ifndef DACCESS_COMPILE @@ -2405,7 +2405,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) case FILE_LOAD_DELIVER_EVENTS: case FILE_LOADED: case FILE_ACTIVE: // The timing of stress logs is not critical, so even for the FILE_ACTIVE stage we need not do it while the m_pList lock is held. - STRESS_LOG3(LF_CLASSLOADER, LL_INFO100, "Completed Load Level %s for DomainFile %p - success = %i\n", fileLoadLevelName[level], m_pDomainFile, success); + STRESS_LOG3(LF_CLASSLOADER, LL_INFO100, "Completed Load Level %s for DomainFile %p - success = %i\n", fileLoadLevelName[level], m_pDomainAssembly, success); break; default: break; @@ -2434,9 +2434,9 @@ void FileLoadLock::SetError(Exception *ex) m_cachedHR = ex->GetHR(); LOG((LF_LOADER, LL_WARNING, "LOADER: %x:***%s*\t!!!Non-transient error 0x%x\n", - m_pDomainFile->GetAppDomain(), m_pDomainFile->GetSimpleName(), m_cachedHR)); + m_pDomainAssembly->GetAppDomain(), m_pDomainAssembly->GetSimpleName(), m_cachedHR)); - m_pDomainFile->SetError(ex); + m_pDomainAssembly->SetError(ex); CompleteLoadLevel(FILE_ACTIVE, FALSE); } @@ -2464,10 +2464,10 @@ UINT32 FileLoadLock::Release() return count; } -FileLoadLock::FileLoadLock(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainFile *pDomainFile) +FileLoadLock::FileLoadLock(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainFile *pDomainAssembly) : ListLockEntry(pLock, pPEAssembly, "File load lock"), m_level((FileLoadLevel) (FILE_LOAD_CREATE)), - m_pDomainFile(pDomainFile), + m_pDomainAssembly(pDomainAssembly), m_cachedHR(S_OK) { WRAPPER_NO_CONTRACT; @@ -2932,14 +2932,14 @@ DomainFile *AppDomain::LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetL { STANDARD_VM_CHECK; PRECONDITION(CheckPointer(pLock)); - PRECONDITION(pLock->GetDomainFile()->GetAppDomain() == this); + PRECONDITION(pLock->GetDomainAssembly()->GetAppDomain() == this); POSTCONDITION(RETVAL->GetLoadLevel() >= GetThreadFileLoadLevel() || RETVAL->GetLoadLevel() >= targetLevel); POSTCONDITION(RETVAL->CheckNoError(targetLevel)); } CONTRACT_END; - DomainFile *pFile = pLock->GetDomainFile(); + DomainFile *pFile = pLock->GetDomainAssembly(); // Make sure we release the lock on exit FileLoadLockRefHolder lockRef(pLock); @@ -3140,7 +3140,7 @@ CHECK AppDomain::CheckValidModule(Module * pModule) } CONTRACTL_END; - if (pModule->GetDomainFile() != NULL) + if (pModule->GetDomainAssembly() != NULL) CHECK_OK; CHECK_OK; @@ -4215,7 +4215,7 @@ DWORD DomainLocalModule::GetClassFlags(MethodTable* pMT, DWORD iClassIndex /*=(D } CONTRACTL_END; { - CONSISTENCY_CHECK(GetDomainFile()->GetModule() == pMT->GetModuleForStatics()); + CONSISTENCY_CHECK(GetDomainAssembly()->GetModule() == pMT->GetModuleForStatics()); } if (pMT->IsDynamicStatics()) @@ -4246,7 +4246,7 @@ void DomainLocalModule::SetClassInitialized(MethodTable* pMT) } CONTRACTL_END; - BaseDomain::DomainLocalBlockLockHolder lh(GetDomainFile()->GetAppDomain()); + BaseDomain::DomainLocalBlockLockHolder lh(GetDomainAssembly()->GetAppDomain()); _ASSERTE(!IsClassInitialized(pMT)); _ASSERTE(!IsClassInitError(pMT)); @@ -4258,7 +4258,7 @@ void DomainLocalModule::SetClassInitError(MethodTable* pMT) { WRAPPER_NO_CONTRACT; - BaseDomain::DomainLocalBlockLockHolder lh(GetDomainFile()->GetAppDomain()); + BaseDomain::DomainLocalBlockLockHolder lh(GetDomainAssembly()->GetAppDomain()); SetClassFlags(pMT, ClassInitFlags::ERROR_FLAG); } @@ -4268,9 +4268,9 @@ void DomainLocalModule::SetClassFlags(MethodTable* pMT, DWORD dwFlags) CONTRACTL { THROWS; GC_TRIGGERS; - PRECONDITION(GetDomainFile()->GetModule() == pMT->GetModuleForStatics()); + PRECONDITION(GetDomainAssembly()->GetModule() == pMT->GetModuleForStatics()); // Assumes BaseDomain::DomainLocalBlockLockHolder is taken - PRECONDITION(GetDomainFile()->GetAppDomain()->OwnDomainLocalBlockLock()); + PRECONDITION(GetDomainAssembly()->GetAppDomain()->OwnDomainLocalBlockLock()); } CONTRACTL_END; if (pMT->IsDynamicStatics()) @@ -4295,7 +4295,7 @@ void DomainLocalModule::EnsureDynamicClassIndex(DWORD dwID) MODE_ANY; INJECT_FAULT(COMPlusThrowOM();); // Assumes BaseDomain::DomainLocalBlockLockHolder is taken - PRECONDITION(GetDomainFile()->GetAppDomain()->OwnDomainLocalBlockLock()); + PRECONDITION(GetDomainAssembly()->GetAppDomain()->OwnDomainLocalBlockLock()); } CONTRACTL_END; @@ -4313,7 +4313,7 @@ void DomainLocalModule::EnsureDynamicClassIndex(DWORD dwID) DynamicClassInfo* pNewDynamicClassTable; pNewDynamicClassTable = (DynamicClassInfo*) - (void*)GetDomainFile()->GetLoaderAllocator()->GetHighFrequencyHeap()->AllocMem( + (void*)GetDomainAssembly()->GetLoaderAllocator()->GetHighFrequencyHeap()->AllocMem( S_SIZE_T(sizeof(DynamicClassInfo)) * S_SIZE_T(aDynamicEntries)); memcpy(pNewDynamicClassTable, m_pDynamicClassTable, sizeof(DynamicClassInfo) * m_aDynamicEntries); @@ -4337,13 +4337,13 @@ void DomainLocalModule::AllocateDynamicClass(MethodTable *pMT) THROWS; GC_TRIGGERS; // Assumes BaseDomain::DomainLocalBlockLockHolder is taken - PRECONDITION(GetDomainFile()->GetAppDomain()->OwnDomainLocalBlockLock()); + PRECONDITION(GetDomainAssembly()->GetAppDomain()->OwnDomainLocalBlockLock()); } CONTRACTL_END; _ASSERTE(!pMT->ContainsGenericVariables()); _ASSERTE(!pMT->IsSharedByGenericInstantiations()); - _ASSERTE(GetDomainFile()->GetModule() == pMT->GetModuleForStatics()); + _ASSERTE(GetDomainAssembly()->GetModule() == pMT->GetModuleForStatics()); _ASSERTE(pMT->IsDynamicStatics()); DWORD dynamicEntryIDIndex = pMT->GetModuleDynamicEntryID(); @@ -4368,7 +4368,7 @@ void DomainLocalModule::AllocateDynamicClass(MethodTable *pMT) { if (pDynamicStatics == NULL) { - LoaderHeap * pLoaderAllocator = GetDomainFile()->GetLoaderAllocator()->GetHighFrequencyHeap(); + LoaderHeap * pLoaderAllocator = GetDomainAssembly()->GetLoaderAllocator()->GetHighFrequencyHeap(); if (pMT->Collectible()) { @@ -4407,7 +4407,7 @@ void DomainLocalModule::AllocateDynamicClass(MethodTable *pMT) else #endif nongcStaticsArray = AllocatePrimitiveArray(ELEMENT_TYPE_U1, dwStaticBytes); - ((CollectibleDynamicEntry *)pDynamicStatics)->m_hNonGCStatics = GetDomainFile()->GetModule()->GetLoaderAllocator()->AllocateHandle(nongcStaticsArray); + ((CollectibleDynamicEntry *)pDynamicStatics)->m_hNonGCStatics = GetDomainAssembly()->GetModule()->GetLoaderAllocator()->AllocateHandle(nongcStaticsArray); GCPROTECT_END(); } if (dwNumHandleStatics > 0) @@ -4423,7 +4423,7 @@ void DomainLocalModule::AllocateDynamicClass(MethodTable *pMT) OBJECTREF gcStaticsArray = NULL; GCPROTECT_BEGIN(gcStaticsArray); gcStaticsArray = AllocateObjectArray(dwNumHandleStatics, g_pObjectClass); - ((CollectibleDynamicEntry *)pDynamicStatics)->m_hGCStatics = GetDomainFile()->GetModule()->GetLoaderAllocator()->AllocateHandle(gcStaticsArray); + ((CollectibleDynamicEntry *)pDynamicStatics)->m_hGCStatics = GetDomainAssembly()->GetModule()->GetLoaderAllocator()->AllocateHandle(gcStaticsArray); GCPROTECT_END(); } } @@ -4448,7 +4448,7 @@ void DomainLocalModule::PopulateClass(MethodTable *pMT) if (!IsClassAllocated(pMT, iClassIndex)) { - BaseDomain::DomainLocalBlockLockHolder lh(GetDomainFile()->GetAppDomain()); + BaseDomain::DomainLocalBlockLockHolder lh(GetDomainAssembly()->GetAppDomain()); if (!IsClassAllocated(pMT, iClassIndex)) { @@ -5186,9 +5186,9 @@ DomainLocalModule::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) // sizeof(DomainLocalModule) == 0x28 DAC_ENUM_DTHIS(); - if (m_pDomainFile.IsValid()) + if (m_pDomainAssembly.IsValid()) { - m_pDomainFile->EnumMemoryRegions(flags); + m_pDomainAssembly->EnumMemoryRegions(flags); } if (m_pDynamicClassTable.Load().IsValid()) diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index c79a1433bc5db..c6e0aeefa74c7 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -201,18 +201,18 @@ struct DomainLocalModule static SIZE_T GetOffsetOfDataBlob() { return offsetof(DomainLocalModule, m_pDataBlob); } static SIZE_T GetOffsetOfGCStaticPointer() { return offsetof(DomainLocalModule, m_pGCStatics); } - inline DomainFile* GetDomainFile() + inline DomainFile* GetDomainAssembly() { LIMITED_METHOD_CONTRACT SUPPORTS_DAC; - return m_pDomainFile; + return m_pDomainAssembly; } #ifndef DACCESS_COMPILE - inline void SetDomainFile(DomainFile* pDomainFile) + inline void SetDomainAssembly(DomainFile* pDomainAssembly) { LIMITED_METHOD_CONTRACT - m_pDomainFile = pDomainFile; + m_pDomainAssembly = pDomainAssembly; } #endif @@ -236,7 +236,7 @@ struct DomainLocalModule if (pMT->IsDynamicStatics()) { - _ASSERTE(GetDomainFile()->GetModule() == pMT->GetModuleForStatics()); + _ASSERTE(GetDomainAssembly()->GetModule() == pMT->GetModuleForStatics()); return GetDynamicEntryGCStaticsBasePointer(pMT->GetModuleDynamicEntryID(), pMT->GetLoaderAllocator()); } else @@ -252,7 +252,7 @@ struct DomainLocalModule if (pMT->IsDynamicStatics()) { - _ASSERTE(GetDomainFile()->GetModule() == pMT->GetModuleForStatics()); + _ASSERTE(GetDomainAssembly()->GetModule() == pMT->GetModuleForStatics()); return GetDynamicEntryNonGCStaticsBasePointer(pMT->GetModuleDynamicEntryID(), pMT->GetLoaderAllocator()); } else @@ -403,7 +403,7 @@ struct DomainLocalModule FORCEINLINE MethodTable * GetMethodTableFromClassDomainID(DWORD dwClassDomainID) { DWORD rid = (DWORD)(dwClassDomainID) + 1; - TypeHandle th = GetDomainFile()->GetModule()->LookupTypeDef(TokenFromRid(rid, mdtTypeDef)); + TypeHandle th = GetDomainAssembly()->GetModule()->LookupTypeDef(TokenFromRid(rid, mdtTypeDef)); _ASSERTE(!th.IsNull()); MethodTable * pMT = th.AsMethodTable(); PREFIX_ASSUME(pMT != NULL); @@ -416,7 +416,7 @@ struct DomainLocalModule void SetClassFlags(MethodTable* pMT, DWORD dwFlags); DWORD GetClassFlags(MethodTable* pMT, DWORD iClassIndex); - PTR_DomainFile m_pDomainFile; + PTR_DomainFile m_pDomainAssembly; VolatilePtr m_pDynamicClassTable; // used for generics and reflection.emit in memory Volatile m_aDynamicEntries; // number of entries in dynamic table VolatilePtr m_pADThunkTable; @@ -773,14 +773,14 @@ class FileLoadLock : public ListLockEntry { private: FileLoadLevel m_level; - DomainFile *m_pDomainFile; + DomainFile *m_pDomainAssembly; HRESULT m_cachedHR; public: - static FileLoadLock *Create(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainFile *pDomainFile); + static FileLoadLock *Create(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainFile *pDomainAssembly); ~FileLoadLock(); - DomainFile *GetDomainFile(); + DomainFile *GetDomainAssembly(); FileLoadLevel GetLoadLevel(); // CanAcquire will return FALSE if Acquire will definitely not take the lock due @@ -807,7 +807,7 @@ class FileLoadLock : public ListLockEntry private: - FileLoadLock(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainFile *pDomainFile); + FileLoadLock(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainFile *pDomainAssembly); static void HolderLeave(FileLoadLock *pThis); diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index bffcfed1464c0..1cc5fda8b3e7a 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -694,7 +694,7 @@ void Assembly::SetDomainAssembly(DomainAssembly *pDomainAssembly) } CONTRACTL_END; - GetModule()->SetDomainFile(pDomainAssembly); + GetModule()->SetDomainAssembly(pDomainAssembly); } // Assembly::SetDomainAssembly diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 51f1873daede9..b9256e691c015 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1049,14 +1049,7 @@ DomainAssembly* Module::GetDomainAssembly() { LIMITED_METHOD_DAC_CONTRACT; - return dac_cast(m_ModuleID->GetDomainFile()); -} - -DomainFile *Module::GetDomainFile() -{ - LIMITED_METHOD_DAC_CONTRACT; - - return dac_cast(m_ModuleID->GetDomainFile()); + return dac_cast(m_ModuleID->GetDomainAssembly()); } #ifndef DACCESS_COMPILE @@ -2000,13 +1993,13 @@ void Module::AllocateStatics(AllocMemTracker *pamTracker) BuildStaticsOffsets(pamTracker); } -void Module::SetDomainFile(DomainFile *pDomainFile) +void Module::SetDomainAssembly(DomainFile *pDomainAssembly) { CONTRACTL { INSTANCE_CHECK; - PRECONDITION(CheckPointer(pDomainFile)); - PRECONDITION(IsManifest() == pDomainFile->IsAssembly()); + PRECONDITION(CheckPointer(pDomainAssembly)); + PRECONDITION(IsManifest() == pDomainAssembly->IsAssembly()); THROWS; GC_TRIGGERS; MODE_ANY; @@ -2026,7 +2019,7 @@ void Module::SetDomainFile(DomainFile *pDomainFile) } else { - pLoaderAllocator = pDomainFile->GetAppDomain()->GetLoaderAllocator(); + pLoaderAllocator = pDomainAssembly->GetAppDomain()->GetLoaderAllocator(); } SIZE_T size = GetDomainLocalModuleSize(); @@ -2066,7 +2059,7 @@ void Module::SetDomainFile(DomainFile *pDomainFile) m_ModuleID = pModuleData; } - m_ModuleID->SetDomainFile(pDomainFile); + m_ModuleID->SetDomainAssembly(pDomainAssembly); // Allocate static handles now. // NOTE: Bootstrapping issue with CoreLib - we will manually allocate later @@ -2074,7 +2067,7 @@ void Module::SetDomainFile(DomainFile *pDomainFile) // as it is currently initialized through the DomainLocalModule::PopulateClass in MethodTable::CheckRunClassInitThrowing // (If we don't do this, it would allocate here unused regular static handles that will be overridden later) if (g_pPredefinedArrayTypes[ELEMENT_TYPE_OBJECT] != NULL && !GetAssembly()->IsCollectible()) - AllocateRegularStaticHandles(pDomainFile->GetAppDomain()); + AllocateRegularStaticHandles(pDomainAssembly->GetAppDomain()); } OBJECTREF Module::GetExposedObject() @@ -2089,7 +2082,7 @@ OBJECTREF Module::GetExposedObject() } CONTRACT_END; - RETURN GetDomainFile()->GetExposedModuleObject(); + RETURN GetDomainAssembly()->GetExposedModuleObject(); } // @@ -4063,7 +4056,7 @@ void Module::UpdateDynamicMetadataIfNeeded() #endif // DEBUGGING_SUPPORTED -BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainFile, int flags, BOOL attaching) +BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainAssembly, int flags, BOOL attaching) { WRAPPER_NO_CONTRACT; @@ -4074,7 +4067,7 @@ BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainFile, in // Always capture metadata, even if no debugger is attached. If a debugger later attaches, it will use // this data. { - Module * pModule = pDomainFile->GetModule(); + Module * pModule = pDomainAssembly->GetModule(); pModule->UpdateDynamicMetadataIfNeeded(); } @@ -4095,7 +4088,7 @@ BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainFile, in m_pPEAssembly->GetPath().GetCount(), GetAssembly(), pDomain, - pDomainFile, + pDomainAssembly, attaching); result = TRUE; @@ -7465,7 +7458,7 @@ VOID Module::EnsureActive() MODE_ANY; } CONTRACTL_END; - GetDomainFile()->EnsureActive(); + GetDomainAssembly()->EnsureActive(); } #endif // DACCESS_COMPILE @@ -7484,13 +7477,13 @@ VOID Module::EnsureAllocated() } CONTRACTL_END; - GetDomainFile()->EnsureAllocated(); + GetDomainAssembly()->EnsureAllocated(); } VOID Module::EnsureLibraryLoaded() { STANDARD_VM_CONTRACT; - GetDomainFile()->EnsureLibraryLoaded(); + GetDomainAssembly()->EnsureLibraryLoaded(); } #endif // !DACCESS_COMPILE @@ -7505,10 +7498,10 @@ CHECK Module::CheckActivated() CONTRACTL_END; #ifndef DACCESS_COMPILE - DomainFile *pDomainFile = GetDomainFile(); - CHECK(pDomainFile != NULL); - PREFIX_ASSUME(pDomainFile != NULL); - CHECK(pDomainFile->CheckActivated()); + DomainFile *pDomainAssembly = GetDomainAssembly(); + CHECK(pDomainAssembly != NULL); + PREFIX_ASSUME(pDomainAssembly != NULL); + CHECK(pDomainAssembly->CheckActivated()); #endif CHECK_OK; } diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index 2b9198b811732..e81797fedc8f9 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -1132,13 +1132,9 @@ class Module MethodTable *GetGlobalMethodTable(); bool NeedsGlobalMethodTable(); - // This works for manifest modules too - DomainFile *GetDomainFile(); - - // Operates on assembly of module DomainAssembly *GetDomainAssembly(); - void SetDomainFile(DomainFile *pDomainFile); + void SetDomainAssembly(DomainFile *pDomainAssembly); OBJECTREF GetExposedObject(); @@ -1719,7 +1715,7 @@ class Module public: // Debugger stuff - BOOL NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainFile, int level, BOOL attaching); + BOOL NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainAssembly, int level, BOOL attaching); void NotifyDebuggerUnload(AppDomain *pDomain); void SetDebuggerInfoBits(DebuggerAssemblyControlFlags newBits); diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp index a1bce6d07d717..c1a5ffb86ecd9 100644 --- a/src/coreclr/vm/clsload.cpp +++ b/src/coreclr/vm/clsload.cpp @@ -3243,15 +3243,6 @@ TypeHandle ClassLoader::LoadTypeHandleForTypeKey(TypeKey *pTypeKey, UINT32 typeLoad = ETW::TypeSystemLog::TypeLoadBegin(); #endif - // When using domain neutral assemblies (and not eagerly propagating dependency loads), - // it's possible to get here without having injected the module into the current app domain. - // GetDomainFile will accomplish that. - - if (!pTypeKey->IsConstructed()) - { - pTypeKey->GetModule()->GetDomainFile(); - } - ClassLoadLevel currentLevel = typeHnd.IsNull() ? CLASS_LOAD_BEGIN : typeHnd.GetLoadLevel(); ClassLoadLevel targetLevelUnderLock = targetLevel < CLASS_DEPENDENCIES_LOADED ? targetLevel : (ClassLoadLevel) (CLASS_DEPENDENCIES_LOADED-1); if (currentLevel < targetLevelUnderLock) diff --git a/src/coreclr/vm/dbginterface.h b/src/coreclr/vm/dbginterface.h index 51b2c3bf36358..befac6a5b4027 100644 --- a/src/coreclr/vm/dbginterface.h +++ b/src/coreclr/vm/dbginterface.h @@ -68,7 +68,7 @@ class DebugInterface DWORD dwModuleName, // number of characters in file name excludign null Assembly * pAssembly, // the assembly the module belongs to AppDomain * pAppDomain, // the AppDomain the module is being loaded into - DomainFile * pDomainFile, + DomainFile * pDomainAssembly, BOOL fAttaching) = 0; // true if this notification is due to a debugger // being attached to the process @@ -242,7 +242,7 @@ class DebugInterface // send a custom notification from the target to the RS. This will become an ICorDebugThread and // ICorDebugAppDomain on the RS. - virtual void SendCustomDebuggerNotification(Thread * pThread, DomainFile * pDomainFile, mdTypeDef classToken) = 0; + virtual void SendCustomDebuggerNotification(Thread * pThread, DomainFile * pDomainAssembly, mdTypeDef classToken) = 0; // Send an MDA notification. This ultimately translates to an ICorDebugMDA object on the Right-Side. virtual void SendMDANotification( diff --git a/src/coreclr/vm/debugdebugger.cpp b/src/coreclr/vm/debugdebugger.cpp index 2ade537044abb..9b0bf6cd9c9ec 100644 --- a/src/coreclr/vm/debugdebugger.cpp +++ b/src/coreclr/vm/debugdebugger.cpp @@ -827,11 +827,11 @@ FCIMPL1(void, DebugDebugger::CustomNotification, Object * dataUNSAFE) StrongHandleHolder objHandle = pAppDomain->CreateStrongHandle(pData); MethodTable * pMT = pData->GetGCSafeMethodTable(); Module * pModule = pMT->GetModule(); - DomainFile * pDomainFile = pModule->GetDomainFile(); + DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); mdTypeDef classToken = pMT->GetCl(); pThread->SetThreadCurrNotification(objHandle); - g_pDebugInterface->SendCustomDebuggerNotification(pThread, pDomainFile, classToken); + g_pDebugInterface->SendCustomDebuggerNotification(pThread, pDomainAssembly, classToken); pThread->ClearThreadCurrNotification(); if (pThread->IsAbortRequested()) diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index e5ee3373db959..f5b9ce068c0bb 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -141,6 +141,7 @@ class DomainFile } #endif + // TODO: VS remove BOOL IsAssembly() { LIMITED_METHOD_DAC_CONTRACT; diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 88fe4891f1ce1..184a9e24e2e7c 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -1529,12 +1529,12 @@ void BulkStaticsLogger::LogAllStatics() if (module == NULL) continue; - DomainFile *domainFile = module->GetDomainFile(); - if (domainFile == NULL) + DomainFile *domainAssembly = module->GetDomainAssembly(); + if (domainAssembly == NULL) continue; // Ensure the module has fully loaded. - if (!domainFile->IsActive()) + if (!domainAssembly->IsActive()) continue; DomainLocalModule *domainModule = module->GetDomainLocalModule(); diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index 109f98ceecfe1..6817ec823be5e 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -1442,7 +1442,7 @@ HCIMPL2(void*, JIT_GetSharedNonGCStaticBaseDynamicClass_Helper, DomainLocalModul HELPER_METHOD_FRAME_BEGIN_RET_0(); - MethodTable *pMT = pLocalModule->GetDomainFile()->GetModule()->GetDynamicClassMT(dwDynamicClassDomainID); + MethodTable *pMT = pLocalModule->GetDomainAssembly()->GetModule()->GetDynamicClassMT(dwDynamicClassDomainID); _ASSERTE(pMT); pMT->CheckRunClassInitThrowing(); @@ -1464,7 +1464,7 @@ HCIMPL2(void*, JIT_GetSharedNonGCStaticBaseDynamicClass, DomainLocalModule *pLoc if (pLocalInfo != NULL) { PTR_BYTE retval; - GET_DYNAMICENTRY_NONGCSTATICS_BASEPOINTER(pLocalModule->GetDomainFile()->GetModule()->GetLoaderAllocator(), + GET_DYNAMICENTRY_NONGCSTATICS_BASEPOINTER(pLocalModule->GetDomainAssembly()->GetModule()->GetLoaderAllocator(), pLocalInfo, &retval); @@ -1486,7 +1486,7 @@ HCIMPL2(void, JIT_ClassInitDynamicClass_Helper, DomainLocalModule *pLocalModule, HELPER_METHOD_FRAME_BEGIN_0(); - MethodTable *pMT = pLocalModule->GetDomainFile()->GetModule()->GetDynamicClassMT(dwDynamicClassDomainID); + MethodTable *pMT = pLocalModule->GetDomainAssembly()->GetModule()->GetDynamicClassMT(dwDynamicClassDomainID); _ASSERTE(pMT); pMT->CheckRunClassInitThrowing(); @@ -1525,7 +1525,7 @@ HCIMPL2(void*, JIT_GetSharedGCStaticBaseDynamicClass_Helper, DomainLocalModule * HELPER_METHOD_FRAME_BEGIN_RET_0(); - MethodTable *pMT = pLocalModule->GetDomainFile()->GetModule()->GetDynamicClassMT(dwDynamicClassDomainID); + MethodTable *pMT = pLocalModule->GetDomainAssembly()->GetModule()->GetDynamicClassMT(dwDynamicClassDomainID); _ASSERTE(pMT); pMT->CheckRunClassInitThrowing(); @@ -1547,7 +1547,7 @@ HCIMPL2(void*, JIT_GetSharedGCStaticBaseDynamicClass, DomainLocalModule *pLocalM if (pLocalInfo != NULL) { PTR_BYTE retval; - GET_DYNAMICENTRY_GCSTATICS_BASEPOINTER(pLocalModule->GetDomainFile()->GetModule()->GetLoaderAllocator(), + GET_DYNAMICENTRY_GCSTATICS_BASEPOINTER(pLocalModule->GetDomainAssembly()->GetModule()->GetLoaderAllocator(), pLocalInfo, &retval); @@ -1861,7 +1861,7 @@ HCIMPL2(void*, JIT_GetSharedNonGCThreadStaticBaseDynamicClass, DomainLocalModule if (pLocalInfo != NULL) { PTR_BYTE retval; - GET_DYNAMICENTRY_NONGCTHREADSTATICS_BASEPOINTER(pDomainLocalModule->GetDomainFile()->GetModule()->GetLoaderAllocator(), + GET_DYNAMICENTRY_NONGCTHREADSTATICS_BASEPOINTER(pDomainLocalModule->GetDomainAssembly()->GetModule()->GetLoaderAllocator(), pLocalInfo, &retval); return retval; @@ -1872,7 +1872,7 @@ HCIMPL2(void*, JIT_GetSharedNonGCThreadStaticBaseDynamicClass, DomainLocalModule // then we have to go through the slow path // Obtain the Module - Module * pModule = pDomainLocalModule->GetDomainFile()->GetModule(); + Module * pModule = pDomainLocalModule->GetDomainAssembly()->GetModule(); // Obtain the MethodTable MethodTable * pMT = pModule->GetDynamicClassMT(dwDynamicClassDomainID); @@ -1909,7 +1909,7 @@ HCIMPL2(void*, JIT_GetSharedGCThreadStaticBaseDynamicClass, DomainLocalModule *p if (pLocalInfo != NULL) { PTR_BYTE retval; - GET_DYNAMICENTRY_GCTHREADSTATICS_BASEPOINTER(pDomainLocalModule->GetDomainFile()->GetModule()->GetLoaderAllocator(), + GET_DYNAMICENTRY_GCTHREADSTATICS_BASEPOINTER(pDomainLocalModule->GetDomainAssembly()->GetModule()->GetLoaderAllocator(), pLocalInfo, &retval); @@ -1921,7 +1921,7 @@ HCIMPL2(void*, JIT_GetSharedGCThreadStaticBaseDynamicClass, DomainLocalModule *p // then we have to go through the slow path // Obtain the Module - Module * pModule = pDomainLocalModule->GetDomainFile()->GetModule(); + Module * pModule = pDomainLocalModule->GetDomainAssembly()->GetModule(); // Obtain the MethodTable MethodTable * pMT = pModule->GetDynamicClassMT(dwDynamicClassDomainID); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index e28434acabe56..1dfebbdcec35e 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -12736,7 +12736,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config, LARGE_INTEGER methodJitTimeStop; QueryPerformanceCounter(&methodJitTimeStop); SString codeBase; - ftn->GetModule()->GetDomainFile()->GetPEAssembly()->GetPathOrCodeBase(codeBase); + ftn->GetModule()->GetDomainAssembly()->GetPEAssembly()->GetPathOrCodeBase(codeBase); codeBase.AppendPrintf(W(",0x%x,%d,%d\n"), //(const WCHAR *)codeBase, //module name ftn->GetMemberDef(), //method token diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index 52a2e0a6c3364..d5177fb4467c5 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -234,11 +234,11 @@ FileLoadLevel MulticoreJitManager::GetModuleFileLoadLevel(Module * pModule) if (pModule != NULL) { - DomainFile * pDomainFile = pModule->GetDomainFile(); + DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); - if (pDomainFile != NULL) + if (pDomainAssembly != NULL) { - level = pDomainFile->GetLoadLevel(); + level = pDomainAssembly->GetLoadLevel(); } } diff --git a/src/coreclr/vm/profilingenumerators.cpp b/src/coreclr/vm/profilingenumerators.cpp index 86f9bcb45c92d..f6b6ee135bb68 100644 --- a/src/coreclr/vm/profilingenumerators.cpp +++ b/src/coreclr/vm/profilingenumerators.cpp @@ -450,8 +450,8 @@ HRESULT IterateAppDomainContainingModule::AddAppDomainContainingModule(AppDomain } CONTRACTL_END; - DomainFile * pDomainFile = m_pModule->GetDomainFile(); - if ((pDomainFile != NULL) && (pDomainFile->IsAvailableToProfilers())) + DomainFile * pDomainAssembly = m_pModule->GetDomainAssembly(); + if ((pDomainAssembly != NULL) && (pDomainAssembly->IsAvailableToProfilers())) { if (m_index < m_cAppDomainIds) { diff --git a/src/coreclr/vm/reflectioninvocation.cpp b/src/coreclr/vm/reflectioninvocation.cpp index 495e10e4f4a36..42cc0b51d32d4 100644 --- a/src/coreclr/vm/reflectioninvocation.cpp +++ b/src/coreclr/vm/reflectioninvocation.cpp @@ -1579,19 +1579,17 @@ extern "C" void QCALLTYPE ReflectionInvocation_RunClassConstructor(QCall::TypeHa END_QCALL; } -// This method triggers the module constructor for a give module +// This method triggers the module constructor for a given module extern "C" void QCALLTYPE ReflectionInvocation_RunModuleConstructor(QCall::ModuleHandle pModule) { QCALL_CONTRACT; - DomainFile *pDomainFile = pModule->GetDomainFile(); - if (pDomainFile != NULL && pDomainFile->IsActive()) + DomainFile *pDomainAssembly = pModule->GetDomainAssembly(); + if (pDomainAssembly != NULL && pDomainAssembly->IsActive()) return; BEGIN_QCALL; - if(pDomainFile == NULL) - pDomainFile = pModule->GetDomainFile(); - pDomainFile->EnsureActive(); + pDomainAssembly->EnsureActive(); END_QCALL; } diff --git a/src/coreclr/vm/runtimehandles.cpp b/src/coreclr/vm/runtimehandles.cpp index 94d2bdf6a6641..c6d53b4c24d8f 100644 --- a/src/coreclr/vm/runtimehandles.cpp +++ b/src/coreclr/vm/runtimehandles.cpp @@ -186,9 +186,9 @@ NOINLINE ReflectModuleBaseObject* GetRuntimeModuleHelper(LPVOID __me, Module *pM if (pModule == NULL) return NULL; - DomainFile * pDomainFile = pModule->GetDomainFile(); + DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); - OBJECTREF refModule = (pDomainFile != NULL) ? pDomainFile->GetExposedModuleObjectIfExists() : NULL; + OBJECTREF refModule = (pDomainAssembly != NULL) ? pDomainAssembly->GetExposedModuleObjectIfExists() : NULL; if(refModule != NULL) return (ReflectModuleBaseObject*)OBJECTREFToObject(refModule); @@ -2670,17 +2670,17 @@ FCIMPL1(ReflectModuleBaseObject*, AssemblyHandle::GetManifestModule, AssemblyBas Assembly* currentAssembly = pAssembly->GetAssembly(); Module *pModule = currentAssembly->GetModule(); - DomainFile * pDomainFile = pModule->GetDomainFile(); + DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); #ifdef _DEBUG OBJECTREF orModule; HELPER_METHOD_FRAME_BEGIN_RET_1(refAssembly); - orModule = (pDomainFile != NULL) ? pDomainFile->GetExposedModuleObjectIfExists() : NULL; + orModule = (pDomainAssembly != NULL) ? pDomainAssembly->GetExposedModuleObjectIfExists() : NULL; if (orModule == NULL) orModule = pModule->GetExposedObject(); #else - OBJECTREF orModule = (pDomainFile != NULL) ? pDomainFile->GetExposedModuleObjectIfExists() : NULL; + OBJECTREF orModule = (pDomainAssembly != NULL) ? pDomainAssembly->GetExposedModuleObjectIfExists() : NULL; if (orModule != NULL) return (ReflectModuleBaseObject*)OBJECTREFToObject(orModule); @@ -2905,7 +2905,7 @@ FCIMPL5(ReflectMethodObject*, ModuleHandle::GetDynamicMethod, ReflectMethodObjec HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - DomainFile *pDomainModule = pModule->GetDomainFile(); + DomainFile *pDomainModule = pModule->GetDomainAssembly(); U1ARRAYREF dataArray = (U1ARRAYREF)sig; DWORD sigSize = dataArray->GetNumComponents(); From c5df253752657a1b31de7e3c901360f2ce0d3aef Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:36:33 -0800 Subject: [PATCH 12/25] deleted DomainFile class --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 29 ++- src/coreclr/debug/daccess/dacdbiimpl.h | 2 +- .../debug/daccess/dacdbiimplstackwalk.cpp | 4 +- src/coreclr/debug/ee/debugger.cpp | 20 +-- src/coreclr/debug/ee/debugger.h | 18 +- src/coreclr/debug/ee/debugger.inl | 2 +- src/coreclr/debug/inc/dacdbiinterface.h | 8 +- src/coreclr/debug/inc/dacdbistructures.h | 6 +- src/coreclr/debug/inc/dbgipcevents.h | 8 +- src/coreclr/vm/appdomain.cpp | 38 ++-- src/coreclr/vm/appdomain.hpp | 32 ++-- src/coreclr/vm/assembly.cpp | 4 +- src/coreclr/vm/assemblynative.cpp | 12 +- src/coreclr/vm/ceeload.cpp | 12 +- src/coreclr/vm/ceeload.h | 6 +- src/coreclr/vm/common.h | 2 - src/coreclr/vm/dbginterface.h | 4 +- src/coreclr/vm/debugdebugger.cpp | 2 +- src/coreclr/vm/domainfile.cpp | 167 ++++++------------ src/coreclr/vm/domainfile.h | 52 +----- src/coreclr/vm/domainfile.inl | 8 +- src/coreclr/vm/dynamicmethod.cpp | 2 +- src/coreclr/vm/eventtrace.cpp | 2 +- src/coreclr/vm/jitinterface.cpp | 2 +- src/coreclr/vm/memberload.cpp | 2 +- src/coreclr/vm/multicorejit.cpp | 2 +- src/coreclr/vm/profilingenumerators.cpp | 8 +- src/coreclr/vm/reflectioninvocation.cpp | 2 +- src/coreclr/vm/runtimehandles.cpp | 6 +- src/coreclr/vm/threads.h | 2 +- 30 files changed, 182 insertions(+), 282 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index c6989440a71d6..f12f4d72ea7da 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -663,7 +663,7 @@ void DacDbiInterfaceImpl::GetCompilerFlags ( { DD_ENTER_MAY_THROW; - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); if (pDomainAssembly == NULL) { @@ -719,7 +719,7 @@ HRESULT DacDbiInterfaceImpl::SetCompilerFlags(VMPTR_DomainFile vmDomainFile, DD_ENTER_MAY_THROW; DWORD dwBits = 0; - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); HRESULT hr = S_OK; @@ -1089,7 +1089,7 @@ void DacDbiInterfaceImpl::GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, { DD_ENTER_MAY_THROW; - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); RVA methodRVA = 0; DWORD implFlags; @@ -1334,7 +1334,7 @@ void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainFile vmDomainFil // pre-initialize: pCodeInfo->Clear(); - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); MethodDesc* pMethodDesc = FindLoadedMethodRefOrDef(pModule, functionToken); @@ -1768,7 +1768,7 @@ void DacDbiInterfaceImpl::GetInstantiationFieldInfo (VMPTR_DomainFile { DD_ENTER_MAY_THROW; - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); _ASSERTE(pDomainAssembly != NULL); AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); TypeHandle thExact; @@ -2889,7 +2889,7 @@ TypeHandle DacDbiInterfaceImpl::GetClassOrValueTypeHandle(DebuggerIPCE_BasicType // otherwise, have the loader look it up using the metadata token and domain file else { - DomainFile * pDomainAssembly = pData->vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pData->vmDomainFile.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); typeHandle = ClassLoader::LookupTypeDefOrRefInModule(pModule, pData->metadataToken); @@ -3725,7 +3725,7 @@ void DacDbiInterfaceImpl::GetStackFramesFromException(VMPTR_Object vmObject, Dac BaseDomain* pBaseDomain = currentElement.pFunc->GetAssembly()->GetDomain(); AppDomain* pDomain = NULL; - DomainFile* pDomainAssembly = NULL; + DomainAssembly* pDomainAssembly = NULL; pDomain = pBaseDomain->AsAppDomain(); @@ -3879,7 +3879,7 @@ FieldDesc * DacDbiInterfaceImpl::GetEnCFieldDesc(const EnCHangingFieldInfo * pEn { FieldDesc * pFD = NULL; - DomainFile * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); // get the type handle for the object @@ -3918,7 +3918,7 @@ PTR_CBYTE DacDbiInterfaceImpl::GetPtrToEnCField(FieldDesc * pFD, const EnCHangin #else PTR_EditAndContinueModule pEnCModule; - DomainFile * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); // make sure we actually have an EditAndContinueModule @@ -4090,7 +4090,7 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) { DD_ENTER_MAY_THROW; - DomainFile * pDomainAssembly = pTypeRefInfo->vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pTypeRefInfo->vmDomainFile.GetDacPtr(); Module * pReferencingModule = pDomainAssembly->GetModule(); BOOL fSuccess = FALSE; @@ -4353,7 +4353,7 @@ void DacDbiInterfaceImpl::GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, _ASSERTE(pModule != NULL); - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); pModule->SetHostPtr(pDomainAssembly->GetModule()); } @@ -4367,12 +4367,11 @@ void DacDbiInterfaceImpl::GetDomainFileData(VMPTR_DomainFile vmDomainFile, Domai ZeroMemory(pData, sizeof(*pData)); - DomainFile * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); // @dbgtodo - is this efficient DAC usage (perhaps a dac-cop rule)? Are we round-tripping the pointer? - // Should we have a GetDomainAssembly() that returns a PTR_DomainAssembly? - pData->vmDomainAssembly.SetHostPtr(pDomainAssembly->GetDomainAssembly()); + pData->vmDomainAssembly.SetHostPtr(pDomainAssembly); pData->vmAppDomain.SetHostPtr(pAppDomain); } @@ -4515,7 +4514,7 @@ VMPTR_DomainAssembly DacDbiInterfaceImpl::ResolveAssembly( DD_ENTER_MAY_THROW; - DomainFile * pDomainAssembly = vmScope.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmScope.GetDacPtr(); AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); Module * pModule = pDomainAssembly->GetModule(); diff --git a/src/coreclr/debug/daccess/dacdbiimpl.h b/src/coreclr/debug/daccess/dacdbiimpl.h index e484a28008b0c..cf3356aac5d65 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.h +++ b/src/coreclr/debug/daccess/dacdbiimpl.h @@ -829,7 +829,7 @@ class DacDbiInterfaceImpl : // Return the current appdomain the specified thread is in. VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread); - // Given an assembly ref token and metadata scope (via the DomainFile), resolve the assembly. + // Given an assembly ref token and metadata scope (via the DomainAssembly), resolve the assembly. VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef); diff --git a/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp b/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp index 2ee0163977a46..af8034c490361 100644 --- a/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp +++ b/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp @@ -514,7 +514,7 @@ void DacDbiInterfaceImpl::EnumerateInternalFrames(VMPTR_Thread #endif // FEATURE_COMINTEROP Module * pModule = (pMD ? pMD->GetModule() : NULL); - DomainFile * pDomainAssembly = (pModule ? pModule->GetDomainAssembly() : NULL); + DomainAssembly * pDomainAssembly = (pModule ? pModule->GetDomainAssembly() : NULL); if (frameData.stubFrame.frameType == STUBFRAME_FUNC_EVAL) { @@ -702,7 +702,7 @@ void DacDbiInterfaceImpl::InitFrameData(StackFrameIterator * pIter, // Although MiniDumpNormal tries to dump all AppDomains, it's possible // target corruption will keep one from being present. This should mean // we'll just fail later, but struggle on for now. - DomainFile *pDomainAssembly = NULL; + DomainAssembly *pDomainAssembly = NULL; EX_TRY_ALLOW_DATATARGET_MISSING_MEMORY { pDomainAssembly = (pModule ? pModule->GetDomainAssembly() : NULL); diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index e64f4778f72c0..532753f31b12e 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -5199,7 +5199,7 @@ void Debugger::SendSyncCompleteIPCEvent(bool isEESuspendedForGC) // @dbgtodo JMC - this should go away when we get rid of DebuggerModule. // -DebuggerModule * Debugger::LookupOrCreateModule(DomainFile * pDomainAssembly) +DebuggerModule * Debugger::LookupOrCreateModule(DomainAssembly * pDomainAssembly) { _ASSERTE(pDomainAssembly != NULL); LOG((LF_CORDB, LL_INFO1000, "D::LOCM df=0x%x\n", pDomainAssembly)); @@ -5211,7 +5211,7 @@ DebuggerModule * Debugger::LookupOrCreateModule(DomainFile * pDomainAssembly) return pDModule; } -// Overloaded Wrapper around for VMPTR_DomainFile-->DomainFile* +// Overloaded Wrapper around for VMPTR_DomainFile-->DomainAssembly* // // Arguments: // vmDomainFile - VMPTR cookie for a domain file. This can be NullPtr(). @@ -5223,7 +5223,7 @@ DebuggerModule * Debugger::LookupOrCreateModule(DomainFile * pDomainAssembly) // VMPTR comes from IPC events DebuggerModule * Debugger::LookupOrCreateModule(VMPTR_DomainFile vmDomainFile) { - DomainFile * pDomainAssembly = vmDomainFile.GetRawPtr(); + DomainAssembly * pDomainAssembly = vmDomainFile.GetRawPtr(); if (pDomainAssembly == NULL) { return NULL; @@ -5281,7 +5281,7 @@ DebuggerModule* Debugger::LookupOrCreateModule(Module* pModule, AppDomain *pAppD HRESULT hr = S_OK; EX_TRY { - DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); + DomainAssembly * pDomainAssembly = pModule->GetDomainAssembly(); SIMPLIFYING_ASSUMPTION(pDomainAssembly != NULL); dmod = AddDebuggerModule(pDomainAssembly); // throws } @@ -5305,7 +5305,7 @@ DebuggerModule* Debugger::LookupOrCreateModule(Module* pModule, AppDomain *pAppD // Returns: // New instnace of a DebuggerModule. Throws on failure. // -DebuggerModule* Debugger::AddDebuggerModule(DomainFile * pDomainAssembly) +DebuggerModule* Debugger::AddDebuggerModule(DomainAssembly * pDomainAssembly) { CONTRACTL { @@ -9426,7 +9426,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, DWORD dwModuleName, // length of pszModuleName in chars, not including null. Assembly *pAssembly, AppDomain *pAppDomain, - DomainFile * pDomainAssembly, + DomainAssembly * pDomainAssembly, BOOL fAttaching) { @@ -9467,7 +9467,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, _ASSERTE(pManifestModule->IsManifest()); _ASSERTE(pManifestModule->GetAssembly() == pRuntimeModule->GetAssembly()); - DomainFile * pManifestDomainFile = pManifestModule->GetDomainAssembly(); + DomainAssembly * pManifestDomainFile = pManifestModule->GetDomainAssembly(); DebuggerLockHolder dbgLockHolder(this); @@ -9509,9 +9509,9 @@ void Debugger::LoadModule(Module* pRuntimeModule, module->SetCanChangeJitFlags(true); - // @dbgtodo inspection - Check whether the DomainFile we get is consistent with the Module and AppDomain we get. + // @dbgtodo inspection - Check whether the DomainAssembly we get is consistent with the Module and AppDomain we get. // We should simply things when we actually get rid of DebuggerModule, possibly by just passing the - // DomainFile around. + // DomainAssembly around. _ASSERTE(module->GetDomainAssembly() == pDomainAssembly); _ASSERTE(module->GetAppDomain() == pDomainAssembly->GetAppDomain()); _ASSERTE(module->GetRuntimeModule() == pDomainAssembly->GetModule()); @@ -14403,7 +14403,7 @@ void Debugger::SendLogSwitchSetting(int iLevel, // pDomain - domain file for the domain in which the notification occurred // classToken - metadata token for the type of the notification object void Debugger::SendCustomDebuggerNotification(Thread * pThread, - DomainFile * pDomain, + DomainAssembly * pDomain, mdTypeDef classToken) { CONTRACTL diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h index 57621605cb556..62e41b9bab4cc 100644 --- a/src/coreclr/debug/ee/debugger.h +++ b/src/coreclr/debug/ee/debugger.h @@ -472,7 +472,7 @@ typedef DPTR(class DebuggerModule) PTR_DebuggerModule; class DebuggerModule { public: - DebuggerModule(Module * pRuntimeModule, DomainFile * pDomainAssembly, AppDomain * pAppDomain); + DebuggerModule(Module * pRuntimeModule, DomainAssembly * pDomainAssembly, AppDomain * pAppDomain); // Do we have any optimized code in the module? // JMC-probes aren't emitted in optimized code, @@ -504,13 +504,13 @@ class DebuggerModule // If the Runtime module is shared, then this gives a common DM. // If the runtime module is not shared, then this is an identity function. // - // The runtime has the notion of "DomainFile", which is 1:1 with DebuggerModule + // The runtime has the notion of "DomainAssembly", which is 1:1 with DebuggerModule // and thus 1:1 with CordbModule. The CordbModule hash table on the RS now uses - // the DomainFile as the key instead of DebuggerModule. This is a temporary + // the DomainAssembly as the key instead of DebuggerModule. This is a temporary // workaround to facilitate the removal of DebuggerModule. // DebuggerModule * GetPrimaryModule(); - DomainFile * GetDomainAssembly() + DomainAssembly * GetDomainAssembly() { LIMITED_METHOD_DAC_CONTRACT; return m_pRuntimeDomainFile; @@ -528,7 +528,7 @@ class DebuggerModule DebuggerModule* m_pPrimaryModule; PTR_Module m_pRuntimeModule; - PTR_DomainFile m_pRuntimeDomainFile; + PTR_DomainAssembly m_pRuntimeDomainFile; AppDomain* m_pAppDomain; @@ -1893,9 +1893,9 @@ class Debugger : public DebugInterface DWORD dwModuleName, Assembly *pAssembly, AppDomain *pAppDomain, - DomainFile * pDomainAssembly, + DomainAssembly * pDomainAssembly, BOOL fAttaching); - DebuggerModule * AddDebuggerModule(DomainFile * pDomainAssembly); + DebuggerModule * AddDebuggerModule(DomainAssembly * pDomainAssembly); void UnloadModule(Module* pRuntimeModule, @@ -2069,7 +2069,7 @@ class Debugger : public DebugInterface bool HandleIPCEvent(DebuggerIPCEvent* event); DebuggerModule * LookupOrCreateModule(VMPTR_DomainFile vmDomainFile); - DebuggerModule * LookupOrCreateModule(DomainFile * pDomainAssembly); + DebuggerModule * LookupOrCreateModule(DomainAssembly * pDomainAssembly); DebuggerModule * LookupOrCreateModule(Module * pModule, AppDomain * pAppDomain); HRESULT GetAndSendInterceptCommand(DebuggerIPCEvent *event); @@ -2437,7 +2437,7 @@ class Debugger : public DebugInterface } // send a custom debugger notification to the RS - void SendCustomDebuggerNotification(Thread * pThread, DomainFile * pDomain, mdTypeDef classToken); + void SendCustomDebuggerNotification(Thread * pThread, DomainAssembly * pDomain, mdTypeDef classToken); // Send an MDA notification. This ultimately translates to an ICorDebugMDA object on the Right-Side. void SendMDANotification( diff --git a/src/coreclr/debug/ee/debugger.inl b/src/coreclr/debug/ee/debugger.inl index 2f76e5ee26138..2c5be6d9d854b 100644 --- a/src/coreclr/debug/ee/debugger.inl +++ b/src/coreclr/debug/ee/debugger.inl @@ -52,7 +52,7 @@ inline DebuggerModuleTable * Debugger::GetModuleTable() // @dbgtodo inspection - get rid of this entire class as we move things out-of-proc. //----------------------------------------------------------------------------- inline DebuggerModule::DebuggerModule(Module * pRuntimeModule, - DomainFile * pDomainAssembly, + DomainAssembly * pDomainAssembly, AppDomain * pAppDomain) : m_enableClassLoadCallbacks(FALSE), m_pPrimaryModule(NULL), diff --git a/src/coreclr/debug/inc/dacdbiinterface.h b/src/coreclr/debug/inc/dacdbiinterface.h index 85eab88e3f5ed..13ec64c4be3a5 100644 --- a/src/coreclr/debug/inc/dacdbiinterface.h +++ b/src/coreclr/debug/inc/dacdbiinterface.h @@ -595,10 +595,10 @@ class IDacDbiInterface // - // Get properties for a DomainFile + // Get properties for a DomainAssembly // // Arguments: - // vmDomainFile - vm handle to a DomainFile + // vmDomainFile - vm handle to a DomainAssembly // pData - required out parameter which will be filled out with module properties // // Notes: @@ -672,7 +672,7 @@ class IDacDbiInterface // Get the values of the JIT Optimization and EnC flags. // // Arguments: - // vmDomainFile - (input) VM DomainFile (module) for which we are retrieving flags + // vmDomainFile - (input) VM DomainAssembly (module) for which we are retrieving flags // pfAllowJITOpts - (mandatory output) true iff this is not compiled for debug, // i.e., without optimization // pfEnableEnc - (mandatory output) true iff this module has EnC enabled @@ -695,7 +695,7 @@ class IDacDbiInterface // Set the values of the JIT optimization and EnC flags. // // Arguments: - // vmDomainFile - (input) VM DomainFile (module) for which we are retrieving flags + // vmDomainFile - (input) VM DomainAssembly (module) for which we are retrieving flags // pfAllowJITOpts - (input) true iff this should not be compiled for debug, // i.e., without optimization // pfEnableEnc - (input) true iff this module should have EnC enabled. If this is diff --git a/src/coreclr/debug/inc/dacdbistructures.h b/src/coreclr/debug/inc/dacdbistructures.h index 5e02a68a792c9..0b3449333b87b 100644 --- a/src/coreclr/debug/inc/dacdbistructures.h +++ b/src/coreclr/debug/inc/dacdbistructures.h @@ -164,13 +164,13 @@ struct MSLAYOUT TargetBuffer // Module properties, retrieved by DAC. // Describes a VMPTR_DomainFile representing a module. // In the VM, a raw Module may be domain neutral and shared by many appdomains. -// Whereas a DomainFile is like a { AppDomain, Module} pair. DomainFile corresponds +// Whereas a DomainAssembly is like a { AppDomain, Module} pair. DomainAssembly corresponds // much more to ICorDebugModule (which also has appdomain affinity). //=================================================================================== struct MSLAYOUT DomainFileInfo { - // The appdomain that the DomainFile is associated with. - // Although VMPTR_Module may be shared across multiple domains, a DomainFile has appdomain affinity. + // The appdomain that the DomainAssembly is associated with. + // Although VMPTR_Module may be shared across multiple domains, a DomainAssembly has appdomain affinity. VMPTR_AppDomain vmAppDomain; // The assembly this module belongs to. All modules live in an assembly. diff --git a/src/coreclr/debug/inc/dbgipcevents.h b/src/coreclr/debug/inc/dbgipcevents.h index ddef09554cf80..9a3ee4ad5349a 100644 --- a/src/coreclr/debug/inc/dbgipcevents.h +++ b/src/coreclr/debug/inc/dbgipcevents.h @@ -847,14 +847,14 @@ typedef VMPTR_Base VMPTR_CONTEXT; typedef VMPTR_Base VMPTR_CONTEXT; #endif -// DomainFile is a base-class for a CLR module, with app-domain affinity. -// For domain-neutral modules (like CoreLib), there is a DomainFile instance +// DomainAssembly is a base-class for a CLR module, with app-domain affinity. +// For domain-neutral modules (like CoreLib), there is a DomainAssembly instance // for each appdomain the module lives in. // This is the canonical handle ICorDebug uses to a CLR module. -DEFINE_VMPTR(class DomainFile, PTR_DomainFile, VMPTR_DomainFile); +DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainFile); DEFINE_VMPTR(class Module, PTR_Module, VMPTR_Module); -// DomainAssembly derives from DomainFile and represents a manifest module. +// DomainAssembly derives from DomainAssembly and represents a manifest module. DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainAssembly); DEFINE_VMPTR(class Assembly, PTR_Assembly, VMPTR_Assembly); diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 39e47d0a7d86d..09acbaf7e1151 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2239,7 +2239,7 @@ DispIDCache* AppDomain::SetupRefDispIDCache() #endif // FEATURE_COMINTEROP -FileLoadLock *FileLoadLock::Create(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainFile *pDomainAssembly) +FileLoadLock *FileLoadLock::Create(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainAssembly *pDomainAssembly) { CONTRACTL { @@ -2272,7 +2272,7 @@ FileLoadLock::~FileLoadLock() ((PEAssembly *) m_data)->Release(); } -DomainFile *FileLoadLock::GetDomainAssembly() +DomainAssembly *FileLoadLock::GetDomainAssembly() { LIMITED_METHOD_CONTRACT; return m_pDomainAssembly; @@ -2379,7 +2379,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) // Dev11 bug 236344 // In AppDomain::IsLoading, if the lock is taken on m_pList and then FindFileLock returns NULL, - // we depend on the DomainFile's load level being up to date. Hence we must update the load + // we depend on the DomainAssembly's load level being up to date. Hence we must update the load // level while the m_pList lock is held. if (success) m_pDomainAssembly->SetLoadLevel(level); @@ -2405,7 +2405,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) case FILE_LOAD_DELIVER_EVENTS: case FILE_LOADED: case FILE_ACTIVE: // The timing of stress logs is not critical, so even for the FILE_ACTIVE stage we need not do it while the m_pList lock is held. - STRESS_LOG3(LF_CLASSLOADER, LL_INFO100, "Completed Load Level %s for DomainFile %p - success = %i\n", fileLoadLevelName[level], m_pDomainAssembly, success); + STRESS_LOG3(LF_CLASSLOADER, LL_INFO100, "Completed Load Level %s for DomainAssembly %p - success = %i\n", fileLoadLevelName[level], m_pDomainAssembly, success); break; default: break; @@ -2464,7 +2464,7 @@ UINT32 FileLoadLock::Release() return count; } -FileLoadLock::FileLoadLock(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainFile *pDomainAssembly) +FileLoadLock::FileLoadLock(PEFileListLock *pLock, PEAssembly * pPEAssembly, DomainAssembly *pDomainAssembly) : ListLockEntry(pLock, pPEAssembly, "File load lock"), m_level((FileLoadLevel) (FILE_LOAD_CREATE)), m_pDomainAssembly(pDomainAssembly), @@ -2522,7 +2522,7 @@ void AppDomain::LoadSystemAssemblies() LoadAssembly(NULL, SystemDomain::System()->SystemPEAssembly(), FILE_ACTIVE); } -FileLoadLevel AppDomain::GetDomainFileLoadLevel(DomainFile *pFile) +FileLoadLevel AppDomain::GetDomainFileLoadLevel(DomainAssembly *pFile) { CONTRACTL { @@ -2555,7 +2555,7 @@ FileLoadLevel AppDomain::GetDomainFileLoadLevel(DomainFile *pFile) // thread has completed the load step. // -BOOL AppDomain::IsLoading(DomainFile *pFile, FileLoadLevel level) +BOOL AppDomain::IsLoading(DomainAssembly *pFile, FileLoadLevel level) { // Cheap out if (pFile->GetLoadLevel() < level) @@ -2592,7 +2592,7 @@ BOOL AppDomain::IsLoading(DomainFile *pFile, FileLoadLevel level) // CheckLoading is a weaker form of IsLoading, which will not block on // other threads waiting for their status. This is appropriate for asserts. -CHECK AppDomain::CheckLoading(DomainFile *pFile, FileLoadLevel level) +CHECK AppDomain::CheckLoading(DomainAssembly *pFile, FileLoadLevel level) { // Cheap out if (pFile->GetLoadLevel() < level) @@ -2658,7 +2658,7 @@ CHECK AppDomain::CheckCanExecuteManagedCode(MethodDesc* pMD) #endif // !DACCESS_COMPILE -void AppDomain::LoadDomainFile(DomainFile *pFile, +void AppDomain::LoadDomainFile(DomainAssembly *pFile, FileLoadLevel targetLevel) { CONTRACTL @@ -2895,14 +2895,6 @@ DomainAssembly *AppDomain::LoadDomainAssemblyInternal(AssemblySpec* pIdentity, else result->EnsureLoadLevel(targetLevel); - // Malformed metadata may contain a Module reference to what is actually - // an Assembly. In this case we need to throw an exception, since returning - // a DomainModule as a DomainAssembly is a type safety violation. - if (!result->IsAssembly()) - { - ThrowHR(COR_E_ASSEMBLYEXPECTED); - } - // Cache result in all cases, since found pPEAssembly could be from a different AssemblyRef than pIdentity if (pIdentity == NULL) { @@ -2923,12 +2915,12 @@ struct LoadFileArgs { FileLoadLock *pLock; FileLoadLevel targetLevel; - DomainFile *result; + DomainAssembly *result; }; -DomainFile *AppDomain::LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetLevel) +DomainAssembly *AppDomain::LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetLevel) { - CONTRACT(DomainFile *) + CONTRACT(DomainAssembly *) { STANDARD_VM_CHECK; PRECONDITION(CheckPointer(pLock)); @@ -2939,7 +2931,7 @@ DomainFile *AppDomain::LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetL } CONTRACT_END; - DomainFile *pFile = pLock->GetDomainAssembly(); + DomainAssembly *pFile = pLock->GetDomainAssembly(); // Make sure we release the lock on exit FileLoadLockRefHolder lockRef(pLock); @@ -3042,7 +3034,7 @@ DomainFile *AppDomain::LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetL RETURN pFile; } -void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, FileLoadLockHolder &lockHolder) +void AppDomain::TryIncrementalLoad(DomainAssembly *pFile, FileLoadLevel workLevel, FileLoadLockHolder &lockHolder) { STANDARD_VM_CONTRACT; @@ -3056,7 +3048,7 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F // Special case: for LoadLibrary, we cannot hold the lock during the // actual LoadLibrary call, because we might get a callback from _CorDllMain on any - // other thread. (Note that this requires DomainFile's LoadLibrary to be independently threadsafe.) + // other thread. (Note that this requires DomainAssembly's LoadLibrary to be independently threadsafe.) if (workLevel == FILE_LOAD_LOADLIBRARY) { diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index c6e0aeefa74c7..89a1fce3e45b0 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -201,7 +201,7 @@ struct DomainLocalModule static SIZE_T GetOffsetOfDataBlob() { return offsetof(DomainLocalModule, m_pDataBlob); } static SIZE_T GetOffsetOfGCStaticPointer() { return offsetof(DomainLocalModule, m_pGCStatics); } - inline DomainFile* GetDomainAssembly() + inline DomainAssembly* GetDomainAssembly() { LIMITED_METHOD_CONTRACT SUPPORTS_DAC; @@ -209,7 +209,7 @@ struct DomainLocalModule } #ifndef DACCESS_COMPILE - inline void SetDomainAssembly(DomainFile* pDomainAssembly) + inline void SetDomainAssembly(DomainAssembly* pDomainAssembly) { LIMITED_METHOD_CONTRACT m_pDomainAssembly = pDomainAssembly; @@ -416,7 +416,7 @@ struct DomainLocalModule void SetClassFlags(MethodTable* pMT, DWORD dwFlags); DWORD GetClassFlags(MethodTable* pMT, DWORD iClassIndex); - PTR_DomainFile m_pDomainAssembly; + PTR_DomainAssembly m_pDomainAssembly; VolatilePtr m_pDynamicClassTable; // used for generics and reflection.emit in memory Volatile m_aDynamicEntries; // number of entries in dynamic table VolatilePtr m_pADThunkTable; @@ -747,7 +747,7 @@ typedef PEFileListLock::Holder PEFileListLockHolder; // Loading infrastructure: // -// a DomainFile is a file being loaded. Files are loaded in layers to enable loading in the +// a DomainAssembly is a file being loaded. Files are loaded in layers to enable loading in the // presence of dependency loops. // // FileLoadLevel describes the various levels available. These are implemented slightly @@ -773,14 +773,14 @@ class FileLoadLock : public ListLockEntry { private: FileLoadLevel m_level; - DomainFile *m_pDomainAssembly; + DomainAssembly *m_pDomainAssembly; HRESULT m_cachedHR; public: - static FileLoadLock *Create(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainFile *pDomainAssembly); + static FileLoadLock *Create(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainAssembly *pDomainAssembly); ~FileLoadLock(); - DomainFile *GetDomainAssembly(); + DomainAssembly *GetDomainAssembly(); FileLoadLevel GetLoadLevel(); // CanAcquire will return FALSE if Acquire will definitely not take the lock due @@ -807,7 +807,7 @@ class FileLoadLock : public ListLockEntry private: - FileLoadLock(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainFile *pDomainAssembly); + FileLoadLock(PEFileListLock *pLock, PEAssembly *pPEAssembly, DomainAssembly *pDomainAssembly); static void HolderLeave(FileLoadLock *pThis); @@ -1307,7 +1307,7 @@ enum AssemblyIterationFlags // (all m_level values) kIncludeAvailableToProfilers = 0x00000020, // include assemblies available to profilers - // See comment at code:DomainFile::IsAvailableToProfilers + // See comment at code:DomainAssembly::IsAvailableToProfilers // Execution / introspection flags kIncludeExecution = 0x00000004, // include assemblies that are loaded for execution only @@ -1797,13 +1797,13 @@ class AppDomain : public BaseDomain CHECK CheckCanLoadTypes(Assembly *pAssembly); CHECK CheckCanExecuteManagedCode(MethodDesc* pMD); - CHECK CheckLoading(DomainFile *pFile, FileLoadLevel level); + CHECK CheckLoading(DomainAssembly *pFile, FileLoadLevel level); - FileLoadLevel GetDomainFileLoadLevel(DomainFile *pFile); - BOOL IsLoading(DomainFile *pFile, FileLoadLevel level); + FileLoadLevel GetDomainFileLoadLevel(DomainAssembly *pFile); + BOOL IsLoading(DomainAssembly *pFile, FileLoadLevel level); static FileLoadLevel GetThreadFileLoadLevel(); - void LoadDomainFile(DomainFile *pFile, + void LoadDomainFile(DomainAssembly *pFile, FileLoadLevel targetLevel); enum FindAssemblyOptions @@ -1839,10 +1839,10 @@ class AppDomain : public BaseDomain // private: void LoadSystemAssemblies(); - DomainFile *LoadDomainFile(FileLoadLock *pLock, + DomainAssembly *LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetLevel); - void TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, FileLoadLockHolder &lockHolder); + void TryIncrementalLoad(DomainAssembly *pFile, FileLoadLevel workLevel, FileLoadLockHolder &lockHolder); #ifndef DACCESS_COMPILE // needs AssemblySpec @@ -2119,7 +2119,7 @@ class AppDomain : public BaseDomain private: void RaiseLoadingAssemblyEvent(DomainAssembly* pAssembly); - friend class DomainFile; + friend class DomainAssembly; private: BOOL RaiseUnhandledExceptionEvent(OBJECTREF *pThrowable, BOOL isTerminating); diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 1cc5fda8b3e7a..850625f838548 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -882,7 +882,7 @@ Module *Assembly::FindModuleByExportedType(mdExportedType mdType, // We should never get here in the GC case - the above should have succeeded. CONSISTENCY_CHECK(!FORBIDGC_LOADER_USE_ENABLED()); - DomainFile* pDomainModule = NULL; + DomainAssembly* pDomainModule = NULL; if (loadFlag == Loader::Load) { pDomainModule = GetModule()->LoadModule(::GetAppDomain(), mdLinkRef); @@ -1015,7 +1015,7 @@ Module * Assembly::FindModuleByTypeRef( #ifndef DACCESS_COMPILE if (loadFlag == Loader::Load) { - DomainFile* pActualDomainFile = pModule->LoadModule(::GetAppDomain(), tkType); + DomainAssembly* pActualDomainFile = pModule->LoadModule(::GetAppDomain(), tkType); RETURN(pActualDomainFile->GetModule()); } else diff --git a/src/coreclr/vm/assemblynative.cpp b/src/coreclr/vm/assemblynative.cpp index cb7776ad34040..659fe3b372fb5 100644 --- a/src/coreclr/vm/assemblynative.cpp +++ b/src/coreclr/vm/assemblynative.cpp @@ -614,7 +614,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetModules(QCall::AssemblyHandle pAssem HENUMInternalHolder phEnum(pAssembly->GetMDImport()); phEnum.EnumInit(mdtFile, mdTokenNil); - InlineSArray modules; + InlineSArray modules; modules.Append(pAssembly); @@ -623,7 +623,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetModules(QCall::AssemblyHandle pAssem { if (fLoadIfNotFound) { - DomainFile* pModule = pAssembly->GetModule()->LoadModule(GetAppDomain(), mdFile); + DomainAssembly* pModule = pAssembly->GetModule()->LoadModule(GetAppDomain(), mdFile); modules.Append(pModule); } } @@ -640,7 +640,7 @@ extern "C" void QCALLTYPE AssemblyNative_GetModules(QCall::AssemblyHandle pAssem for(COUNT_T i = 0; i < modules.GetCount(); i++) { - DomainFile * pModule = modules[i]; + DomainAssembly * pModule = modules[i]; OBJECTREF o = pModule->GetExposedModuleObject(); orModules->SetAt(i, o); @@ -699,10 +699,10 @@ extern "C" void QCALLTYPE AssemblyNative_GetModule(QCall::AssemblyHandle pAssemb LPCUTF8 pModuleName = NULL; - if SUCCEEDED(pAssembly->GetDomainAssembly()->GetModule()->GetScopeName(&pModuleName)) + if SUCCEEDED(pAssembly->GetModule()->GetScopeName(&pModuleName)) { if (::SString::_stricmp(pModuleName, szModuleName) == 0) - pModule = pAssembly->GetDomainAssembly()->GetModule(); + pModule = pAssembly->GetModule(); } @@ -1358,7 +1358,7 @@ extern "C" void QCALLTYPE AssemblyNative_ApplyUpdate( { COMPlusThrow(kNotSupportedException, W("NotSupported_DebuggerAttached")); } - Module* pModule = assembly->GetDomainAssembly()->GetModule(); + Module* pModule = assembly->GetModule(); if (!pModule->IsEditAndContinueEnabled()) { COMPlusThrow(kInvalidOperationException, W("InvalidOperation_AssemblyNotEditable")); diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index b9256e691c015..a2e88f0329e03 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1993,13 +1993,13 @@ void Module::AllocateStatics(AllocMemTracker *pamTracker) BuildStaticsOffsets(pamTracker); } -void Module::SetDomainAssembly(DomainFile *pDomainAssembly) +void Module::SetDomainAssembly(DomainAssembly *pDomainAssembly) { CONTRACTL { INSTANCE_CHECK; PRECONDITION(CheckPointer(pDomainAssembly)); - PRECONDITION(IsManifest() == pDomainAssembly->IsAssembly()); + PRECONDITION(IsManifest()); THROWS; GC_TRIGGERS; MODE_ANY; @@ -3510,9 +3510,9 @@ Module *Module::GetModuleIfLoaded(mdFile kFile) #ifndef DACCESS_COMPILE -DomainFile *Module::LoadModule(AppDomain *pDomain, mdFile kFile) +DomainAssembly *Module::LoadModule(AppDomain *pDomain, mdFile kFile) { - CONTRACT(DomainFile *) + CONTRACT(DomainAssembly *) { INSTANCE_CHECK; THROWS; @@ -4056,7 +4056,7 @@ void Module::UpdateDynamicMetadataIfNeeded() #endif // DEBUGGING_SUPPORTED -BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainAssembly, int flags, BOOL attaching) +BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainAssembly * pDomainAssembly, int flags, BOOL attaching) { WRAPPER_NO_CONTRACT; @@ -7498,7 +7498,7 @@ CHECK Module::CheckActivated() CONTRACTL_END; #ifndef DACCESS_COMPILE - DomainFile *pDomainAssembly = GetDomainAssembly(); + DomainAssembly *pDomainAssembly = GetDomainAssembly(); CHECK(pDomainAssembly != NULL); PREFIX_ASSUME(pDomainAssembly != NULL); CHECK(pDomainAssembly->CheckActivated()); diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index e81797fedc8f9..e88534570a55c 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -1134,7 +1134,7 @@ class Module DomainAssembly *GetDomainAssembly(); - void SetDomainAssembly(DomainFile *pDomainAssembly); + void SetDomainAssembly(DomainAssembly *pDomainAssembly); OBJECTREF GetExposedObject(); @@ -1432,7 +1432,7 @@ class Module DomainAssembly * LoadAssembly(mdAssemblyRef kAssemblyRef); Module *GetModuleIfLoaded(mdFile kFile); - DomainFile *LoadModule(AppDomain *pDomain, mdFile kFile); + DomainAssembly *LoadModule(AppDomain *pDomain, mdFile kFile); PTR_Module LookupModule(mdToken kFile); //wrapper over GetModuleIfLoaded, takes modulerefs as well DWORD GetAssemblyRefFlags(mdAssemblyRef tkAssemblyRef); @@ -1715,7 +1715,7 @@ class Module public: // Debugger stuff - BOOL NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainAssembly, int level, BOOL attaching); + BOOL NotifyDebuggerLoad(AppDomain *pDomain, DomainAssembly * pDomainAssembly, int level, BOOL attaching); void NotifyDebuggerUnload(AppDomain *pDomain); void SetDebuggerInfoBits(DebuggerAssemblyControlFlags newBits); diff --git a/src/coreclr/vm/common.h b/src/coreclr/vm/common.h index bcd9af84555c6..60a26944289dc 100644 --- a/src/coreclr/vm/common.h +++ b/src/coreclr/vm/common.h @@ -120,8 +120,6 @@ typedef DPTR(class ComPlusCallMethodDesc) PTR_ComPlusCallMethodDesc; typedef VPTR(class DebugInterface) PTR_DebugInterface; typedef DPTR(class Dictionary) PTR_Dictionary; typedef VPTR(class DomainAssembly) PTR_DomainAssembly; -typedef VPTR(class DomainFile) PTR_DomainFile; -typedef VPTR(class DomainModule) PTR_DomainModule; typedef DPTR(struct FailedAssembly) PTR_FailedAssembly; typedef VPTR(class EditAndContinueModule) PTR_EditAndContinueModule; typedef DPTR(class EEClass) PTR_EEClass; diff --git a/src/coreclr/vm/dbginterface.h b/src/coreclr/vm/dbginterface.h index befac6a5b4027..c9bc65c33fd28 100644 --- a/src/coreclr/vm/dbginterface.h +++ b/src/coreclr/vm/dbginterface.h @@ -68,7 +68,7 @@ class DebugInterface DWORD dwModuleName, // number of characters in file name excludign null Assembly * pAssembly, // the assembly the module belongs to AppDomain * pAppDomain, // the AppDomain the module is being loaded into - DomainFile * pDomainAssembly, + DomainAssembly * pDomainAssembly, BOOL fAttaching) = 0; // true if this notification is due to a debugger // being attached to the process @@ -242,7 +242,7 @@ class DebugInterface // send a custom notification from the target to the RS. This will become an ICorDebugThread and // ICorDebugAppDomain on the RS. - virtual void SendCustomDebuggerNotification(Thread * pThread, DomainFile * pDomainAssembly, mdTypeDef classToken) = 0; + virtual void SendCustomDebuggerNotification(Thread * pThread, DomainAssembly * pDomainAssembly, mdTypeDef classToken) = 0; // Send an MDA notification. This ultimately translates to an ICorDebugMDA object on the Right-Side. virtual void SendMDANotification( diff --git a/src/coreclr/vm/debugdebugger.cpp b/src/coreclr/vm/debugdebugger.cpp index 9b0bf6cd9c9ec..566bb74d6d3eb 100644 --- a/src/coreclr/vm/debugdebugger.cpp +++ b/src/coreclr/vm/debugdebugger.cpp @@ -827,7 +827,7 @@ FCIMPL1(void, DebugDebugger::CustomNotification, Object * dataUNSAFE) StrongHandleHolder objHandle = pAppDomain->CreateStrongHandle(pData); MethodTable * pMT = pData->GetGCSafeMethodTable(); Module * pModule = pMT->GetModule(); - DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); + DomainAssembly * pDomainAssembly = pModule->GetDomainAssembly(); mdTypeDef classToken = pMT->GetCl(); pThread->SetThreadCurrNotification(objHandle); diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainfile.cpp index 1f5e8cc6f1fbf..3de15545c2df7 100644 --- a/src/coreclr/vm/domainfile.cpp +++ b/src/coreclr/vm/domainfile.cpp @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // -------------------------------------------------------------------------------- -// DomainFile.cpp +// DomainAssembly.cpp // // -------------------------------------------------------------------------------- @@ -30,7 +30,7 @@ #endif // FEATURE_PERFMAP #ifndef DACCESS_COMPILE -DomainFile::DomainFile(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator) : +DomainAssembly::DomainAssembly(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator) : m_pAssembly(NULL), m_pDomain(pDomain), m_pPEAssembly(pPEAssembly), @@ -67,7 +67,7 @@ DomainFile::DomainFile(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAlloca SetupDebuggingConfig(); } -DomainFile::~DomainFile() +DomainAssembly::~DomainAssembly() { CONTRACTL { @@ -98,7 +98,7 @@ DomainFile::~DomainFile() // Optimization intended for EnsureLoadLevel only #include -void DomainFile::EnsureLoadLevel(FileLoadLevel targetLevel) +void DomainAssembly::EnsureLoadLevel(FileLoadLevel targetLevel) { CONTRACT_VOID { @@ -126,7 +126,7 @@ void DomainFile::EnsureLoadLevel(FileLoadLevel targetLevel) } #include -void DomainFile::AttemptLoadLevel(FileLoadLevel targetLevel) +void DomainAssembly::AttemptLoadLevel(FileLoadLevel targetLevel) { CONTRACT_VOID { @@ -145,7 +145,7 @@ void DomainFile::AttemptLoadLevel(FileLoadLevel targetLevel) } -CHECK DomainFile::CheckLoadLevel(FileLoadLevel requiredLevel, BOOL deadlockOK) +CHECK DomainAssembly::CheckLoadLevel(FileLoadLevel requiredLevel, BOOL deadlockOK) { CONTRACTL { @@ -175,7 +175,7 @@ CHECK DomainFile::CheckLoadLevel(FileLoadLevel requiredLevel, BOOL deadlockOK) -void DomainFile::RequireLoadLevel(FileLoadLevel targetLevel) +void DomainAssembly::RequireLoadLevel(FileLoadLevel targetLevel) { CONTRACT_VOID { @@ -195,7 +195,7 @@ void DomainFile::RequireLoadLevel(FileLoadLevel targetLevel) } -void DomainFile::SetError(Exception *ex) +void DomainAssembly::SetError(Exception *ex) { CONTRACT_VOID { @@ -229,7 +229,7 @@ void DomainFile::SetError(Exception *ex) RETURN; } -void DomainFile::ThrowIfError(FileLoadLevel targetLevel) +void DomainAssembly::ThrowIfError(FileLoadLevel targetLevel) { CONTRACT_VOID { @@ -249,7 +249,7 @@ void DomainFile::ThrowIfError(FileLoadLevel targetLevel) RETURN; } -CHECK DomainFile::CheckNoError(FileLoadLevel targetLevel) +CHECK DomainAssembly::CheckNoError(FileLoadLevel targetLevel) { LIMITED_METHOD_CONTRACT; CHECK(m_level >= targetLevel @@ -258,7 +258,7 @@ CHECK DomainFile::CheckNoError(FileLoadLevel targetLevel) CHECK_OK; } -CHECK DomainFile::CheckLoaded() +CHECK DomainAssembly::CheckLoaded() { CONTRACTL { @@ -269,7 +269,7 @@ CHECK DomainFile::CheckLoaded() } CONTRACTL_END; - CHECK_MSG(CheckNoError(FILE_LOADED), "DomainFile load resulted in an error"); + CHECK_MSG(CheckNoError(FILE_LOADED), "DomainAssembly load resulted in an error"); if (IsLoaded()) CHECK_OK; @@ -286,7 +286,7 @@ CHECK DomainFile::CheckLoaded() CHECK_OK; } -CHECK DomainFile::CheckActivated() +CHECK DomainAssembly::CheckActivated() { CONTRACTL { @@ -297,7 +297,7 @@ CHECK DomainFile::CheckActivated() } CONTRACTL_END; - CHECK_MSG(CheckNoError(FILE_ACTIVE), "DomainFile load resulted in an error"); + CHECK_MSG(CheckNoError(FILE_ACTIVE), "DomainAssembly load resulted in an error"); if (IsActive()) CHECK_OK; @@ -310,7 +310,7 @@ CHECK DomainFile::CheckActivated() CHECK_OK; CHECK_MSG(GetPEAssembly()->IsLoaded(), "PEAssembly has not been loaded"); - CHECK_MSG(IsLoaded(), "DomainFile has not been fully loaded"); + CHECK_MSG(IsLoaded(), "DomainAssembly has not been fully loaded"); CHECK_MSG(m_bDisableActivationCheck || CheckLoadLevel(FILE_ACTIVE), "File has not had execution verified"); CHECK_OK; @@ -318,20 +318,6 @@ CHECK DomainFile::CheckActivated() #endif //!DACCESS_COMPILE -DomainAssembly *DomainFile::GetDomainAssembly() -{ - CONTRACTL - { - SUPPORTS_DAC; - NOTHROW; - GC_NOTRIGGER; - } - CONTRACTL_END; - - _ASSERTE(IsAssembly()); - return (DomainAssembly *) this; -} - // Return true iff the debugger should get notifications about this assembly. // // Notes: @@ -342,7 +328,7 @@ DomainAssembly *DomainFile::GetDomainAssembly() // to visible, but NOT vice versa. Once a DomainAssmebly is fully initialized, this function should be // immutable for an instance of a module. That ensures that the debugger gets consistent // notifications about it. It this value mutates, than the debugger may miss relevant notifications. -BOOL DomainFile::IsVisibleToDebugger() +BOOL DomainAssembly::IsVisibleToDebugger() { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; @@ -357,7 +343,7 @@ BOOL DomainFile::IsVisibleToDebugger() // Returns managed representation of the module (Module or ModuleBuilder). // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). // -OBJECTREF DomainFile::GetExposedModuleObject() +OBJECTREF DomainAssembly::GetExposedModuleObject() { CONTRACTL { @@ -422,9 +408,9 @@ OBJECTREF DomainFile::GetExposedModuleObject() } return pLoaderAllocator->GetHandleValue(m_hExposedModuleObject); -} // DomainFile::GetExposedModuleObject +} -BOOL DomainFile::DoIncrementalLoad(FileLoadLevel level) +BOOL DomainAssembly::DoIncrementalLoad(FileLoadLevel level) { STANDARD_VM_CONTRACT; @@ -502,7 +488,7 @@ BOOL DomainFile::DoIncrementalLoad(FileLoadLevel level) return TRUE; } -void DomainFile::PreLoadLibrary() +void DomainAssembly::PreLoadLibrary() { CONTRACTL { @@ -511,11 +497,9 @@ void DomainFile::PreLoadLibrary() } CONTRACTL_END; -} // DomainFile::PreLoadLibrary +} // DomainAssembly::PreLoadLibrary -// Note that this is the sole loading function which must be called OUTSIDE THE LOCK, since -// it will potentially involve the OS loader lock. -void DomainFile::LoadLibrary() +void DomainAssembly::LoadLibrary() { CONTRACTL { @@ -526,7 +510,7 @@ void DomainFile::LoadLibrary() } -void DomainFile::PostLoadLibrary() +void DomainAssembly::PostLoadLibrary() { CONTRACTL { @@ -562,12 +546,12 @@ void DomainFile::PostLoadLibrary() #endif } -void DomainFile::AddDependencies() +void DomainAssembly::AddDependencies() { STANDARD_VM_CONTRACT; } -void DomainFile::EagerFixups() +void DomainAssembly::EagerFixups() { WRAPPER_NO_CONTRACT; @@ -588,14 +572,14 @@ void DomainFile::EagerFixups() #endif // FEATURE_READYTORUN } -void DomainFile::VtableFixups() +void DomainAssembly::VtableFixups() { WRAPPER_NO_CONTRACT; GetModule()->FixupVTables(); } -void DomainFile::FinishLoad() +void DomainAssembly::FinishLoad() { CONTRACTL { @@ -620,7 +604,7 @@ void DomainFile::FinishLoad() #endif } -void DomainFile::Activate() +void DomainAssembly::Activate() { CONTRACT_VOID { @@ -630,20 +614,11 @@ void DomainFile::Activate() } CONTRACT_END; - // If we are a module, ensure we've activated the assembly first. - - if (!IsAssembly()) - { - GetDomainAssembly()->EnsureActive(); - } - else - { - // We cannot execute any code in this assembly until we know what exception plan it is on. - // At the point of an exception's stack-crawl it is too late because we cannot tolerate a GC. - // See PossiblyUnwrapThrowable and its callers. - _ASSERTE(GetModule() == GetDomainAssembly()->GetAssembly()->GetModule()); - GetModule()->IsRuntimeWrapExceptions(); - } + // We cannot execute any code in this assembly until we know what exception plan it is on. + // At the point of an exception's stack-crawl it is too late because we cannot tolerate a GC. + // See PossiblyUnwrapThrowable and its callers. + _ASSERTE(GetModule() == GetAssembly()->GetModule()); + GetModule()->IsRuntimeWrapExceptions(); // Now activate any dependencies. // This will typically cause reentrancy of course. @@ -672,29 +647,7 @@ void DomainFile::Activate() RETURN; } -//-------------------------------------------------------------------------------- -// DomainAssembly -//-------------------------------------------------------------------------------- - -DomainAssembly::DomainAssembly(AppDomain *pDomain, PEAssembly *pPEAssembly, LoaderAllocator *pLoaderAllocator) - : DomainFile(pDomain, pPEAssembly, pLoaderAllocator) -{ -} - -DomainAssembly::~DomainAssembly() -{ - CONTRACTL - { - DESTRUCTOR_CHECK; - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; -} - -void DomainFile::SetAssembly(Assembly* pAssembly) +void DomainAssembly::SetAssembly(Assembly* pAssembly) { STANDARD_VM_CONTRACT; @@ -704,7 +657,7 @@ void DomainFile::SetAssembly(Assembly* pAssembly) m_pAssembly = pAssembly; m_pModule = pAssembly->GetModule(); - pAssembly->SetDomainAssembly((DomainAssembly*)this); + pAssembly->SetDomainAssembly(this); } @@ -713,7 +666,7 @@ void DomainFile::SetAssembly(Assembly* pAssembly) // Returns managed representation of the assembly (Assembly or AssemblyBuilder). // Returns NULL if the managed scout was already collected (see code:LoaderAllocator#AssemblyPhases). // -OBJECTREF DomainFile::GetExposedAssemblyObject() +OBJECTREF DomainAssembly::GetExposedAssemblyObject() { CONTRACTL { @@ -766,7 +719,7 @@ OBJECTREF DomainFile::GetExposedAssemblyObject() GCPROTECT_BEGIN(assemblyObj); assemblyObj = (ASSEMBLYREF)AllocateObject(pMT); - assemblyObj->SetAssembly((DomainAssembly*)this); + assemblyObj->SetAssembly(this); // Attach the reference to the assembly to keep the LoaderAllocator for this collectible type // alive as long as a reference to the assembly is kept alive. @@ -799,20 +752,20 @@ OBJECTREF DomainFile::GetExposedAssemblyObject() return pLoaderAllocator->GetHandleValue(m_hExposedAssemblyObject); } -void DomainFile::Begin() +void DomainAssembly::Begin() { STANDARD_VM_CONTRACT; { AppDomain::LoadLockHolder lock(m_pDomain); - m_pDomain->AddAssembly((DomainAssembly*)this); + m_pDomain->AddAssembly(this); } // Make it possible to find this DomainAssembly object from associated BINDER_SPACE::Assembly. RegisterWithHostAssembly(); m_fHostAssemblyPublished = true; } -void DomainFile::RegisterWithHostAssembly() +void DomainAssembly::RegisterWithHostAssembly() { CONTRACTL { @@ -824,11 +777,11 @@ void DomainFile::RegisterWithHostAssembly() if (GetPEAssembly()->HasHostAssembly()) { - GetPEAssembly()->GetHostAssembly()->SetDomainAssembly((DomainAssembly*)this); + GetPEAssembly()->GetHostAssembly()->SetDomainAssembly(this); } } -void DomainFile::UnregisterFromHostAssembly() +void DomainAssembly::UnregisterFromHostAssembly() { CONTRACTL { @@ -844,7 +797,7 @@ void DomainFile::UnregisterFromHostAssembly() } } -void DomainFile::Allocate() +void DomainAssembly::Allocate() { CONTRACTL { @@ -873,10 +826,9 @@ void DomainFile::Allocate() } SetAssembly(pAssembly); - } -void DomainFile::DeliverAsyncEvents() +void DomainAssembly::DeliverAsyncEvents() { CONTRACTL { @@ -888,10 +840,10 @@ void DomainFile::DeliverAsyncEvents() CONTRACTL_END; OVERRIDE_LOAD_LEVEL_LIMIT(FILE_ACTIVE); - m_pDomain->RaiseLoadingAssemblyEvent((DomainAssembly*)this); + m_pDomain->RaiseLoadingAssemblyEvent(this); } -void DomainFile::DeliverSyncEvents() +void DomainAssembly::DeliverSyncEvents() { CONTRACTL { @@ -934,7 +886,7 @@ void DomainFile::DeliverSyncEvents() } */ -BOOL DomainFile::GetResource(LPCSTR szName, DWORD *cbResource, +BOOL DomainAssembly::GetResource(LPCSTR szName, DWORD *cbResource, PBYTE *pbInMemoryResource, DomainAssembly** pAssemblyRef, LPCSTR *szFileName, DWORD *dwLocation, BOOL fSkipRaiseResolveEvent) @@ -955,12 +907,12 @@ BOOL DomainFile::GetResource(LPCSTR szName, DWORD *cbResource, szFileName, dwLocation, fSkipRaiseResolveEvent, - (DomainAssembly*)this, + this, this->m_pDomain ); } -DWORD DomainFile::ComputeDebuggingConfig() +DWORD DomainAssembly::ComputeDebuggingConfig() { CONTRACTL { @@ -981,7 +933,7 @@ DWORD DomainFile::ComputeDebuggingConfig() #endif // DEBUGGING_SUPPORTED } -void DomainFile::SetupDebuggingConfig(void) +void DomainAssembly::SetupDebuggingConfig(void) { CONTRACTL { @@ -1004,7 +956,7 @@ void DomainFile::SetupDebuggingConfig(void) // For right now, we only check to see if the DebuggableAttribute is present - later may add fields/properties to the // attributes. -HRESULT DomainFile::GetDebuggingCustomAttributes(DWORD *pdwFlags) +HRESULT DomainAssembly::GetDebuggingCustomAttributes(DWORD *pdwFlags) { CONTRACTL { @@ -1086,7 +1038,7 @@ HRESULT DomainFile::GetDebuggingCustomAttributes(DWORD *pdwFlags) return hr; } -BOOL DomainFile::NotifyDebuggerLoad(int flags, BOOL attaching) +BOOL DomainAssembly::NotifyDebuggerLoad(int flags, BOOL attaching) { WRAPPER_NO_CONTRACT; @@ -1106,12 +1058,11 @@ BOOL DomainFile::NotifyDebuggerLoad(int flags, BOOL attaching) } // There is still work we need to do even when no debugger is attached. - if (flags & ATTACH_ASSEMBLY_LOAD) { if (ShouldNotifyDebugger()) { - g_pDebugInterface->LoadAssembly((DomainAssembly*)this); + g_pDebugInterface->LoadAssembly(this); } result = TRUE; } @@ -1128,12 +1079,10 @@ BOOL DomainFile::NotifyDebuggerLoad(int flags, BOOL attaching) SetDebuggerNotified(); } - - return result; } -void DomainFile::NotifyDebuggerUnload() +void DomainAssembly::NotifyDebuggerUnload() { LIMITED_METHOD_CONTRACT; @@ -1149,20 +1098,18 @@ void DomainFile::NotifyDebuggerUnload() // a previous load event (such as if debugger attached after the modules was loaded). this->GetModule()->NotifyDebuggerUnload(this->GetAppDomain()); - g_pDebugInterface->UnloadAssembly((DomainAssembly*)this); - + g_pDebugInterface->UnloadAssembly(this); } #endif // #ifndef DACCESS_COMPILE #ifdef DACCESS_COMPILE -void -DomainFile::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) +void DomainAssembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) { SUPPORTS_DAC; - //sizeof(DomainFile) == 0x60 + //sizeof(DomainAssembly) == 0x60 DAC_ENUM_VTHIS(); // Modules are needed for all minidumps, but they are enumerated elsewhere diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainfile.h index f5b9ce068c0bb..8a57f3aafb90e 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainfile.h @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // -------------------------------------------------------------------------------- -// DomainFile.h +// DomainAssembly.h // // -------------------------------------------------------------------------------- @@ -59,13 +59,13 @@ enum NotificationStatus }; // -------------------------------------------------------------------------------- -// DomainFile represents a file loaded (or being loaded) into an app domain. It +// DomainAssembly represents an assembly loaded (or being loaded) into an app domain. It // is guranteed to be unique per file per app domain. // -------------------------------------------------------------------------------- -class DomainFile +class DomainAssembly final { - VPTR_BASE_VTABLE_CLASS(DomainFile); + VPTR_BASE_CONCRETE_VTABLE_CLASS(DomainAssembly); public: @@ -74,8 +74,8 @@ class DomainFile // ------------------------------------------------------------ #ifndef DACCESS_COMPILE - virtual ~DomainFile(); - DomainFile() {LIMITED_METHOD_CONTRACT;}; + virtual ~DomainAssembly(); + DomainAssembly() {LIMITED_METHOD_CONTRACT;}; #endif PTR_AppDomain GetAppDomain() @@ -141,19 +141,10 @@ class DomainFile } #endif - // TODO: VS remove - BOOL IsAssembly() - { - LIMITED_METHOD_DAC_CONTRACT; - return TRUE; - } - BOOL IsCollectible(); Assembly* GetAssembly(); ULONG HashIdentity(); - DomainAssembly *GetDomainAssembly(); - // ------------------------------------------------------------ // Public API // ------------------------------------------------------------ @@ -270,7 +261,7 @@ class DomainFile // ------------------------------------------------------------ #ifndef DACCESS_COMPILE - BOOL Equals(DomainFile *pFile) { WRAPPER_NO_CONTRACT; return GetPEAssembly()->Equals(pFile->GetPEAssembly()); } + 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 @@ -322,7 +313,7 @@ class DomainFile friend class Module; friend class FileLoadLock; - DomainFile(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator); + DomainAssembly(AppDomain* pDomain, PEAssembly* pPEAssembly, LoaderAllocator* pLoaderAllocator); BOOL DoIncrementalLoad(FileLoadLevel targetLevel); void ClearLoading() { LIMITED_METHOD_CONTRACT; m_loading = FALSE; } @@ -481,31 +472,4 @@ class DomainFile BOOL m_fHostAssemblyPublished; }; -// -------------------------------------------------------------------------------- -// DomainAssembly is a subclass of DomainFile which specifically represents a assembly. -// -------------------------------------------------------------------------------- - -class DomainAssembly : public DomainFile -{ - VPTR_VTABLE_CLASS(DomainAssembly, DomainFile); - -public: - - private: - - // ------------------------------------------------------------ - // Loader API - // ------------------------------------------------------------ - - friend class AppDomain; - friend class Assembly; - -#ifndef DACCESS_COMPILE -public: - ~DomainAssembly(); -private: - DomainAssembly(AppDomain *pDomain, PEAssembly *pPEAssembly, LoaderAllocator *pLoaderAllocator); -#endif -}; - #endif // _DOMAINFILE_H_ diff --git a/src/coreclr/vm/domainfile.inl b/src/coreclr/vm/domainfile.inl index 02cebae7ea7a5..22bdb14c91b1c 100644 --- a/src/coreclr/vm/domainfile.inl +++ b/src/coreclr/vm/domainfile.inl @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -inline Module* DomainFile::GetModule() +inline Module* DomainAssembly::GetModule() { LIMITED_METHOD_CONTRACT; CONSISTENCY_CHECK(CheckLoaded()); @@ -9,7 +9,7 @@ inline Module* DomainFile::GetModule() return m_pModule; } -inline Assembly* DomainFile::GetAssembly() +inline Assembly* DomainAssembly::GetAssembly() { LIMITED_METHOD_DAC_CONTRACT; CONSISTENCY_CHECK(CheckLoaded()); @@ -17,13 +17,13 @@ inline Assembly* DomainFile::GetAssembly() return m_pAssembly; } -inline ULONG DomainFile::HashIdentity() +inline ULONG DomainAssembly::HashIdentity() { WRAPPER_NO_CONTRACT; return GetPEAssembly()->HashIdentity(); } -inline BOOL DomainFile::IsCollectible() +inline BOOL DomainAssembly::IsCollectible() { LIMITED_METHOD_CONTRACT; return m_fCollectible; diff --git a/src/coreclr/vm/dynamicmethod.cpp b/src/coreclr/vm/dynamicmethod.cpp index 35137855229e5..a5a9ee44ba8eb 100644 --- a/src/coreclr/vm/dynamicmethod.cpp +++ b/src/coreclr/vm/dynamicmethod.cpp @@ -20,7 +20,7 @@ #ifndef DACCESS_COMPILE // get the method table for dynamic methods -DynamicMethodTable* DomainFile::GetDynamicMethodTable() +DynamicMethodTable* DomainAssembly::GetDynamicMethodTable() { CONTRACT (DynamicMethodTable*) { diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 184a9e24e2e7c..d340cba119b4f 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -1529,7 +1529,7 @@ void BulkStaticsLogger::LogAllStatics() if (module == NULL) continue; - DomainFile *domainAssembly = module->GetDomainAssembly(); + DomainAssembly *domainAssembly = module->GetDomainAssembly(); if (domainAssembly == NULL) continue; diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 1dfebbdcec35e..da58e99f118a8 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -953,7 +953,7 @@ void CEEInfo::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken ThrowBadTokenException(pResolvedToken); { - DomainFile *pTargetModule = pModule->LoadModule(GetAppDomain(), metaTOK); + DomainAssembly *pTargetModule = pModule->LoadModule(GetAppDomain(), metaTOK); if (pTargetModule == NULL) COMPlusThrowHR(COR_E_BADIMAGEFORMAT); th = TypeHandle(pTargetModule->GetModule()->GetGlobalMethodTable()); diff --git a/src/coreclr/vm/memberload.cpp b/src/coreclr/vm/memberload.cpp index 78fdb518a1618..4c8e7dc7e2a92 100644 --- a/src/coreclr/vm/memberload.cpp +++ b/src/coreclr/vm/memberload.cpp @@ -277,7 +277,7 @@ void MemberLoader::GetDescFromMemberRef(Module * pModule, { case mdtModuleRef: { - DomainFile *pTargetModule = pModule->LoadModule(GetAppDomain(), parent); + DomainAssembly *pTargetModule = pModule->LoadModule(GetAppDomain(), parent); if (pTargetModule == NULL) COMPlusThrowHR(COR_E_BADIMAGEFORMAT); typeHnd = TypeHandle(pTargetModule->GetModule()->GetGlobalMethodTable()); diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index d5177fb4467c5..18a0a141a8228 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -234,7 +234,7 @@ FileLoadLevel MulticoreJitManager::GetModuleFileLoadLevel(Module * pModule) if (pModule != NULL) { - DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); + DomainAssembly * pDomainAssembly = pModule->GetDomainAssembly(); if (pDomainAssembly != NULL) { diff --git a/src/coreclr/vm/profilingenumerators.cpp b/src/coreclr/vm/profilingenumerators.cpp index f6b6ee135bb68..f8a2091e73172 100644 --- a/src/coreclr/vm/profilingenumerators.cpp +++ b/src/coreclr/vm/profilingenumerators.cpp @@ -250,7 +250,7 @@ HRESULT IterateUnsharedModules(AppDomain * pAppDomain, // enumerable. // // Note: To determine what happens in a given load stage of a module or assembly, - // look at the switch statement in code:DomainFile::DoIncrementalLoad, and keep in + // look at the switch statement in code:DomainAssembly::DoIncrementalLoad, and keep in // mind that it takes cases on the *next* load stage; in other words, the actions // that appear in a case for a given load stage are actually executed as we attempt // to transition TO that load stage, and thus they actually execute while the module @@ -395,8 +395,8 @@ HRESULT ProfilerModuleEnum::Init() HRESULT hr = S_OK; - // When an assembly or module is loaded into an AppDomain, a separate DomainFile is - // created (one per pairing of the AppDomain with the module or assembly). This means + // When an assembly is loaded into an AppDomain, a DomainAssembly is + // created (one per pairing of the AppDomain with the assembly). This means // that we'll create multiple DomainFiles for the same module if it is loaded // domain-neutral (i.e., "shared"). The profiling API callbacks shield the profiler // from this, and only report a given module the first time it's loaded. So a @@ -450,7 +450,7 @@ HRESULT IterateAppDomainContainingModule::AddAppDomainContainingModule(AppDomain } CONTRACTL_END; - DomainFile * pDomainAssembly = m_pModule->GetDomainAssembly(); + DomainAssembly * pDomainAssembly = m_pModule->GetDomainAssembly(); if ((pDomainAssembly != NULL) && (pDomainAssembly->IsAvailableToProfilers())) { if (m_index < m_cAppDomainIds) diff --git a/src/coreclr/vm/reflectioninvocation.cpp b/src/coreclr/vm/reflectioninvocation.cpp index 42cc0b51d32d4..e49ad881f5fe5 100644 --- a/src/coreclr/vm/reflectioninvocation.cpp +++ b/src/coreclr/vm/reflectioninvocation.cpp @@ -1584,7 +1584,7 @@ extern "C" void QCALLTYPE ReflectionInvocation_RunModuleConstructor(QCall::Modul { QCALL_CONTRACT; - DomainFile *pDomainAssembly = pModule->GetDomainAssembly(); + DomainAssembly *pDomainAssembly = pModule->GetDomainAssembly(); if (pDomainAssembly != NULL && pDomainAssembly->IsActive()) return; diff --git a/src/coreclr/vm/runtimehandles.cpp b/src/coreclr/vm/runtimehandles.cpp index c6d53b4c24d8f..362ea14986498 100644 --- a/src/coreclr/vm/runtimehandles.cpp +++ b/src/coreclr/vm/runtimehandles.cpp @@ -186,7 +186,7 @@ NOINLINE ReflectModuleBaseObject* GetRuntimeModuleHelper(LPVOID __me, Module *pM if (pModule == NULL) return NULL; - DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); + DomainAssembly * pDomainAssembly = pModule->GetDomainAssembly(); OBJECTREF refModule = (pDomainAssembly != NULL) ? pDomainAssembly->GetExposedModuleObjectIfExists() : NULL; @@ -2670,7 +2670,7 @@ FCIMPL1(ReflectModuleBaseObject*, AssemblyHandle::GetManifestModule, AssemblyBas Assembly* currentAssembly = pAssembly->GetAssembly(); Module *pModule = currentAssembly->GetModule(); - DomainFile * pDomainAssembly = pModule->GetDomainAssembly(); + DomainAssembly * pDomainAssembly = pModule->GetDomainAssembly(); #ifdef _DEBUG OBJECTREF orModule; @@ -2905,7 +2905,7 @@ FCIMPL5(ReflectMethodObject*, ModuleHandle::GetDynamicMethod, ReflectMethodObjec HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - DomainFile *pDomainModule = pModule->GetDomainAssembly(); + DomainAssembly *pDomainModule = pModule->GetDomainAssembly(); U1ARRAYREF dataArray = (U1ARRAYREF)sig; DWORD sigSize = dataArray->GetNumComponents(); diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index 1bfccb85e10d6..f51f75445b399 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -132,7 +132,7 @@ class Frame; class ThreadBaseObject; class AppDomainStack; class LoadLevelLimiter; -class DomainFile; +class DomainAssembly; class DeadlockAwareLock; struct HelperMethodFrameCallerList; class ThreadLocalIBCInfo; From 04b7e7ecc692d64dce694329bce0ca237b398d73 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:45:26 -0800 Subject: [PATCH 13/25] renamed files --- src/coreclr/vm/CMakeLists.txt | 6 +++--- src/coreclr/vm/appdomain.hpp | 2 +- src/coreclr/vm/assemblyspec.hpp | 2 +- src/coreclr/vm/common.h | 2 +- src/coreclr/vm/coreassemblyspec.cpp | 2 +- src/coreclr/vm/{domainfile.cpp => domainassembly.cpp} | 0 src/coreclr/vm/{domainfile.h => domainassembly.h} | 6 +++--- src/coreclr/vm/{domainfile.inl => domainassembly.inl} | 0 src/coreclr/vm/eventtrace.cpp | 2 +- src/coreclr/vm/methoditer.h | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) rename src/coreclr/vm/{domainfile.cpp => domainassembly.cpp} (100%) rename src/coreclr/vm/{domainfile.h => domainassembly.h} (99%) rename src/coreclr/vm/{domainfile.inl => domainassembly.inl} (100%) diff --git a/src/coreclr/vm/CMakeLists.txt b/src/coreclr/vm/CMakeLists.txt index 2f34d2c0ceaa1..aea9b275acb0e 100644 --- a/src/coreclr/vm/CMakeLists.txt +++ b/src/coreclr/vm/CMakeLists.txt @@ -63,7 +63,7 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON debuginfostore.cpp decodemd.cpp disassembler.cpp - domainfile.cpp + domainassembly.cpp dynamicmethod.cpp ecall.cpp eedbginterfaceimpl.cpp @@ -161,8 +161,8 @@ set(VM_HEADERS_DAC_AND_WKS_COMMON debuginfostore.h decodemd.h disassembler.h - domainfile.h - domainfile.inl + domainassembly.h + domainassembly.inl dynamicmethod.h ecall.h eedbginterfaceimpl.h diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 89a1fce3e45b0..1f81f932a5b87 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -21,7 +21,7 @@ #include "arraylist.h" #include "comreflectioncache.hpp" #include "comutilnative.h" -#include "domainfile.h" +#include "domainassembly.h" #include "fptrstubs.h" #include "gcheaputilities.h" #include "gchandleutilities.h" diff --git a/src/coreclr/vm/assemblyspec.hpp b/src/coreclr/vm/assemblyspec.hpp index 5d09b5b75a664..b3f5f509d4ec7 100644 --- a/src/coreclr/vm/assemblyspec.hpp +++ b/src/coreclr/vm/assemblyspec.hpp @@ -16,7 +16,7 @@ #define _ASSEMBLYSPEC_H #include "hash.h" #include "assemblyspecbase.h" -#include "domainfile.h" +#include "domainassembly.h" #include "holder.h" class AppDomain; diff --git a/src/coreclr/vm/common.h b/src/coreclr/vm/common.h index 60a26944289dc..f928f0c6504a0 100644 --- a/src/coreclr/vm/common.h +++ b/src/coreclr/vm/common.h @@ -427,7 +427,7 @@ extern DummyGlobalContract ___contract; #include "typehandle.inl" #include "object.inl" #include "clsload.inl" -#include "domainfile.inl" +#include "domainassembly.inl" #include "method.inl" #include "syncblk.inl" #include "threads.inl" diff --git a/src/coreclr/vm/coreassemblyspec.cpp b/src/coreclr/vm/coreassemblyspec.cpp index eaaddafdbe9c6..2da6e14750d71 100644 --- a/src/coreclr/vm/coreassemblyspec.cpp +++ b/src/coreclr/vm/coreassemblyspec.cpp @@ -15,7 +15,7 @@ #include "appdomain.inl" #include #include "peimagelayout.inl" -#include "domainfile.h" +#include "domainassembly.h" #include "holder.h" #include "bundle.h" #include "strongnameinternal.h" diff --git a/src/coreclr/vm/domainfile.cpp b/src/coreclr/vm/domainassembly.cpp similarity index 100% rename from src/coreclr/vm/domainfile.cpp rename to src/coreclr/vm/domainassembly.cpp diff --git a/src/coreclr/vm/domainfile.h b/src/coreclr/vm/domainassembly.h similarity index 99% rename from src/coreclr/vm/domainfile.h rename to src/coreclr/vm/domainassembly.h index 8a57f3aafb90e..7cec054ca85d6 100644 --- a/src/coreclr/vm/domainfile.h +++ b/src/coreclr/vm/domainassembly.h @@ -7,8 +7,8 @@ // -------------------------------------------------------------------------------- -#ifndef _DOMAINFILE_H_ -#define _DOMAINFILE_H_ +#ifndef _DOMAINASSEMBLY_H_ +#define _DOMAINASSEMBLY_H_ // -------------------------------------------------------------------------------- // Required headers @@ -472,4 +472,4 @@ class DomainAssembly final BOOL m_fHostAssemblyPublished; }; -#endif // _DOMAINFILE_H_ +#endif // _DOMAINASSEMBLY_H_ diff --git a/src/coreclr/vm/domainfile.inl b/src/coreclr/vm/domainassembly.inl similarity index 100% rename from src/coreclr/vm/domainfile.inl rename to src/coreclr/vm/domainassembly.inl diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index d340cba119b4f..3c5d8ded8c574 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -1380,7 +1380,7 @@ void BulkComLogger::AddCcwHandle(Object **handle) -#include "domainfile.h" +#include "domainassembly.h" BulkStaticsLogger::BulkStaticsLogger(BulkTypeEventLogger *typeLogger) : m_buffer(0), m_used(0), m_count(0), m_domain(0), m_typeLogger(typeLogger) diff --git a/src/coreclr/vm/methoditer.h b/src/coreclr/vm/methoditer.h index 7f4fd520a1d01..e1835e6538a2e 100644 --- a/src/coreclr/vm/methoditer.h +++ b/src/coreclr/vm/methoditer.h @@ -9,7 +9,7 @@ #include "instmethhash.h" #include "method.hpp" #include "appdomain.hpp" -#include "domainfile.h" +#include "domainassembly.h" #include "typehash.h" From 2365789d1b673fa0607d81b1b24e2ac7bfda4f8c Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 28 Dec 2021 15:32:21 -0800 Subject: [PATCH 14/25] a few minor cleanups --- src/coreclr/vm/appdomain.cpp | 12 ++++++------ src/coreclr/vm/appdomain.hpp | 4 ++-- src/coreclr/vm/assembly.hpp | 8 -------- src/coreclr/vm/assemblyspec.cpp | 2 +- src/coreclr/vm/ceeload.cpp | 11 +---------- src/coreclr/vm/ceeload.h | 18 +----------------- src/coreclr/vm/domainassembly.cpp | 4 ++-- src/coreclr/vm/domainassembly.h | 15 +++++++-------- 8 files changed, 20 insertions(+), 54 deletions(-) diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 09acbaf7e1151..3a63fed87655a 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2373,7 +2373,7 @@ BOOL FileLoadLock::CompleteLoadLevel(FileLoadLevel level, BOOL success) m_pDomainAssembly->ClearLoading(); - CONSISTENCY_CHECK(m_dwRefCount >= 2); // Caller (LoadDomainFile) should have 1 refcount and m_pList should have another which was acquired in FileLoadLock::Create. + CONSISTENCY_CHECK(m_dwRefCount >= 2); // Caller (LoadDomainAssembly) should have 1 refcount and m_pList should have another which was acquired in FileLoadLock::Create. m_level = (FileLoadLevel)level; @@ -2658,7 +2658,7 @@ CHECK AppDomain::CheckCanExecuteManagedCode(MethodDesc* pMD) #endif // !DACCESS_COMPILE -void AppDomain::LoadDomainFile(DomainAssembly *pFile, +void AppDomain::LoadDomainAssembly(DomainAssembly *pFile, FileLoadLevel targetLevel) { CONTRACTL @@ -2698,7 +2698,7 @@ void AppDomain::LoadDomainFile(DomainAssembly *pFile, lock.Release(); - LoadDomainFile(pLockEntry, targetLevel); + LoadDomainAssembly(pLockEntry, targetLevel); } #else // DACCESS_COMPILE @@ -2875,12 +2875,12 @@ DomainAssembly *AppDomain::LoadDomainAssemblyInternal(AssemblySpec* pIdentity, if (result == NULL) { - // We pass our ref on fileLock to LoadDomainFile to release. + // We pass our ref on fileLock to LoadDomainAssembly to release. // Note that if we throw here, we will poison fileLock with an error condition, // so it will not be removed until app domain unload. So there is no need // to release our ref count. - result = (DomainAssembly *)LoadDomainFile(fileLock, targetLevel); + result = (DomainAssembly *)LoadDomainAssembly(fileLock, targetLevel); } else { @@ -2918,7 +2918,7 @@ struct LoadFileArgs DomainAssembly *result; }; -DomainAssembly *AppDomain::LoadDomainFile(FileLoadLock *pLock, FileLoadLevel targetLevel) +DomainAssembly *AppDomain::LoadDomainAssembly(FileLoadLock *pLock, FileLoadLevel targetLevel) { CONTRACT(DomainAssembly *) { diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 1f81f932a5b87..98936dfac9fad 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -1803,7 +1803,7 @@ class AppDomain : public BaseDomain BOOL IsLoading(DomainAssembly *pFile, FileLoadLevel level); static FileLoadLevel GetThreadFileLoadLevel(); - void LoadDomainFile(DomainAssembly *pFile, + void LoadDomainAssembly(DomainAssembly *pFile, FileLoadLevel targetLevel); enum FindAssemblyOptions @@ -1839,7 +1839,7 @@ class AppDomain : public BaseDomain // private: void LoadSystemAssemblies(); - DomainAssembly *LoadDomainFile(FileLoadLock *pLock, + DomainAssembly *LoadDomainAssembly(FileLoadLock *pLock, FileLoadLevel targetLevel); void TryIncrementalLoad(DomainAssembly *pFile, FileLoadLevel workLevel, FileLoadLockHolder &lockHolder); diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index 943f4b7235be5..9f047474d2871 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -110,14 +110,6 @@ class Assembly WRAPPER_NO_CONTRACT; m_pModule->SetIsTenured(); } - - // CAUTION: This should only be used as backout code if an assembly is unsuccessfully - // added to the shared domain assembly map. - void UnsetIsTenured() - { - WRAPPER_NO_CONTRACT; - m_pModule->UnsetIsTenured(); - } #endif // DACCESS_COMPILE //**************************************************************************************** diff --git a/src/coreclr/vm/assemblyspec.cpp b/src/coreclr/vm/assemblyspec.cpp index dfbee7152df19..10cea0fce9a52 100644 --- a/src/coreclr/vm/assemblyspec.cpp +++ b/src/coreclr/vm/assemblyspec.cpp @@ -756,7 +756,7 @@ DomainAssembly *AssemblySpec::LoadDomainAssembly(FileLoadLevel targetLevel, BinderTracing::AssemblyBindOperation bindOperation(this); bindOperation.SetResult(pAssembly->GetPEAssembly(), true /*cached*/); - pDomain->LoadDomainFile(pAssembly, targetLevel); + pDomain->LoadDomainAssembly(pAssembly, targetLevel); RETURN pAssembly; } diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index a2e88f0329e03..58a99e3ff0eb7 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -443,7 +443,6 @@ void Module::SetNativeMetadataAssemblyRefInCache(DWORD rid, PTR_Assembly pAssemb // // szName is only used by dynamic modules, see ReflectionModule::Initialize // -// void Module::Initialize(AllocMemTracker *pamTracker, LPCWSTR szName) { CONTRACTL @@ -464,14 +463,6 @@ void Module::Initialize(AllocMemTracker *pamTracker, LPCWSTR szName) m_DictionaryCrst.Init(CrstDomainLocalBlock); AllocateMaps(); - - if (IsSystem() || - (strcmp(m_pSimpleName, "System") == 0) || - (strcmp(m_pSimpleName, "System.Core") == 0)) - { - FastInterlockOr(&m_dwPersistedFlags, LOW_LEVEL_SYSTEM_ASSEMBLY_BY_NAME); - } - m_dwTransientFlags &= ~((DWORD)CLASSES_FREED); // Set flag indicating LookupMaps are now in a consistent and destructable state #ifdef FEATURE_COLLECTIBLE_TYPES @@ -3393,7 +3384,7 @@ DomainAssembly * Module::LoadAssembly(mdAssemblyRef kAssemblyRef) if (pAssembly != NULL) { pDomainAssembly = pAssembly->GetDomainAssembly(); - ::GetAppDomain()->LoadDomainFile(pDomainAssembly, FILE_LOADED); + ::GetAppDomain()->LoadDomainAssembly(pDomainAssembly, FILE_LOADED); RETURN pDomainAssembly; } diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h index e88534570a55c..d9cd6742cb6c0 100644 --- a/src/coreclr/vm/ceeload.h +++ b/src/coreclr/vm/ceeload.h @@ -832,8 +832,7 @@ class Module //If m_MethodDefToPropertyInfoMap has been generated COMPUTED_METHODDEF_TO_PROPERTYINFO_MAP = 0x00002000, - // Low level system assembly. Used by preferred zap module computation. - LOW_LEVEL_SYSTEM_ASSEMBLY_BY_NAME = 0x00004000, + // unused = 0x00004000, //If setting has been cached RUNTIME_MARSHALLING_ENABLED_IS_CACHED = 0x00008000, @@ -1191,14 +1190,6 @@ class Module LIMITED_METHOD_CONTRACT; FastInterlockOr(&m_dwTransientFlags, MODULE_IS_TENURED); } - - // CAUTION: This should only be used as backout code if an assembly is unsuccessfully - // added to the shared domain assembly map. - VOID UnsetIsTenured() - { - LIMITED_METHOD_CONTRACT; - FastInterlockAnd(&m_dwTransientFlags, ~MODULE_IS_TENURED); - } #endif // !DACCESS_COMPILE @@ -1219,13 +1210,6 @@ class Module } #endif - BOOL IsLowLevelSystemAssemblyByName() - { - LIMITED_METHOD_CONTRACT; - // The flag is set during initialization, so we can skip the memory barrier - return m_dwPersistedFlags.LoadWithoutBarrier() & LOW_LEVEL_SYSTEM_ASSEMBLY_BY_NAME; - } - #ifndef DACCESS_COMPILE VOID EnsureActive(); VOID EnsureAllocated(); diff --git a/src/coreclr/vm/domainassembly.cpp b/src/coreclr/vm/domainassembly.cpp index 3de15545c2df7..2d2a8dcafe353 100644 --- a/src/coreclr/vm/domainassembly.cpp +++ b/src/coreclr/vm/domainassembly.cpp @@ -111,7 +111,7 @@ void DomainAssembly::EnsureLoadLevel(FileLoadLevel targetLevel) TRIGGERSGC (); if (IsLoading()) { - this->GetAppDomain()->LoadDomainFile(this, targetLevel); + this->GetAppDomain()->LoadDomainAssembly(this, targetLevel); // Enforce the loading requirement. Note that we may have a deadlock in which case we // may be off by one which is OK. (At this point if we are short of targetLevel we know @@ -137,7 +137,7 @@ void DomainAssembly::AttemptLoadLevel(FileLoadLevel targetLevel) CONTRACT_END; if (IsLoading()) - this->GetAppDomain()->LoadDomainFile(this, targetLevel); + this->GetAppDomain()->LoadDomainAssembly(this, targetLevel); else ThrowIfError(targetLevel); diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index 7cec054ca85d6..da634205179d0 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -141,15 +141,15 @@ class DomainAssembly final } #endif - BOOL IsCollectible(); - Assembly* GetAssembly(); - ULONG HashIdentity(); - // ------------------------------------------------------------ // Public API // ------------------------------------------------------------ - void SetAssembly(Assembly* pAssembly); + Assembly* GetAssembly(); + Module* GetModule(); + + BOOL IsCollectible(); + ULONG HashIdentity(); // ------------------------------------------------------------ // Loading state checks @@ -265,8 +265,6 @@ class DomainAssembly final BOOL Equals(PEAssembly *pPEAssembly) { WRAPPER_NO_CONTRACT; return GetPEAssembly()->Equals(pPEAssembly); } #endif // DACCESS_COMPILE - Module* GetModule(); - #ifdef DACCESS_COMPILE virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif @@ -303,7 +301,7 @@ class DomainAssembly final LPCSTR* szFileName, DWORD* dwLocation, BOOL fSkipRaiseResolveEvent); - protected: + private: // ------------------------------------------------------------ // Loader API // ------------------------------------------------------------ @@ -339,6 +337,7 @@ class DomainAssembly final // This should be used to permanently set the load to fail. Do not use with transient conditions void SetError(Exception *ex); + void SetAssembly(Assembly* pAssembly); void SetProfilerNotified() { LIMITED_METHOD_CONTRACT; m_notifyflags|= PROFILER_NOTIFIED; } void SetDebuggerNotified() { LIMITED_METHOD_CONTRACT; m_notifyflags|=DEBUGGER_NOTIFIED; } From 987aa5decfb6e56d11fa96de27f90155a79dda78 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 17:31:58 -0800 Subject: [PATCH 15/25] DomainAssembly does not need to have VPTR_. Couple other changes. --- src/coreclr/inc/vptr_list.h | 2 -- src/coreclr/vm/assembly.hpp | 2 -- src/coreclr/vm/domainassembly.cpp | 3 +-- src/coreclr/vm/domainassembly.h | 14 +++----------- src/coreclr/vm/peassembly.cpp | 2 +- src/coreclr/vm/peassembly.h | 11 +++-------- 6 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/coreclr/inc/vptr_list.h b/src/coreclr/inc/vptr_list.h index ad17ef35a3b60..d8e6cd42bd7c3 100644 --- a/src/coreclr/inc/vptr_list.h +++ b/src/coreclr/inc/vptr_list.h @@ -23,7 +23,6 @@ VPTR_CLASS(ReflectionModule) VPTR_CLASS(AppDomain) VPTR_CLASS(SystemDomain) -VPTR_CLASS(DomainAssembly) VPTR_CLASS(PrecodeStubManager) VPTR_CLASS(StubLinkStubManager) VPTR_CLASS(ThePreStubManager) @@ -39,7 +38,6 @@ VPTR_CLASS(DelegateInvokeStubManager) VPTR_CLASS(TailCallStubManager) #endif VPTR_CLASS(CallCountingStubManager) -VPTR_CLASS(PEAssembly) VPTR_CLASS(PEImageLayout) VPTR_CLASS(ConvertedImageLayout) diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index 9f047474d2871..7c4b967c22be7 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -479,8 +479,6 @@ class Assembly PTR_BaseDomain m_pDomain; // Parent Domain PTR_ClassLoader m_pClassLoader; // Single Loader - - PTR_MethodDesc m_pEntryPoint; // Method containing the entry point PTR_Module m_pModule; PTR_PEAssembly m_pPEAssembly; diff --git a/src/coreclr/vm/domainassembly.cpp b/src/coreclr/vm/domainassembly.cpp index 2d2a8dcafe353..d1b71dc28b1c6 100644 --- a/src/coreclr/vm/domainassembly.cpp +++ b/src/coreclr/vm/domainassembly.cpp @@ -1109,8 +1109,7 @@ void DomainAssembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) { SUPPORTS_DAC; - //sizeof(DomainAssembly) == 0x60 - DAC_ENUM_VTHIS(); + 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. diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index da634205179d0..f26d21e90b721 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -65,16 +65,14 @@ enum NotificationStatus class DomainAssembly final { - VPTR_BASE_CONCRETE_VTABLE_CLASS(DomainAssembly); - - public: + public: // ------------------------------------------------------------ // Public API // ------------------------------------------------------------ #ifndef DACCESS_COMPILE - virtual ~DomainAssembly(); + ~DomainAssembly(); DomainAssembly() {LIMITED_METHOD_CONTRACT;}; #endif @@ -266,7 +264,7 @@ class DomainAssembly final #endif // DACCESS_COMPILE #ifdef DACCESS_COMPILE - virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); + void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif #ifndef DACCESS_COMPILE @@ -402,12 +400,6 @@ class DomainAssembly final } }; - void ReleaseManagedData() - { - if (m_pError) - m_pError->ConvertToHResult(); - }; - public: // ------------------------------------------------------------ // Debugger control API diff --git a/src/coreclr/vm/peassembly.cpp b/src/coreclr/vm/peassembly.cpp index ef396bc8e702e..7926fa8b85bf8 100644 --- a/src/coreclr/vm/peassembly.cpp +++ b/src/coreclr/vm/peassembly.cpp @@ -1080,7 +1080,7 @@ void PEAssembly::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) WRAPPER_NO_CONTRACT; SUPPORTS_DAC; - DAC_ENUM_VTHIS(); + DAC_ENUM_DTHIS(); EMEM_OUT(("MEM: %p PEAssembly\n", dac_cast(this))); #ifdef _DEBUG diff --git a/src/coreclr/vm/peassembly.h b/src/coreclr/vm/peassembly.h index 3342e835f265a..8cb12f986c8bb 100644 --- a/src/coreclr/vm/peassembly.h +++ b/src/coreclr/vm/peassembly.h @@ -83,11 +83,6 @@ typedef VPTR(PEAssembly) PTR_PEAssembly; class PEAssembly final { - // ------------------------------------------------------------ - // SOS support - // ------------------------------------------------------------ - VPTR_BASE_CONCRETE_VTABLE_CLASS(PEAssembly) - public: // ------------------------------------------------------------ @@ -98,7 +93,7 @@ class PEAssembly final STDMETHOD_(ULONG, Release)(); #ifdef DACCESS_COMPILE - virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); + void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif #if CHECK_INVARIANTS @@ -381,7 +376,7 @@ class PEAssembly final #ifdef DACCESS_COMPILE // just to make the DAC and GCC happy. - virtual ~PEAssembly() {}; + ~PEAssembly() {}; PEAssembly() = default; #else PEAssembly( @@ -393,7 +388,7 @@ class PEAssembly final BINDER_SPACE::Assembly* pHostAssembly = NULL ); - virtual ~PEAssembly(); + ~PEAssembly(); #endif void OpenMDImport(); From 0c7926fa0d7651dd6f7fb7ce740172f544a1b5f6 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 17:44:02 -0800 Subject: [PATCH 16/25] More DomainFile --> DomainAssembly renames --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 76 +++++++++---------- src/coreclr/debug/daccess/dacdbiimpl.h | 22 +++--- .../debug/daccess/dacdbiimplstackwalk.cpp | 6 +- src/coreclr/debug/di/breakpoint.cpp | 2 +- src/coreclr/debug/di/divalue.cpp | 4 +- src/coreclr/debug/di/module.cpp | 50 ++++++------ src/coreclr/debug/di/process.cpp | 54 ++++++------- src/coreclr/debug/di/rsappdomain.cpp | 20 ++--- src/coreclr/debug/di/rsclass.cpp | 10 +-- src/coreclr/debug/di/rsfunction.cpp | 12 +-- src/coreclr/debug/di/rspriv.h | 22 +++--- src/coreclr/debug/di/rsstackwalk.cpp | 2 +- src/coreclr/debug/di/rsthread.cpp | 20 ++--- src/coreclr/debug/di/rstype.cpp | 32 ++++---- src/coreclr/debug/ee/debugger.cpp | 60 +++++++-------- src/coreclr/debug/ee/debugger.h | 2 +- src/coreclr/debug/inc/dacdbiinterface.h | 42 +++++----- src/coreclr/debug/inc/dacdbistructures.h | 8 +- src/coreclr/debug/inc/dacdbistructures.inl | 4 +- src/coreclr/debug/inc/dbgipcevents.h | 44 +++++------ src/coreclr/vm/assembly.cpp | 4 +- src/coreclr/vm/threads.cpp | 2 +- 22 files changed, 249 insertions(+), 249 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index f12f4d72ea7da..a8416f4ece23f 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -657,13 +657,13 @@ void DacDbiInterfaceImpl::GetAppDomainFullName( // Get the values of the JIT Optimization and EnC flags. void DacDbiInterfaceImpl::GetCompilerFlags ( - VMPTR_DomainFile vmDomainFile, + VMPTR_DomainAssembly vmDomainAssembly, BOOL *pfAllowJITOpts, BOOL *pfEnableEnC) { DD_ENTER_MAY_THROW; - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); if (pDomainAssembly == NULL) { @@ -712,14 +712,14 @@ bool DacDbiInterfaceImpl::CanSetEnCBits(Module * pModule) } // DacDbiInterfaceImpl::SetEnCBits // Set the values of the JIT optimization and EnC flags. -HRESULT DacDbiInterfaceImpl::SetCompilerFlags(VMPTR_DomainFile vmDomainFile, +HRESULT DacDbiInterfaceImpl::SetCompilerFlags(VMPTR_DomainAssembly vmDomainAssembly, BOOL fAllowJitOpts, BOOL fEnableEnC) { DD_ENTER_MAY_THROW; DWORD dwBits = 0; - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); HRESULT hr = S_OK; @@ -1082,14 +1082,14 @@ ULONG DacDbiInterfaceImpl::TranslateInstrumentedILOffsetToOriginal(ULONG // a module and a token. The info will come from a MethodDesc, if // one exists or from metadata. // -void DacDbiInterfaceImpl::GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, +void DacDbiInterfaceImpl::GetILCodeAndSig(VMPTR_DomainAssembly vmDomainAssembly, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken) { DD_ENTER_MAY_THROW; - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); RVA methodRVA = 0; DWORD implFlags; @@ -1323,7 +1323,7 @@ void DacDbiInterfaceImpl::GetMethodRegionInfo(MethodDesc * pMethodDe // isn't currently available. In this case, all values in pCodeInfo will be // cleared. -void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, +void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainAssembly vmDomainAssembly, mdToken functionToken, NativeCodeFunctionData * pCodeInfo) { @@ -1334,7 +1334,7 @@ void DacDbiInterfaceImpl::GetNativeCodeInfo(VMPTR_DomainFile vmDomainFil // pre-initialize: pCodeInfo->Clear(); - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); MethodDesc* pMethodDesc = FindLoadedMethodRefOrDef(pModule, functionToken); @@ -1760,7 +1760,7 @@ void DacDbiInterfaceImpl::GetClassInfo(VMPTR_AppDomain vmAppDomain, } // DacDbiInterfaceImpl::GetClassInfo // DacDbi API: Get field information and object size for an instantiated generic type -void DacDbiInterfaceImpl::GetInstantiationFieldInfo (VMPTR_DomainFile vmDomainFile, +void DacDbiInterfaceImpl::GetInstantiationFieldInfo (VMPTR_DomainAssembly vmDomainAssembly, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList * pFieldList, @@ -1768,7 +1768,7 @@ void DacDbiInterfaceImpl::GetInstantiationFieldInfo (VMPTR_DomainFile { DD_ENTER_MAY_THROW; - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); _ASSERTE(pDomainAssembly != NULL); AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); TypeHandle thExact; @@ -2503,11 +2503,11 @@ void DacDbiInterfaceImpl::GetClassTypeInfo(TypeHandle typeH pTypeInfo->ClassTypeData.vmModule.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule)); if (pAppDomain) { - pTypeInfo->ClassTypeData.vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainAssembly())); + pTypeInfo->ClassTypeData.vmDomainAssembly.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainAssembly())); } else { - pTypeInfo->ClassTypeData.vmDomainFile = VMPTR_DomainFile::NullPtr(); + pTypeInfo->ClassTypeData.vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); } } // DacDbiInterfaceImpl::GetClassTypeInfo @@ -2567,7 +2567,7 @@ void DacDbiInterfaceImpl::TypeHandleToBasicTypeInfo(TypeHandle case ELEMENT_TYPE_BYREF: pTypeInfo->vmTypeHandle.SetDacTargetPtr(typeHandle.AsTAddr()); pTypeInfo->metadataToken = mdTokenNil; - pTypeInfo->vmDomainFile = VMPTR_DomainFile::NullPtr(); + pTypeInfo->vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); break; case ELEMENT_TYPE_CLASS: @@ -2590,11 +2590,11 @@ void DacDbiInterfaceImpl::TypeHandleToBasicTypeInfo(TypeHandle pTypeInfo->vmModule.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule)); if (pAppDomain) { - pTypeInfo->vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainAssembly())); + pTypeInfo->vmDomainAssembly.SetDacTargetPtr(PTR_HOST_TO_TADDR(pModule->GetDomainAssembly())); } else { - pTypeInfo->vmDomainFile = VMPTR_DomainFile::NullPtr(); + pTypeInfo->vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); } break; } @@ -2602,7 +2602,7 @@ void DacDbiInterfaceImpl::TypeHandleToBasicTypeInfo(TypeHandle default: pTypeInfo->vmTypeHandle = VMPTR_TypeHandle::NullPtr(); pTypeInfo->metadataToken = mdTokenNil; - pTypeInfo->vmDomainFile = VMPTR_DomainFile::NullPtr(); + pTypeInfo->vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); break; } return; @@ -2889,7 +2889,7 @@ TypeHandle DacDbiInterfaceImpl::GetClassOrValueTypeHandle(DebuggerIPCE_BasicType // otherwise, have the loader look it up using the metadata token and domain file else { - DomainAssembly * pDomainAssembly = pData->vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pData->vmDomainAssembly.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); typeHandle = ClassLoader::LookupTypeDefOrRefInModule(pModule, pData->metadataToken); @@ -3292,7 +3292,7 @@ void DacDbiInterfaceImpl::GetSimpleType(VMPTR_AppDomain vmAppDomain, CorElementType simpleType, mdTypeDef *pMetadataToken, VMPTR_Module *pVmModule, - VMPTR_DomainFile *pVmDomainFile) + VMPTR_DomainAssembly *pVmDomainAssembly) { DD_ENTER_MAY_THROW; @@ -3300,8 +3300,8 @@ void DacDbiInterfaceImpl::GetSimpleType(VMPTR_AppDomain vmAppDomain, // if we fail to get either a valid type handle or module, we will want to send back // a NULL domain file too, so we'll to preinitialize this here. - _ASSERTE(pVmDomainFile != NULL); - *pVmDomainFile = VMPTR_DomainFile::NullPtr(); + _ASSERTE(pVmDomainAssembly != NULL); + *pVmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); // FindLoadedElementType will return NULL if the type hasn't been loaded yet. TypeHandle typeHandle = FindLoadedElementType(simpleType); @@ -3322,8 +3322,8 @@ void DacDbiInterfaceImpl::GetSimpleType(VMPTR_AppDomain vmAppDomain, if (pAppDomain) { - pVmDomainFile->SetHostPtr(pModule->GetDomainAssembly()); - if (pVmDomainFile->IsNull()) + pVmDomainAssembly->SetHostPtr(pModule->GetDomainAssembly()); + if (pVmDomainAssembly->IsNull()) ThrowHR(CORDBG_E_TARGET_INCONSISTENT); } } @@ -3483,7 +3483,7 @@ HRESULT DacDbiInterfaceImpl::GetDelegateType(VMPTR_Object delegateObject, Delega HRESULT DacDbiInterfaceImpl::GetDelegateFunctionData( DelegateType delegateType, VMPTR_Object delegateObject, - OUT VMPTR_DomainFile *ppFunctionDomainFile, + OUT VMPTR_DomainAssembly *ppFunctionDomainFile, OUT mdMethodDef *pMethodDef) { DD_ENTER_MAY_THROW; @@ -3735,7 +3735,7 @@ void DacDbiInterfaceImpl::GetStackFramesFromException(VMPTR_Object vmObject, Dac _ASSERTE(pDomainAssembly != NULL); currentFrame.vmAppDomain.SetHostPtr(pDomain); - currentFrame.vmDomainFile.SetHostPtr(pDomainAssembly); + currentFrame.vmDomainAssembly.SetHostPtr(pDomainAssembly); currentFrame.ip = currentElement.ip; currentFrame.methodDef = currentElement.pFunc->GetMemberDef(); currentFrame.isLastForeignExceptionFrame = (currentElement.flags & STEF_LAST_FRAME_FROM_FOREIGN_STACK_TRACE) != 0; @@ -3879,7 +3879,7 @@ FieldDesc * DacDbiInterfaceImpl::GetEnCFieldDesc(const EnCHangingFieldInfo * pEn { FieldDesc * pFD = NULL; - DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainAssembly.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); // get the type handle for the object @@ -3918,7 +3918,7 @@ PTR_CBYTE DacDbiInterfaceImpl::GetPtrToEnCField(FieldDesc * pFD, const EnCHangin #else PTR_EditAndContinueModule pEnCModule; - DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pEnCFieldInfo->GetObjectTypeData().vmDomainAssembly.GetDacPtr(); Module * pModule = pDomainAssembly->GetModule(); // make sure we actually have an EditAndContinueModule @@ -4090,7 +4090,7 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, TypeRefData * pTargetRefInfo) { DD_ENTER_MAY_THROW; - DomainAssembly * pDomainAssembly = pTypeRefInfo->vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = pTypeRefInfo->vmDomainAssembly.GetDacPtr(); Module * pReferencingModule = pDomainAssembly->GetModule(); BOOL fSuccess = FALSE; @@ -4119,7 +4119,7 @@ void DacDbiInterfaceImpl::ResolveTypeReference(const TypeRefData * pTypeRefInfo, AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); - pTargetRefInfo->vmDomainFile.SetDacTargetPtr(PTR_HOST_TO_TADDR(pTargetModule->GetDomainAssembly())); + pTargetRefInfo->vmDomainAssembly.SetDacTargetPtr(PTR_HOST_TO_TADDR(pTargetModule->GetDomainAssembly())); pTargetRefInfo->typeToken = targetTypeDef; } else @@ -4347,19 +4347,19 @@ void DacDbiInterfaceImpl::GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * -void DacDbiInterfaceImpl::GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, OUT VMPTR_Module * pModule) +void DacDbiInterfaceImpl::GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule) { DD_ENTER_MAY_THROW; _ASSERTE(pModule != NULL); - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); pModule->SetHostPtr(pDomainAssembly->GetModule()); } // Implement IDacDbiInterface::GetDomainFileData -void DacDbiInterfaceImpl::GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData) +void DacDbiInterfaceImpl::GetDomainFileData(VMPTR_DomainAssembly vmDomainAssembly, DomainFileInfo * pData) { DD_ENTER_MAY_THROW; @@ -4367,7 +4367,7 @@ void DacDbiInterfaceImpl::GetDomainFileData(VMPTR_DomainFile vmDomainFile, Domai ZeroMemory(pData, sizeof(*pData)); - DomainAssembly * pDomainAssembly = vmDomainFile.GetDacPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetDacPtr(); AppDomain * pAppDomain = pDomainAssembly->GetAppDomain(); // @dbgtodo - is this efficient DAC usage (perhaps a dac-cop rule)? Are we round-tripping the pointer? @@ -4498,17 +4498,17 @@ void DacDbiInterfaceImpl::EnumerateModulesInAssembly( { _ASSERTE(pDomainAssembly->IsLoaded()); - VMPTR_DomainFile vmDomainFile = VMPTR_DomainFile::NullPtr(); - vmDomainFile.SetHostPtr(pDomainAssembly); + VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); + vmDomainAssembly.SetHostPtr(pDomainAssembly); - fpCallback(vmDomainFile, pUserData); + fpCallback(vmDomainAssembly, pUserData); } } // Implementation of IDacDbiInterface::ResolveAssembly // Returns NULL if not found. VMPTR_DomainAssembly DacDbiInterfaceImpl::ResolveAssembly( - VMPTR_DomainFile vmScope, + VMPTR_DomainAssembly vmScope, mdToken tkAssemblyRef) { DD_ENTER_MAY_THROW; @@ -6056,7 +6056,7 @@ void DacDbiInterfaceImpl::GetTypedByRefInfo(CORDB_ADDRESS pTypedByRe "ref=0x%08x, cls=0x%08x, mod=0x%p\n", pObjectData->objRef, pObjectData->typedByrefType.metadataToken, - pObjectData->typedByrefType.vmDomainFile.GetDacPtr())); + pObjectData->typedByrefType.vmDomainAssembly.GetDacPtr())); } // DacDbiInterfaceImpl::GetTypedByRefInfo // Get the string data associated withn obj and put it into the pointers @@ -7013,7 +7013,7 @@ bool DacDbiInterfaceImpl::IsValidObject(CORDB_ADDRESS addr) } bool DacDbiInterfaceImpl::GetAppDomainForObject(CORDB_ADDRESS addr, OUT VMPTR_AppDomain * pAppDomain, - OUT VMPTR_Module *pModule, OUT VMPTR_DomainFile *pDomainAssembly) + OUT VMPTR_Module *pModule, OUT VMPTR_DomainAssembly *pDomainAssembly) { DD_ENTER_MAY_THROW; diff --git a/src/coreclr/debug/daccess/dacdbiimpl.h b/src/coreclr/debug/daccess/dacdbiimpl.h index cf3356aac5d65..e80be6511a0a2 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.h +++ b/src/coreclr/debug/daccess/dacdbiimpl.h @@ -96,7 +96,7 @@ class DacDbiInterfaceImpl : IStringHolder * pStrName); // Get the values of the JIT Optimization and EnC flags. - void GetCompilerFlags (VMPTR_DomainFile vmDomainFile, + void GetCompilerFlags (VMPTR_DomainAssembly vmDomainAssembly, BOOL * pfAllowJITOpts, BOOL * pfEnableEnC); @@ -104,7 +104,7 @@ class DacDbiInterfaceImpl : bool CanSetEnCBits(Module * pModule); // Set the values of the JIT optimization and EnC flags. - HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, + HRESULT SetCompilerFlags(VMPTR_DomainAssembly vmDomainAssembly, BOOL fAllowJitOpts, BOOL fEnableEnC); @@ -133,7 +133,7 @@ class DacDbiInterfaceImpl : bool IsValidObject(CORDB_ADDRESS obj); - bool GetAppDomainForObject(CORDB_ADDRESS obj, OUT VMPTR_AppDomain * pApp, OUT VMPTR_Module *pModule, OUT VMPTR_DomainFile *mod); + bool GetAppDomainForObject(CORDB_ADDRESS obj, OUT VMPTR_AppDomain * pApp, OUT VMPTR_Module *pModule, OUT VMPTR_DomainAssembly *mod); @@ -218,7 +218,7 @@ class DacDbiInterfaceImpl : // a module and a token. The info will come from a MethodDesc, if // one exists or from metadata. // - void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, + void GetILCodeAndSig(VMPTR_DomainAssembly vmDomainAssembly, mdToken functionToken, TargetBuffer * pCodeInfo, mdToken * pLocalSigToken); @@ -229,7 +229,7 @@ class DacDbiInterfaceImpl : // whether it's an instantiated generic // its EnC version number // hot and cold region information. - void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, + void GetNativeCodeInfo(VMPTR_DomainAssembly vmDomainAssembly, mdToken functionToken, NativeCodeFunctionData * pCodeInfo); @@ -260,7 +260,7 @@ class DacDbiInterfaceImpl : ClassInfo * pData); // get field information and object size for an instantiated generic type - void GetInstantiationFieldInfo (VMPTR_DomainFile vmDomainFile, + void GetInstantiationFieldInfo (VMPTR_DomainAssembly vmDomainAssembly, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, DacDbiArrayList * pFieldList, @@ -336,7 +336,7 @@ class DacDbiInterfaceImpl : CorElementType simpleType, mdTypeDef * pMetadataToken, VMPTR_Module * pVmModule, - VMPTR_DomainFile * pVmDomainFile); + VMPTR_DomainAssembly * pVmDomainAssembly); BOOL IsExceptionObject(VMPTR_Object vmObject); @@ -352,7 +352,7 @@ class DacDbiInterfaceImpl : HRESULT GetDelegateFunctionData( DelegateType delegateType, VMPTR_Object delegateObject, - OUT VMPTR_DomainFile *ppFunctionDomainFile, + OUT VMPTR_DomainAssembly *ppFunctionDomainFile, OUT mdMethodDef *pMethodDef); HRESULT GetDelegateTargetObject( @@ -731,9 +731,9 @@ class DacDbiInterfaceImpl : void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData); // Gets properties for a domainfile - void GetDomainFileData(VMPTR_DomainFile vmDomainFile, DomainFileInfo * pData); + void GetDomainFileData(VMPTR_DomainAssembly vmDomainAssembly, DomainFileInfo * pData); - void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, OUT VMPTR_Module * pModule); + void GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule); // Yields true if the address is a CLR stub. BOOL IsTransitionStub(CORDB_ADDRESS address); @@ -830,7 +830,7 @@ class DacDbiInterfaceImpl : VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread); // Given an assembly ref token and metadata scope (via the DomainAssembly), resolve the assembly. - VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef); + VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainAssembly vmScope, mdToken tkAssemblyRef); // Hijack the thread diff --git a/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp b/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp index af8034c490361..b8a84043b396f 100644 --- a/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp +++ b/src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp @@ -522,14 +522,14 @@ void DacDbiInterfaceImpl::EnumerateInternalFrames(VMPTR_Thread DebuggerEval * pDE = pFEF->GetDebuggerEval(); frameData.stubFrame.funcMetadataToken = pDE->m_methodToken; - frameData.stubFrame.vmDomainFile.SetHostPtr( + frameData.stubFrame.vmDomainAssembly.SetHostPtr( pDE->m_debuggerModule ? pDE->m_debuggerModule->GetDomainAssembly() : NULL); frameData.stubFrame.vmMethodDesc = VMPTR_MethodDesc::NullPtr(); } else { frameData.stubFrame.funcMetadataToken = (pMD == NULL ? NULL : pMD->GetMemberDef()); - frameData.stubFrame.vmDomainFile.SetHostPtr(pDomainAssembly); + frameData.stubFrame.vmDomainAssembly.SetHostPtr(pDomainAssembly); frameData.stubFrame.vmMethodDesc.SetHostPtr(pMD); } @@ -783,7 +783,7 @@ void DacDbiInterfaceImpl::InitFrameData(StackFrameIterator * pIter, // pFuncData->funcMetadataToken = pMD->GetMemberDef(); - pFuncData->vmDomainFile.SetHostPtr(pDomainAssembly); + pFuncData->vmDomainAssembly.SetHostPtr(pDomainAssembly); // PERF: this is expensive to get so I stopped fetching it eagerly // It is only needed if we haven't already got a cached copy diff --git a/src/coreclr/debug/di/breakpoint.cpp b/src/coreclr/debug/di/breakpoint.cpp index eb156c49e04d9..ad45df5c618ac 100644 --- a/src/coreclr/debug/di/breakpoint.cpp +++ b/src/coreclr/debug/di/breakpoint.cpp @@ -201,7 +201,7 @@ HRESULT CordbFunctionBreakpoint::Activate(BOOL fActivate) pProcess->InitIPCEvent(pEvent, DB_IPCE_BREAKPOINT_ADD, true, pAppDomain->GetADToken()); pEvent->BreakpointData.funcMetadataToken = m_code->GetMetadataToken(); - pEvent->BreakpointData.vmDomainFile = m_code->GetModule()->GetRuntimeDomainFile(); + pEvent->BreakpointData.vmDomainAssembly = m_code->GetModule()->GetRuntimeDomainAssembly(); pEvent->BreakpointData.encVersion = m_code->GetVersion(); BOOL codeIsIL = m_code->IsIL(); diff --git a/src/coreclr/debug/di/divalue.cpp b/src/coreclr/debug/di/divalue.cpp index b8c9e745260db..e6a4e68d12dd6 100644 --- a/src/coreclr/debug/di/divalue.cpp +++ b/src/coreclr/debug/di/divalue.cpp @@ -2464,7 +2464,7 @@ HRESULT CordbObjectValue::EnumerateExceptionCallStack(ICorDebugExceptionObjectCa CorDebugExceptionObjectStackFrame& currentStackFrame = pStackFrames[index]; CordbAppDomain* pAppDomain = GetProcess()->LookupOrCreateAppDomain(currentDacFrame.vmAppDomain); - CordbModule* pModule = pAppDomain->LookupOrCreateModule(currentDacFrame.vmDomainFile); + CordbModule* pModule = pAppDomain->LookupOrCreateModule(currentDacFrame.vmDomainAssembly); hr = pModule->QueryInterface(IID_ICorDebugModule, reinterpret_cast(¤tStackFrame.pModule)); _ASSERTE(SUCCEEDED(hr)); @@ -2653,7 +2653,7 @@ HRESULT CordbObjectValue::GetFunctionHelper(ICorDebugFunction **ppFunction) return hr; mdMethodDef functionMethodDef = 0; - VMPTR_DomainFile functionDomainFile; + VMPTR_DomainAssembly functionDomainFile; NativeCodeFunctionData nativeCodeForDelFunc; hr = pDAC->GetDelegateFunctionData(delType, pDelegateObj, &functionDomainFile, &functionMethodDef); diff --git a/src/coreclr/debug/di/module.cpp b/src/coreclr/debug/di/module.cpp index 6d6a7a55befa2..f89c20927851f 100644 --- a/src/coreclr/debug/di/module.cpp +++ b/src/coreclr/debug/di/module.cpp @@ -48,17 +48,17 @@ STDAPI ReOpenMetaDataWithMemoryEx( // // Arguments: // pProcess - process that this module lives in -// vmDomainFile - CLR cookie for module. +// vmDomainAssembly - CLR cookie for module. CordbModule::CordbModule( CordbProcess * pProcess, VMPTR_Module vmModule, - VMPTR_DomainFile vmDomainFile) -: CordbBase(pProcess, vmDomainFile.IsNull() ? VmPtrToCookie(vmModule) : VmPtrToCookie(vmDomainFile), enumCordbModule), + VMPTR_DomainAssembly vmDomainAssembly) +: CordbBase(pProcess, vmDomainAssembly.IsNull() ? VmPtrToCookie(vmModule) : VmPtrToCookie(vmDomainAssembly), enumCordbModule), m_pAssembly(0), m_pAppDomain(0), m_classes(11), m_functions(101), - m_vmDomainFile(vmDomainFile), + m_vmDomainAssembly(vmDomainAssembly), m_vmModule(vmModule), m_EnCCount(0), m_fForceMetaDataSerialize(FALSE), @@ -84,11 +84,11 @@ CordbModule::CordbModule( m_fInMemory = modInfo.fInMemory; m_vmPEFile = modInfo.vmPEAssembly; - if (!vmDomainFile.IsNull()) + if (!vmDomainAssembly.IsNull()) { DomainFileInfo dfInfo; - pProcess->GetDAC()->GetDomainFileData(vmDomainFile, &dfInfo); // throws + pProcess->GetDAC()->GetDomainFileData(vmDomainAssembly, &dfInfo); // throws m_pAppDomain = pProcess->LookupOrCreateAppDomain(dfInfo.vmAppDomain); m_pAssembly = m_pAppDomain->LookupOrCreateAssembly(dfInfo.vmDomainAssembly); @@ -115,19 +115,19 @@ CordbModule::CordbModule( // Callback helper for code:CordbModule::DbgAssertModuleDeleted // // Arguments -// vmDomainFile - domain file in the enumeration +// vmDomainAssembly - domain file in the enumeration // pUserData - pointer to the CordbModule that we just got an exit event for. // -void DbgAssertModuleDeletedCallback(VMPTR_DomainFile vmDomainFile, void * pUserData) +void DbgAssertModuleDeletedCallback(VMPTR_DomainAssembly vmDomainAssembly, void * pUserData) { CordbModule * pThis = reinterpret_cast(pUserData); INTERNAL_DAC_CALLBACK(pThis->GetProcess()); - if (!pThis->m_vmDomainFile.IsNull()) + if (!pThis->m_vmDomainAssembly.IsNull()) { - VMPTR_DomainFile vmDomainFileDeleted = pThis->m_vmDomainFile; + VMPTR_DomainAssembly vmDomainFileDeleted = pThis->m_vmDomainAssembly; - CONSISTENCY_CHECK_MSGF((vmDomainFileDeleted != vmDomainFile), + CONSISTENCY_CHECK_MSGF((vmDomainFileDeleted != vmDomainAssembly), ("A Module Unload event was sent for a module, but it still shows up in the enumeration.\n vmDomainFileDeleted=%p\n", VmPtrToCookie(vmDomainFileDeleted))); } @@ -1499,7 +1499,7 @@ HRESULT CordbModule::EnableClassLoadCallbacks(BOOL bClassLoadCallbacks) if (m_fDynamic && !bClassLoadCallbacks) return E_INVALIDARG; - if (m_vmDomainFile.IsNull()) + if (m_vmDomainAssembly.IsNull()) return E_UNEXPECTED; // Send a Set Class Load Flag event to the left side. There is no need to wait for a response, and this can be @@ -1511,7 +1511,7 @@ HRESULT CordbModule::EnableClassLoadCallbacks(BOOL bClassLoadCallbacks) DB_IPCE_SET_CLASS_LOAD_FLAG, false, (GetAppDomain()->GetADToken())); - event.SetClassLoad.vmDomainFile = this->m_vmDomainFile; + event.SetClassLoad.vmDomainAssembly = this->m_vmDomainAssembly; event.SetClassLoad.flag = (bClassLoadCallbacks == TRUE); HRESULT hr = pProcess->m_cordb->SendIPCEvent(pProcess, &event, @@ -2041,7 +2041,7 @@ HRESULT CordbModule::ResolveTypeRef(mdTypeRef token, CordbClass **ppClass) return E_INVALIDARG; } - if (m_vmDomainFile.IsNull() || m_pAppDomain == NULL) + if (m_vmDomainAssembly.IsNull() || m_pAppDomain == NULL) { return E_UNEXPECTED; } @@ -2050,7 +2050,7 @@ HRESULT CordbModule::ResolveTypeRef(mdTypeRef token, CordbClass **ppClass) *ppClass = NULL; EX_TRY { - TypeRefData inData = {m_vmDomainFile, token}; + TypeRefData inData = {m_vmDomainAssembly, token}; TypeRefData outData; { @@ -2058,7 +2058,7 @@ HRESULT CordbModule::ResolveTypeRef(mdTypeRef token, CordbClass **ppClass) pProcess->GetDAC()->ResolveTypeReference(&inData, &outData); } - CordbModule * pModule = m_pAppDomain->LookupOrCreateModule(outData.vmDomainFile); + CordbModule * pModule = m_pAppDomain->LookupOrCreateModule(outData.vmDomainAssembly); IfFailThrow(pModule->LookupClassByToken(outData.typeToken, ppClass)); } EX_CATCH_HRESULT(hr); @@ -2271,7 +2271,7 @@ HRESULT CordbModule::ApplyChangesInternal(ULONG cbMetaData, FAIL_IF_NEUTERED(this); INTERNAL_SYNC_API_ENTRY(this->GetProcess()); // - if (m_vmDomainFile.IsNull()) + if (m_vmDomainAssembly.IsNull()) return E_UNEXPECTED; #ifdef FEATURE_ENC_SUPPORTED @@ -2288,7 +2288,7 @@ HRESULT CordbModule::ApplyChangesInternal(ULONG cbMetaData, DebuggerIPCEvent event; GetProcess()->InitIPCEvent(&event, DB_IPCE_APPLY_CHANGES, false, VMPTR_AppDomain::NullPtr()); - event.ApplyChanges.vmDomainFile = this->m_vmDomainFile; + event.ApplyChanges.vmDomainAssembly = this->m_vmDomainAssembly; // Have the left-side create a buffer for us to store the delta into ULONG cbSize = cbMetaData+cbIL; @@ -2354,7 +2354,7 @@ HRESULT CordbModule::ApplyChangesInternal(ULONG cbMetaData, CordbModule* pModule = NULL; - pModule = pAppDomain->LookupOrCreateModule(retEvent->EnCUpdate.vmDomainFile); // throws + pModule = pAppDomain->LookupOrCreateModule(retEvent->EnCUpdate.vmDomainAssembly); // throws _ASSERTE(pModule != NULL); // update to the newest version @@ -2412,7 +2412,7 @@ HRESULT CordbModule::SetJMCStatus( FAIL_IF_NEUTERED(this); ATT_REQUIRE_STOPPED_MAY_FAIL(GetProcess()); - if (m_vmDomainFile.IsNull()) + if (m_vmDomainAssembly.IsNull()) return E_UNEXPECTED; // @todo -allow the other parameters. These are functions that have default status @@ -2431,7 +2431,7 @@ HRESULT CordbModule::SetJMCStatus( // Tell the LS that this module is/is not user code DebuggerIPCEvent event; pProcess->InitIPCEvent(&event, DB_IPCE_SET_MODULE_JMC_STATUS, true, this->GetAppDomain()->GetADToken()); - event.SetJMCFunctionStatus.vmDomainFile = m_vmDomainFile; + event.SetJMCFunctionStatus.vmDomainAssembly = m_vmDomainAssembly; event.SetJMCFunctionStatus.dwStatus = fIsUserCode; @@ -2520,10 +2520,10 @@ CordbAssembly * CordbModule::ResolveAssemblyInternal(mdToken tkAssemblyRef) CordbAssembly * pAssembly = NULL; - if (!m_vmDomainFile.IsNull()) + if (!m_vmDomainAssembly.IsNull()) { // Get DAC to do the real work to resolve the assembly - VMPTR_DomainAssembly vmDomainAssembly = GetProcess()->GetDAC()->ResolveAssembly(m_vmDomainFile, tkAssemblyRef); + VMPTR_DomainAssembly vmDomainAssembly = GetProcess()->GetDAC()->ResolveAssembly(m_vmDomainAssembly, tkAssemblyRef); // now find the ICorDebugAssembly corresponding to it if (!vmDomainAssembly.IsNull() && m_pAppDomain != NULL) @@ -2694,7 +2694,7 @@ HRESULT CordbModule::SetJITCompilerFlags(DWORD dwFlags) if (SUCCEEDED(hr)) { // DD interface will check if it's a valid time to change the flags. - hr = pProcess->GetDAC()->SetCompilerFlags(GetRuntimeDomainFile(), fAllowJitOpts, fEnableEnC); + hr = pProcess->GetDAC()->SetCompilerFlags(GetRuntimeDomainAssembly(), fAllowJitOpts, fEnableEnC); } } } @@ -2730,7 +2730,7 @@ HRESULT CordbModule::GetJITCompilerFlags(DWORD *pdwFlags ) BOOL fEnableEnC; pProcess->GetDAC()->GetCompilerFlags ( - GetRuntimeDomainFile(), + GetRuntimeDomainAssembly(), &fAllowJitOpts, &fEnableEnC); diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index 59af4cc8d9c64..cc172a8c8b61d 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -2564,7 +2564,7 @@ HRESULT CordbProcess::GetTypeForObject(CORDB_ADDRESS addr, CordbAppDomain* pAppD { VMPTR_AppDomain appDomain; VMPTR_Module mod; - VMPTR_DomainFile domainFile; + VMPTR_DomainAssembly domainFile; HRESULT hr = E_FAIL; if (GetDAC()->GetAppDomainForObject(addr, &appDomain, &mod, &domainFile)) @@ -4431,15 +4431,15 @@ class ShimModuleCallbackData // Callback invoked from DAC enumeration. // // arguments: - // vmDomainFile - VMPTR for Module + // vmDomainAssembly - VMPTR for Module // pData - a 'this' pointer // - static void Callback(VMPTR_DomainFile vmDomainFile, void * pData) + static void Callback(VMPTR_DomainAssembly vmDomainAssembly, void * pData) { ShimModuleCallbackData * pThis = static_cast (pData); INTERNAL_DAC_CALLBACK(pThis->m_pProcess); - CordbModule * pModule = pThis->m_pAssembly->GetAppDomain()->LookupOrCreateModule(vmDomainFile); + CordbModule * pModule = pThis->m_pAssembly->GetAppDomain()->LookupOrCreateModule(vmDomainAssembly); pThis->SetAndMoveNext(pModule); } @@ -5065,7 +5065,7 @@ void CordbProcess::RawDispatchEvent( case DB_IPCE_METADATA_UPDATE: { - CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->MetadataUpdateData.vmDomainFile); + CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->MetadataUpdateData.vmDomainAssembly); pModule->RefreshMetaData(); } break; @@ -5073,7 +5073,7 @@ void CordbProcess::RawDispatchEvent( case DB_IPCE_LOAD_MODULE: { _ASSERTE (pAppDomain != NULL); - CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->LoadModuleData.vmDomainFile); + CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->LoadModuleData.vmDomainAssembly); { pModule->SetLoadEventContinueMarker(); @@ -5125,12 +5125,12 @@ void CordbProcess::RawDispatchEvent( { STRESS_LOG3(LF_CORDB, LL_INFO100, "RCET::HRCE: unload module on thread %#x Mod:0x%x AD:0x%08x\n", dwVolatileThreadId, - VmPtrToCookie(pEvent->UnloadModuleData.vmDomainFile), + VmPtrToCookie(pEvent->UnloadModuleData.vmDomainAssembly), VmPtrToCookie(pEvent->vmAppDomain)); PREFIX_ASSUME (pAppDomain != NULL); - CordbModule *module = pAppDomain->LookupOrCreateModule(pEvent->UnloadModuleData.vmDomainFile); + CordbModule *module = pAppDomain->LookupOrCreateModule(pEvent->UnloadModuleData.vmDomainAssembly); if (module == NULL) { @@ -5151,7 +5151,7 @@ void CordbProcess::RawDispatchEvent( pCallback1->UnloadModule(pAppDomain, module); } - pAppDomain->m_modules.RemoveBase(VmPtrToCookie(pEvent->UnloadModuleData.vmDomainFile)); + pAppDomain->m_modules.RemoveBase(VmPtrToCookie(pEvent->UnloadModuleData.vmDomainAssembly)); } break; @@ -5163,13 +5163,13 @@ void CordbProcess::RawDispatchEvent( "RCET::HRCE: load class on thread %#x Tok:0x%08x Mod:0x%08x Asm:0x%08x AD:0x%08x\n", dwVolatileThreadId, pEvent->LoadClass.classMetadataToken, - VmPtrToCookie(pEvent->LoadClass.vmDomainFile), + VmPtrToCookie(pEvent->LoadClass.vmDomainAssembly), LsPtrToCookie(pEvent->LoadClass.classDebuggerAssemblyToken), VmPtrToCookie(pEvent->vmAppDomain))); _ASSERTE (pAppDomain != NULL); - CordbModule* pModule = pAppDomain->LookupOrCreateModule(pEvent->LoadClass.vmDomainFile); + CordbModule* pModule = pAppDomain->LookupOrCreateModule(pEvent->LoadClass.vmDomainAssembly); if (pModule == NULL) { LOG((LF_CORDB, LL_INFO100, "Load Class on not-loaded Module - continue()ing!" )); @@ -5221,13 +5221,13 @@ void CordbProcess::RawDispatchEvent( "RCET::HRCE: unload class on thread %#x Tok:0x%08x Mod:0x%08x AD:0x%08x\n", dwVolatileThreadId, pEvent->UnloadClass.classMetadataToken, - VmPtrToCookie(pEvent->UnloadClass.vmDomainFile), + VmPtrToCookie(pEvent->UnloadClass.vmDomainAssembly), VmPtrToCookie(pEvent->vmAppDomain))); // get the appdomain object _ASSERTE (pAppDomain != NULL); - CordbModule *pModule = pAppDomain->LookupOrCreateModule(pEvent->UnloadClass.vmDomainFile); + CordbModule *pModule = pAppDomain->LookupOrCreateModule(pEvent->UnloadClass.vmDomainAssembly); if (pModule == NULL) { LOG((LF_CORDB, LL_INFO100, "Unload Class on not-loaded Module - continue()ing!" )); @@ -5304,7 +5304,7 @@ void CordbProcess::RawDispatchEvent( // determine first whether custom notifications for this type are enabled -- if not // we just return without doing anything. CordbClass * pNotificationClass = LookupClass(pAppDomain, - pEvent->CustomNotification.vmDomainFile, + pEvent->CustomNotification.vmDomainAssembly, pEvent->CustomNotification.classToken); // if the class is NULL, that means the debugger never enabled notifications for it. Otherwise, @@ -5580,7 +5580,7 @@ void CordbProcess::RawDispatchEvent( _ASSERTE (pAppDomain != NULL); // Find the Right Side module for this module. - CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->UpdateModuleSymsData.vmDomainFile); + CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->UpdateModuleSymsData.vmDomainAssembly); _ASSERTE(pModule != NULL); // This is a legacy event notification for updated PDBs. @@ -5654,7 +5654,7 @@ void CordbProcess::RawDispatchEvent( _ASSERTE(NULL != pAppDomain); - CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->EnCRemap.vmDomainFile); + CordbModule * pModule = pAppDomain->LookupOrCreateModule(pEvent->EnCRemap.vmDomainAssembly); PREFIX_ASSUME(pModule != NULL); CordbFunction * pCurFunction = NULL; @@ -5710,7 +5710,7 @@ void CordbProcess::RawDispatchEvent( _ASSERTE(NULL != pAppDomain); - CordbModule* pModule = pAppDomain->LookupOrCreateModule(pEvent->EnCRemap.vmDomainFile); + CordbModule* pModule = pAppDomain->LookupOrCreateModule(pEvent->EnCRemap.vmDomainAssembly); PREFIX_ASSUME(pModule != NULL); // Find the function we're remapping to, which must be the latest version @@ -14976,16 +14976,16 @@ void CordbProcess::UpdateThreadsForAdUnload(CordbAppDomain * pAppDomain) // CordbProcess::LookupClass // Looks up a previously constructed CordbClass instance without creating. May return NULL if the // CordbClass instance doesn't exist. -// Argument: (in) vmDomainFile - pointer to the domainfile for the module +// Argument: (in) vmDomainAssembly - pointer to the domainfile for the module // (in) mdTypeDef - metadata token for the class // Return value: pointer to a previously created CordbClass instance or NULL in none exists -CordbClass * CordbProcess::LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_DomainFile vmDomainFile, mdTypeDef classToken) +CordbClass * CordbProcess::LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_DomainAssembly vmDomainAssembly, mdTypeDef classToken) { _ASSERTE(ThreadHoldsProcessLock()); if (pAppDomain != NULL) { - CordbModule * pModule = ((CordbAppDomain *)pAppDomain)->m_modules.GetBase(VmPtrToCookie(vmDomainFile)); + CordbModule * pModule = ((CordbAppDomain *)pAppDomain)->m_modules.GetBase(VmPtrToCookie(vmDomainAssembly)); if (pModule != NULL) { return pModule->LookupClass(classToken); @@ -14998,7 +14998,7 @@ CordbClass * CordbProcess::LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_Do // Look for a specific module in the process. // // Arguments: -// vmDomainFile - non-null module to lookup +// vmDomainAssembly - non-null module to lookup // // Returns: // a CordbModule object for the given cookie. Object may be from the cache, or created @@ -15006,23 +15006,23 @@ CordbClass * CordbProcess::LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_Do // Never returns null. Throws on error. // // Notes: -// A VMPTR_DomainFile has appdomain affinity, but is ultimately scoped to a process. -// So if we get a raw VMPTR_DomainFile (eg, from the stackwalker or from some other +// A VMPTR_DomainAssembly has appdomain affinity, but is ultimately scoped to a process. +// So if we get a raw VMPTR_DomainAssembly (eg, from the stackwalker or from some other // lookup function), then we need to do a process wide lookup since we don't know which // appdomain it's in. If you know the appdomain, you can use code:CordbAppDomain::LookupOrCreateModule. // -CordbModule * CordbProcess::LookupOrCreateModule(VMPTR_DomainFile vmDomainFile) +CordbModule * CordbProcess::LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAssembly) { INTERNAL_API_ENTRY(this); RSLockHolder lockHolder(GetProcess()->GetProcessLock()); - _ASSERTE(!vmDomainFile.IsNull()); + _ASSERTE(!vmDomainAssembly.IsNull()); DomainFileInfo data; - GetDAC()->GetDomainFileData(vmDomainFile, &data); // throws + GetDAC()->GetDomainFileData(vmDomainAssembly, &data); // throws CordbAppDomain * pAppDomain = LookupOrCreateAppDomain(data.vmAppDomain); - return pAppDomain->LookupOrCreateModule(vmDomainFile); + return pAppDomain->LookupOrCreateModule(vmDomainAssembly); } //--------------------------------------------------------------------------------------- diff --git a/src/coreclr/debug/di/rsappdomain.cpp b/src/coreclr/debug/di/rsappdomain.cpp index 081baa95216d5..b79c295e05c6a 100644 --- a/src/coreclr/debug/di/rsappdomain.cpp +++ b/src/coreclr/debug/di/rsappdomain.cpp @@ -829,7 +829,7 @@ CordbAssembly * CordbAppDomain::LookupOrCreateAssembly(VMPTR_Assembly vmAssembly // Lookup or create a module within the appdomain // // Arguments: -// vmDomainFile - non-null module to lookup +// vmDomainAssembly - non-null module to lookup // // Returns: // a CordbModule object for the given cookie. Object may be from the cache, or created @@ -839,26 +839,26 @@ CordbAssembly * CordbAppDomain::LookupOrCreateAssembly(VMPTR_Assembly vmAssembly // Notes: // If you don't know which appdomain the module is in, use code:CordbProcess::LookupOrCreateModule. // -CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_Module vmModule, VMPTR_DomainFile vmDomainFile) +CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_Module vmModule, VMPTR_DomainAssembly vmDomainAssembly) { INTERNAL_API_ENTRY(this); CordbModule * pModule; RSLockHolder lockHolder(GetProcess()->GetProcessLock()); // @dbgtodo locking: push this up. - _ASSERTE(!vmDomainFile.IsNull() || !vmModule.IsNull()); + _ASSERTE(!vmDomainAssembly.IsNull() || !vmModule.IsNull()); // check to see if the module is present in this app domain - pModule = m_modules.GetBase(vmDomainFile.IsNull() ? VmPtrToCookie(vmModule) : VmPtrToCookie(vmDomainFile)); + pModule = m_modules.GetBase(vmDomainAssembly.IsNull() ? VmPtrToCookie(vmModule) : VmPtrToCookie(vmDomainAssembly)); if (pModule != NULL) { return pModule; } if (vmModule.IsNull()) - GetProcess()->GetDAC()->GetModuleForDomainFile(vmDomainFile, &vmModule); + GetProcess()->GetDAC()->GetModuleForDomainFile(vmDomainAssembly, &vmModule); - RSInitHolder pModuleInit(new CordbModule(GetProcess(), vmModule, vmDomainFile)); + RSInitHolder pModuleInit(new CordbModule(GetProcess(), vmModule, vmDomainAssembly)); pModule = pModuleInit.TransferOwnershipToHash(&m_modules); // The appdomains should match. @@ -868,12 +868,12 @@ CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_Module vmModule, VMPTR_D } -CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_DomainFile vmDomainFile) +CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAssembly) { INTERNAL_API_ENTRY(this); - _ASSERTE(!vmDomainFile.IsNull()); - return LookupOrCreateModule(VMPTR_Module::NullPtr(), vmDomainFile); + _ASSERTE(!vmDomainAssembly.IsNull()); + return LookupOrCreateModule(VMPTR_Module::NullPtr(), vmDomainAssembly); } @@ -890,7 +890,7 @@ CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_DomainFile vmDomainFile) // invokes this callback. // static -void CordbAppDomain::ModuleEnumerationCallback(VMPTR_DomainFile vmModule, void * pUserData) +void CordbAppDomain::ModuleEnumerationCallback(VMPTR_DomainAssembly vmModule, void * pUserData) { CONTRACTL { diff --git a/src/coreclr/debug/di/rsclass.cpp b/src/coreclr/debug/di/rsclass.cpp index 40d886de9935e..5921e2788593f 100644 --- a/src/coreclr/debug/di/rsclass.cpp +++ b/src/coreclr/debug/di/rsclass.cpp @@ -781,11 +781,11 @@ void CordbClass::Init(ClassLoadLevel desiredLoadLevel) if(desiredLoadLevel == FullInfo) { VMPTR_AppDomain vmAppDomain = VMPTR_AppDomain::NullPtr(); - VMPTR_DomainFile vmDomainFile = m_pModule->GetRuntimeDomainFile(); - if (!vmDomainFile.IsNull()) + VMPTR_DomainAssembly vmDomainAssembly = m_pModule->GetRuntimeDomainAssembly(); + if (!vmDomainAssembly.IsNull()) { DomainFileInfo info; - pDac->GetDomainFileData(vmDomainFile, &info); + pDac->GetDomainFileData(vmDomainAssembly, &info); vmAppDomain = info.vmAppDomain; } pDac->GetClassInfo(vmAppDomain, vmTypeHandle, &m_classInfo); @@ -941,7 +941,7 @@ void CordbClass::InitEnCFieldInfo(EnCHangingFieldInfo * pEncField, fieldToken, ELEMENT_TYPE_MAX, classToken, - m_pModule->GetRuntimeDomainFile()); + m_pModule->GetRuntimeDomainAssembly()); } else { @@ -966,7 +966,7 @@ void CordbClass::InitEnCFieldInfo(EnCHangingFieldInfo * pEncField, // This is used only for log messages, and could // be removed. classToken, // metadata token for the class - m_pModule->GetRuntimeDomainFile()); // Domain file for the class + m_pModule->GetRuntimeDomainAssembly()); // Domain file for the class } } // CordbClass::InitFieldData diff --git a/src/coreclr/debug/di/rsfunction.cpp b/src/coreclr/debug/di/rsfunction.cpp index b901a1ded88fe..f2384411bc0f2 100644 --- a/src/coreclr/debug/di/rsfunction.cpp +++ b/src/coreclr/debug/di/rsfunction.cpp @@ -705,7 +705,7 @@ HRESULT CordbFunction::GetILCodeAndSigToken() // and we also fallback on creating an empty ILCode object. // See issue DD 273199 for cases where IL and NGEN metadata mismatch (different RVAs). ALLOW_DATATARGET_MISSING_OR_INCONSISTENT_MEMORY( - pProcess->GetDAC()->GetILCodeAndSig(m_pModule->GetRuntimeDomainFile(), + pProcess->GetDAC()->GetILCodeAndSig(m_pModule->GetRuntimeDomainAssembly(), m_MDToken, &codeInfo, &localVarSigToken); @@ -782,7 +782,7 @@ HRESULT CordbFunction::InitParentClassOfFunction() } mdTypeDef classMetadataToken; - VMPTR_DomainFile vmDomainFile = m_pModule->GetRuntimeDomainFile(); + VMPTR_DomainAssembly vmDomainAssembly = m_pModule->GetRuntimeDomainAssembly(); classMetadataToken = InitParentClassOfFunctionHelper(m_MDToken); @@ -795,7 +795,7 @@ HRESULT CordbFunction::InitParentClassOfFunction() CordbAssembly *pAssembly = m_pModule->GetCordbAssembly(); PREFIX_ASSUME(pAssembly != NULL); - CordbModule* pClassModule = pAssembly->GetAppDomain()->LookupOrCreateModule(vmDomainFile); + CordbModule* pClassModule = pAssembly->GetAppDomain()->LookupOrCreateModule(vmDomainAssembly); PREFIX_ASSUME(pClassModule != NULL); CordbClass *pClass; @@ -850,7 +850,7 @@ HRESULT CordbFunction::InitNativeCodeInfo() // All we actually need is the start address and method desc which are cheap to get relative // to some of the other members. So far this doesn't appear to be a perf hotspot, but if it // shows up in some scenario it wouldn't be too hard to improve it - pProcess->GetDAC()->GetNativeCodeInfo(m_pModule->GetRuntimeDomainFile(), m_MDToken, &codeInfo); + pProcess->GetDAC()->GetNativeCodeInfo(m_pModule->GetRuntimeDomainAssembly(), m_MDToken, &codeInfo); } // populate the m_nativeCode pointer with the code info we found @@ -904,7 +904,7 @@ HRESULT CordbFunction::SetJMCStatus(BOOL fIsUserCode) DebuggerIPCEvent event; pProcess->InitIPCEvent(&event, DB_IPCE_SET_METHOD_JMC_STATUS, true, m_pModule->GetAppDomain()->GetADToken()); - event.SetJMCFunctionStatus.vmDomainFile = m_pModule->GetRuntimeDomainFile(); + event.SetJMCFunctionStatus.vmDomainAssembly = m_pModule->GetRuntimeDomainAssembly(); event.SetJMCFunctionStatus.funcMetadataToken = m_MDToken; event.SetJMCFunctionStatus.dwStatus = fIsUserCode; @@ -956,7 +956,7 @@ HRESULT CordbFunction::GetJMCStatus(BOOL * pfIsUserCode) // Ask the left-side if a method is user code or not. DebuggerIPCEvent event; pProcess->InitIPCEvent(&event, DB_IPCE_GET_METHOD_JMC_STATUS, true, m_pModule->GetAppDomain()->GetADToken()); - event.SetJMCFunctionStatus.vmDomainFile = m_pModule->GetRuntimeDomainFile(); + event.SetJMCFunctionStatus.vmDomainAssembly = m_pModule->GetRuntimeDomainAssembly(); event.SetJMCFunctionStatus.funcMetadataToken = m_MDToken; diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h index d927dbf3d6d6c..3e1dcd3b168f8 100644 --- a/src/coreclr/debug/di/rspriv.h +++ b/src/coreclr/debug/di/rspriv.h @@ -2511,13 +2511,13 @@ class CordbAppDomain : public CordbBase, CordbModule * GetModuleFromMetaDataInterface(IUnknown *pIMetaData); // Lookup a module from the cache. Create and to the cache if needed. - CordbModule * LookupOrCreateModule(VMPTR_Module vmModuleToken, VMPTR_DomainFile vmDomainFileToken); + CordbModule * LookupOrCreateModule(VMPTR_Module vmModuleToken, VMPTR_DomainAssembly vmDomainFileToken); // Lookup a module from the cache. Create and to the cache if needed. - CordbModule * LookupOrCreateModule(VMPTR_DomainFile vmDomainFileToken); + CordbModule * LookupOrCreateModule(VMPTR_DomainAssembly vmDomainFileToken); // Callback from DAC for module enumeration - static void ModuleEnumerationCallback(VMPTR_DomainFile vmModule, void * pUserData); + static void ModuleEnumerationCallback(VMPTR_DomainAssembly vmModule, void * pUserData); // Use DAC to add any modules for this assembly. void PrepopulateModules(); @@ -2549,7 +2549,7 @@ class CordbAppDomain : public CordbBase, // Cache of modules in this appdomain. In the VM, modules live in an assembly. // This cache lives on the appdomain because we generally want to do appdomain (or process) // wide lookup. - // This is indexed by VMPTR_DomainFile, which has appdomain affinity. + // This is indexed by VMPTR_DomainAssembly, which has appdomain affinity. // This is populated by code:CordbAppDomain::LookupOrCreateModule (which may be invoked // anytime the RS gets hold of a VMPTR), and are removed at the unload event. CordbSafeHashTable m_modules; @@ -3460,9 +3460,9 @@ class CordbProcess : // Looks up a previously constructed CordbClass instance without creating. May return NULL if the // CordbClass instance doesn't exist. - CordbClass * LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_DomainFile vmDomainFile, mdTypeDef classToken); + CordbClass * LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_DomainAssembly vmDomainAssembly, mdTypeDef classToken); - CordbModule * LookupOrCreateModule(VMPTR_DomainFile vmDomainFile); + CordbModule * LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAssembly); #ifdef FEATURE_INTEROP_DEBUGGING CordbUnmanagedThread *GetUnmanagedThread(DWORD dwThreadId) @@ -4147,7 +4147,7 @@ class CordbModule : public CordbBase, public: CordbModule(CordbProcess * process, VMPTR_Module vmModule, - VMPTR_DomainFile vmDomainFile); + VMPTR_DomainAssembly vmDomainAssembly); virtual ~CordbModule(); virtual void Neuter(); @@ -4354,9 +4354,9 @@ class CordbModule : public CordbBase, const WCHAR * GetNGenImagePath(); - const VMPTR_DomainFile GetRuntimeDomainFile () + const VMPTR_DomainAssembly GetRuntimeDomainAssembly () { - return m_vmDomainFile; + return m_vmDomainAssembly; } const VMPTR_Module GetRuntimeModule() @@ -4391,7 +4391,7 @@ class CordbModule : public CordbBase, // The real handle into the VM for a module. This is appdomain aware. // This is the primary VM counterpart for the CordbModule. - VMPTR_DomainFile m_vmDomainFile; + VMPTR_DomainAssembly m_vmDomainAssembly; VMPTR_Module m_vmModule; @@ -4806,7 +4806,7 @@ class CordbType : public CordbBase, public ICorDebugType, public ICorDebugType2 void DestNaryType(Instantiation *pInst); CorElementType GetElementType() { return m_elementType; } - VMPTR_DomainFile GetDomainAssembly(); + VMPTR_DomainAssembly GetDomainAssembly(); VMPTR_Module GetModule(); // If this is a ptr type, get the CordbType that it points to. diff --git a/src/coreclr/debug/di/rsstackwalk.cpp b/src/coreclr/debug/di/rsstackwalk.cpp index 42732435db409..b115349593fc2 100644 --- a/src/coreclr/debug/di/rsstackwalk.cpp +++ b/src/coreclr/debug/di/rsstackwalk.cpp @@ -634,7 +634,7 @@ HRESULT CordbStackWalk::GetFrameWorker(ICorDebugFrame ** ppFrame) _ASSERTE(pCurrentAppDomain != NULL); // Lookup the module - CordbModule* pModule = pCurrentAppDomain->LookupOrCreateModule(pFuncData->vmDomainFile); + CordbModule* pModule = pCurrentAppDomain->LookupOrCreateModule(pFuncData->vmDomainAssembly); PREFIX_ASSUME(pModule != NULL); // Create or look up a CordbNativeCode. There is one for each jitted instance of a method, diff --git a/src/coreclr/debug/di/rsthread.cpp b/src/coreclr/debug/di/rsthread.cpp index 577574b796019..de92c3195efab 100644 --- a/src/coreclr/debug/di/rsthread.cpp +++ b/src/coreclr/debug/di/rsthread.cpp @@ -1630,8 +1630,8 @@ HRESULT CordbThread::SetIP(bool fCanSetIPOnly, ATT_REQUIRE_STOPPED_MAY_FAIL(GetProcess()); - VMPTR_DomainFile vmDomainFile = pNativeCode->GetModule()->m_vmDomainFile; - _ASSERTE(!vmDomainFile.IsNull()); + VMPTR_DomainAssembly vmDomainAssembly = pNativeCode->GetModule()->m_vmDomainAssembly; + _ASSERTE(!vmDomainAssembly.IsNull()); // If this thread is stopped due to an exception, never allow SetIP if (HasException()) @@ -1643,7 +1643,7 @@ HRESULT CordbThread::SetIP(bool fCanSetIPOnly, GetProcess()->InitIPCEvent(&event, DB_IPCE_SET_IP, true, GetAppDomain()->GetADToken()); event.SetIP.fCanSetIPOnly = fCanSetIPOnly; event.SetIP.vmThreadToken = m_vmThreadToken; - event.SetIP.vmDomainFile = vmDomainFile; + event.SetIP.vmDomainAssembly = vmDomainAssembly; event.SetIP.mdMethod = pNativeCode->GetMetadataToken(); event.SetIP.vmMethodDesc = pNativeCode->GetVMNativeCodeMethodDescToken(); event.SetIP.startAddress = pNativeCode->GetAddress(); @@ -1655,7 +1655,7 @@ HRESULT CordbThread::SetIP(bool fCanSetIPOnly, "mod:0x%x MethodDef:0x%x offset:0x%x il?:0x%x\n", GetCurrentThreadId(), VmPtrToCookie(m_vmThreadToken), - VmPtrToCookie(vmDomainFile), + VmPtrToCookie(vmDomainAssembly), pNativeCode->GetMetadataToken(), offset, fIsIL)); @@ -5265,7 +5265,7 @@ CordbInternalFrame::CordbInternalFrame(CordbThread * pThread, // Find the module of the function. Note that this module isn't necessarily in the same domain as our frame. // FuncEval frames can point to methods they are going to invoke in another domain. CordbModule * pModule = NULL; - pModule = GetProcess()->LookupOrCreateModule(pData->stubFrame.vmDomainFile); + pModule = GetProcess()->LookupOrCreateModule(pData->stubFrame.vmDomainAssembly); _ASSERTE(pModule != NULL); // @@ -9661,7 +9661,7 @@ HRESULT CordbEval::CallParameterizedFunction(ICorDebugFunction *pFunction, event.FuncEval.vmThreadToken = m_thread->m_vmThreadToken; event.FuncEval.funcEvalType = m_evalType; event.FuncEval.funcMetadataToken = m_function->GetMetadataToken(); - event.FuncEval.vmDomainFile = m_function->GetModule()->GetRuntimeDomainFile(); + event.FuncEval.vmDomainAssembly = m_function->GetModule()->GetRuntimeDomainAssembly(); event.FuncEval.funcEvalKey = hFuncEval.Ptr(); event.FuncEval.argCount = nArgs; event.FuncEval.genericArgsCount = nTypeArgs; @@ -9844,7 +9844,7 @@ HRESULT CordbEval::NewParameterizedObject(ICorDebugFunction * pConstructor, event.FuncEval.vmThreadToken = m_thread->m_vmThreadToken; event.FuncEval.funcEvalType = m_evalType; event.FuncEval.funcMetadataToken = m_function->GetMetadataToken(); - event.FuncEval.vmDomainFile = m_function->GetModule()->GetRuntimeDomainFile(); + event.FuncEval.vmDomainAssembly = m_function->GetModule()->GetRuntimeDomainAssembly(); event.FuncEval.funcEvalKey = hFuncEval.Ptr(); event.FuncEval.argCount = nArgs; event.FuncEval.genericArgsCount = nTypeArgs; @@ -9945,7 +9945,7 @@ HRESULT CordbEval::NewParameterizedObjectNoConstructor(ICorDebugClass * pClass, event.FuncEval.funcEvalType = m_evalType; event.FuncEval.funcMetadataToken = mdMethodDefNil; event.FuncEval.funcClassMetadataToken = (mdTypeDef)m_class->m_id; - event.FuncEval.vmDomainFile = m_class->GetModule()->GetRuntimeDomainFile(); + event.FuncEval.vmDomainAssembly = m_class->GetModule()->GetRuntimeDomainAssembly(); event.FuncEval.funcEvalKey = hFuncEval.Ptr(); event.FuncEval.argCount = 0; event.FuncEval.genericArgsCount = nTypeArgs; @@ -10040,7 +10040,7 @@ HRESULT CordbEval::NewStringWithLength(LPCWSTR wszString, UINT iLength) // Note: no function or module here... event.FuncEval.funcMetadataToken = mdMethodDefNil; event.FuncEval.funcClassMetadataToken = mdTypeDefNil; - event.FuncEval.vmDomainFile = VMPTR_DomainFile::NullPtr(); + event.FuncEval.vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); event.FuncEval.argCount = 0; event.FuncEval.genericArgsCount = 0; event.FuncEval.genericArgsNodeCount = 0; @@ -10157,7 +10157,7 @@ HRESULT CordbEval::NewParameterizedArray(ICorDebugType * pElementType, // Note: no function or module here... event.FuncEval.funcMetadataToken = mdMethodDefNil; event.FuncEval.funcClassMetadataToken = mdTypeDefNil; - event.FuncEval.vmDomainFile = VMPTR_DomainFile::NullPtr(); + event.FuncEval.vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); event.FuncEval.argCount = 0; event.FuncEval.genericArgsCount = 1; diff --git a/src/coreclr/debug/di/rstype.cpp b/src/coreclr/debug/di/rstype.cpp index 0605dcf09f607..af6a8f5e14a58 100644 --- a/src/coreclr/debug/di/rstype.cpp +++ b/src/coreclr/debug/di/rstype.cpp @@ -1191,7 +1191,7 @@ HRESULT CordbType::TypeDataToType(CordbAppDomain *pAppDomain, DebuggerIPCE_Basic DebuggerIPCE_ExpandedTypeData e; e.elementType = et; e.ClassTypeData.metadataToken = data->metadataToken; - e.ClassTypeData.vmDomainFile = data->vmDomainFile; + e.ClassTypeData.vmDomainAssembly = data->vmDomainAssembly; e.ClassTypeData.vmModule = data->vmModule; e.ClassTypeData.typeHandle = data->vmTypeHandle; return CordbType::TypeDataToType(pAppDomain, &e, pRes); @@ -1254,7 +1254,7 @@ HRESULT CordbType::TypeDataToType(CordbAppDomain *pAppDomain, DebuggerIPCE_Expan CordbModule * pClassModule = NULL; EX_TRY { - pClassModule = pAppDomain->LookupOrCreateModule(data->ClassTypeData.vmModule, data->ClassTypeData.vmDomainFile); + pClassModule = pAppDomain->LookupOrCreateModule(data->ClassTypeData.vmModule, data->ClassTypeData.vmDomainAssembly); } EX_CATCH_HRESULT(hr); if( pClassModule == NULL ) @@ -1611,7 +1611,7 @@ HRESULT CordbType::InitStringOrObjectClass(BOOL fForceInit) // CordbProcess *pProcess = GetProcess(); mdTypeDef metadataToken; - VMPTR_DomainFile vmDomainFile = VMPTR_DomainFile::NullPtr(); + VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); VMPTR_Module vmModule = VMPTR_Module::NullPtr(); { @@ -1620,13 +1620,13 @@ HRESULT CordbType::InitStringOrObjectClass(BOOL fForceInit) m_elementType, &metadataToken, &vmModule, - &vmDomainFile); + &vmDomainAssembly); } // // Step 2) Lookup CordbClass based off token + Module. // - CordbModule * pTypeModule = m_appdomain->LookupOrCreateModule(vmModule, vmDomainFile); + CordbModule * pTypeModule = m_appdomain->LookupOrCreateModule(vmModule, vmDomainAssembly); _ASSERTE(pTypeModule != NULL); IfFailThrow(pTypeModule->LookupOrCreateClass(metadataToken, &m_pClass)); @@ -1704,7 +1704,7 @@ HRESULT CordbType::InitInstantiationFieldInfo(BOOL fForceInit) // this may be called multiple times. Each call will discard previous values in m_fieldList and reinitialize // the list with updated information RSLockHolder lockHolder(pProcess->GetProcessLock()); - pProcess->GetDAC()->GetInstantiationFieldInfo(m_pClass->GetModule()->GetRuntimeDomainFile(), + pProcess->GetDAC()->GetInstantiationFieldInfo(m_pClass->GetModule()->GetRuntimeDomainAssembly(), m_typeHandleExact, typeHandleApprox, &m_fieldList, @@ -1876,23 +1876,23 @@ CordbType::GetUnboxedObjectSize(ULONG32 *pObjectSize) } } -VMPTR_DomainFile CordbType::GetDomainAssembly() +VMPTR_DomainAssembly CordbType::GetDomainAssembly() { if (m_pClass != NULL) { CordbModule * pModule = m_pClass->GetModule(); if (pModule) { - return pModule->m_vmDomainFile; + return pModule->m_vmDomainAssembly; } else { - return VMPTR_DomainFile::NullPtr(); + return VMPTR_DomainAssembly::NullPtr(); } } else { - return VMPTR_DomainFile::NullPtr(); + return VMPTR_DomainAssembly::NullPtr(); } } @@ -1937,7 +1937,7 @@ HRESULT CordbType::TypeToBasicTypeData(DebuggerIPCE_BasicTypeData *data) case ELEMENT_TYPE_PTR: data->elementType = m_elementType; data->metadataToken = mdTokenNil; - data->vmDomainFile = VMPTR_DomainFile::NullPtr(); + data->vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); data->vmTypeHandle = m_typeHandleExact; if (data->vmTypeHandle.IsNull()) { @@ -1950,7 +1950,7 @@ HRESULT CordbType::TypeToBasicTypeData(DebuggerIPCE_BasicTypeData *data) _ASSERTE(m_pClass != NULL); data->elementType = m_pClass->IsValueClassNoInit() ? ELEMENT_TYPE_VALUETYPE : ELEMENT_TYPE_CLASS; data->metadataToken = m_pClass->MDToken(); - data->vmDomainFile = GetDomainAssembly(); + data->vmDomainAssembly = GetDomainAssembly(); data->vmTypeHandle = m_typeHandleExact; if (m_pClass->HasTypeParams() && data->vmTypeHandle.IsNull()) { @@ -1961,7 +1961,7 @@ HRESULT CordbType::TypeToBasicTypeData(DebuggerIPCE_BasicTypeData *data) // This includes all the "primitive" types, in which CorElementType is a sufficient description. data->elementType = m_elementType; data->metadataToken = mdTokenNil; - data->vmDomainFile = VMPTR_DomainFile::NullPtr(); + data->vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); data->vmTypeHandle = VMPTR_TypeHandle::NullPtr(); break; } @@ -2001,7 +2001,7 @@ void CordbType::TypeToExpandedTypeData(DebuggerIPCE_ExpandedTypeData *data) { data->elementType = m_pClass->IsValueClassNoInit() ? ELEMENT_TYPE_VALUETYPE : ELEMENT_TYPE_CLASS; data->ClassTypeData.metadataToken = m_pClass->GetToken(); - data->ClassTypeData.vmDomainFile = GetDomainAssembly(); + data->ClassTypeData.vmDomainAssembly = GetDomainAssembly(); data->ClassTypeData.vmModule = GetModule(); data->ClassTypeData.typeHandle = VMPTR_TypeHandle::NullPtr(); @@ -2339,14 +2339,14 @@ HRESULT CordbType::GetTypeID(COR_TYPEID *pId) { mdTypeDef mdToken; VMPTR_Module vmModule = VMPTR_Module::NullPtr(); - VMPTR_DomainFile vmDomainFile = VMPTR_DomainFile::NullPtr(); + VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::NullPtr(); // get module and token of the simple type GetProcess()->GetDAC()->GetSimpleType(GetAppDomain()->GetADToken(), et, &mdToken, &vmModule, - &vmDomainFile); + &vmDomainAssembly); vmTypeHandle = GetProcess()->GetDAC()->GetTypeHandle(vmModule, mdToken); } diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 532753f31b12e..3eec67822e7b3 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -1347,7 +1347,7 @@ DebuggerEval::DebuggerEval(CONTEXT * pContext, DebuggerIPCE_FuncEvalInfo * pEval // could get unloaded between now and when the funceval actually starts. So we stash an // AppDomain ID which is safe to use after the AD is unloaded. It's only safe to // use the DebuggerModule* after we've verified the ADID is still valid (i.e. by entering that domain). - m_debuggerModule = g_pDebugger->LookupOrCreateModule(pEvalInfo->vmDomainFile); + m_debuggerModule = g_pDebugger->LookupOrCreateModule(pEvalInfo->vmDomainAssembly); m_funcEvalKey = pEvalInfo->funcEvalKey; m_argCount = pEvalInfo->argCount; m_targetCodeAddr = NULL; @@ -5211,19 +5211,19 @@ DebuggerModule * Debugger::LookupOrCreateModule(DomainAssembly * pDomainAssembly return pDModule; } -// Overloaded Wrapper around for VMPTR_DomainFile-->DomainAssembly* +// Overloaded Wrapper around for VMPTR_DomainAssembly-->DomainAssembly* // // Arguments: -// vmDomainFile - VMPTR cookie for a domain file. This can be NullPtr(). +// vmDomainAssembly - VMPTR cookie for a domain file. This can be NullPtr(). // // Returns: // Debugger Module instance for the given domain file. May be lazily created. // // Notes: // VMPTR comes from IPC events -DebuggerModule * Debugger::LookupOrCreateModule(VMPTR_DomainFile vmDomainFile) +DebuggerModule * Debugger::LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAssembly) { - DomainAssembly * pDomainAssembly = vmDomainFile.GetRawPtr(); + DomainAssembly * pDomainAssembly = vmDomainAssembly.GetRawPtr(); if (pDomainAssembly == NULL) { return NULL; @@ -6246,7 +6246,7 @@ void Debugger::LockAndSendEnCRemapEvent(DebuggerJitInfo * dji, SIZE_T currentIP, Module *pRuntimeModule = pFD->GetModule(); DebuggerModule * pDModule = LookupOrCreateModule(pRuntimeModule, thread->GetDomain()); - ipce->EnCRemap.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); + ipce->EnCRemap.vmDomainAssembly.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); LOG((LF_CORDB, LL_INFO10000, "D::LASEnCRE: %s::%s " "dmod:0x%x, methodDef:0x%x \n", @@ -6315,7 +6315,7 @@ void Debugger::LockAndSendEnCRemapCompleteEvent(MethodDesc *pFD) Module *pRuntimeModule = pFD->GetModule(); DebuggerModule * pDModule = LookupOrCreateModule(pRuntimeModule, thread->GetDomain()); - ipce->EnCRemapComplete.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); + ipce->EnCRemapComplete.vmDomainAssembly.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); LOG((LF_CORDB, LL_INFO10000, "D::LASEnCRC: %s::%s " @@ -6381,7 +6381,7 @@ void Debugger::SendEnCUpdateEvent(DebuggerIPCEventType eventType, _ASSERTE(pModule->GetDomain()->IsAppDomain()); DebuggerModule * pDModule = LookupOrCreateModule(pModule, pModule->GetDomain()->AsAppDomain()); - event->EnCUpdate.vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); + event->EnCUpdate.vmDomainAssembly.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); m_pRCThread->SendIPCEvent(); @@ -9477,7 +9477,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, DebuggerIPCEvent eventMetadataUpdate; InitIPCEvent(&eventMetadataUpdate, DB_IPCE_METADATA_UPDATE, NULL, pAppDomain); - eventMetadataUpdate.MetadataUpdateData.vmDomainFile.SetRawPtr(pManifestDomainFile); + eventMetadataUpdate.MetadataUpdateData.vmDomainAssembly.SetRawPtr(pManifestDomainFile); SendRawEvent(&eventMetadataUpdate); } @@ -9520,7 +9520,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, ipce = m_pRCThread->GetIPCEventSendBuffer(); InitIPCEvent(ipce,DB_IPCE_LOAD_MODULE, pThread, pAppDomain); - ipce->LoadModuleData.vmDomainFile.SetRawPtr(pDomainAssembly); + ipce->LoadModuleData.vmDomainAssembly.SetRawPtr(pDomainAssembly); m_pRCThread->SendIPCEvent(); @@ -9588,7 +9588,7 @@ void Debugger::SendRawUpdateModuleSymsEvent(Module *pRuntimeModule, AppDomain *p g_pEEInterface->GetThread(), pAppDomain); - ipce->UpdateModuleSymsData.vmDomainFile.SetRawPtr((module ? module->GetDomainAssembly() : NULL)); + ipce->UpdateModuleSymsData.vmDomainAssembly.SetRawPtr((module ? module->GetDomainAssembly() : NULL)); m_pRCThread->SendIPCEvent(); } @@ -9705,7 +9705,7 @@ void Debugger::UnloadModule(Module* pRuntimeModule, // Send the unload module event to the Right Side. DebuggerIPCEvent* ipce = m_pRCThread->GetIPCEventSendBuffer(); InitIPCEvent(ipce, DB_IPCE_UNLOAD_MODULE, thread, pAppDomain); - ipce->UnloadModuleData.vmDomainFile.SetRawPtr((module ? module->GetDomainAssembly() : NULL)); + ipce->UnloadModuleData.vmDomainAssembly.SetRawPtr((module ? module->GetDomainAssembly() : NULL)); ipce->UnloadModuleData.debuggerAssemblyToken.Set(pRuntimeModule->GetClassLoader()->GetAssembly()); m_pRCThread->SendIPCEvent(); @@ -9877,7 +9877,7 @@ void Debugger::SendClassLoadUnloadEvent (mdTypeDef classMetadataToken, InitIPCEvent(pEvent, DB_IPCE_LOAD_CLASS, g_pEEInterface->GetThread(), pAppDomain); pEvent->LoadClass.classMetadataToken = classMetadataToken; - pEvent->LoadClass.vmDomainFile.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainAssembly() : NULL)); + pEvent->LoadClass.vmDomainAssembly.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainAssembly() : NULL)); pEvent->LoadClass.classDebuggerAssemblyToken.Set(pAssembly); @@ -9889,7 +9889,7 @@ void Debugger::SendClassLoadUnloadEvent (mdTypeDef classMetadataToken, InitIPCEvent(pEvent, DB_IPCE_UNLOAD_CLASS, g_pEEInterface->GetThread(), pAppDomain); pEvent->UnloadClass.classMetadataToken = classMetadataToken; - pEvent->UnloadClass.vmDomainFile.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainAssembly() : NULL)); + pEvent->UnloadClass.vmDomainAssembly.SetRawPtr((pClassDebuggerModule ? pClassDebuggerModule->GetDomainAssembly() : NULL)); pEvent->UnloadClass.classDebuggerAssemblyToken.Set(pAssembly); } @@ -10528,7 +10528,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) _ASSERTE(hr == S_OK); DebuggerBreakpoint * pDebuggerBP = NULL; - DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->BreakpointData.vmDomainFile); + DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->BreakpointData.vmDomainAssembly); Module * pModule = pDebuggerModule->GetRuntimeModule(); DebuggerMethodInfo * pDMI = GetOrCreateMethodInfo(pModule, pEvent->BreakpointData.funcMetadataToken); MethodDesc * pMethodDesc = pEvent->BreakpointData.nativeCodeMethodDescToken.UnWrap(); @@ -10847,7 +10847,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) { LOG((LF_ENC, LL_INFO100, "D::HIPCE: DB_IPCE_APPLY_CHANGES 1\n")); - DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->ApplyChanges.vmDomainFile); + DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->ApplyChanges.vmDomainAssembly); // // @todo handle error. // @@ -10864,7 +10864,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) case DB_IPCE_SET_CLASS_LOAD_FLAG: { - DebuggerModule *pDebuggerModule = LookupOrCreateModule(pEvent->SetClassLoad.vmDomainFile); + DebuggerModule *pDebuggerModule = LookupOrCreateModule(pEvent->SetClassLoad.vmDomainAssembly); _ASSERTE(pDebuggerModule != NULL); @@ -10914,7 +10914,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.vmDomainFile.GetRawPtr()->GetModule(); + Module * pModule = pEvent->SetIP.vmDomainAssembly.GetRawPtr()->GetModule(); // Get the DJI for this function DebuggerMethodInfo * pDMI = GetOrCreateMethodInfo(pModule, pEvent->SetIP.mdMethod); @@ -11244,7 +11244,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) case DB_IPCE_SET_METHOD_JMC_STATUS: { // Get the info out of the event - DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->SetJMCFunctionStatus.vmDomainFile); + DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->SetJMCFunctionStatus.vmDomainAssembly); Module * pModule = pDebuggerModule->GetRuntimeModule(); bool fStatus = (pEvent->SetJMCFunctionStatus.dwStatus != 0); @@ -11292,7 +11292,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) case DB_IPCE_GET_METHOD_JMC_STATUS: { // Get the method - DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->SetJMCFunctionStatus.vmDomainFile); + DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->SetJMCFunctionStatus.vmDomainAssembly); Module * pModule = pDebuggerModule->GetRuntimeModule(); @@ -11326,7 +11326,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) case DB_IPCE_SET_MODULE_JMC_STATUS: { // Get data out of event - DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->SetJMCFunctionStatus.vmDomainFile); + DebuggerModule * pDebuggerModule = LookupOrCreateModule(pEvent->SetJMCFunctionStatus.vmDomainAssembly); bool fStatus = (pEvent->SetJMCFunctionStatus.dwStatus != 0); @@ -11818,7 +11818,7 @@ void Debugger::TypeHandleToBasicTypeInfo(AppDomain *pAppDomain, TypeHandle th, D case ELEMENT_TYPE_BYREF: res->vmTypeHandle = WrapTypeHandle(th); res->metadataToken = mdTokenNil; - res->vmDomainFile.SetRawPtr(NULL); + res->vmDomainAssembly.SetRawPtr(NULL); break; case ELEMENT_TYPE_CLASS: @@ -11828,14 +11828,14 @@ void Debugger::TypeHandleToBasicTypeInfo(AppDomain *pAppDomain, TypeHandle th, D // only set if instantiated res->metadataToken = th.GetCl(); DebuggerModule * pDModule = LookupOrCreateModule(th.GetModule(), pAppDomain); - res->vmDomainFile.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); + res->vmDomainAssembly.SetRawPtr((pDModule ? pDModule->GetDomainAssembly() : NULL)); break; } default: res->vmTypeHandle = VMPTR_TypeHandle::NullPtr(); res->metadataToken = mdTokenNil; - res->vmDomainFile.SetRawPtr(NULL); + res->vmDomainAssembly.SetRawPtr(NULL); break; } return; @@ -11907,8 +11907,8 @@ void Debugger::TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, res->ClassTypeData.typeHandle = th.HasInstantiation() ? WrapTypeHandle(th) : VMPTR_TypeHandle::NullPtr(); // only set if instantiated res->ClassTypeData.metadataToken = th.GetCl(); DebuggerModule * pModule = LookupOrCreateModule(th.GetModule(), pAppDomain); - res->ClassTypeData.vmDomainFile.SetRawPtr((pModule ? pModule->GetDomainAssembly() : NULL)); - _ASSERTE(!res->ClassTypeData.vmDomainFile.IsNull()); + res->ClassTypeData.vmDomainAssembly.SetRawPtr((pModule ? pModule->GetDomainAssembly() : NULL)); + _ASSERTE(!res->ClassTypeData.vmDomainAssembly.IsNull()); break; } @@ -11968,7 +11968,7 @@ HRESULT Debugger::BasicTypeInfoToTypeHandle(DebuggerIPCE_BasicTypeData *data, Ty } else { - DebuggerModule *pDebuggerModule = g_pDebugger->LookupOrCreateModule(data->vmDomainFile); + DebuggerModule *pDebuggerModule = g_pDebugger->LookupOrCreateModule(data->vmDomainAssembly); th = g_pEEInterface->FindLoadedClass(pDebuggerModule->GetRuntimeModule(), data->metadataToken); if (th.IsNull()) @@ -12070,7 +12070,7 @@ TypeHandle Debugger::TypeDataWalk::ReadTypeHandle() case ELEMENT_TYPE_CLASS: case ELEMENT_TYPE_VALUETYPE: { - DebuggerModule *pDebuggerModule = g_pDebugger->LookupOrCreateModule(data->data.ClassTypeData.vmDomainFile); + DebuggerModule *pDebuggerModule = g_pDebugger->LookupOrCreateModule(data->data.ClassTypeData.vmDomainAssembly); th = ReadInstantiation(pDebuggerModule->GetRuntimeModule(), data->data.ClassTypeData.metadataToken, data->numTypeArgs); break; } @@ -14434,10 +14434,10 @@ void Debugger::SendCustomDebuggerNotification(Thread * pThread, curThread, curThread->GetDomain()); - VMPTR_DomainFile vmDomainFile = VMPTR_DomainFile::MakePtr(pDomain); + VMPTR_DomainAssembly vmDomainAssembly = VMPTR_DomainAssembly::MakePtr(pDomain); ipce->CustomNotification.classToken = classToken; - ipce->CustomNotification.vmDomainFile = vmDomainFile; + ipce->CustomNotification.vmDomainAssembly = vmDomainAssembly; m_pRCThread->SendIPCEvent(); diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h index 62e41b9bab4cc..513274220e24d 100644 --- a/src/coreclr/debug/ee/debugger.h +++ b/src/coreclr/debug/ee/debugger.h @@ -2068,7 +2068,7 @@ class Debugger : public DebugInterface bool HandleIPCEvent(DebuggerIPCEvent* event); - DebuggerModule * LookupOrCreateModule(VMPTR_DomainFile vmDomainFile); + DebuggerModule * LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAssembly); DebuggerModule * LookupOrCreateModule(DomainAssembly * pDomainAssembly); DebuggerModule * LookupOrCreateModule(Module * pModule, AppDomain * pAppDomain); diff --git a/src/coreclr/debug/inc/dacdbiinterface.h b/src/coreclr/debug/inc/dacdbiinterface.h index 13ec64c4be3a5..17599b3359b36 100644 --- a/src/coreclr/debug/inc/dacdbiinterface.h +++ b/src/coreclr/debug/inc/dacdbiinterface.h @@ -598,17 +598,17 @@ class IDacDbiInterface // Get properties for a DomainAssembly // // Arguments: - // vmDomainFile - vm handle to a DomainAssembly + // vmDomainAssembly - vm handle to a DomainAssembly // pData - required out parameter which will be filled out with module properties // // Notes: // See definition of DomainFileInfo for more details about what properties // this gives back. virtual - void GetDomainFileData(VMPTR_DomainFile vmDomainFile, OUT DomainFileInfo * pData) = 0; + void GetDomainFileData(VMPTR_DomainAssembly vmDomainAssembly, OUT DomainFileInfo * pData) = 0; virtual - void GetModuleForDomainFile(VMPTR_DomainFile vmDomainFile, OUT VMPTR_Module * pModule) = 0; + void GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule) = 0; //......................................................................... // These methods were the methods that DBI was calling from IXClrData in V2. @@ -672,7 +672,7 @@ class IDacDbiInterface // Get the values of the JIT Optimization and EnC flags. // // Arguments: - // vmDomainFile - (input) VM DomainAssembly (module) for which we are retrieving flags + // vmDomainAssembly - (input) VM DomainAssembly (module) for which we are retrieving flags // pfAllowJITOpts - (mandatory output) true iff this is not compiled for debug, // i.e., without optimization // pfEnableEnc - (mandatory output) true iff this module has EnC enabled @@ -687,7 +687,7 @@ class IDacDbiInterface virtual void GetCompilerFlags( - VMPTR_DomainFile vmDomainFile, + VMPTR_DomainAssembly vmDomainAssembly, OUT BOOL * pfAllowJITOpts, OUT BOOL * pfEnableEnC) = 0; @@ -695,7 +695,7 @@ class IDacDbiInterface // Set the values of the JIT optimization and EnC flags. // // Arguments: - // vmDomainFile - (input) VM DomainAssembly (module) for which we are retrieving flags + // vmDomainAssembly - (input) VM DomainAssembly (module) for which we are retrieving flags // pfAllowJITOpts - (input) true iff this should not be compiled for debug, // i.e., without optimization // pfEnableEnc - (input) true iff this module should have EnC enabled. If this is @@ -717,7 +717,7 @@ class IDacDbiInterface //......................................................................... virtual - HRESULT SetCompilerFlags(VMPTR_DomainFile vmDomainFile, + HRESULT SetCompilerFlags(VMPTR_DomainAssembly vmDomainAssembly, BOOL fAllowJitOpts, BOOL fEnableEnC) = 0; @@ -784,7 +784,7 @@ class IDacDbiInterface // Arguments: // vmModule - new module from the enumeration // pUserData - user data passed to EnumerateModulesInAssembly - typedef void (*FP_MODULE_ENUMERATION_CALLBACK)(VMPTR_DomainFile vmModule, CALLBACK_DATA pUserData); + typedef void (*FP_MODULE_ENUMERATION_CALLBACK)(VMPTR_DomainAssembly vmModule, CALLBACK_DATA pUserData); // // Enumerates all the code Modules in an assembly. @@ -1277,7 +1277,7 @@ class IDacDbiInterface // The debugger can't duplicate this policy with 100% accuracy, and // so we need DAC to lookup the assembly that was actually loaded. virtual - VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainFile vmScope, mdToken tkAssemblyRef) = 0; + VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainAssembly vmScope, mdToken tkAssemblyRef) = 0; //----------------------------------------------------------------------------- // Interface for initializing the native/IL sequence points and native var info @@ -1707,13 +1707,13 @@ class IDacDbiInterface // // Arguments: // Input: - // vmDomainFile - module containing metadata for the method + // vmDomainAssembly - module containing metadata for the method // functionToken - metadata token for the function // Output (required): // codeInfo - start address and size of the IL // pLocalSigToken - signature token for the method virtual - void GetILCodeAndSig(VMPTR_DomainFile vmDomainFile, + void GetILCodeAndSig(VMPTR_DomainAssembly vmDomainAssembly, mdToken functionToken, OUT TargetBuffer * pCodeInfo, OUT mdToken * pLocalSigToken) = 0; @@ -1723,7 +1723,7 @@ class IDacDbiInterface // and hot and cold region information. // Arguments: // Input: - // vmDomainFile - module containing metadata for the method + // vmDomainAssembly - module containing metadata for the method // functionToken - token for the function for which we need code info // Output (required): // pCodeInfo - data structure describing the native code regions. @@ -1733,7 +1733,7 @@ class IDacDbiInterface // invalid (i.e., pCodeInfo->IsValid is false). virtual - void GetNativeCodeInfo(VMPTR_DomainFile vmDomainFile, + void GetNativeCodeInfo(VMPTR_DomainAssembly vmDomainAssembly, mdToken functionToken, OUT NativeCodeFunctionData * pCodeInfo) = 0; @@ -1798,7 +1798,7 @@ class IDacDbiInterface // get field information and object size for an instantiated generic // // Arguments: - // input: vmDomainFile - module containing metadata for the type + // input: vmDomainAssembly - module containing metadata for the type // thExact - exact type handle for type (may be NULL) // thApprox - approximate type handle for the type // output: @@ -1807,7 +1807,7 @@ class IDacDbiInterface // pObjectSize - size of the instantiated object // virtual - void GetInstantiationFieldInfo (VMPTR_DomainFile vmDomainFile, + void GetInstantiationFieldInfo (VMPTR_DomainAssembly vmDomainAssembly, VMPTR_TypeHandle vmThExact, VMPTR_TypeHandle vmThApprox, OUT DacDbiArrayList * pFieldList, @@ -1992,12 +1992,12 @@ class IDacDbiInterface // input: vmAppDomain - Appdomain in which simpleType resides // simpleType - CorElementType value corresponding to a simple type // output: pMetadataToken - the metadata token corresponding to simpleType, - // in the scope of vmDomainFile. - // vmDomainFile - the domainFile for simpleType + // in the scope of vmDomainAssembly. + // vmDomainAssembly - the domainFile for simpleType // Notes: // This is inspection-only. If the type is not yet loaded, it will throw CORDBG_E_CLASS_NOT_LOADED. // It will not try to load a type. - // If the type has been loaded, vmDomainFile will be non-null unless the target is somehow corrupted. + // If the type has been loaded, vmDomainAssembly will be non-null unless the target is somehow corrupted. // In that case, we will throw CORDBG_E_TARGET_INCONSISTENT. virtual @@ -2005,7 +2005,7 @@ class IDacDbiInterface CorElementType simpleType, OUT mdTypeDef * pMetadataToken, OUT VMPTR_Module * pVmModule, - OUT VMPTR_DomainFile * pVmDomainFile) = 0; + OUT VMPTR_DomainAssembly * pVmDomainAssembly) = 0; // for the specified object returns TRUE if the object derives from System.Exception virtual @@ -2459,7 +2459,7 @@ class IDacDbiInterface virtual bool GetAppDomainForObject(CORDB_ADDRESS obj, OUT VMPTR_AppDomain * pApp, OUT VMPTR_Module * pModule, - OUT VMPTR_DomainFile * pDomainAssembly) = 0; + OUT VMPTR_DomainAssembly * pDomainAssembly) = 0; // Reference Walking. @@ -2731,7 +2731,7 @@ class IDacDbiInterface HRESULT GetDelegateFunctionData( DelegateType delegateType, VMPTR_Object delegateObject, - OUT VMPTR_DomainFile *ppFunctionDomainFile, + OUT VMPTR_DomainAssembly *ppFunctionDomainFile, OUT mdMethodDef *pMethodDef) = 0; virtual diff --git a/src/coreclr/debug/inc/dacdbistructures.h b/src/coreclr/debug/inc/dacdbistructures.h index 0b3449333b87b..0a8de378b64d6 100644 --- a/src/coreclr/debug/inc/dacdbistructures.h +++ b/src/coreclr/debug/inc/dacdbistructures.h @@ -162,7 +162,7 @@ struct MSLAYOUT TargetBuffer //=================================================================================== // Module properties, retrieved by DAC. -// Describes a VMPTR_DomainFile representing a module. +// Describes a VMPTR_DomainAssembly representing a module. // In the VM, a raw Module may be domain neutral and shared by many appdomains. // Whereas a DomainAssembly is like a { AppDomain, Module} pair. DomainAssembly corresponds // much more to ICorDebugModule (which also has appdomain affinity). @@ -624,7 +624,7 @@ class MSLAYOUT EnCHangingFieldInfo mdFieldDef fieldToken, CorElementType elementType, mdTypeDef metadataToken, - VMPTR_DomainFile vmDomainFile); + VMPTR_DomainAssembly vmDomainAssembly); DebuggerIPCE_BasicTypeData GetObjectTypeData() const { return m_objectTypeData; }; mdFieldDef GetFieldToken() const { return m_fldToken; }; @@ -660,7 +660,7 @@ enum AreValueTypesBoxed { NoValueTypeBoxing, OnlyPrimitivesUnboxed, AllBoxed }; typedef struct MSLAYOUT { // domain file for the type - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; // metadata token for the type. This may be a typeRef (for requests) or a typeDef (for responses). mdToken typeToken; } TypeRefData; @@ -746,7 +746,7 @@ struct MSLAYOUT DacGcReference struct MSLAYOUT DacExceptionCallStackData { VMPTR_AppDomain vmAppDomain; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; CORDB_ADDRESS ip; mdMethodDef methodDef; BOOL isLastForeignExceptionFrame; diff --git a/src/coreclr/debug/inc/dacdbistructures.inl b/src/coreclr/debug/inc/dacdbistructures.inl index f9c0404b659c4..84dd234319863 100644 --- a/src/coreclr/debug/inc/dacdbistructures.inl +++ b/src/coreclr/debug/inc/dacdbistructures.inl @@ -712,14 +712,14 @@ void EnCHangingFieldInfo::Init(VMPTR_Object pObject, mdFieldDef fieldToken, CorElementType elementType, mdTypeDef metadataToken, - VMPTR_DomainFile vmDomainFile) + VMPTR_DomainAssembly vmDomainAssembly) { m_vmObject = pObject; m_offsetToVars = offset; m_fldToken = fieldToken; m_objectTypeData.elementType = elementType; m_objectTypeData.metadataToken = metadataToken; - m_objectTypeData.vmDomainFile = vmDomainFile; + m_objectTypeData.vmDomainAssembly = vmDomainAssembly; } diff --git a/src/coreclr/debug/inc/dbgipcevents.h b/src/coreclr/debug/inc/dbgipcevents.h index 9a3ee4ad5349a..105ddb0d94b2a 100644 --- a/src/coreclr/debug/inc/dbgipcevents.h +++ b/src/coreclr/debug/inc/dbgipcevents.h @@ -851,7 +851,7 @@ typedef VMPTR_Base VMPTR_CONTEXT; // For domain-neutral modules (like CoreLib), there is a DomainAssembly instance // for each appdomain the module lives in. // This is the canonical handle ICorDebug uses to a CLR module. -DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainFile); +DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainAssembly); DEFINE_VMPTR(class Module, PTR_Module, VMPTR_Module); // DomainAssembly derives from DomainAssembly and represents a manifest module. @@ -1285,7 +1285,7 @@ inline bool IsEqualOrCloserToRoot(FramePointer fp1, FramePointer fp2) struct MSLAYOUT DebuggerIPCE_FuncData { mdMethodDef funcMetadataToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; mdTypeDef classMetadataToken; @@ -1425,7 +1425,7 @@ struct MSLAYOUT DebuggerIPCE_STRData struct MSLAYOUT { mdMethodDef funcMetadataToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; VMPTR_MethodDesc vmMethodDesc; CorDebugInternalFrameType frameType; } stubFrame; @@ -1469,7 +1469,7 @@ struct MSLAYOUT DebuggerIPCE_BasicTypeData CorElementType elementType; mdTypeDef metadataToken; VMPTR_Module vmModule; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; VMPTR_TypeHandle vmTypeHandle; }; @@ -1505,7 +1505,7 @@ struct MSLAYOUT DebuggerIPCE_ExpandedTypeData { mdTypeDef metadataToken; VMPTR_Module vmModule; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; VMPTR_TypeHandle typeHandle; // if non-null then further fetches will be needed to get type arguments } ClassTypeData; @@ -1679,7 +1679,7 @@ struct MSLAYOUT DebuggerIPCE_FuncEvalInfo DebuggerIPCE_FuncEvalType funcEvalType; mdMethodDef funcMetadataToken; mdTypeDef funcClassMetadataToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; RSPTR_CORDBEVAL funcEvalKey; bool evalDuringException; @@ -1917,7 +1917,7 @@ struct MSLAYOUT DebuggerIPCEvent { // Module whos metadata is being updated // This tells the RS that the metadata for that module has become invalid. - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; } MetadataUpdateData; @@ -1960,13 +1960,13 @@ struct MSLAYOUT DebuggerIPCEvent struct MSLAYOUT { // Module that was just loaded. - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; }LoadModuleData; struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; LSPTR_ASSEMBLY debuggerAssemblyToken; } UnloadModuleData; @@ -1975,7 +1975,7 @@ struct MSLAYOUT DebuggerIPCEvent // Queury PDB from OOP struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; } UpdateModuleSymsData; DebuggerMDANotification MDANotification; @@ -1984,7 +1984,7 @@ struct MSLAYOUT DebuggerIPCEvent { LSPTR_BREAKPOINT breakpointToken; mdMethodDef funcMetadataToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; bool isIL; SIZE_T offset; SIZE_T encVersion; @@ -2064,7 +2064,7 @@ struct MSLAYOUT DebuggerIPCEvent // Apply an EnC edit struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; // Module to edit + VMPTR_DomainAssembly vmDomainAssembly; // Module to edit DWORD cbDeltaMetadata; // size of blob pointed to by pDeltaMetadata CORDB_ADDRESS pDeltaMetadata; // pointer to delta metadata in debuggee // it's the RS's responsibility to allocate and free @@ -2081,20 +2081,20 @@ struct MSLAYOUT DebuggerIPCEvent struct MSLAYOUT { mdTypeDef classMetadataToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; LSPTR_ASSEMBLY classDebuggerAssemblyToken; } LoadClass; struct MSLAYOUT { mdTypeDef classMetadataToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; LSPTR_ASSEMBLY classDebuggerAssemblyToken; } UnloadClass; struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; bool flag; } SetClassLoad; @@ -2125,7 +2125,7 @@ struct MSLAYOUT DebuggerIPCEvent CORDB_ADDRESS startAddress; bool fCanSetIPOnly; VMPTR_Thread vmThreadToken; - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; mdMethodDef mdMethod; VMPTR_MethodDesc vmMethodDesc; SIZE_T offset; @@ -2154,7 +2154,7 @@ struct MSLAYOUT DebuggerIPCEvent struct MSLAYOUT { // Domain file for the domain in which the notification occurred - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; // metadata token for the type of the CustomNotification object's type mdTypeDef classToken; @@ -2219,7 +2219,7 @@ struct MSLAYOUT DebuggerIPCEvent struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; BOOL fAllowJitOpts; BOOL fEnableEnC; } JitDebugInfo; @@ -2227,7 +2227,7 @@ struct MSLAYOUT DebuggerIPCEvent // EnC Remap opportunity struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; mdMethodDef funcMetadataToken ; // methodDef of function with remap opportunity SIZE_T currentVersionNumber; // version currently executing SIZE_T resumeVersionNumber; // latest version @@ -2239,7 +2239,7 @@ struct MSLAYOUT DebuggerIPCEvent // EnC Remap has taken place struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; mdMethodDef funcMetadataToken; // methodDef of function that was remapped } EnCRemapComplete; @@ -2247,7 +2247,7 @@ struct MSLAYOUT DebuggerIPCEvent // specific edit made by EnC (function add/update or field add). struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; mdToken memberMetadataToken; // Either a methodDef token indicating the function that // was updated/added, or a fieldDef token indicating the // field which was added. @@ -2268,7 +2268,7 @@ struct MSLAYOUT DebuggerIPCEvent // @todo - Perhaps we can bundle these up so we can set multiple funcs w/ 1 event? struct MSLAYOUT { - VMPTR_DomainFile vmDomainFile; + VMPTR_DomainAssembly vmDomainAssembly; mdMethodDef funcMetadataToken; DWORD dwStatus; } SetJMCFunctionStatus; diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index 850625f838548..d4f9e7bfcc974 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -1015,8 +1015,8 @@ Module * Assembly::FindModuleByTypeRef( #ifndef DACCESS_COMPILE if (loadFlag == Loader::Load) { - DomainAssembly* pActualDomainFile = pModule->LoadModule(::GetAppDomain(), tkType); - RETURN(pActualDomainFile->GetModule()); + DomainAssembly* pActualDomainAssembly = pModule->LoadModule(::GetAppDomain(), tkType); + RETURN(pActualDomainAssembly->GetModule()); } else { diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 200d36586ef52..933f568f84d41 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -8527,7 +8527,7 @@ Thread::EnumMemoryRegionsWorker(CLRDataEnumMemoryFlags flags) // To stackwalk through funceval frames, we need to be sure to preserve the // DebuggerModule's m_pRuntimeDomainFile. This is the only case that doesn't use the current - // vmDomainFile in code:DacDbiInterfaceImpl::EnumerateInternalFrames. The following + // vmDomainAssembly in code:DacDbiInterfaceImpl::EnumerateInternalFrames. The following // code mimics that function. // Allow failure, since we want to continue attempting to walk the stack regardless of the outcome. EX_TRY From b3599881f3aada7782bb5716e582d4a2ee387343 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 17:59:18 -0800 Subject: [PATCH 17/25] More DomainFile --> DomainAssembly renames --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 10 +++++----- src/coreclr/debug/daccess/dacdbiimpl.h | 6 +++--- src/coreclr/debug/di/divalue.cpp | 8 ++++---- src/coreclr/debug/di/module.cpp | 12 ++++++------ src/coreclr/debug/di/process.cpp | 4 ++-- src/coreclr/debug/di/rsappdomain.cpp | 2 +- src/coreclr/debug/di/rsclass.cpp | 4 ++-- src/coreclr/debug/di/rspriv.h | 4 ++-- src/coreclr/debug/ee/debugger.cpp | 6 +++--- src/coreclr/debug/ee/debugger.h | 4 ++-- src/coreclr/debug/ee/debugger.inl | 2 +- src/coreclr/debug/inc/dacdbiinterface.h | 10 +++++----- src/coreclr/debug/inc/dacdbistructures.h | 2 +- src/coreclr/vm/appdomain.cpp | 4 ++-- src/coreclr/vm/appdomain.hpp | 2 +- src/coreclr/vm/profilingenumerators.cpp | 2 +- src/coreclr/vm/threads.cpp | 2 +- 17 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index a8416f4ece23f..1ff143cf7cce1 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -3483,7 +3483,7 @@ HRESULT DacDbiInterfaceImpl::GetDelegateType(VMPTR_Object delegateObject, Delega HRESULT DacDbiInterfaceImpl::GetDelegateFunctionData( DelegateType delegateType, VMPTR_Object delegateObject, - OUT VMPTR_DomainAssembly *ppFunctionDomainFile, + OUT VMPTR_DomainAssembly *ppFunctionDomainAssembly, OUT mdMethodDef *pMethodDef) { DD_ENTER_MAY_THROW; @@ -3514,7 +3514,7 @@ HRESULT DacDbiInterfaceImpl::GetDelegateFunctionData( if (hr != S_OK) return hr; - ppFunctionDomainFile->SetDacTargetPtr(dac_cast(pMD.GetDacPtr()->GetModule()->GetDomainAssembly())); + ppFunctionDomainAssembly->SetDacTargetPtr(dac_cast(pMD.GetDacPtr()->GetModule()->GetDomainAssembly())); *pMethodDef = pMD.GetDacPtr()->GetMemberDef(); return hr; @@ -4347,7 +4347,7 @@ void DacDbiInterfaceImpl::GetSymbolsBuffer(VMPTR_Module vmModule, TargetBuffer * -void DacDbiInterfaceImpl::GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule) +void DacDbiInterfaceImpl::GetModuleForDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule) { DD_ENTER_MAY_THROW; @@ -4358,8 +4358,8 @@ void DacDbiInterfaceImpl::GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAs } -// Implement IDacDbiInterface::GetDomainFileData -void DacDbiInterfaceImpl::GetDomainFileData(VMPTR_DomainAssembly vmDomainAssembly, DomainFileInfo * pData) +// Implement IDacDbiInterface::GetDomainAssemblyData +void DacDbiInterfaceImpl::GetDomainAssemblyData(VMPTR_DomainAssembly vmDomainAssembly, DomainAssemblyInfo * pData) { DD_ENTER_MAY_THROW; diff --git a/src/coreclr/debug/daccess/dacdbiimpl.h b/src/coreclr/debug/daccess/dacdbiimpl.h index e80be6511a0a2..356df9ec7be5c 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.h +++ b/src/coreclr/debug/daccess/dacdbiimpl.h @@ -352,7 +352,7 @@ class DacDbiInterfaceImpl : HRESULT GetDelegateFunctionData( DelegateType delegateType, VMPTR_Object delegateObject, - OUT VMPTR_DomainAssembly *ppFunctionDomainFile, + OUT VMPTR_DomainAssembly *ppFunctionDomainAssembly, OUT mdMethodDef *pMethodDef); HRESULT GetDelegateTargetObject( @@ -731,9 +731,9 @@ class DacDbiInterfaceImpl : void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData); // Gets properties for a domainfile - void GetDomainFileData(VMPTR_DomainAssembly vmDomainAssembly, DomainFileInfo * pData); + void GetDomainAssemblyData(VMPTR_DomainAssembly vmDomainAssembly, DomainAssemblyInfo * pData); - void GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule); + void GetModuleForDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule); // Yields true if the address is a CLR stub. BOOL IsTransitionStub(CORDB_ADDRESS address); diff --git a/src/coreclr/debug/di/divalue.cpp b/src/coreclr/debug/di/divalue.cpp index e6a4e68d12dd6..5e79a5ee1c92b 100644 --- a/src/coreclr/debug/di/divalue.cpp +++ b/src/coreclr/debug/di/divalue.cpp @@ -2653,18 +2653,18 @@ HRESULT CordbObjectValue::GetFunctionHelper(ICorDebugFunction **ppFunction) return hr; mdMethodDef functionMethodDef = 0; - VMPTR_DomainAssembly functionDomainFile; + VMPTR_DomainAssembly functionDomainAssembly; NativeCodeFunctionData nativeCodeForDelFunc; - hr = pDAC->GetDelegateFunctionData(delType, pDelegateObj, &functionDomainFile, &functionMethodDef); + hr = pDAC->GetDelegateFunctionData(delType, pDelegateObj, &functionDomainAssembly, &functionMethodDef); if (hr != S_OK) return hr; // TODO: How to ensure results are sanitized? // Also, this is expensive. Do we really care that much about this? - pDAC->GetNativeCodeInfo(functionDomainFile, functionMethodDef, &nativeCodeForDelFunc); + pDAC->GetNativeCodeInfo(functionDomainAssembly, functionMethodDef, &nativeCodeForDelFunc); - RSSmartPtr funcModule(GetProcess()->LookupOrCreateModule(functionDomainFile)); + RSSmartPtr funcModule(GetProcess()->LookupOrCreateModule(functionDomainAssembly)); RSSmartPtr func; { RSLockHolder lockHolder(GetProcess()->GetProcessLock()); diff --git a/src/coreclr/debug/di/module.cpp b/src/coreclr/debug/di/module.cpp index f89c20927851f..e4011cbe76099 100644 --- a/src/coreclr/debug/di/module.cpp +++ b/src/coreclr/debug/di/module.cpp @@ -86,9 +86,9 @@ CordbModule::CordbModule( if (!vmDomainAssembly.IsNull()) { - DomainFileInfo dfInfo; + DomainAssemblyInfo dfInfo; - pProcess->GetDAC()->GetDomainFileData(vmDomainAssembly, &dfInfo); // throws + pProcess->GetDAC()->GetDomainAssemblyData(vmDomainAssembly, &dfInfo); // throws m_pAppDomain = pProcess->LookupOrCreateAppDomain(dfInfo.vmAppDomain); m_pAssembly = m_pAppDomain->LookupOrCreateAssembly(dfInfo.vmDomainAssembly); @@ -125,11 +125,11 @@ void DbgAssertModuleDeletedCallback(VMPTR_DomainAssembly vmDomainAssembly, void if (!pThis->m_vmDomainAssembly.IsNull()) { - VMPTR_DomainAssembly vmDomainFileDeleted = pThis->m_vmDomainAssembly; + VMPTR_DomainAssembly vmDomainAssemblyDeleted = pThis->m_vmDomainAssembly; - CONSISTENCY_CHECK_MSGF((vmDomainFileDeleted != vmDomainAssembly), - ("A Module Unload event was sent for a module, but it still shows up in the enumeration.\n vmDomainFileDeleted=%p\n", - VmPtrToCookie(vmDomainFileDeleted))); + CONSISTENCY_CHECK_MSGF((vmDomainAssemblyDeleted != vmDomainAssembly), + ("A Module Unload event was sent for a module, but it still shows up in the enumeration.\n vmDomainAssemblyDeleted=%p\n", + VmPtrToCookie(vmDomainAssemblyDeleted))); } } diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index cc172a8c8b61d..b4463b4a229e6 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -15018,8 +15018,8 @@ CordbModule * CordbProcess::LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAs RSLockHolder lockHolder(GetProcess()->GetProcessLock()); _ASSERTE(!vmDomainAssembly.IsNull()); - DomainFileInfo data; - GetDAC()->GetDomainFileData(vmDomainAssembly, &data); // throws + DomainAssemblyInfo data; + GetDAC()->GetDomainAssemblyData(vmDomainAssembly, &data); // throws CordbAppDomain * pAppDomain = LookupOrCreateAppDomain(data.vmAppDomain); return pAppDomain->LookupOrCreateModule(vmDomainAssembly); diff --git a/src/coreclr/debug/di/rsappdomain.cpp b/src/coreclr/debug/di/rsappdomain.cpp index b79c295e05c6a..e140b8a77f13f 100644 --- a/src/coreclr/debug/di/rsappdomain.cpp +++ b/src/coreclr/debug/di/rsappdomain.cpp @@ -856,7 +856,7 @@ CordbModule* CordbAppDomain::LookupOrCreateModule(VMPTR_Module vmModule, VMPTR_D } if (vmModule.IsNull()) - GetProcess()->GetDAC()->GetModuleForDomainFile(vmDomainAssembly, &vmModule); + GetProcess()->GetDAC()->GetModuleForDomainAssembly(vmDomainAssembly, &vmModule); RSInitHolder pModuleInit(new CordbModule(GetProcess(), vmModule, vmDomainAssembly)); pModule = pModuleInit.TransferOwnershipToHash(&m_modules); diff --git a/src/coreclr/debug/di/rsclass.cpp b/src/coreclr/debug/di/rsclass.cpp index 5921e2788593f..4fe8930712a4e 100644 --- a/src/coreclr/debug/di/rsclass.cpp +++ b/src/coreclr/debug/di/rsclass.cpp @@ -784,8 +784,8 @@ void CordbClass::Init(ClassLoadLevel desiredLoadLevel) VMPTR_DomainAssembly vmDomainAssembly = m_pModule->GetRuntimeDomainAssembly(); if (!vmDomainAssembly.IsNull()) { - DomainFileInfo info; - pDac->GetDomainFileData(vmDomainAssembly, &info); + DomainAssemblyInfo info; + pDac->GetDomainAssemblyData(vmDomainAssembly, &info); vmAppDomain = info.vmAppDomain; } pDac->GetClassInfo(vmAppDomain, vmTypeHandle, &m_classInfo); diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h index 3e1dcd3b168f8..d4e45895feb0c 100644 --- a/src/coreclr/debug/di/rspriv.h +++ b/src/coreclr/debug/di/rspriv.h @@ -2511,10 +2511,10 @@ class CordbAppDomain : public CordbBase, CordbModule * GetModuleFromMetaDataInterface(IUnknown *pIMetaData); // Lookup a module from the cache. Create and to the cache if needed. - CordbModule * LookupOrCreateModule(VMPTR_Module vmModuleToken, VMPTR_DomainAssembly vmDomainFileToken); + CordbModule * LookupOrCreateModule(VMPTR_Module vmModuleToken, VMPTR_DomainAssembly vmDomainAssemblyToken); // Lookup a module from the cache. Create and to the cache if needed. - CordbModule * LookupOrCreateModule(VMPTR_DomainAssembly vmDomainFileToken); + CordbModule * LookupOrCreateModule(VMPTR_DomainAssembly vmDomainAssemblyToken); // Callback from DAC for module enumeration static void ModuleEnumerationCallback(VMPTR_DomainAssembly vmModule, void * pUserData); diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 3eec67822e7b3..5f37ca76af492 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -9467,7 +9467,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, _ASSERTE(pManifestModule->IsManifest()); _ASSERTE(pManifestModule->GetAssembly() == pRuntimeModule->GetAssembly()); - DomainAssembly * pManifestDomainFile = pManifestModule->GetDomainAssembly(); + DomainAssembly * pManifestDomainAssembly = pManifestModule->GetDomainAssembly(); DebuggerLockHolder dbgLockHolder(this); @@ -9477,7 +9477,7 @@ void Debugger::LoadModule(Module* pRuntimeModule, DebuggerIPCEvent eventMetadataUpdate; InitIPCEvent(&eventMetadataUpdate, DB_IPCE_METADATA_UPDATE, NULL, pAppDomain); - eventMetadataUpdate.MetadataUpdateData.vmDomainAssembly.SetRawPtr(pManifestDomainFile); + eventMetadataUpdate.MetadataUpdateData.vmDomainAssembly.SetRawPtr(pManifestDomainAssembly); SendRawEvent(&eventMetadataUpdate); } @@ -9940,7 +9940,7 @@ BOOL Debugger::SendSystemClassLoadUnloadEvent(mdTypeDef classMetadataToken, // Only notify for app domains where the module has been fully loaded already // We used to make a different check here domain->ContainsAssembly() but that - // triggers too early in the loading process. FindDomainFile will not become + // triggers too early in the loading process. FindDomainAssembly will not become // non-NULL until the module is fully loaded into the domain which is what we // want. if (classModule->GetDomainAssembly() != NULL ) diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h index 513274220e24d..9703354ec4235 100644 --- a/src/coreclr/debug/ee/debugger.h +++ b/src/coreclr/debug/ee/debugger.h @@ -513,7 +513,7 @@ class DebuggerModule DomainAssembly * GetDomainAssembly() { LIMITED_METHOD_DAC_CONTRACT; - return m_pRuntimeDomainFile; + return m_pRuntimeDomainAssembly; } // Called by DebuggerModuleTable to set our primary module @@ -528,7 +528,7 @@ class DebuggerModule DebuggerModule* m_pPrimaryModule; PTR_Module m_pRuntimeModule; - PTR_DomainAssembly m_pRuntimeDomainFile; + PTR_DomainAssembly m_pRuntimeDomainAssembly; AppDomain* m_pAppDomain; diff --git a/src/coreclr/debug/ee/debugger.inl b/src/coreclr/debug/ee/debugger.inl index 2c5be6d9d854b..be4e3f67c4daf 100644 --- a/src/coreclr/debug/ee/debugger.inl +++ b/src/coreclr/debug/ee/debugger.inl @@ -57,7 +57,7 @@ inline DebuggerModule::DebuggerModule(Module * pRuntimeModule, m_enableClassLoadCallbacks(FALSE), m_pPrimaryModule(NULL), m_pRuntimeModule(pRuntimeModule), - m_pRuntimeDomainFile(pDomainAssembly), + m_pRuntimeDomainAssembly(pDomainAssembly), m_pAppDomain(pAppDomain) { LOG((LF_CORDB,LL_INFO10000, "DM::DM this:0x%x Module:0x%x DF:0x%x AD:0x%x\n", diff --git a/src/coreclr/debug/inc/dacdbiinterface.h b/src/coreclr/debug/inc/dacdbiinterface.h index 17599b3359b36..85868080855be 100644 --- a/src/coreclr/debug/inc/dacdbiinterface.h +++ b/src/coreclr/debug/inc/dacdbiinterface.h @@ -588,7 +588,7 @@ class IDacDbiInterface // pData - required out parameter which will be filled out with module properties // // Notes: - // See definition of DomainFileInfo for more details about what properties + // See definition of DomainAssemblyInfo for more details about what properties // this gives back. virtual void GetModuleData(VMPTR_Module vmModule, OUT ModuleInfo * pData) = 0; @@ -602,13 +602,13 @@ class IDacDbiInterface // pData - required out parameter which will be filled out with module properties // // Notes: - // See definition of DomainFileInfo for more details about what properties + // See definition of DomainAssemblyInfo for more details about what properties // this gives back. virtual - void GetDomainFileData(VMPTR_DomainAssembly vmDomainAssembly, OUT DomainFileInfo * pData) = 0; + void GetDomainAssemblyData(VMPTR_DomainAssembly vmDomainAssembly, OUT DomainAssemblyInfo * pData) = 0; virtual - void GetModuleForDomainFile(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule) = 0; + void GetModuleForDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule) = 0; //......................................................................... // These methods were the methods that DBI was calling from IXClrData in V2. @@ -2731,7 +2731,7 @@ class IDacDbiInterface HRESULT GetDelegateFunctionData( DelegateType delegateType, VMPTR_Object delegateObject, - OUT VMPTR_DomainAssembly *ppFunctionDomainFile, + OUT VMPTR_DomainAssembly *ppFunctionDomainAssembly, OUT mdMethodDef *pMethodDef) = 0; virtual diff --git a/src/coreclr/debug/inc/dacdbistructures.h b/src/coreclr/debug/inc/dacdbistructures.h index 0a8de378b64d6..aca5c668de42b 100644 --- a/src/coreclr/debug/inc/dacdbistructures.h +++ b/src/coreclr/debug/inc/dacdbistructures.h @@ -167,7 +167,7 @@ struct MSLAYOUT TargetBuffer // Whereas a DomainAssembly is like a { AppDomain, Module} pair. DomainAssembly corresponds // much more to ICorDebugModule (which also has appdomain affinity). //=================================================================================== -struct MSLAYOUT DomainFileInfo +struct MSLAYOUT DomainAssemblyInfo { // The appdomain that the DomainAssembly is associated with. // Although VMPTR_Module may be shared across multiple domains, a DomainAssembly has appdomain affinity. diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 3a63fed87655a..d602f9f920399 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2522,7 +2522,7 @@ void AppDomain::LoadSystemAssemblies() LoadAssembly(NULL, SystemDomain::System()->SystemPEAssembly(), FILE_ACTIVE); } -FileLoadLevel AppDomain::GetDomainFileLoadLevel(DomainAssembly *pFile) +FileLoadLevel AppDomain::GetDomainAssemblyLoadLevel(DomainAssembly *pFile) { CONTRACTL { @@ -3026,7 +3026,7 @@ DomainAssembly *AppDomain::LoadDomainAssembly(FileLoadLock *pLock, FileLoadLevel // lower level. In such a case, we throw an exception which transiently fails the current // load, since it is likely we have not satisfied the caller. // (An alternate, and possibly preferable, strategy here would be for all callers to explicitly - // identify the minimum load level acceptable via CheckLoadDomainFile and throw from there.) + // identify the minimum load level acceptable via CheckLoadDomainAssembly and throw from there.) pFile->RequireLoadLevel((FileLoadLevel)(immediateTargetLevel-1)); diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 98936dfac9fad..a2a42d5ed6aaa 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -1799,7 +1799,7 @@ class AppDomain : public BaseDomain CHECK CheckCanExecuteManagedCode(MethodDesc* pMD); CHECK CheckLoading(DomainAssembly *pFile, FileLoadLevel level); - FileLoadLevel GetDomainFileLoadLevel(DomainAssembly *pFile); + FileLoadLevel GetDomainAssemblyLoadLevel(DomainAssembly *pFile); BOOL IsLoading(DomainAssembly *pFile, FileLoadLevel level); static FileLoadLevel GetThreadFileLoadLevel(); diff --git a/src/coreclr/vm/profilingenumerators.cpp b/src/coreclr/vm/profilingenumerators.cpp index f8a2091e73172..7d537924df891 100644 --- a/src/coreclr/vm/profilingenumerators.cpp +++ b/src/coreclr/vm/profilingenumerators.cpp @@ -397,7 +397,7 @@ HRESULT ProfilerModuleEnum::Init() // When an assembly is loaded into an AppDomain, a DomainAssembly is // created (one per pairing of the AppDomain with the assembly). This means - // that we'll create multiple DomainFiles for the same module if it is loaded + // that we'll create multiple DomainAssemblys for the same module if it is loaded // domain-neutral (i.e., "shared"). The profiling API callbacks shield the profiler // from this, and only report a given module the first time it's loaded. So a // profiler sees only one ModuleLoadFinished for a module loaded domain-neutral, even diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 933f568f84d41..29d31f1fbc0b9 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -8526,7 +8526,7 @@ Thread::EnumMemoryRegionsWorker(CLRDataEnumMemoryFlags flags) DacEnumCodeForStackwalk(callEnd); // To stackwalk through funceval frames, we need to be sure to preserve the - // DebuggerModule's m_pRuntimeDomainFile. This is the only case that doesn't use the current + // DebuggerModule's m_pRuntimeDomainAssembly. This is the only case that doesn't use the current // vmDomainAssembly in code:DacDbiInterfaceImpl::EnumerateInternalFrames. The following // code mimics that function. // Allow failure, since we want to continue attempting to walk the stack regardless of the outcome. From 4359b0e11c425bb113100ebb3581dc8a81e2f62e Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:02:47 -0800 Subject: [PATCH 18/25] a few more renames --- src/coreclr/debug/daccess/dacdbiimpl.h | 2 +- src/coreclr/debug/di/process.cpp | 6 +++--- src/coreclr/debug/inc/dacdbiinterface.h | 2 +- src/coreclr/debug/inc/dbgipcevents.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.h b/src/coreclr/debug/daccess/dacdbiimpl.h index 356df9ec7be5c..e885703113197 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.h +++ b/src/coreclr/debug/daccess/dacdbiimpl.h @@ -730,7 +730,7 @@ class DacDbiInterfaceImpl : // Gets properties for a module void GetModuleData(VMPTR_Module vmModule, ModuleInfo * pData); - // Gets properties for a domainfile + // Gets properties for a domain assembly void GetDomainAssemblyData(VMPTR_DomainAssembly vmDomainAssembly, DomainAssemblyInfo * pData); void GetModuleForDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Module * pModule); diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index b4463b4a229e6..6e427292fee01 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -2564,10 +2564,10 @@ HRESULT CordbProcess::GetTypeForObject(CORDB_ADDRESS addr, CordbAppDomain* pAppD { VMPTR_AppDomain appDomain; VMPTR_Module mod; - VMPTR_DomainAssembly domainFile; + VMPTR_DomainAssembly domainAssembly; HRESULT hr = E_FAIL; - if (GetDAC()->GetAppDomainForObject(addr, &appDomain, &mod, &domainFile)) + if (GetDAC()->GetAppDomainForObject(addr, &appDomain, &mod, &domainAssembly)) { if (pAppDomainOverride) { @@ -14976,7 +14976,7 @@ void CordbProcess::UpdateThreadsForAdUnload(CordbAppDomain * pAppDomain) // CordbProcess::LookupClass // Looks up a previously constructed CordbClass instance without creating. May return NULL if the // CordbClass instance doesn't exist. -// Argument: (in) vmDomainAssembly - pointer to the domainfile for the module +// Argument: (in) vmDomainAssembly - pointer to the domain assembly for the module // (in) mdTypeDef - metadata token for the class // Return value: pointer to a previously created CordbClass instance or NULL in none exists CordbClass * CordbProcess::LookupClass(ICorDebugAppDomain * pAppDomain, VMPTR_DomainAssembly vmDomainAssembly, mdTypeDef classToken) diff --git a/src/coreclr/debug/inc/dacdbiinterface.h b/src/coreclr/debug/inc/dacdbiinterface.h index 85868080855be..82d5c4d1e465a 100644 --- a/src/coreclr/debug/inc/dacdbiinterface.h +++ b/src/coreclr/debug/inc/dacdbiinterface.h @@ -1993,7 +1993,7 @@ class IDacDbiInterface // simpleType - CorElementType value corresponding to a simple type // output: pMetadataToken - the metadata token corresponding to simpleType, // in the scope of vmDomainAssembly. - // vmDomainAssembly - the domainFile for simpleType + // vmDomainAssembly - the domainAssembly for simpleType // Notes: // This is inspection-only. If the type is not yet loaded, it will throw CORDBG_E_CLASS_NOT_LOADED. // It will not try to load a type. diff --git a/src/coreclr/debug/inc/dbgipcevents.h b/src/coreclr/debug/inc/dbgipcevents.h index 105ddb0d94b2a..a81e02f3a653f 100644 --- a/src/coreclr/debug/inc/dbgipcevents.h +++ b/src/coreclr/debug/inc/dbgipcevents.h @@ -851,7 +851,7 @@ typedef VMPTR_Base VMPTR_CONTEXT; // For domain-neutral modules (like CoreLib), there is a DomainAssembly instance // for each appdomain the module lives in. // This is the canonical handle ICorDebug uses to a CLR module. -DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainAssembly); +DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainAssembly); DEFINE_VMPTR(class Module, PTR_Module, VMPTR_Module); // DomainAssembly derives from DomainAssembly and represents a manifest module. From 91a5f93c488a49f28e00162e31ebdac88900896c Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:12:28 -0800 Subject: [PATCH 19/25] removed domainassembly.inl --- src/coreclr/vm/CMakeLists.txt | 1 - src/coreclr/vm/common.h | 1 - src/coreclr/vm/domainassembly.h | 36 +++++++++++++++++++++++-------- src/coreclr/vm/domainassembly.inl | 31 -------------------------- 4 files changed, 27 insertions(+), 42 deletions(-) delete mode 100644 src/coreclr/vm/domainassembly.inl diff --git a/src/coreclr/vm/CMakeLists.txt b/src/coreclr/vm/CMakeLists.txt index aea9b275acb0e..12e9e741eced5 100644 --- a/src/coreclr/vm/CMakeLists.txt +++ b/src/coreclr/vm/CMakeLists.txt @@ -162,7 +162,6 @@ set(VM_HEADERS_DAC_AND_WKS_COMMON decodemd.h disassembler.h domainassembly.h - domainassembly.inl dynamicmethod.h ecall.h eedbginterfaceimpl.h diff --git a/src/coreclr/vm/common.h b/src/coreclr/vm/common.h index f928f0c6504a0..c2fff3f9c9a96 100644 --- a/src/coreclr/vm/common.h +++ b/src/coreclr/vm/common.h @@ -427,7 +427,6 @@ extern DummyGlobalContract ___contract; #include "typehandle.inl" #include "object.inl" #include "clsload.inl" -#include "domainassembly.inl" #include "method.inl" #include "syncblk.inl" #include "threads.inl" diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index f26d21e90b721..1cd33e857ba4d 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -65,7 +65,7 @@ enum NotificationStatus class DomainAssembly final { - public: +public: // ------------------------------------------------------------ // Public API @@ -89,6 +89,22 @@ class DomainAssembly final return PTR_PEAssembly(m_pPEAssembly); } + Assembly* DomainAssembly::GetAssembly() + { + LIMITED_METHOD_DAC_CONTRACT; + CONSISTENCY_CHECK(CheckLoaded()); + + return m_pAssembly; + } + + Module* DomainAssembly::GetModule() + { + LIMITED_METHOD_CONTRACT; + CONSISTENCY_CHECK(CheckLoaded()); + + return m_pModule; + } + IMDInternalImport *GetMDImport() { WRAPPER_NO_CONTRACT; @@ -139,15 +155,17 @@ class DomainAssembly final } #endif -// ------------------------------------------------------------ -// Public API -// ------------------------------------------------------------ - - Assembly* GetAssembly(); - Module* GetModule(); + BOOL DomainAssembly::IsCollectible() + { + LIMITED_METHOD_CONTRACT; + return m_fCollectible; + } - BOOL IsCollectible(); - ULONG HashIdentity(); + ULONG DomainAssembly::HashIdentity() + { + WRAPPER_NO_CONTRACT; + return GetPEAssembly()->HashIdentity(); + } // ------------------------------------------------------------ // Loading state checks diff --git a/src/coreclr/vm/domainassembly.inl b/src/coreclr/vm/domainassembly.inl deleted file mode 100644 index 22bdb14c91b1c..0000000000000 --- a/src/coreclr/vm/domainassembly.inl +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -inline Module* DomainAssembly::GetModule() -{ - LIMITED_METHOD_CONTRACT; - CONSISTENCY_CHECK(CheckLoaded()); - - return m_pModule; -} - -inline Assembly* DomainAssembly::GetAssembly() -{ - LIMITED_METHOD_DAC_CONTRACT; - CONSISTENCY_CHECK(CheckLoaded()); - - return m_pAssembly; -} - -inline ULONG DomainAssembly::HashIdentity() -{ - WRAPPER_NO_CONTRACT; - return GetPEAssembly()->HashIdentity(); -} - -inline BOOL DomainAssembly::IsCollectible() -{ - LIMITED_METHOD_CONTRACT; - return m_fCollectible; -} - From 9222df3b3130834bae02b1ff2a18fd31ab914c9e Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:53:34 -0800 Subject: [PATCH 20/25] domainassembly.h cleanup --- src/coreclr/vm/domainassembly.cpp | 30 ++++++-------------------- src/coreclr/vm/domainassembly.h | 36 +++++++++++-------------------- 2 files changed, 19 insertions(+), 47 deletions(-) diff --git a/src/coreclr/vm/domainassembly.cpp b/src/coreclr/vm/domainassembly.cpp index d1b71dc28b1c6..68775b0fd3777 100644 --- a/src/coreclr/vm/domainassembly.cpp +++ b/src/coreclr/vm/domainassembly.cpp @@ -39,15 +39,16 @@ DomainAssembly::DomainAssembly(AppDomain* pDomain, PEAssembly* pPEAssembly, Load m_NextDomainAssemblyInSameALC(NULL), m_pLoaderAllocator(pLoaderAllocator), m_level(FILE_LOAD_CREATE), - m_pError(NULL), - m_notifyflags(NOT_NOTIFIED), m_loading(TRUE), - m_pDynamicMethodTable(NULL), - m_pUMThunkHash(NULL), + m_hExposedModuleObject(NULL), + m_hExposedAssemblyObject(NULL), + m_pError(NULL), m_bDisableActivationCheck(FALSE), + m_fHostAssemblyPublished(FALSE), + m_pDynamicMethodTable(NULL), m_debuggerFlags(DACF_NONE), - m_fDebuggerUnloadStarted(FALSE), - m_fHostAssemblyPublished(FALSE) + m_notifyflags(NOT_NOTIFIED), + m_fDebuggerUnloadStarted(FALSE) { CONTRACTL { @@ -58,9 +59,6 @@ DomainAssembly::DomainAssembly(AppDomain* pDomain, PEAssembly* pPEAssembly, Load } CONTRACTL_END; - m_hExposedModuleObject = NULL; - m_hExposedAssemblyObject = NULL; - pPEAssembly->AddRef(); pPEAssembly->ValidateForExecution(); @@ -620,10 +618,6 @@ void DomainAssembly::Activate() _ASSERTE(GetModule() == GetAssembly()->GetModule()); GetModule()->IsRuntimeWrapExceptions(); - // Now activate any dependencies. - // This will typically cause reentrancy of course. - - // // Now call the module constructor. Note that this might cause reentrancy; // this is fine and will be handled by the class cctor mechanism. @@ -643,7 +637,6 @@ void DomainAssembly::Activate() } #endif //_DEBUG - RETURN; } @@ -854,15 +847,6 @@ void DomainAssembly::DeliverSyncEvents() GetModule()->NotifyEtwLoadFinished(S_OK); - // We may be notified from inside the loader lock if we are delivering IJW events, so keep track. -#ifdef PROFILING_SUPPORTED - if (!IsProfilerNotified()) - { - SetProfilerNotified(); - GetModule()->NotifyProfilerLoadFinished(S_OK); - } - -#endif #ifdef DEBUGGING_SUPPORTED GCX_COOP(); if (!IsDebuggerNotified()) diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index 1cd33e857ba4d..7d23ba7330410 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -307,7 +307,6 @@ class DomainAssembly final return m_pLoaderAllocator; } - // ------------------------------------------------------------ // Resource access // ------------------------------------------------------------ @@ -370,7 +369,7 @@ class DomainAssembly final union { Exception* m_pEx; - HRESULT m_hr; + HRESULT m_hr; }; public: @@ -392,6 +391,7 @@ class DomainAssembly final _ASSERTE(!"Bad exception type"); ThrowHR(E_UNEXPECTED); }; + ExInfo(Exception* pEx) { LIMITED_METHOD_CONTRACT; @@ -399,17 +399,6 @@ class DomainAssembly final m_pEx = pEx; }; - void ConvertToHResult() - { - LIMITED_METHOD_CONTRACT; - if (m_type == ExType_HR) - return; - _ASSERTE(m_type == ExType_ClrEx); - HRESULT hr = m_pEx->GetHR(); - delete m_pEx; - m_hr = hr; - m_type = ExType_HR; - }; ~ExInfo() { LIMITED_METHOD_CONTRACT; @@ -444,7 +433,7 @@ class DomainAssembly final BOOL NotifyDebuggerLoad(int flags, BOOL attaching); void NotifyDebuggerUnload(); -protected: +private: // ------------------------------------------------------------ // Instance data // ------------------------------------------------------------ @@ -455,30 +444,29 @@ class DomainAssembly final PTR_Module m_pModule; BOOL m_fCollectible; - DomainAssembly *m_NextDomainAssemblyInSameALC; + DomainAssembly* m_NextDomainAssemblyInSameALC; PTR_LoaderAllocator m_pLoaderAllocator; FileLoadLevel m_level; + BOOL m_loading; LOADERHANDLE m_hExposedModuleObject; LOADERHANDLE m_hExposedAssemblyObject; - ExInfo *m_pError; + ExInfo* m_pError; - DWORD m_notifyflags; - BOOL m_loading; + BOOL m_bDisableActivationCheck; + BOOL m_fHostAssemblyPublished; // m_pDynamicMethodTable is used by the light code generation to allow method // generation on the fly. They are lazily created when/if a dynamic method is requested // for this specific module - DynamicMethodTable *m_pDynamicMethodTable; - class UMThunkHash *m_pUMThunkHash; - BOOL m_bDisableActivationCheck; + DynamicMethodTable* m_pDynamicMethodTable; - DebuggerAssemblyControlFlags m_debuggerFlags; - BOOL m_fDebuggerUnloadStarted; - BOOL m_fHostAssemblyPublished; + DebuggerAssemblyControlFlags m_debuggerFlags; + DWORD m_notifyflags; + BOOL m_fDebuggerUnloadStarted; }; #endif // _DOMAINASSEMBLY_H_ From 8ea72eda1e96b0648f258add8879c234e3a73f9c Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 29 Dec 2021 19:51:31 -0800 Subject: [PATCH 21/25] make gcc happy --- src/coreclr/vm/domainassembly.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index 7d23ba7330410..c104292a929ac 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -89,7 +89,7 @@ class DomainAssembly final return PTR_PEAssembly(m_pPEAssembly); } - Assembly* DomainAssembly::GetAssembly() + Assembly* GetAssembly() { LIMITED_METHOD_DAC_CONTRACT; CONSISTENCY_CHECK(CheckLoaded()); @@ -97,7 +97,7 @@ class DomainAssembly final return m_pAssembly; } - Module* DomainAssembly::GetModule() + Module* GetModule() { LIMITED_METHOD_CONTRACT; CONSISTENCY_CHECK(CheckLoaded()); @@ -155,13 +155,13 @@ class DomainAssembly final } #endif - BOOL DomainAssembly::IsCollectible() + BOOL IsCollectible() { LIMITED_METHOD_CONTRACT; return m_fCollectible; } - ULONG DomainAssembly::HashIdentity() + ULONG HashIdentity() { WRAPPER_NO_CONTRACT; return GetPEAssembly()->HashIdentity(); @@ -338,7 +338,7 @@ class DomainAssembly final void AddDependencies(); void PreLoadLibrary(); void LoadLibrary(); - void PostLoadLibrary(); + void PostLoadLibrary(); void EagerFixups(); void VtableFixups(); void DeliverSyncEvents(); From ca767c194356c4e54b9b1b7e80ff2d32f56fe71a Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 10 Jan 2022 16:11:08 -0800 Subject: [PATCH 22/25] couple more changes --- src/coreclr/vm/ceeload.cpp | 2 +- src/coreclr/vm/domainassembly.cpp | 19 ------------------- src/coreclr/vm/domainassembly.h | 4 ---- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 58a99e3ff0eb7..ab31183b89372 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -3300,7 +3300,7 @@ Module::GetAssemblyIfLoaded( } if (pDomainAssembly && pDomainAssembly->IsLoaded()) - pAssembly = pDomainAssembly->GetAssembly(); // Do not use GetAssembly - that may force the completion of a load + pAssembly = pDomainAssembly->GetAssembly(); // Only store in the rid map if working with the current AppDomain. if (fCanUseRidMap && pAssembly) diff --git a/src/coreclr/vm/domainassembly.cpp b/src/coreclr/vm/domainassembly.cpp index 68775b0fd3777..458f988280b02 100644 --- a/src/coreclr/vm/domainassembly.cpp +++ b/src/coreclr/vm/domainassembly.cpp @@ -124,25 +124,6 @@ void DomainAssembly::EnsureLoadLevel(FileLoadLevel targetLevel) } #include -void DomainAssembly::AttemptLoadLevel(FileLoadLevel targetLevel) -{ - CONTRACT_VOID - { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - } - CONTRACT_END; - - if (IsLoading()) - this->GetAppDomain()->LoadDomainAssembly(this, targetLevel); - else - ThrowIfError(targetLevel); - - RETURN; -} - - CHECK DomainAssembly::CheckLoadLevel(FileLoadLevel requiredLevel, BOOL deadlockOK) { CONTRACTL diff --git a/src/coreclr/vm/domainassembly.h b/src/coreclr/vm/domainassembly.h index c104292a929ac..268c49654253c 100644 --- a/src/coreclr/vm/domainassembly.h +++ b/src/coreclr/vm/domainassembly.h @@ -246,10 +246,6 @@ class DomainAssembly final // is required for an operation. Note that deadlocks are tolerated so the level may be one void EnsureLoadLevel(FileLoadLevel targetLevel) DAC_EMPTY(); - // AttemptLoadLevel is a generic routine used to try to further load the file to a given level. - // No guarantee is made about the load level resulting however. - void AttemptLoadLevel(FileLoadLevel targetLevel) DAC_EMPTY(); - // CheckLoadLevel is an assert predicate used to verify the load level of an assembly. // deadlockOK indicates that the level is allowed to be one short if we are restricted // by loader reentrancy. From 47db77086d18b0e01fa6e7632b1f1cfb1b46e6e4 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Fri, 21 Jan 2022 14:29:54 -0800 Subject: [PATCH 23/25] fixed build after rebasing --- src/coreclr/vm/ceeload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index ab31183b89372..c25b7aa19cc9d 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1772,7 +1772,7 @@ BOOL Module::IsRuntimeMarshallingEnabled() HRESULT hr; - IMDInternalImport *mdImport = GetAssembly()->GetManifestImport(); + IMDInternalImport *mdImport = GetAssembly()->GetMDImport(); mdToken token; if (SUCCEEDED(hr = mdImport->GetAssemblyFromScope(&token))) From be348b9218e43d34ea51b243030cab6adc725c91 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 26 Jan 2022 13:34:23 -0800 Subject: [PATCH 24/25] PR feedback --- src/coreclr/debug/ee/debugger.cpp | 6 - src/coreclr/debug/inc/dbgipcevents.h | 4 +- src/coreclr/nativeaot/Runtime/eventtrace.cpp | 1442 +++++++++--------- src/coreclr/vm/appdomain.cpp | 8 - src/coreclr/vm/appdomain.hpp | 2 +- src/coreclr/vm/assembly.hpp | 12 +- src/coreclr/vm/methoditer.cpp | 6 +- src/coreclr/vm/methoditer.h | 2 +- 8 files changed, 733 insertions(+), 749 deletions(-) diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 5f37ca76af492..bd96c50fc59d3 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -14725,12 +14725,6 @@ HRESULT Debugger::IterateAppDomainsForPdbs() if (!pDomainAssembly->IsVisibleToDebugger()) continue; - if (pDomainAssembly->ShouldNotifyDebugger()) - { - Module* pRuntimeModule = pDomainAssembly->GetModule(); - CopyModulePdb(pRuntimeModule); - } - if (pDomainAssembly->ShouldNotifyDebugger()) { CopyModulePdb(pDomainAssembly->GetModule()); diff --git a/src/coreclr/debug/inc/dbgipcevents.h b/src/coreclr/debug/inc/dbgipcevents.h index a81e02f3a653f..41197a2f0ffcd 100644 --- a/src/coreclr/debug/inc/dbgipcevents.h +++ b/src/coreclr/debug/inc/dbgipcevents.h @@ -854,8 +854,6 @@ typedef VMPTR_Base VMPTR_CONTEXT; DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainAssembly); DEFINE_VMPTR(class Module, PTR_Module, VMPTR_Module); -// DomainAssembly derives from DomainAssembly and represents a manifest module. -DEFINE_VMPTR(class DomainAssembly, PTR_DomainAssembly, VMPTR_DomainAssembly); DEFINE_VMPTR(class Assembly, PTR_Assembly, VMPTR_Assembly); DEFINE_VMPTR(class PEAssembly, PTR_PEAssembly, VMPTR_PEAssembly); @@ -1679,7 +1677,7 @@ struct MSLAYOUT DebuggerIPCE_FuncEvalInfo DebuggerIPCE_FuncEvalType funcEvalType; mdMethodDef funcMetadataToken; mdTypeDef funcClassMetadataToken; - VMPTR_DomainAssembly vmDomainAssembly; + VMPTR_DomainAssembly vmDomainAssembly; RSPTR_CORDBEVAL funcEvalKey; bool evalDuringException; diff --git a/src/coreclr/nativeaot/Runtime/eventtrace.cpp b/src/coreclr/nativeaot/Runtime/eventtrace.cpp index 1740f41b61f70..0f4646152165b 100644 --- a/src/coreclr/nativeaot/Runtime/eventtrace.cpp +++ b/src/coreclr/nativeaot/Runtime/eventtrace.cpp @@ -35,9 +35,9 @@ #define Win32EventWrite EventWrite // Flags used to store some runtime information for Event Tracing -BOOL g_fEEOtherStartup=FALSE; -BOOL g_fEEComActivatedStartup=FALSE; -LPCGUID g_fEEComObjectGuid=&GUID_NULL; +BOOL g_fEEOtherStartup = FALSE; +BOOL g_fEEComActivatedStartup = FALSE; +LPCGUID g_fEEComObjectGuid = &GUID_NULL; BOOL g_fEEHostedStartup = FALSE; @@ -188,16 +188,16 @@ BOOL IsRuntimeNgenKeywordEnabledAndNotSuppressed() LIMITED_METHOD_CONTRACT; return - ( - ETW_TRACING_CATEGORY_ENABLED( - MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_NGEN_KEYWORD) - && ! ( ETW_TRACING_CATEGORY_ENABLED( + ( + ETW_TRACING_CATEGORY_ENABLED( MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, - CLR_OVERRIDEANDSUPPRESSNGENEVENTS_KEYWORD) ) - ); + CLR_NGEN_KEYWORD) + && !(ETW_TRACING_CATEGORY_ENABLED( + MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_OVERRIDEANDSUPPRESSNGENEVENTS_KEYWORD)) + ); } // Same as above, but for the rundown provider @@ -206,16 +206,16 @@ BOOL IsRundownNgenKeywordEnabledAndNotSuppressed() LIMITED_METHOD_CONTRACT; return - ( - ETW_TRACING_CATEGORY_ENABLED( - MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_RUNDOWNNGEN_KEYWORD) - && ! ( ETW_TRACING_CATEGORY_ENABLED( + ( + ETW_TRACING_CATEGORY_ENABLED( + MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_RUNDOWNNGEN_KEYWORD) + && !(ETW_TRACING_CATEGORY_ENABLED( MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, - CLR_RUNDOWNOVERRIDEANDSUPPRESSNGENEVENTS_KEYWORD) ) - ); + CLR_RUNDOWNOVERRIDEANDSUPPRESSNGENEVENTS_KEYWORD)) + ); } /*******************************************************/ @@ -226,7 +226,7 @@ extern "C" { CallStackFrame* GetEbp() { - CallStackFrame *frame=NULL; + CallStackFrame* frame = NULL; __asm { mov frame, ebp @@ -244,8 +244,8 @@ extern "C" void ETW::SamplingLog::Append(SIZE_T currentFrame) { LIMITED_METHOD_CONTRACT; - if(m_FrameCount < (ETW::SamplingLog::s_MaxStackSize-1) && - currentFrame != 0) + if (m_FrameCount < (ETW::SamplingLog::s_MaxStackSize - 1) && + currentFrame != 0) { m_EBPStack[m_FrameCount] = currentFrame; m_FrameCount++; @@ -255,7 +255,7 @@ void ETW::SamplingLog::Append(SIZE_T currentFrame) /********************************************************/ /* Function to get the callstack on the current thread */ /********************************************************/ -ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::GetCurrentThreadsCallStack(UINT32 *frameCount, PVOID **Stack) +ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::GetCurrentThreadsCallStack(UINT32* frameCount, PVOID** Stack) { CONTRACTL { @@ -278,17 +278,17 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::GetCurrentThreadsCallStac // this not really needed, but let's do it // because we use the framecount while dumping the stack event - for(int i=m_FrameCount; im_Next; // Skip the top N frames - if(skipTopNFrames) { + if (skipTopNFrames) { skipTopNFrames--; continue; } @@ -358,16 +358,16 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::SaveCurrentStack(int skip Append(lastEBP->m_ReturnAddress); // Check for stack limits - if((SIZE_T)currentEBP < (SIZE_T)Thread::GetStackLowerBound() || (SIZE_T)currentEBP > (SIZE_T)Thread::GetStackUpperBound()) + if ((SIZE_T)currentEBP < (SIZE_T)Thread::GetStackLowerBound() || (SIZE_T)currentEBP >(SIZE_T)Thread::GetStackUpperBound()) { break; } // If we have a too small address, we are probably bad - if((SIZE_T)currentEBP < (SIZE_T)0x10000) + if ((SIZE_T)currentEBP < (SIZE_T)0x10000) break; - if((SIZE_T)currentEBP < (SIZE_T)lastEBP) + if ((SIZE_T)currentEBP < (SIZE_T)lastEBP) { break; } @@ -378,7 +378,7 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::SaveCurrentStack(int skip UINT_PTR ControlPc = 0; UINT_PTR CurrentSP = 0, PrevSP = 0; - while(1) + while (1) { // Unwind to the caller ControlPc = Thread::VirtualUnwindCallFrame(&ctx); @@ -387,13 +387,13 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::SaveCurrentStack(int skip CurrentSP = (UINT_PTR)GetSP(&ctx); // when to break from this loop - if ( ControlPc == 0 || ( PrevSP == CurrentSP ) ) + if (ControlPc == 0 || (PrevSP == CurrentSP)) { break; } // Skip the top N frames - if ( skipTopNFrames ) { + if (skipTopNFrames) { skipTopNFrames--; continue; } @@ -404,7 +404,7 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::SaveCurrentStack(int skip PrevSP = CurrentSP; } #endif //TARGET_X86 - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); pThread->MarkEtwStackWalkCompleted(); #endif //!DACCESS_COMPILE @@ -431,7 +431,7 @@ ETW::SamplingLog::EtwStackWalkStatus ETW::SamplingLog::SaveCurrentStack(int skip /***************************************************************************/ /* This function should be called from the event tracing callback routine when the private CLR provider is enabled */ -/***************************************************************************/ + /***************************************************************************/ #ifndef FEATURE_REDHAWK @@ -440,13 +440,13 @@ void ETW::GCLog::GCSettingsEvent() if (GCHeapUtilities::IsGCHeapInitialized()) { if (ETW_TRACING_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, - GCSettings)) + GCSettings)) { ETW::GCLog::ETW_GC_INFO Info; - Info.GCSettings.ServerGC = GCHeapUtilities::IsServerHeap (); - Info.GCSettings.SegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize (FALSE); - Info.GCSettings.LargeObjectSegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize (TRUE); + Info.GCSettings.ServerGC = GCHeapUtilities::IsServerHeap(); + Info.GCSettings.SegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize(FALSE); + Info.GCSettings.LargeObjectSegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize(TRUE); FireEtwGCSettings_V1(Info.GCSettings.SegmentSize, Info.GCSettings.LargeObjectSegmentSize, Info.GCSettings.ServerGC, GetClrInstanceId()); } GCHeapUtilities::GetGCHeap()->TraceGCSegments(); @@ -518,13 +518,13 @@ struct EtwGcMovementContext // else, a new EtwGcMovementContext is allocated, stored in that pointer, and // then returned. Callers should test for NULL, which can be returned if out of // memory - static EtwGcMovementContext * GetOrCreateInGCContext(EtwGcMovementContext ** ppContext) + static EtwGcMovementContext* GetOrCreateInGCContext(EtwGcMovementContext** ppContext) { LIMITED_METHOD_CONTRACT; _ASSERTE(ppContext != NULL); - EtwGcMovementContext * pContext = *ppContext; + EtwGcMovementContext* pContext = *ppContext; if (pContext == NULL) { pContext = new (nothrow) EtwGcMovementContext; @@ -597,13 +597,13 @@ struct MovedReferenceContextForEtwAndProfapi // returned; else, a new MovedReferenceContextForEtwAndProfapi is allocated, stored // in that pointer, and then returned. Callers should test for NULL, which can be // returned if out of memory - static MovedReferenceContextForEtwAndProfapi * CreateInGCContext(LPVOID pvContext) + static MovedReferenceContextForEtwAndProfapi* CreateInGCContext(LPVOID pvContext) { LIMITED_METHOD_CONTRACT; _ASSERTE(pvContext != NULL); - MovedReferenceContextForEtwAndProfapi * pContext = *(MovedReferenceContextForEtwAndProfapi **) pvContext; + MovedReferenceContextForEtwAndProfapi* pContext = *(MovedReferenceContextForEtwAndProfapi**)pvContext; // Shouldn't be called if the context was already created. Perhaps someone made // one too many BeginMovedReferences calls, or didn't have an EndMovedReferences @@ -611,7 +611,7 @@ struct MovedReferenceContextForEtwAndProfapi _ASSERTE(pContext == NULL); pContext = new (nothrow) MovedReferenceContextForEtwAndProfapi; - *(MovedReferenceContextForEtwAndProfapi **) pvContext = pContext; + *(MovedReferenceContextForEtwAndProfapi**)pvContext = pContext; return pContext; } @@ -626,7 +626,7 @@ struct MovedReferenceContextForEtwAndProfapi } LPVOID pctxProfAPI; - EtwGcMovementContext * pctxEtw; + EtwGcMovementContext* pctxEtw; }; @@ -648,8 +648,8 @@ struct MovedReferenceContextForEtwAndProfapi // static void ETW::GCLog::MovedReference( - BYTE * pbMemBlockStart, - BYTE * pbMemBlockEnd, + BYTE* pbMemBlockStart, + BYTE* pbMemBlockEnd, ptrdiff_t cbRelocDistance, size_t profilingContext, BOOL fCompacting, @@ -665,8 +665,8 @@ void ETW::GCLog::MovedReference( } CONTRACTL_END; - MovedReferenceContextForEtwAndProfapi * pCtxForEtwAndProfapi = - (MovedReferenceContextForEtwAndProfapi *) profilingContext; + MovedReferenceContextForEtwAndProfapi* pCtxForEtwAndProfapi = + (MovedReferenceContextForEtwAndProfapi*)profilingContext; if (pCtxForEtwAndProfapi == NULL) { _ASSERTE(!"MovedReference() encountered a NULL profilingContext"); @@ -678,10 +678,10 @@ void ETW::GCLog::MovedReference( { BEGIN_PIN_PROFILER(CORProfilerTrackGC()); g_profControlBlock.pProfInterface->MovedReference(pbMemBlockStart, - pbMemBlockEnd, - cbRelocDistance, - &(pCtxForEtwAndProfapi->pctxProfAPI), - fCompacting); + pbMemBlockEnd, + cbRelocDistance, + &(pCtxForEtwAndProfapi->pctxProfAPI), + fCompacting); END_PIN_PROFILER(); } #endif // PROFILING_SUPPORTED @@ -691,7 +691,7 @@ void ETW::GCLog::MovedReference( if (!ShouldTrackMovementForEtw()) return; - EtwGcMovementContext * pContext = + EtwGcMovementContext* pContext = EtwGcMovementContext::GetOrCreateInGCContext(&pCtxForEtwAndProfapi->pctxEtw); if (pContext == NULL) return; @@ -701,7 +701,7 @@ void ETW::GCLog::MovedReference( // Moved references _ASSERTE(pContext->cBulkMovedObjectRanges < _countof(pContext->rgGCBulkMovedObjectRanges)); - EventStructGCBulkMovedObjectRangesValue * pValue = + EventStructGCBulkMovedObjectRangesValue* pValue = &pContext->rgGCBulkMovedObjectRanges[pContext->cBulkMovedObjectRanges]; pValue->OldRangeBase = pbMemBlockStart; pValue->NewRangeBase = pbMemBlockStart + cbRelocDistance; @@ -727,7 +727,7 @@ void ETW::GCLog::MovedReference( // Surviving references _ASSERTE(pContext->cBulkSurvivingObjectRanges < _countof(pContext->rgGCBulkSurvivingObjectRanges)); - EventStructGCBulkSurvivingObjectRangesValue * pValue = + EventStructGCBulkSurvivingObjectRangesValue* pValue = &pContext->rgGCBulkSurvivingObjectRanges[pContext->cBulkSurvivingObjectRanges]; pValue->RangeBase = pbMemBlockStart; pValue->RangeLength = pbMemBlockEnd - pbMemBlockStart; @@ -763,7 +763,7 @@ void ETW::GCLog::MovedReference( // // static -void ETW::GCLog::BeginMovedReferences(size_t * pProfilingContext) +void ETW::GCLog::BeginMovedReferences(size_t* pProfilingContext) { LIMITED_METHOD_CONTRACT; @@ -794,7 +794,7 @@ void ETW::GCLog::EndMovedReferences(size_t profilingContext, } CONTRACTL_END; - MovedReferenceContextForEtwAndProfapi * pCtxForEtwAndProfapi = (MovedReferenceContextForEtwAndProfapi *) profilingContext; + MovedReferenceContextForEtwAndProfapi* pCtxForEtwAndProfapi = (MovedReferenceContextForEtwAndProfapi*)profilingContext; if (pCtxForEtwAndProfapi == NULL) { _ASSERTE(!"EndMovedReferences() encountered a NULL profilingContext"); @@ -817,7 +817,7 @@ void ETW::GCLog::EndMovedReferences(size_t profilingContext, // If context isn't already set up for us, then we haven't been collecting any data // for ETW events. - EtwGcMovementContext * pContext = pCtxForEtwAndProfapi->pctxEtw; + EtwGcMovementContext* pContext = pCtxForEtwAndProfapi->pctxEtw; if (pContext == NULL) return; @@ -893,7 +893,7 @@ void ETW::GCLog::ForceGC(LONGLONG l64ClientSequenceNumber) // // static -void ETW::GCLog::FireGcStart(ETW_GC_INFO * pGcInfo) +void ETW::GCLog::FireGcStart(ETW_GC_INFO* pGcInfo) { LIMITED_METHOD_CONTRACT; @@ -924,7 +924,7 @@ void ETW::GCLog::FireGcStart(ETW_GC_INFO * pGcInfo) FireEtwGCStart_V2(pGcInfo->GCStart.Count, pGcInfo->GCStart.Depth, pGcInfo->GCStart.Reason, pGcInfo->GCStart.Type, GetClrInstanceId(), l64ClientSequenceNumberToLog); #elif defined(FEATURE_DTRACE) - FireEtwGCStart(pGcInfo->GCStart.Count,pGcInfo->GCStart.Reason); + FireEtwGCStart(pGcInfo->GCStart.Count, pGcInfo->GCStart.Reason); #endif } @@ -990,7 +990,7 @@ HRESULT ETW::GCLog::ForceGCForDiagnostics() _ASSERTE(GCHeapUtilities::IsGCHeapInitialized()); ThreadStore::AttachCurrentThread(); - Thread * pThread = ThreadStore::GetCurrentThread(); + Thread* pThread = ThreadStore::GetCurrentThread(); // Doing this prevents the GC from trying to walk this thread's stack for roots. pThread->SetGCSpecial(true); @@ -1011,11 +1011,11 @@ HRESULT ETW::GCLog::ForceGCForDiagnostics() pThread->EnablePreemptiveMode(); #else // !FEATURE_REDHAWK } - EX_CATCH { } - EX_END_CATCH(RethrowCorruptingExceptions); +EX_CATCH{ } +EX_END_CATCH(RethrowCorruptingExceptions); #endif // FEATURE_REDHAWK - return hr; +return hr; } @@ -1142,7 +1142,7 @@ void BulkTypeEventLogger::FireBulkTypeEvent() #ifdef FEATURE_REDHAWK ((m_rgBulkTypeValues[iTypeData].cTypeParameters == 1) ? &(m_rgBulkTypeValues[iTypeData].ullSingleTypeParameter) : - (ULONGLONG *) (m_rgBulkTypeValues[iTypeData].rgTypeParameters)), + (ULONGLONG*)(m_rgBulkTypeValues[iTypeData].rgTypeParameters)), #else m_rgBulkTypeValues[iTypeData].rgTypeParameters.GetElements(), #endif @@ -1200,7 +1200,7 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) return -1; } - BulkTypeValue * pVal = &m_rgBulkTypeValues[m_nBulkTypeValueCount]; + BulkTypeValue* pVal = &m_rgBulkTypeValues[m_nBulkTypeValueCount]; // Clear out pVal before filling it out (array elements can get reused if there // are enough types that we need to flush to multiple events). Clearing the @@ -1211,7 +1211,7 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) pVal->Clear(); fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -1219,11 +1219,11 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) if (!fSucceeded) return -1; - pVal->fixedSizedData.TypeID = (ULONGLONG) th.AsTAddr(); - pVal->fixedSizedData.ModuleID = (ULONGLONG) (TADDR) th.GetModule(); + pVal->fixedSizedData.TypeID = (ULONGLONG)th.AsTAddr(); + pVal->fixedSizedData.ModuleID = (ULONGLONG)(TADDR)th.GetModule(); pVal->fixedSizedData.TypeNameID = (th.GetMethodTable() == NULL) ? 0 : th.GetCl(); pVal->fixedSizedData.Flags = 0; - pVal->fixedSizedData.CorElementType = (BYTE) th.GetInternalCorElementType(); + pVal->fixedSizedData.CorElementType = (BYTE)th.GetInternalCorElementType(); if (th.IsArray()) { @@ -1234,10 +1234,10 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) fSucceeded = FALSE; EX_TRY { - pVal->rgTypeParameters.Append((ULONGLONG) th.AsArray()->GetArrayElementTypeHandle().AsTAddr()); + pVal->rgTypeParameters.Append((ULONGLONG)th.AsArray()->GetArrayElementTypeHandle().AsTAddr()); fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -1254,10 +1254,10 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) fSucceeded = FALSE; EX_TRY { - pVal->rgTypeParameters.Append((ULONGLONG) pTypeDesc->GetTypeParam().AsTAddr()); + pVal->rgTypeParameters.Append((ULONGLONG)pTypeDesc->GetTypeParam().AsTAddr()); fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -1290,13 +1290,13 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) fSucceeded = FALSE; EX_TRY { - for (DWORD i=0; i < cTypeParameters; i++) + for (DWORD i = 0; i < cTypeParameters; i++) { - pVal->rgTypeParameters.Append((ULONGLONG) inst[i].AsTAddr()); + pVal->rgTypeParameters.Append((ULONGLONG)inst[i].AsTAddr()); } fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -1332,7 +1332,7 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) } pVal->sName.Normalize(); } - EX_CATCH + EX_CATCH { // If this failed, the name remains empty, which is ok; the event just // won't have a name in it. @@ -1397,7 +1397,7 @@ void BulkTypeEventLogger::LogTypeAndParameters(ULONGLONG thAsAddr, ETW::TypeSyst } CONTRACTL_END; - TypeHandle th = TypeHandle::FromTAddr((TADDR) thAsAddr); + TypeHandle th = TypeHandle::FromTAddr((TADDR)thAsAddr); // Batch up this type. This grabs useful info about the type, including any // type parameters it may have, and sticks it in m_rgBulkTypeValues @@ -1410,7 +1410,7 @@ void BulkTypeEventLogger::LogTypeAndParameters(ULONGLONG thAsAddr, ETW::TypeSyst } // Look at the type info we just batched, so we can get the type parameters - BulkTypeValue * pVal = &m_rgBulkTypeValues[iBulkTypeEventData]; + BulkTypeValue* pVal = &m_rgBulkTypeValues[iBulkTypeEventData]; // We're about to recursively call ourselves for the type parameters, so make a // local copy of their type handles first (else, as we log them we could flush @@ -1428,7 +1428,7 @@ void BulkTypeEventLogger::LogTypeAndParameters(ULONGLONG thAsAddr, ETW::TypeSyst } fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -1443,7 +1443,7 @@ void BulkTypeEventLogger::LogTypeAndParameters(ULONGLONG thAsAddr, ETW::TypeSyst typeLogBehavior = ETW::TypeSystemLog::kTypeLogBehaviorAssumeLockAndLogIfFirstTime; // Recursively log any referenced parameter types - for (COUNT_T i=0; i < cParams; i++) + for (COUNT_T i = 0; i < cParams; i++) { ETW::TypeSystemLog::LogTypeAndParametersIfNecessary(this, rgTypeParameters[i], typeLogBehavior); } @@ -1463,13 +1463,13 @@ class EtwGcHeapDumpContext // ProfilerWalkHeapContext::pvEtwContext; if non-NULL it gets returned; else, a new // EtwGcHeapDumpContext is allocated, stored in that pointer, and then returned. // Callers should test for NULL, which can be returned if out of memory - static EtwGcHeapDumpContext * GetOrCreateInGCContext(LPVOID * ppvEtwContext) + static EtwGcHeapDumpContext* GetOrCreateInGCContext(LPVOID* ppvEtwContext) { LIMITED_METHOD_CONTRACT; _ASSERTE(ppvEtwContext != NULL); - EtwGcHeapDumpContext * pContext = (EtwGcHeapDumpContext *) *ppvEtwContext; + EtwGcHeapDumpContext* pContext = (EtwGcHeapDumpContext*)*ppvEtwContext; if (pContext == NULL) { pContext = new (nothrow) EtwGcHeapDumpContext; @@ -1644,10 +1644,10 @@ class EtwGcHeapDumpContext // static void ETW::GCLog::RootReference( LPVOID pvHandle, - Object * pRootedNode, - Object * pSecondaryNodeForDependentHandle, + Object* pRootedNode, + Object* pSecondaryNodeForDependentHandle, BOOL fDependentHandle, - ProfilingScanContext * profilingScanContext, + ProfilingScanContext* profilingScanContext, DWORD dwGCFlags, DWORD rootFlags) { @@ -1657,14 +1657,14 @@ void ETW::GCLog::RootReference( if (pRootedNode == NULL) return; - EtwGcHeapDumpContext * pContext = + EtwGcHeapDumpContext* pContext = EtwGcHeapDumpContext::GetOrCreateInGCContext(&profilingScanContext->pvEtwContext); if (pContext == NULL) return; // Determine root kind, root ID, and handle-specific flags LPVOID pvRootID = NULL; - BYTE nRootKind = (BYTE) profilingScanContext->dwEtwRootKind; + BYTE nRootKind = (BYTE)profilingScanContext->dwEtwRootKind; switch (nRootKind) { case kEtwGCRootKindStack: @@ -1699,7 +1699,7 @@ void ETW::GCLog::RootReference( { _ASSERTE(pContext->cGCBulkRootConditionalWeakTableElementEdges < _countof(pContext->rgGCBulkRootConditionalWeakTableElementEdges)); - EventStructGCBulkRootConditionalWeakTableElementEdgeValue * pRCWTEEdgeValue = + EventStructGCBulkRootConditionalWeakTableElementEdgeValue* pRCWTEEdgeValue = &pContext->rgGCBulkRootConditionalWeakTableElementEdges[pContext->cGCBulkRootConditionalWeakTableElementEdges]; pRCWTEEdgeValue->GCKeyNodeID = pRootedNode; pRCWTEEdgeValue->GCValueNodeID = pSecondaryNodeForDependentHandle; @@ -1724,7 +1724,7 @@ void ETW::GCLog::RootReference( else { _ASSERTE(pContext->cGcBulkRootEdges < _countof(pContext->rgGcBulkRootEdges)); - EventStructGCBulkRootEdgeValue * pBulkRootEdgeValue = &pContext->rgGcBulkRootEdges[pContext->cGcBulkRootEdges]; + EventStructGCBulkRootEdgeValue* pBulkRootEdgeValue = &pContext->rgGcBulkRootEdges[pContext->cGcBulkRootEdges]; pBulkRootEdgeValue->RootedNodeAddress = pRootedNode; pBulkRootEdgeValue->GCRootKind = nRootKind; pBulkRootEdgeValue->GCRootFlag = rootFlags; @@ -1765,11 +1765,11 @@ void ETW::GCLog::RootReference( // static void ETW::GCLog::ObjectReference( - ProfilerWalkHeapContext * profilerWalkHeapContext, - Object * pObjReferenceSource, + ProfilerWalkHeapContext* profilerWalkHeapContext, + Object* pObjReferenceSource, ULONGLONG typeID, ULONGLONG cRefs, - Object ** rgObjReferenceTargets) + Object** rgObjReferenceTargets) { #ifndef WINXP_AND_WIN2K3_BUILD_SUPPORT CONTRACTL @@ -1783,7 +1783,7 @@ void ETW::GCLog::ObjectReference( } CONTRACTL_END; - EtwGcHeapDumpContext * pContext = + EtwGcHeapDumpContext* pContext = EtwGcHeapDumpContext::GetOrCreateInGCContext(&profilerWalkHeapContext->pvEtwContext); if (pContext == NULL) return; @@ -1794,7 +1794,7 @@ void ETW::GCLog::ObjectReference( // Add Node (pObjReferenceSource) to buffer _ASSERTE(pContext->cGcBulkNodeValues < _countof(pContext->rgGcBulkNodeValues)); - EventStructGCBulkNodeValue * pBulkNodeValue = &pContext->rgGcBulkNodeValues[pContext->cGcBulkNodeValues]; + EventStructGCBulkNodeValue* pBulkNodeValue = &pContext->rgGcBulkNodeValues[pContext->cGcBulkNodeValues]; pBulkNodeValue->Address = pObjReferenceSource; pBulkNodeValue->Size = pObjReferenceSource->GetSize(); pBulkNodeValue->TypeID = typeID; @@ -1830,7 +1830,7 @@ void ETW::GCLog::ObjectReference( // During heap walk, GC holds the lock for us, so we can directly enter the // hash to see if the type has already been logged ETW::TypeSystemLog::kTypeLogBehaviorAssumeLockAndLogIfFirstTime - ); + ); } //--------------------------------------------------------------------------------------- @@ -1842,10 +1842,10 @@ void ETW::GCLog::ObjectReference( // a lot of edges), so empty Edge buffer into ETW as we go along, as many times as we // need. - for (ULONGLONG i=0; i < cRefs; i++) + for (ULONGLONG i = 0; i < cRefs; i++) { _ASSERTE(pContext->cGcBulkEdgeValues < _countof(pContext->rgGcBulkEdgeValues)); - EventStructGCBulkEdgeValue * pBulkEdgeValue = &pContext->rgGcBulkEdgeValues[pContext->cGcBulkEdgeValues]; + EventStructGCBulkEdgeValue* pBulkEdgeValue = &pContext->rgGcBulkEdgeValues[pContext->cGcBulkEdgeValues]; pBulkEdgeValue->Value = rgObjReferenceTargets[i]; // FUTURE: ReferencingFieldID pBulkEdgeValue->ReferencingFieldID = 0; @@ -1878,14 +1878,14 @@ void ETW::GCLog::ObjectReference( // // static -void ETW::GCLog::EndHeapDump(ProfilerWalkHeapContext * profilerWalkHeapContext) +void ETW::GCLog::EndHeapDump(ProfilerWalkHeapContext* profilerWalkHeapContext) { #ifndef WINXP_AND_WIN2K3_BUILD_SUPPORT LIMITED_METHOD_CONTRACT; // If context isn't already set up for us, then we haven't been collecting any data // for ETW events. - EtwGcHeapDumpContext * pContext = (EtwGcHeapDumpContext *) profilerWalkHeapContext->pvEtwContext; + EtwGcHeapDumpContext* pContext = (EtwGcHeapDumpContext*)profilerWalkHeapContext->pvEtwContext; if (pContext == NULL) return; @@ -1969,7 +1969,7 @@ void ETW::GCLog::EndHeapDump(ProfilerWalkHeapContext * profilerWalkHeapContext) // // static -void ETW::GCLog::SendFinalizeObjectEvent(MethodTable * pMT, Object * pObj) +void ETW::GCLog::SendFinalizeObjectEvent(MethodTable* pMT, Object* pObj) { CONTRACTL { @@ -1991,12 +1991,12 @@ void ETW::GCLog::SendFinalizeObjectEvent(MethodTable * pMT, Object * pObj) // finalized object's type (and parameter types, if any) ETW::TypeSystemLog::LogTypeAndParametersIfNecessary( NULL, // Not batching this type with others - (TADDR) pMT, + (TADDR)pMT, // Don't spend the time entering the lock and checking the hash table to see // if we've already logged the type; just log it (if type events are enabled). ETW::TypeSystemLog::kTypeLogBehaviorAlwaysLog - ); + ); } // Send private finalize object event, if it's enabled @@ -2007,14 +2007,14 @@ void ETW::GCLog::SendFinalizeObjectEvent(MethodTable * pMT, Object * pObj) DefineFullyQualifiedNameForClassWOnStack(); FireEtwPrvFinalizeObject(pMT, pObj, GetClrInstanceId(), GetFullyQualifiedNameForClassNestedAwareW(pMT)); } - EX_CATCH + EX_CATCH { } EX_END_CATCH(RethrowCorruptingExceptions); } } -DWORD ETW::ThreadLog::GetEtwThreadFlags(Thread * pThread) +DWORD ETW::ThreadLog::GetEtwThreadFlags(Thread* pThread) { LIMITED_METHOD_CONTRACT; @@ -2037,7 +2037,7 @@ DWORD ETW::ThreadLog::GetEtwThreadFlags(Thread * pThread) return dwEtwThreadFlags; } -void ETW::ThreadLog::FireThreadCreated(Thread * pThread) +void ETW::ThreadLog::FireThreadCreated(Thread* pThread) { LIMITED_METHOD_CONTRACT; @@ -2050,7 +2050,7 @@ void ETW::ThreadLog::FireThreadCreated(Thread * pThread) GetClrInstanceId()); } -void ETW::ThreadLog::FireThreadDC(Thread * pThread) +void ETW::ThreadLog::FireThreadDC(Thread* pThread) { LIMITED_METHOD_CONTRACT; @@ -2088,7 +2088,7 @@ class LoggedTypesFromModuleTraits : public NoRemoveSHashTraits< DefaultSHashTrai typedef TypeHandle key_t; - static key_t GetKey(const element_t &e) + static key_t GetKey(const element_t& e) { LIMITED_METHOD_CONTRACT; return e.th; @@ -2103,10 +2103,10 @@ class LoggedTypesFromModuleTraits : public NoRemoveSHashTraits< DefaultSHashTrai static count_t Hash(key_t k) { LIMITED_METHOD_CONTRACT; - return (count_t) k.AsTAddr(); + return (count_t)k.AsTAddr(); } - static bool IsNull(const element_t &e) + static bool IsNull(const element_t& e) { LIMITED_METHOD_CONTRACT; return (e.th.AsTAddr() == NULL); @@ -2125,23 +2125,23 @@ typedef SHash LoggedTypesFromModuleHash; class ETW::LoggedTypesFromModule { public: - Module * pModule; + Module* pModule; LoggedTypesFromModuleHash loggedTypesFromModuleHash; // These are used by the outer hash table (mapping Module*'s to instances of // LoggedTypesFromModule). - static COUNT_T Hash(Module * pModule) + static COUNT_T Hash(Module* pModule) { LIMITED_METHOD_CONTRACT; - return (COUNT_T) (SIZE_T) pModule; + return (COUNT_T)(SIZE_T)pModule; } - Module * GetKey() + Module* GetKey() { LIMITED_METHOD_CONTRACT; return pModule; } - LoggedTypesFromModule(Module * pModuleParam) : loggedTypesFromModuleHash() + LoggedTypesFromModule(Module* pModuleParam) : loggedTypesFromModuleHash() { LIMITED_METHOD_CONTRACT; pModule = pModuleParam; @@ -2156,19 +2156,19 @@ class ETW::LoggedTypesFromModule // The following define the outer hash table (mapping Module*'s to instances of // LoggedTypesFromModule). -class AllLoggedTypesTraits : public DefaultSHashTraits +class AllLoggedTypesTraits : public DefaultSHashTraits { public: // explicitly declare local typedefs for these traits types, otherwise // the compiler may get confused - typedef DefaultSHashTraits PARENT; + typedef DefaultSHashTraits PARENT; typedef PARENT::element_t element_t; typedef PARENT::count_t count_t; - typedef Module * key_t; + typedef Module* key_t; - static key_t GetKey(const element_t &e) + static key_t GetKey(const element_t& e) { LIMITED_METHOD_CONTRACT; return e->pModule; @@ -2183,10 +2183,10 @@ class AllLoggedTypesTraits : public DefaultSHashTraitsloggedTypesFromModuleHash.AddOrReplace(*pTypeLoggingInfo); fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -2447,7 +2447,7 @@ BOOL ETW::TypeSystemLog::AddOrReplaceTypeLoggingInfo(ETW::LoggedTypesFromModule // // static -void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) +void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object* pObject) { CONTRACTL { @@ -2465,7 +2465,7 @@ void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) TypeHandle th = pObject->GetTypeHandle(); SIZE_T size = pObject->GetSize(); - if(size < MIN_OBJECT_SIZE) + if (size < MIN_OBJECT_SIZE) { size = PtrAlign(size); } @@ -2481,7 +2481,7 @@ void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) // Get stats for type TypeLoggingInfo typeLoggingInfo(NULL); - LoggedTypesFromModule * pLoggedTypesFromModule = NULL; + LoggedTypesFromModule* pLoggedTypesFromModule = NULL; BOOL fCreatedNew = FALSE; typeLoggingInfo = LookupOrCreateTypeLoggingInfo(th, &fCreatedNew, &pLoggedTypesFromModule); if (typeLoggingInfo.th.IsNull()) @@ -2524,19 +2524,19 @@ void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) int nMinAllocPerMSec = typeLoggingInfo.dwAllocCountInCurrentBucket / 16; // This is an underestimation of the true rate. if (delta >= 16 || (nMinAllocPerMSec > 2 && nMinAllocPerMSec > typeLoggingInfo.flAllocPerMSec * 1.5F)) { - float flNewAllocPerMSec = 0; + float flNewAllocPerMSec = 0; if (delta >= 16) { // This is the normal case, our allocation rate is under control with the current throttling. - flNewAllocPerMSec = ((float) typeLoggingInfo.dwAllocCountInCurrentBucket) / delta; + flNewAllocPerMSec = ((float)typeLoggingInfo.dwAllocCountInCurrentBucket) / delta; // Do a exponential decay window that is 5 * max(16, AllocationInterval) - typeLoggingInfo.flAllocPerMSec = 0.8F * typeLoggingInfo.flAllocPerMSec + 0.2F * flNewAllocPerMSec; + typeLoggingInfo.flAllocPerMSec = 0.8F * typeLoggingInfo.flAllocPerMSec + 0.2F * flNewAllocPerMSec; typeLoggingInfo.dwTickOfCurrentTimeBucket = dwTickNow; typeLoggingInfo.dwAllocCountInCurrentBucket = 0; } else { - flNewAllocPerMSec = (float) nMinAllocPerMSec; + flNewAllocPerMSec = (float)nMinAllocPerMSec; // This means the second clause above is true, which means our sampling rate is too low // so we need to throttle quickly. typeLoggingInfo.flAllocPerMSec = flNewAllocPerMSec; @@ -2546,7 +2546,7 @@ void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) // Obey the desired sampling rate, but don't ignore > 1000 allocations per second // per type int nDesiredMsBetweenEvents = (s_nCustomMsBetweenEvents == 0) ? GetDefaultMsBetweenEvents() : s_nCustomMsBetweenEvents; - typeLoggingInfo.dwAllocsToSkipPerSample = min((int) (typeLoggingInfo.flAllocPerMSec * nDesiredMsBetweenEvents), 1000); + typeLoggingInfo.dwAllocsToSkipPerSample = min((int)(typeLoggingInfo.flAllocPerMSec * nDesiredMsBetweenEvents), 1000); if (typeLoggingInfo.dwAllocsToSkipPerSample == 1) typeLoggingInfo.dwAllocsToSkipPerSample = 0; } @@ -2586,11 +2586,11 @@ void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) // Now log the allocation if (s_fHeapAllocHighEventEnabledNow) { - FireEtwGCSampledObjectAllocationHigh(pObject, (LPVOID) th.AsTAddr(), dwObjectCountForTypeSample, nTotalSizeForTypeSample, GetClrInstanceId()); + FireEtwGCSampledObjectAllocationHigh(pObject, (LPVOID)th.AsTAddr(), dwObjectCountForTypeSample, nTotalSizeForTypeSample, GetClrInstanceId()); } else { - FireEtwGCSampledObjectAllocationLow(pObject, (LPVOID) th.AsTAddr(), dwObjectCountForTypeSample, nTotalSizeForTypeSample, GetClrInstanceId()); + FireEtwGCSampledObjectAllocationLow(pObject, (LPVOID)th.AsTAddr(), dwObjectCountForTypeSample, nTotalSizeForTypeSample, GetClrInstanceId()); } } @@ -2603,7 +2603,7 @@ void ETW::TypeSystemLog::SendObjectAllocatedEvent(Object * pObject) // // static -CrstBase * ETW::TypeSystemLog::GetHashCrst() +CrstBase* ETW::TypeSystemLog::GetHashCrst() { LIMITED_METHOD_CONTRACT; return &AllLoggedTypes::s_cs; @@ -2629,7 +2629,7 @@ CrstBase * ETW::TypeSystemLog::GetHashCrst() // // static -void ETW::TypeSystemLog::LogTypeAndParametersIfNecessary(BulkTypeEventLogger * pLogger, ULONGLONG thAsAddr, TypeLogBehavior typeLogBehavior) +void ETW::TypeSystemLog::LogTypeAndParametersIfNecessary(BulkTypeEventLogger* pLogger, ULONGLONG thAsAddr, TypeLogBehavior typeLogBehavior) { CONTRACTL { @@ -2650,7 +2650,7 @@ void ETW::TypeSystemLog::LogTypeAndParametersIfNecessary(BulkTypeEventLogger * p return; } - TypeHandle th = TypeHandle::FromTAddr((TADDR) thAsAddr); + TypeHandle th = TypeHandle::FromTAddr((TADDR)thAsAddr); if (!th.IsRestored()) { return; @@ -2661,11 +2661,11 @@ void ETW::TypeSystemLog::LogTypeAndParametersIfNecessary(BulkTypeEventLogger * p // through to the logging code below. If caller doesn't care, then don't even // check; just log the type BOOL fShouldLogType = ((typeLogBehavior == kTypeLogBehaviorAlwaysLog) || - (typeLogBehavior == kTypeLogBehaviorAssumeLockAndAlwaysLogTopLevelType)) ? - TRUE : - ((typeLogBehavior == kTypeLogBehaviorTakeLockAndLogIfFirstTime) ? - ShouldLogType(th) : - ShouldLogTypeNoLock(th)); + (typeLogBehavior == kTypeLogBehaviorAssumeLockAndAlwaysLogTopLevelType)) ? + TRUE : + ((typeLogBehavior == kTypeLogBehaviorTakeLockAndLogIfFirstTime) ? + ShouldLogType(th) : + ShouldLogTypeNoLock(th)); if (!fShouldLogType) return; @@ -2767,7 +2767,7 @@ BOOL ETW::TypeSystemLog::ShouldLogTypeNoLock(TypeHandle th) // // static -ETW::TypeLoggingInfo ETW::TypeSystemLog::LookupOrCreateTypeLoggingInfo(TypeHandle th, BOOL * pfCreatedNew, LoggedTypesFromModule ** ppLoggedTypesFromModule /* = NULL */) +ETW::TypeLoggingInfo ETW::TypeSystemLog::LookupOrCreateTypeLoggingInfo(TypeHandle th, BOOL* pfCreatedNew, LoggedTypesFromModule** ppLoggedTypesFromModule /* = NULL */) { LIMITED_METHOD_CONTRACT; @@ -2794,9 +2794,9 @@ ETW::TypeLoggingInfo ETW::TypeSystemLog::LookupOrCreateTypeLoggingInfo(TypeHandl // Step 1: go from LoaderModule to hash of types. - Module * pLoaderModule = th.GetLoaderModule(); + Module* pLoaderModule = th.GetLoaderModule(); _ASSERTE(pLoaderModule != NULL); - LoggedTypesFromModule * pLoggedTypesFromModule = s_pAllLoggedTypes->allLoggedTypesHash.Lookup(pLoaderModule); + LoggedTypesFromModule* pLoggedTypesFromModule = s_pAllLoggedTypes->allLoggedTypesHash.Lookup(pLoaderModule); if (pLoggedTypesFromModule == NULL) { pLoggedTypesFromModule = new (nothrow) LoggedTypesFromModule(pLoaderModule); @@ -2813,7 +2813,7 @@ ETW::TypeLoggingInfo ETW::TypeSystemLog::LookupOrCreateTypeLoggingInfo(TypeHandl s_pAllLoggedTypes->allLoggedTypesHash.Add(pLoggedTypesFromModule); fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -2850,7 +2850,7 @@ ETW::TypeLoggingInfo ETW::TypeSystemLog::LookupOrCreateTypeLoggingInfo(TypeHandl pLoggedTypesFromModule->loggedTypesFromModuleHash.Add(typeLoggingInfoNew); fSucceeded = TRUE; } - EX_CATCH + EX_CATCH { fSucceeded = FALSE; } @@ -2876,7 +2876,7 @@ ETW::TypeLoggingInfo ETW::TypeSystemLog::LookupOrCreateTypeLoggingInfo(TypeHandl // // static -void ETW::TypeSystemLog::OnModuleUnload(Module * pModule) +void ETW::TypeSystemLog::OnModuleUnload(Module* pModule) { CONTRACTL { @@ -2895,7 +2895,7 @@ void ETW::TypeSystemLog::OnModuleUnload(Module * pModule) return; } - LoggedTypesFromModule * pLoggedTypesFromModule = NULL; + LoggedTypesFromModule* pLoggedTypesFromModule = NULL; { CrstHolder _crst(GetHashCrst()); @@ -2943,12 +2943,12 @@ void ETW::TypeSystemLog::OnTypesKeywordTurnedOff() return; // Destruct each of the per-module TypesHashes - AllLoggedTypesHash * pLoggedTypesHash = &s_pAllLoggedTypes->allLoggedTypesHash; + AllLoggedTypesHash* pLoggedTypesHash = &s_pAllLoggedTypes->allLoggedTypesHash; for (AllLoggedTypesHash::Iterator iter = pLoggedTypesHash->Begin(); - iter != pLoggedTypesHash->End(); - ++iter) + iter != pLoggedTypesHash->End(); + ++iter) { - LoggedTypesFromModule * pLoggedTypesFromModule = *iter; + LoggedTypesFromModule* pLoggedTypesFromModule = *iter; delete pLoggedTypesFromModule; } @@ -2962,10 +2962,10 @@ void ETW::TypeSystemLog::OnTypesKeywordTurnedOff() /****************************************************************************/ /* Called when ETW is turned ON on an existing process and ModuleRange events are to be fired */ -/****************************************************************************/ + /****************************************************************************/ void ETW::EnumerationLog::ModuleRangeRundown() { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; @@ -2978,7 +2978,7 @@ void ETW::EnumerationLog::ModuleRangeRundown() { ETW::EnumerationLog::EnumerationHelper(NULL, NULL, ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoadPrivate); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ @@ -2986,7 +2986,7 @@ void ETW::EnumerationLog::ModuleRangeRundown() /****************************************************************************/ void ETW::EnumerationLog::StartRundown() { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; @@ -3004,7 +3004,7 @@ void ETW::EnumerationLog::StartRundown() TRACE_LEVEL_INFORMATION, CLR_RUNDOWNTHREADING_KEYWORD); - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNJIT_KEYWORD) || @@ -3028,30 +3028,30 @@ void ETW::EnumerationLog::StartRundown() FireEtwDCStartInit_V1(GetClrInstanceId()); // The rundown flag is expected to be checked in the caller, so no need to check here again - DWORD enumerationOptions=ETW::EnumerationLog::EnumerationStructs::None; - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + DWORD enumerationOptions = ETW::EnumerationLog::EnumerationStructs::None; + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNLOADER_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart; } - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNJIT_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::JitMethodDCStart; } - if(IsRundownNgenKeywordEnabledAndNotSuppressed()) + if (IsRundownNgenKeywordEnabledAndNotSuppressed()) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::NgenMethodDCStart; } - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNJITTEDMETHODILTONATIVEMAP_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::MethodDCStartILToNativeMap; } - if(bIsPerfTrackRundownEnabled) + if (bIsPerfTrackRundownEnabled) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCStart; } @@ -3076,7 +3076,7 @@ void ETW::EnumerationLog::StartRundown() // end marker event will go to the rundown provider FireEtwDCStartComplete_V1(GetClrInstanceId()); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } //--------------------------------------------------------------------------------------- @@ -3094,26 +3094,26 @@ DWORD ETW::EnumerationLog::GetEnumerationOptionsFromRuntimeKeywords() { LIMITED_METHOD_CONTRACT; - DWORD enumerationOptions=ETW::EnumerationLog::EnumerationStructs::None; - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + DWORD enumerationOptions = ETW::EnumerationLog::EnumerationStructs::None; + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_LOADER_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload; } - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_JIT_KEYWORD) && ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_ENDENUMERATION_KEYWORD)) + TRACE_LEVEL_INFORMATION, + CLR_ENDENUMERATION_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::JitMethodUnload; } - if(IsRuntimeNgenKeywordEnabledAndNotSuppressed() && + if (IsRuntimeNgenKeywordEnabledAndNotSuppressed() && ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_ENDENUMERATION_KEYWORD)) + TRACE_LEVEL_INFORMATION, + CLR_ENDENUMERATION_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::NgenMethodUnload; } @@ -3149,7 +3149,7 @@ void ETW::EnumerationLog::EnumerateForCaptureState() EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) { DWORD enumerationOptions = GetEnumerationOptionsFromRuntimeKeywords(); @@ -3165,7 +3165,7 @@ void ETW::EnumerationLog::EnumerateForCaptureState() SendThreadRundownEvent(); } } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /**************************************************************************************/ @@ -3173,7 +3173,7 @@ void ETW::EnumerationLog::EnumerateForCaptureState() /**************************************************************************************/ void ETW::EnumerationLog::EndRundown() { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; @@ -3187,7 +3187,7 @@ void ETW::EnumerationLog::EndRundown() MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNTHREADING_KEYWORD); - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNJIT_KEYWORD) || @@ -3210,30 +3210,30 @@ void ETW::EnumerationLog::EndRundown() FireEtwDCEndInit_V1(GetClrInstanceId()); // The rundown flag is expected to be checked in the caller, so no need to check here again - DWORD enumerationOptions=ETW::EnumerationLog::EnumerationStructs::None; - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + DWORD enumerationOptions = ETW::EnumerationLog::EnumerationStructs::None; + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNLOADER_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd; } - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNJIT_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd; } - if(IsRundownNgenKeywordEnabledAndNotSuppressed()) + if (IsRundownNgenKeywordEnabledAndNotSuppressed()) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::NgenMethodDCEnd; } - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNJITTEDMETHODILTONATIVEMAP_KEYWORD)) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::MethodDCEndILToNativeMap; } - if(bIsPerfTrackRundownEnabled) + if (bIsPerfTrackRundownEnabled) { enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCEnd; } @@ -3248,7 +3248,7 @@ void ETW::EnumerationLog::EndRundown() // end marker event will go to the rundown provider FireEtwDCEndComplete_V1(GetClrInstanceId()); } - } EX_CATCH { + } EX_CATCH{ STRESS_LOG1(LF_ALWAYS, LL_ERROR, "Exception during Rundown Enumeration, EIP of last AV = %p", g_LastAccessViolationEIP); } EX_END_CATCH(SwallowAllExceptions); } @@ -3290,9 +3290,9 @@ void InitializeEventTracing() // Register CLR providers with the OS if (g_pEtwTracer == NULL) { - NewHolder tempEtwTracer (new (nothrow) ETW::CEtwTracer()); - if (tempEtwTracer != NULL && tempEtwTracer->Register () == ERROR_SUCCESS) - g_pEtwTracer = tempEtwTracer.Extract (); + NewHolder tempEtwTracer(new (nothrow) ETW::CEtwTracer()); + if (tempEtwTracer != NULL && tempEtwTracer->Register() == ERROR_SUCCESS) + g_pEtwTracer = tempEtwTracer.Extract(); } g_nClrInstanceId = GetRuntimeId() & 0x0000FFFF; // This will give us duplicate ClrInstanceId after UINT16_MAX @@ -3375,37 +3375,44 @@ HRESULT ETW::CEtwTracer::UnRegister() extern "C" { ETW_INLINE - void EtwCallout(REGHANDLE RegHandle, - PCEVENT_DESCRIPTOR Descriptor, - ULONG ArgumentCount, - PEVENT_DATA_DESCRIPTOR EventData) + void EtwCallout(REGHANDLE RegHandle, + PCEVENT_DESCRIPTOR Descriptor, + ULONG ArgumentCount, + PEVENT_DATA_DESCRIPTOR EventData) { WRAPPER_NO_CONTRACT; UINT8 providerIndex = 0; - if(RegHandle == Microsoft_Windows_DotNETRuntimeHandle) { + if (RegHandle == Microsoft_Windows_DotNETRuntimeHandle) { providerIndex = 0; - } else if(RegHandle == Microsoft_Windows_DotNETRuntimeRundownHandle) { + } + else if (RegHandle == Microsoft_Windows_DotNETRuntimeRundownHandle) { providerIndex = 1; - } else if(RegHandle == Microsoft_Windows_DotNETRuntimeStressHandle) { + } + else if (RegHandle == Microsoft_Windows_DotNETRuntimeStressHandle) { providerIndex = 2; - } else if(RegHandle == Microsoft_Windows_DotNETRuntimePrivateHandle) { + } + else if (RegHandle == Microsoft_Windows_DotNETRuntimePrivateHandle) { providerIndex = 3; - } else { + } + else { _ASSERTE(!"Provider not one of Runtime, Rundown, Private and Stress"); return; } // stacks are supposed to be fired for only the events with a bit set in the etwStackSupportedEvents bitmap - if(((etwStackSupportedEvents[providerIndex][Descriptor->Id/8]) & - (1<<(Descriptor->Id%8))) != 0) + if (((etwStackSupportedEvents[providerIndex][Descriptor->Id / 8]) & + (1 << (Descriptor->Id % 8))) != 0) { - if(RegHandle == Microsoft_Windows_DotNETRuntimeHandle) { + if (RegHandle == Microsoft_Windows_DotNETRuntimeHandle) { ETW::SamplingLog::SendStackTrace(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, &CLRStackWalk, &CLRStackId); - } else if(RegHandle == Microsoft_Windows_DotNETRuntimeRundownHandle) { + } + else if (RegHandle == Microsoft_Windows_DotNETRuntimeRundownHandle) { ETW::SamplingLog::SendStackTrace(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, &CLRStackWalkDCStart, &CLRStackRundownId); - } else if(RegHandle == Microsoft_Windows_DotNETRuntimePrivateHandle) { + } + else if (RegHandle == Microsoft_Windows_DotNETRuntimePrivateHandle) { ETW::SamplingLog::SendStackTrace(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, &CLRStackWalkPrivate, &CLRStackPrivateId); - } else if(RegHandle == Microsoft_Windows_DotNETRuntimeStressHandle) { + } + else if (RegHandle == Microsoft_Windows_DotNETRuntimeStressHandle) { ETW::SamplingLog::SendStackTrace(MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_Context, &CLRStackWalkStress, &CLRStackStressId); } } @@ -3430,22 +3437,23 @@ extern "C" // action in this class, we pass "this" during provider registration and modify the // context to the relevant context in the C callback later. ETW_INLINE - void EtwCallback( - _In_ LPCGUID SourceId, - _In_ ULONG ControlCode, - _In_ UCHAR Level, - _In_ ULONGLONG MatchAnyKeyword, - _In_ ULONGLONG MatchAllKeyword, - _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData, - _Inout_opt_ PVOID CallbackContext) - { - CONTRACTL { + void EtwCallback( + _In_ LPCGUID SourceId, + _In_ ULONG ControlCode, + _In_ UCHAR Level, + _In_ ULONGLONG MatchAnyKeyword, + _In_ ULONGLONG MatchAllKeyword, + _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData, + _Inout_opt_ PVOID CallbackContext) + { + CONTRACTL{ NOTHROW; - if(g_fEEStarted) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}; - MODE_ANY; - CAN_TAKE_LOCK; - STATIC_CONTRACT_FAULT; - SO_NOT_MAINLINE; + if (g_fEEStarted) { GC_TRIGGERS; } + else { DISABLED(GC_NOTRIGGER); }; +MODE_ANY; +CAN_TAKE_LOCK; +STATIC_CONTRACT_FAULT; +SO_NOT_MAINLINE; } CONTRACTL_END; // Mark that we are the special ETWRundown thread. Currently all this does @@ -3459,21 +3467,21 @@ extern "C" BOOLEAN bIsPublicTraceHandle = #ifdef WINXP_AND_WIN2K3_BUILD_SUPPORT - McGenPreVista ? ((ULONGLONG)Microsoft_Windows_DotNETRuntimeHandle==(ULONGLONG)context) : + McGenPreVista ? ((ULONGLONG)Microsoft_Windows_DotNETRuntimeHandle == (ULONGLONG)context) : #endif - (context->RegistrationHandle==Microsoft_Windows_DotNETRuntimeHandle); + (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimeHandle); BOOLEAN bIsPrivateTraceHandle = #ifdef WINXP_AND_WIN2K3_BUILD_SUPPORT - McGenPreVista ? ((ULONGLONG)Microsoft_Windows_DotNETRuntimePrivateHandle==(ULONGLONG)context) : + McGenPreVista ? ((ULONGLONG)Microsoft_Windows_DotNETRuntimePrivateHandle == (ULONGLONG)context) : #endif - (context->RegistrationHandle==Microsoft_Windows_DotNETRuntimePrivateHandle); + (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimePrivateHandle); BOOLEAN bIsRundownTraceHandle = #ifdef WINXP_AND_WIN2K3_BUILD_SUPPORT - McGenPreVista ? ((ULONGLONG)Microsoft_Windows_DotNETRuntimeRundownHandle==(ULONGLONG)context) : + McGenPreVista ? ((ULONGLONG)Microsoft_Windows_DotNETRuntimeRundownHandle == (ULONGLONG)context) : #endif - (context->RegistrationHandle==Microsoft_Windows_DotNETRuntimeRundownHandle); + (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimeRundownHandle); // A manifest based provider can be enabled to multiple event tracing sessions @@ -3482,8 +3490,8 @@ extern "C" // IsEnabled will be TRUE when it is enabled and FALSE when disabled BOOL bEnabled = ((ControlCode == EVENT_CONTROL_CODE_ENABLE_PROVIDER) || - (ControlCode == EVENT_CONTROL_CODE_CAPTURE_STATE)); - if(bEnabled) + (ControlCode == EVENT_CONTROL_CODE_CAPTURE_STATE)); + if (bEnabled) { // TypeSystemLog needs a notification when certain keywords are modified, so // give it a hook here. @@ -3495,7 +3503,7 @@ extern "C" if (bIsPrivateTraceHandle) { ETW::GCLog::GCSettingsEvent(); - if(g_fEEStarted && !g_fEEShutDown) + if (g_fEEStarted && !g_fEEShutDown) { ETW::EnumerationLog::ModuleRangeRundown(); } @@ -3505,10 +3513,10 @@ extern "C" // If we have turned on the JIT keyword to the VERBOSE setting (needed to get JIT names) then // we assume that we also want good stack traces so we need to publish unwind information so // ETW can get at it - if(bIsPublicTraceHandle && ETW_CATEGORY_ENABLED((*context), TRACE_LEVEL_VERBOSE, CLR_RUNDOWNJIT_KEYWORD)) + if (bIsPublicTraceHandle && ETW_CATEGORY_ENABLED((*context), TRACE_LEVEL_VERBOSE, CLR_RUNDOWNJIT_KEYWORD)) UnwindInfoTable::PublishUnwindInfo(g_fEEStarted != FALSE); #endif - if(g_fEEStarted && !g_fEEShutDown && bIsRundownTraceHandle) + if (g_fEEStarted && !g_fEEShutDown && bIsRundownTraceHandle) { // Fire the runtime information event ETW::InfoLog::RuntimeInformation(ETW::InfoLog::InfoStructs::Callback); @@ -3516,15 +3524,15 @@ extern "C" // Start and End Method/Module Rundowns // Used to fire events that we missed since we started the controller after the process started // flags for immediate start rundown - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_RUNDOWNSTART_KEYWORD)) + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_RUNDOWNSTART_KEYWORD)) ETW::EnumerationLog::StartRundown(); // flags delayed end rundown - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_RUNDOWNEND_KEYWORD)) + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_RUNDOWNEND_KEYWORD)) ETW::EnumerationLog::EndRundown(); } @@ -3545,7 +3553,7 @@ extern "C" (FilterData->Type == 1) && (FilterData->Size == sizeof(l64ClientSequenceNumber))) { - l64ClientSequenceNumber = *(LONGLONG *) (FilterData->Ptr); + l64ClientSequenceNumber = *(LONGLONG*)(FilterData->Ptr); } ETW::GCLog::ForceGC(l64ClientSequenceNumber); } @@ -3566,7 +3574,7 @@ extern "C" /* in its printf API, we cast the unicode string to UFT8 string and then output them. */ /**************************************************************************************/ #define DTRACE_OUTPUT_STRING_LEN 512 -const CHAR szDtraceOutputNULL[]="NULL"; +const CHAR szDtraceOutputNULL[] = "NULL"; INT32 WideCharToMultiByte(LPCWSTR wszSrcStr, LPSTR szDstStr); #include @@ -3586,7 +3594,7 @@ ULONG ETW::CEtwTracer::Register() // Get Env Var COMPlus_ETWEnabled char szETWEnabled[SIZE_ETWEnabled]; DWORD newLen = GetEnvironmentVariableA("COMPlus_ETWEnabled", szETWEnabled, SIZE_ETWEnabled); - if (newLen == 0 || newLen >= SIZE_ETWEnabled || strcmp(szETWEnabled, "1") != 0) + if (newLen == 0 || newLen >= SIZE_ETWEnabled || strcmp(szETWEnabled, "1") != 0) return 0; // Get Env Var COMPlus_EventInfo @@ -3621,12 +3629,12 @@ INT32 WideCharToMultiByte(LPCWSTR wszSrcStr, LPSTR szDstStr) { return 0; } - if (nSize > DTRACE_OUTPUT_STRING_LEN-1) + if (nSize > DTRACE_OUTPUT_STRING_LEN - 1) { - nSize = DTRACE_OUTPUT_STRING_LEN-1; + nSize = DTRACE_OUTPUT_STRING_LEN - 1; } - INT32 nSize2 = WideCharToMultiByte(CP_UTF8, 0, wszSrcStr, -1, szDstStr, nSize, NULL, NULL); - if(nSize2 != nSize || nSize2 <=0 ) + INT32 nSize2 = WideCharToMultiByte(CP_UTF8, 0, wszSrcStr, -1, szDstStr, nSize, NULL, NULL); + if (nSize2 != nSize || nSize2 <= 0) { return 0; } @@ -3801,20 +3809,20 @@ void SecurityCatchCallEnd_V1() /****************************************************************************/ /* This is called by the runtime when an exception is thrown */ /****************************************************************************/ -void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownException, BOOL bIsNewException) +void ETW::ExceptionLog::ExceptionThrown(CrawlFrame* pCf, BOOL bIsReThrownException, BOOL bIsNewException) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; PRECONDITION(GetThread() != NULL); PRECONDITION(GetThread()->GetThrowable() != NULL); } CONTRACTL_END; - if(!(bIsReThrownException || bIsNewException)) + if (!(bIsReThrownException || bIsNewException)) { return; } - if(!ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, ExceptionThrown_V1)) + if (!ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, ExceptionThrown_V1)) { return; } @@ -3822,11 +3830,11 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept { SString exceptionType(L""); LPWSTR exceptionMessage = NULL; - BOOL bIsCLSCompliant=FALSE, bIsCSE=FALSE, bIsNestedException=FALSE, bHasInnerException=FALSE; - UINT16 exceptionFlags=0; - PVOID exceptionEIP=0; + BOOL bIsCLSCompliant = FALSE, bIsCSE = FALSE, bIsNestedException = FALSE, bHasInnerException = FALSE; + UINT16 exceptionFlags = 0; + PVOID exceptionEIP = 0; - Thread *pThread = GetThread(); + Thread* pThread = GetThread(); struct { @@ -3840,7 +3848,7 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept gc.exceptionObj = pThread->GetThrowable(); gc.innerExceptionObj = ((EXCEPTIONREF)gc.exceptionObj)->GetInnerException(); - ThreadExceptionState *pExState = pThread->GetExceptionState(); + ThreadExceptionState* pExState = pThread->GetExceptionState(); #ifndef WIN64EXCEPTIONS PTR_ExInfo pExInfo = NULL; #else @@ -3855,7 +3863,7 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept // A rethrown exception is also a nested exception // but since we have a separate flag for it, lets unset the nested flag - if(bIsReThrownException) + if (bIsReThrownException) { bIsNestedException = FALSE; } @@ -3887,12 +3895,12 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept exceptionEIP = (PVOID)((UINT_PTR)exceptionEIP - 1); } - gc.exceptionMessageRef = ((EXCEPTIONREF)gc.exceptionObj)->GetMessage(); + gc.exceptionMessageRef = ((EXCEPTIONREF)gc.exceptionObj)->GetMessage(); TypeHandle exceptionTypeHandle = (gc.exceptionObj)->GetTypeHandle(); exceptionTypeHandle.GetName(exceptionType); - WCHAR *exceptionTypeName = (WCHAR *)exceptionType.GetUnicode(); + WCHAR* exceptionTypeName = (WCHAR*)exceptionType.GetUnicode(); - if(gc.exceptionMessageRef != NULL) + if (gc.exceptionMessageRef != NULL) { exceptionMessage = (gc.exceptionMessageRef)->GetBuffer(); } @@ -3906,53 +3914,53 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept exceptionFlags, GetClrInstanceId()); GCPROTECT_END(); - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ /* This is called by the runtime when a domain is loaded */ /****************************************************************************/ -void ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName) +void ETW::LoaderLog::DomainLoadReal(BaseDomain* pDomain, _In_opt_ LPWSTR wszFriendlyName) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_LOADER_KEYWORD)) { DWORD dwEventOptions = ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad; ETW::LoaderLog::SendDomainEvent(pDomain, dwEventOptions, wszFriendlyName); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ /* This is called by the runtime when an AppDomain is unloaded */ /****************************************************************************/ -void ETW::LoaderLog::DomainUnload(AppDomain *pDomain) +void ETW::LoaderLog::DomainUnload(AppDomain* pDomain) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) { - if(!pDomain->NoAccessToHandleTable()) + if (!pDomain->NoAccessToHandleTable()) { DWORD enumerationOptions = ETW::EnumerationLog::GetEnumerationOptionsFromRuntimeKeywords(); // Domain unload also causes type unload events - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_TYPE_KEYWORD)) { @@ -3962,29 +3970,29 @@ void ETW::LoaderLog::DomainUnload(AppDomain *pDomain) ETW::EnumerationLog::EnumerationHelper(NULL, pDomain, enumerationOptions); } } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ /* This is called by the runtime when a LoaderAllocator is unloaded */ /****************************************************************************/ -void ETW::LoaderLog::CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator) +void ETW::LoaderLog::CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator* pLoaderAllocator) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) { DWORD enumerationOptions = ETW::EnumerationLog::GetEnumerationOptionsFromRuntimeKeywords(); // Collectible Loader Allocator unload also causes type unload events - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_TYPE_KEYWORD)) { @@ -3993,23 +4001,23 @@ void ETW::LoaderLog::CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *p ETW::EnumerationLog::IterateCollectibleLoaderAllocator(pLoaderAllocator, enumerationOptions); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ /* This is called by the runtime when the runtime is loaded Function gets called by both the Callback mechanism and regular ETW events. Type is used to differentiate whether its a callback or a normal call*/ -/****************************************************************************/ + /****************************************************************************/ void ETW::InfoLog::RuntimeInformation(INT32 type) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; - EX_TRY { - if((type == ETW::InfoLog::InfoStructs::Normal && ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, RuntimeInformationStart)) + EX_TRY{ + if ((type == ETW::InfoLog::InfoStructs::Normal && ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, RuntimeInformationStart)) #ifndef FEATURE_PAL || (type == ETW::InfoLog::InfoStructs::Callback && ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, RuntimeInformationDCStart)) @@ -4017,21 +4025,21 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) ) { #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L"",szDtraceOutput2=L""; + PCWSTR szDtraceOutput1 = L"",szDtraceOutput2 = L""; #else CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; CHAR szDtraceOutput2[DTRACE_OUTPUT_STRING_LEN]; #endif // !FEATURE_DTRACE UINT8 startupMode = 0; UINT startupFlags = 0; - WCHAR dllPath[MAX_PATH+1] = {0}; + WCHAR dllPath[MAX_PATH + 1] = {0}; UINT8 Sku = 0; _ASSERTE(g_fEEManagedEXEStartup || //CLR started due to a managed exe g_fEEIJWStartup || //CLR started as a mixed mode Assembly CLRHosted() || g_fEEHostedStartup || //CLR started through one of the Hosting API CLRHosted() returns true if CLR started through the V2 Interface while // g_fEEHostedStartup is true if CLR is hosted through the V1 API. g_fEEComActivatedStartup || //CLR started as a COM object - g_fEEOtherStartup ); //In case none of the 4 above mentioned cases are true for example ngen, ildasm then we asssume its a "other" startup + g_fEEOtherStartup); //In case none of the 4 above mentioned cases are true for example ngen, ildasm then we asssume its a "other" startup #ifdef FEATURE_CORECLR Sku = ETW::InfoLog::InfoStructs::CoreCLR; @@ -4052,9 +4060,9 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) USHORT bclQfeVersion = VER_ASSEMBLYBUILD_QFE; #ifndef FEATURE_PAL - LPCGUID comGUID=g_fEEComObjectGuid; + LPCGUID comGUID = g_fEEComObjectGuid; #else - unsigned int comGUID=0; + unsigned int comGUID = 0; #endif //!FEATURE_PAL #ifndef FEATURE_DTRACE @@ -4070,12 +4078,12 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) #endif //!FEATURE_CORECLR // Determine the startupmode - if(g_fEEIJWStartup) + if (g_fEEIJWStartup) { //IJW Mode startupMode = ETW::InfoLog::InfoStructs::IJW; } - else if(g_fEEManagedEXEStartup) + else if (g_fEEManagedEXEStartup) { //managed exe startupMode = ETW::InfoLog::InfoStructs::ManagedExe; @@ -4083,7 +4091,7 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) lpwszCommandLine = WszGetCommandLine(); #else INT32 nSize = WideCharToMultiByte(WszGetCommandLine(), szDtraceOutput1); - if(nSize > 0) { + if (nSize > 0) { lpwszCommandLine = (SIZE_T)szDtraceOutput1; } #endif //!FEATURE_DTRACE @@ -4093,34 +4101,34 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) //Hosted CLR startupMode = ETW::InfoLog::InfoStructs::HostedCLR; } - else if(g_fEEComActivatedStartup) + else if (g_fEEComActivatedStartup) { //com activated startupMode = ETW::InfoLog::InfoStructs::COMActivated; } - else if(g_fEEOtherStartup) + else if (g_fEEOtherStartup) { //startup type is other startupMode = ETW::InfoLog::InfoStructs::Other; } - _ASSERTE (NumItems(dllPath) > MAX_PATH); + _ASSERTE(NumItems(dllPath) > MAX_PATH); // if WszGetModuleFileName fails, we return an empty string if (!WszGetModuleFileName(GetCLRModule(), dllPath, MAX_PATH)) { dllPath[0] = 0; } dllPath[MAX_PATH] = 0; #ifdef FEATURE_DTRACE - _ASSERTE (NumItems(szDtraceOutput2) >= NumItems(dllPath)); + _ASSERTE(NumItems(szDtraceOutput2) >= NumItems(dllPath)); INT32 nSize = WideCharToMultiByte(dllPath, szDtraceOutput2); - if(nSize > 0) { + if (nSize > 0) { lpwszRuntimeDllPath = (SIZE_T)szDtraceOutput2; } #endif // FEATURE_DTRACE - if(type == ETW::InfoLog::InfoStructs::Callback) + if (type == ETW::InfoLog::InfoStructs::Callback) { - FireEtwRuntimeInformationDCStart( GetClrInstanceId(), + FireEtwRuntimeInformationDCStart(GetClrInstanceId(), Sku, bclMajorVersion, bclMinorVersion, @@ -4134,11 +4142,11 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) startupMode, lpwszCommandLine, comGUID, - lpwszRuntimeDllPath ); + lpwszRuntimeDllPath); } else { - FireEtwRuntimeInformationStart( GetClrInstanceId(), + FireEtwRuntimeInformationStart(GetClrInstanceId(), Sku, bclMajorVersion, bclMinorVersion, @@ -4152,32 +4160,32 @@ void ETW::InfoLog::RuntimeInformation(INT32 type) startupMode, lpwszCommandLine, comGUID, - lpwszRuntimeDllPath ); + lpwszRuntimeDllPath); } } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /*******************************************************/ /* This is called by the runtime when a method is jitted completely */ /*******************************************************/ -void ETW::MethodLog::MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName, SString *methodName, SString *methodSignature, SIZE_T pCode, ReJITID rejitID) +void ETW::MethodLog::MethodJitted(MethodDesc* pMethodDesc, SString* namespaceOrClassName, SString* methodName, SString* methodSignature, SIZE_T pCode, ReJITID rejitID) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_JIT_KEYWORD)) { ETW::MethodLog::SendMethodEvent(pMethodDesc, ETW::EnumerationLog::EnumerationStructs::JitMethodLoad, TRUE, namespaceOrClassName, methodName, methodSignature, pCode, rejitID); } #ifndef WINXP_AND_WIN2K3_BUILD_SUPPORT - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_JITTEDMETHODILTONATIVEMAP_KEYWORD)) { @@ -4192,15 +4200,15 @@ void ETW::MethodLog::MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrC ETW::MethodLog::SendMethodILToNativeMapEvent(pMethodDesc, ETW::EnumerationLog::EnumerationStructs::JitMethodILToNativeMap, rejitID); } #endif // WINXP_AND_WIN2K3_BUILD_SUPPORT - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /*************************************************/ /* This is called by the runtime when method jitting started */ /*************************************************/ -void ETW::MethodLog::MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOrClassName, SString *methodName, SString *methodSignature) +void ETW::MethodLog::MethodJitting(MethodDesc* pMethodDesc, SString* namespaceOrClassName, SString* methodName, SString* methodSignature) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; PRECONDITION(pMethodDesc != NULL); @@ -4208,14 +4216,14 @@ void ETW::MethodLog::MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOr EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_VERBOSE, CLR_JIT_KEYWORD)) { pMethodDesc->GetMethodInfo(*namespaceOrClassName, *methodName, *methodSignature); ETW::MethodLog::SendMethodJitStartEvent(pMethodDesc, namespaceOrClassName, methodName, methodSignature); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /**********************************************************************/ @@ -4223,7 +4231,7 @@ void ETW::MethodLog::MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOr /**********************************************************************/ void ETW::MethodLog::StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; PRECONDITION(ullHelperStartAddress != 0); @@ -4231,31 +4239,31 @@ void ETW::MethodLog::StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pH EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_JIT_KEYWORD)) { - DWORD dwHelperSize=0; + DWORD dwHelperSize = 0; Stub::RecoverStubAndSize((TADDR)ullHelperStartAddress, &dwHelperSize); ETW::MethodLog::SendHelperEvent(ullHelperStartAddress, dwHelperSize, pHelperName); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /**********************************************************/ /* This is called by the runtime when helpers with stubs are initialized */ /**********************************************************/ -void ETW::MethodLog::StubsInitialized(PVOID *pHelperStartAddresss, PVOID *pHelperNames, LONG lNoOfHelpers) +void ETW::MethodLog::StubsInitialized(PVOID* pHelperStartAddresss, PVOID* pHelperNames, LONG lNoOfHelpers) { WRAPPER_NO_CONTRACT; - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_JIT_KEYWORD)) + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_JIT_KEYWORD)) { - for(int i=0; iIsThunking()) + if (!pMethodTable->IsThunking()) #endif { MethodTable::MethodIterator iter(pMethodTable); for (; iter.IsValid(); iter.Next()) { - MethodDesc *pMD = (MethodDesc *)(iter.GetMethodDesc()); - if(pMD && pMD->IsRestored() && pMD->GetMethodTable_NoLogging() == pMethodTable) + MethodDesc* pMD = (MethodDesc*)(iter.GetMethodDesc()); + if (pMD && pMD->IsRestored() && pMD->GetMethodTable_NoLogging() == pMethodTable) ETW::MethodLog::SendMethodEvent(pMD, ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad, FALSE); } } } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } @@ -4362,7 +4370,7 @@ void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR /****************************************************************************/ /* This is called by the runtime when a Strong Name Verification Ends */ /****************************************************************************/ -void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName) +void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags, ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_CORECLR @@ -4382,8 +4390,8 @@ void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, /* This is called by the runtime when field transparency calculations begin */ /****************************************************************************/ void ETW::SecurityLog::FireFieldTransparencyComputationStart(LPCWSTR wszFieldName, - LPCWSTR wszModuleName, - DWORD dwAppDomain) + LPCWSTR wszModuleName, + DWORD dwAppDomain) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4404,10 +4412,10 @@ void ETW::SecurityLog::FireFieldTransparencyComputationStart(LPCWSTR wszFieldNam /* This is called by the runtime when field transparency calculations end */ /****************************************************************************/ void ETW::SecurityLog::FireFieldTransparencyComputationEnd(LPCWSTR wszFieldName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) + LPCWSTR wszModuleName, + DWORD dwAppDomain, + BOOL fIsCritical, + BOOL fIsTreatAsSafe) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4428,8 +4436,8 @@ void ETW::SecurityLog::FireFieldTransparencyComputationEnd(LPCWSTR wszFieldName, /* This is called by the runtime when method transparency calculations begin */ /*****************************************************************************/ void ETW::SecurityLog::FireMethodTransparencyComputationStart(LPCWSTR wszMethodName, - LPCWSTR wszModuleName, - DWORD dwAppDomain) + LPCWSTR wszModuleName, + DWORD dwAppDomain) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4450,10 +4458,10 @@ void ETW::SecurityLog::FireMethodTransparencyComputationStart(LPCWSTR wszMethodN /* This is called by the runtime when method transparency calculations end */ /********************************************(********************************/ void ETW::SecurityLog::FireMethodTransparencyComputationEnd(LPCWSTR wszMethodName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) + LPCWSTR wszModuleName, + DWORD dwAppDomain, + BOOL fIsCritical, + BOOL fIsTreatAsSafe) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4474,7 +4482,7 @@ void ETW::SecurityLog::FireMethodTransparencyComputationEnd(LPCWSTR wszMethodNam /* This is called by the runtime when module transparency calculations begin */ /*****************************************************************************/ void ETW::SecurityLog::FireModuleTransparencyComputationStart(LPCWSTR wszModuleName, - DWORD dwAppDomain) + DWORD dwAppDomain) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4493,12 +4501,12 @@ void ETW::SecurityLog::FireModuleTransparencyComputationStart(LPCWSTR wszModuleN /* This is called by the runtime when module transparency calculations end */ /****************************************************************************/ void ETW::SecurityLog::FireModuleTransparencyComputationEnd(LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsAllCritical, - BOOL fIsAllTransparent, - BOOL fIsTreatAsSafe, - BOOL fIsOpportunisticallyCritical, - DWORD dwSecurityRuleSet) + DWORD dwAppDomain, + BOOL fIsAllCritical, + BOOL fIsAllTransparent, + BOOL fIsTreatAsSafe, + BOOL fIsOpportunisticallyCritical, + DWORD dwSecurityRuleSet) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4517,8 +4525,8 @@ void ETW::SecurityLog::FireModuleTransparencyComputationEnd(LPCWSTR wszModuleNam /* This is called by the runtime when token transparency calculations begin */ /****************************************************************************/ void ETW::SecurityLog::FireTokenTransparencyComputationStart(DWORD dwToken, - LPCWSTR wszModuleName, - DWORD dwAppDomain) + LPCWSTR wszModuleName, + DWORD dwAppDomain) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4537,10 +4545,10 @@ void ETW::SecurityLog::FireTokenTransparencyComputationStart(DWORD dwToken, /* This is called by the runtime when token transparency calculations end */ /****************************************************************************/ void ETW::SecurityLog::FireTokenTransparencyComputationEnd(DWORD dwToken, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) + LPCWSTR wszModuleName, + DWORD dwAppDomain, + BOOL fIsCritical, + BOOL fIsTreatAsSafe) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4559,8 +4567,8 @@ void ETW::SecurityLog::FireTokenTransparencyComputationEnd(DWORD dwToken, /* This is called by the runtime when type transparency calculations begin */ /*****************************************************************************/ void ETW::SecurityLog::FireTypeTransparencyComputationStart(LPCWSTR wszTypeName, - LPCWSTR wszModuleName, - DWORD dwAppDomain) + LPCWSTR wszModuleName, + DWORD dwAppDomain) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4581,12 +4589,12 @@ void ETW::SecurityLog::FireTypeTransparencyComputationStart(LPCWSTR wszTypeName, /* This is called by the runtime when type transparency calculations end */ /****************************************************************************/ void ETW::SecurityLog::FireTypeTransparencyComputationEnd(LPCWSTR wszTypeName, - LPCWSTR wszModuleName, - DWORD dwAppDomain, - BOOL fIsAllCritical, - BOOL fIsAllTransparent, - BOOL fIsCritical, - BOOL fIsTreatAsSafe) + LPCWSTR wszModuleName, + DWORD dwAppDomain, + BOOL fIsAllCritical, + BOOL fIsAllTransparent, + BOOL fIsCritical, + BOOL fIsTreatAsSafe) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_DTRACE @@ -4607,9 +4615,9 @@ void ETW::SecurityLog::FireTypeTransparencyComputationEnd(LPCWSTR wszTypeName, /* This is called by the runtime when a module is loaded */ /* liReportedSharedModule will be 0 when this module is reported for the 1st time */ /**********************************************************************************/ -void ETW::LoaderLog::ModuleLoad(Module *pModule, LONG liReportedSharedModule) +void ETW::LoaderLog::ModuleLoad(Module* pModule, LONG liReportedSharedModule) { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; @@ -4617,7 +4625,7 @@ void ETW::LoaderLog::ModuleLoad(Module *pModule, LONG liReportedSharedModule) EX_TRY { DWORD enumerationOptions = ETW::EnumerationLog::EnumerationStructs::None; - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) { @@ -4632,27 +4640,27 @@ void ETW::LoaderLog::ModuleLoad(Module *pModule, LONG liReportedSharedModule) TRACE_LEVEL_INFORMATION, CLR_PERFTRACK_KEYWORD); - if(liReportedSharedModule == 0) + if (liReportedSharedModule == 0) { - if(bTraceFlagLoaderSet) + if (bTraceFlagLoaderSet) enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad; if (bTraceFlagPerfTrackSet) enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoad; - if(bTraceFlagNgenMethodSet && bTraceFlagStartRundownSet) + if (bTraceFlagNgenMethodSet && bTraceFlagStartRundownSet) enumerationOptions |= ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad; - if(pModule->IsManifest() && bTraceFlagLoaderSet) + if (pModule->IsManifest() && bTraceFlagLoaderSet) ETW::LoaderLog::SendAssemblyEvent(pModule->GetAssembly(), enumerationOptions); - if(bTraceFlagLoaderSet || bTraceFlagPerfTrackSet) + if (bTraceFlagLoaderSet || bTraceFlagPerfTrackSet) ETW::LoaderLog::SendModuleEvent(pModule, ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad | ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoad); ETW::EnumerationLog::EnumerationHelper(pModule, NULL, enumerationOptions); } // we want to report domainmodule events whenever they are loaded in any AppDomain - if(bTraceFlagLoaderSet) + if (bTraceFlagLoaderSet) ETW::LoaderLog::SendModuleEvent(pModule, ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad, TRUE); } @@ -4668,7 +4676,7 @@ void ETW::LoaderLog::ModuleLoad(Module *pModule, LONG liReportedSharedModule) } } #endif - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ @@ -4676,14 +4684,14 @@ void ETW::LoaderLog::ModuleLoad(Module *pModule, LONG liReportedSharedModule) /****************************************************************************/ void ETW::EnumerationLog::ProcessShutdown() { - CONTRACTL { + CONTRACTL{ NOTHROW; GC_TRIGGERS; } CONTRACTL_END; EX_TRY { - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, KEYWORDZERO)) { DWORD enumerationOptions = GetEnumerationOptionsFromRuntimeKeywords(); @@ -4691,7 +4699,7 @@ void ETW::EnumerationLog::ProcessShutdown() // default domain. ETW::EnumerationLog::EnumerationHelper(NULL /* module filter */, NULL /* domain filter */, enumerationOptions); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /****************************************************************************/ @@ -4703,18 +4711,18 @@ void ETW::EnumerationLog::ProcessShutdown() /****************************************************************************/ /* This routine is used to send a domain load/unload or rundown event */ /****************************************************************************/ -void ETW::LoaderLog::SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptions, LPCWSTR wszFriendlyName) +void ETW::LoaderLog::SendDomainEvent(BaseDomain* pBaseDomain, DWORD dwEventOptions, LPCWSTR wszFriendlyName) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; - if(!pBaseDomain) + if (!pBaseDomain) return; #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L""; + PCWSTR szDtraceOutput1 = L""; #else CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; #endif // !FEATURE_DTRACE @@ -4722,22 +4730,22 @@ 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 = bIsAppDomain ? (pBaseDomain->AsAppDomain()->GetSharePolicy()) : 0; ULONGLONG ullDomainId = (ULONGLONG)pBaseDomain; ULONG ulDomainFlags = ((bIsDefaultDomain ? ETW::LoaderLog::LoaderStructs::DefaultDomain : 0) | - (bIsExecutable ? ETW::LoaderLog::LoaderStructs::ExecutableDomain : 0) | - (bIsSharedDomain ? ETW::LoaderLog::LoaderStructs::SharedDomain : 0) | - (uSharingPolicy<<28)); + (bIsExecutable ? ETW::LoaderLog::LoaderStructs::ExecutableDomain : 0) | + (bIsSharedDomain ? ETW::LoaderLog::LoaderStructs::SharedDomain : 0) | + (uSharingPolicy << 28)); LPCWSTR wsEmptyString = L""; LPCWSTR wsSharedString = L"SharedDomain"; LPWSTR lpswzDomainName = (LPWSTR)wsEmptyString; - if(bIsAppDomain) + if (bIsAppDomain) { - if(wszFriendlyName) + if (wszFriendlyName) lpswzDomainName = (PWCHAR)wszFriendlyName; else lpswzDomainName = (PWCHAR)pBaseDomain->AsAppDomain()->GetFriendlyName(); @@ -4755,28 +4763,28 @@ void ETW::LoaderLog::SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptio return; #endif // !FEATURE_DTRACE - if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) + if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) { FireEtwAppDomainLoad_V1(ullDomainId, ulDomainFlags, szDtraceOutput1, pBaseDomain->GetId().m_dwId, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) { FireEtwAppDomainUnload_V1(ullDomainId, ulDomainFlags, szDtraceOutput1, pBaseDomain->GetId().m_dwId, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { FireEtwAppDomainDCStart_V1(ullDomainId, ulDomainFlags, szDtraceOutput1, pBaseDomain->GetId().m_dwId, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) { FireEtwAppDomainDCEnd_V1(ullDomainId, ulDomainFlags, szDtraceOutput1, pBaseDomain->GetId().m_dwId, GetClrInstanceId()); } else { _ASSERTE((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd)); + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd)); } } @@ -4785,13 +4793,13 @@ void ETW::LoaderLog::SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptio /********************************************************/ void ETW::EnumerationLog::SendThreadRundownEvent() { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; #ifndef DACCESS_COMPILE - Thread *pThread = NULL; + Thread* pThread = NULL; // Take the thread store lock while we enumerate threads. ThreadStoreLockHolder tsl; @@ -4811,42 +4819,42 @@ void ETW::EnumerationLog::SendThreadRundownEvent() /****************************************************************************/ /* This routine is used to send an assembly load/unload or rundown event ****/ /****************************************************************************/ -void ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions) +void ETW::LoaderLog::SendAssemblyEvent(Assembly* pAssembly, DWORD dwEventOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; - if(!pAssembly) + if (!pAssembly) return; #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L""; + PCWSTR szDtraceOutput1 = L""; #else CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; #endif // !FEATURE_DTRACE BOOL bIsDynamicAssembly = pAssembly->IsDynamic(); BOOL bIsCollectibleAssembly = pAssembly->IsCollectible(); - BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral() ; - BOOL bHasNativeImage = pAssembly->GetPEAssembly()->HasNativeImage(); + BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); + BOOL bHasNativeImage = pAssembly->GetManifestFile()->HasNativeImage(); ULONGLONG ullAssemblyId = (ULONGLONG)pAssembly; ULONGLONG ullDomainId = (ULONGLONG)pAssembly->GetDomain(); ULONGLONG ullBindingID = 0; #if (defined FEATURE_PREJIT) && (defined FEATURE_FUSION_DEPRECATE) - ullBindingID = pAssembly->GetPEAssembly()->GetBindingID(); + ullBindingID = pAssembly->GetManifestFile()->GetBindingID(); #endif ULONG ulAssemblyFlags = ((bIsDomainNeutral ? ETW::LoaderLog::LoaderStructs::DomainNeutralAssembly : 0) | - (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicAssembly : 0) | - (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeAssembly : 0) | - (bIsCollectibleAssembly ? ETW::LoaderLog::LoaderStructs::CollectibleAssembly : 0)); + (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicAssembly : 0) | + (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeAssembly : 0) | + (bIsCollectibleAssembly ? ETW::LoaderLog::LoaderStructs::CollectibleAssembly : 0)); SString sAssemblyPath; pAssembly->GetDisplayName(sAssemblyPath); LPWSTR lpszAssemblyPath = (LPWSTR)sAssemblyPath.GetUnicode(); -/* prepare events args for ETW and ETM */ + /* prepare events args for ETW and ETM */ #ifndef FEATURE_DTRACE szDtraceOutput1 = (PCWSTR)lpszAssemblyPath; #else // !FEATURE_DTRACE @@ -4856,36 +4864,36 @@ void ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions return; #endif // !FEATURE_DTRACE - if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) + if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) { FireEtwAssemblyLoad_V1(ullAssemblyId, ullDomainId, ullBindingID, ulAssemblyFlags, szDtraceOutput1, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) { FireEtwAssemblyUnload_V1(ullAssemblyId, ullDomainId, ullBindingID, ulAssemblyFlags, szDtraceOutput1, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { FireEtwAssemblyDCStart_V1(ullAssemblyId, ullDomainId, ullBindingID, ulAssemblyFlags, szDtraceOutput1, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) { FireEtwAssemblyDCEnd_V1(ullAssemblyId, ullDomainId, ullBindingID, ulAssemblyFlags, szDtraceOutput1, GetClrInstanceId()); } else { _ASSERTE((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd)); + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd)); } } #if !defined(FEATURE_PAL) ETW_INLINE - ULONG - ETW::LoaderLog::SendModuleRange( - _In_ Module *pModule, +ULONG +ETW::LoaderLog::SendModuleRange( + _In_ Module* pModule, _In_ DWORD dwEventOptions) { @@ -4895,22 +4903,22 @@ ETW_INLINE // do not fire the ETW event when: // 1. We did not load the native image // 2. We do not have IBC data for the native image - if( !pModule || !pModule->HasNativeImage() || !pModule->IsIbcOptimized() ) + if (!pModule || !pModule->HasNativeImage() || !pModule->IsIbcOptimized()) { return Result; } // get information about the hot sections from the native image that has been loaded COUNT_T cbSizeOfSectionTable; - CORCOMPILE_VIRTUAL_SECTION_INFO* pVirtualSectionsTable = (CORCOMPILE_VIRTUAL_SECTION_INFO* )pModule->GetNativeImage()->GetVirtualSectionsTable(&cbSizeOfSectionTable); + CORCOMPILE_VIRTUAL_SECTION_INFO* pVirtualSectionsTable = (CORCOMPILE_VIRTUAL_SECTION_INFO*)pModule->GetNativeImage()->GetVirtualSectionsTable(&cbSizeOfSectionTable); - COUNT_T RangeCount = cbSizeOfSectionTable/sizeof(CORCOMPILE_VIRTUAL_SECTION_INFO); + COUNT_T RangeCount = cbSizeOfSectionTable / sizeof(CORCOMPILE_VIRTUAL_SECTION_INFO); // if we do not have any hot ranges, we do not fire the ETW event // Figure out the rest of the event data UINT16 ClrInstanceId = GetClrInstanceId(); - UINT64 ModuleID = (ULONGLONG)(TADDR) pModule; + UINT64 ModuleID = (ULONGLONG)(TADDR)pModule; for (COUNT_T i = 0; i < RangeCount; ++i) { @@ -4972,13 +4980,13 @@ ETW_INLINE // untrusted, and reported sizes of buffers are verified against their data. // -static void GetCodeViewInfo(Module * pModule, CV_INFO_PDB70 * pCvInfoIL, CV_INFO_PDB70 * pCvInfoNative) +static void GetCodeViewInfo(Module* pModule, CV_INFO_PDB70* pCvInfoIL, CV_INFO_PDB70* pCvInfoNative) { LIMITED_METHOD_CONTRACT; - _ASSERTE (pModule != NULL); - _ASSERTE (pCvInfoIL != NULL); - _ASSERTE (pCvInfoNative != NULL); + _ASSERTE(pModule != NULL); + _ASSERTE(pCvInfoIL != NULL); + _ASSERTE(pCvInfoNative != NULL); ZeroMemory(pCvInfoIL, sizeof(*pCvInfoIL)); ZeroMemory(pCvInfoNative, sizeof(*pCvInfoNative)); @@ -5013,8 +5021,8 @@ static void GetCodeViewInfo(Module * pModule, CV_INFO_PDB70 * pCvInfoIL, CV_INFO return; COUNT_T cbDebugEntries; - IMAGE_DEBUG_DIRECTORY * rgDebugEntries = - (IMAGE_DEBUG_DIRECTORY *) pLayout->GetDirectoryEntryData(IMAGE_DIRECTORY_ENTRY_DEBUG, &cbDebugEntries); + IMAGE_DEBUG_DIRECTORY* rgDebugEntries = + (IMAGE_DEBUG_DIRECTORY*)pLayout->GetDirectoryEntryData(IMAGE_DIRECTORY_ENTRY_DEBUG, &cbDebugEntries); if (cbDebugEntries < sizeof(IMAGE_DEBUG_DIRECTORY)) return; @@ -5028,15 +5036,15 @@ static void GetCodeViewInfo(Module * pModule, CV_INFO_PDB70 * pCvInfoIL, CV_INFO // sizeof(CV_INFO_PDB70); see below). struct PdbInfo { - CV_INFO_PDB70 * m_pPdb70; + CV_INFO_PDB70* m_pPdb70; ULONG m_cbPdb70; }; // Iterate through all debug directory entries. The very last one will be the // managed PDB entry. The next to last one (if it exists) will be the (native) NGEN // PDB entry. Treat raw bytes we read as untrusted. - PdbInfo pdbInfoLast = {0}; - PdbInfo pdbInfoNextToLast = {0}; + PdbInfo pdbInfoLast = { 0 }; + PdbInfo pdbInfoNextToLast = { 0 }; int cEntries = cbDebugEntries / sizeof(IMAGE_DEBUG_DIRECTORY); for (int i = 0; i < cEntries; i++) { @@ -5068,7 +5076,7 @@ static void GetCodeViewInfo(Module * pModule, CV_INFO_PDB70 * pCvInfoIL, CV_INFO } // Verify the magic number is as expected - CV_INFO_PDB70 * pPdb70 = (CV_INFO_PDB70 *) pLayout->GetRvaData(rvaOfRawData); + CV_INFO_PDB70* pPdb70 = (CV_INFO_PDB70*)pLayout->GetRvaData(rvaOfRawData); if (pPdb70->magic != CV_SIGNATURE_RSDS) { // Unrecognized magic number. Skip @@ -5143,18 +5151,18 @@ static void GetCodeViewInfo(Module * pModule, CV_INFO_PDB70 * pCvInfoIL, CV_INFO // * bFireDomainModuleEvents - nonzero if we are to fire DomainModule events; zero // if we are to fire Module events // -void ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL bFireDomainModuleEvents) +void ETW::LoaderLog::SendModuleEvent(Module* pModule, DWORD dwEventOptions, BOOL bFireDomainModuleEvents) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; - if(!pModule) + if (!pModule) return; #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L"",szDtraceOutput2=L""; + PCWSTR szDtraceOutput1 = L"", szDtraceOutput2 = L""; #else CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; CHAR szDtraceOutput2[DTRACE_OUTPUT_STRING_LEN]; @@ -5166,35 +5174,35 @@ void ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL #endif // FEATURE_PREJIT BOOL bIsManifestModule = pModule->IsManifest(); ULONGLONG ullAppDomainId = 0; // This is used only with DomainModule events - ULONGLONG ullModuleId = (ULONGLONG)(TADDR) pModule; + ULONGLONG ullModuleId = (ULONGLONG)(TADDR)pModule; ULONGLONG ullAssemblyId = (ULONGLONG)pModule->GetAssembly(); BOOL bIsDomainNeutral = pModule->GetAssembly()->IsDomainNeutral(); BOOL bIsIbcOptimized = FALSE; - if(bHasNativeImage) + if (bHasNativeImage) { bIsIbcOptimized = pModule->IsIbcOptimized(); } ULONG ulReservedFlags = 0; ULONG ulFlags = ((bIsDomainNeutral ? ETW::LoaderLog::LoaderStructs::DomainNeutralModule : 0) | - (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeModule : 0) | - (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicModule : 0) | - (bIsManifestModule ? ETW::LoaderLog::LoaderStructs::ManifestModule : 0) | - (bIsIbcOptimized ? ETW::LoaderLog::LoaderStructs::IbcOptimized : 0)); + (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeModule : 0) | + (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicModule : 0) | + (bIsManifestModule ? ETW::LoaderLog::LoaderStructs::ManifestModule : 0) | + (bIsIbcOptimized ? ETW::LoaderLog::LoaderStructs::IbcOptimized : 0)); #ifndef FEATURE_DTRACE // Grab PDB path, guid, and age for managed PDB and native (NGEN) PDB when // available. Any failures are not fatal. The corresponding PDB info will remain // zeroed out, and that's what we'll include in the event. - CV_INFO_PDB70 cvInfoIL = {0}; - CV_INFO_PDB70 cvInfoNative = {0}; + CV_INFO_PDB70 cvInfoIL = { 0 }; + CV_INFO_PDB70 cvInfoNative = { 0 }; GetCodeViewInfo(pModule, &cvInfoIL, &cvInfoNative); #endif // FEATURE_DTRACE - PWCHAR ModuleILPath=L"", ModuleNativePath=L""; + PWCHAR ModuleILPath = L"", ModuleNativePath = L""; - if(bFireDomainModuleEvents) + if (bFireDomainModuleEvents) { - if(pModule->GetDomain()->IsSharedDomain()) // for shared domains, we do not fire domainmodule event + if (pModule->GetDomain()->IsSharedDomain()) // for shared domains, we do not fire domainmodule event return; ullAppDomainId = (ULONGLONG)pModule->FindDomainAssembly(pModule->GetDomain()->AsAppDomain())->GetAppDomain(); } @@ -5205,19 +5213,19 @@ void ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL #else // !FEATURE_PAL SString moduleName; #endif // !FEATURE_PAL - if(!bIsDynamicAssembly) + if (!bIsDynamicAssembly) { - ModuleILPath = (PWCHAR)pModule->GetAssembly()->GetPEAssembly()->GetILimage()->GetPath().GetUnicode(); + ModuleILPath = (PWCHAR)pModule->GetAssembly()->GetManifestFile()->GetILimage()->GetPath().GetUnicode(); ModuleNativePath = (PWCHAR)pEmptyString; #ifdef FEATURE_PREJIT - if(bHasNativeImage) + if (bHasNativeImage) ModuleNativePath = (PWCHAR)pModule->GetNativeImage()->GetPath().GetUnicode(); #endif // FEATURE_PREJIT } // if we do not have a module path yet, we put the module name - if(bIsDynamicAssembly || ModuleILPath==NULL || wcslen(ModuleILPath) <= 2) + if (bIsDynamicAssembly || ModuleILPath == NULL || wcslen(ModuleILPath) <= 2) { moduleName.SetUTF8(pModule->GetSimpleName()); ModuleILPath = (PWCHAR)moduleName.GetUnicode(); @@ -5242,52 +5250,52 @@ void ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL return; #endif // !FEATURE_DTRACE - if(bFireDomainModuleEvents) + if (bFireDomainModuleEvents) { - if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) + if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) { FireEtwDomainModuleLoad_V1(ullModuleId, ullAssemblyId, ullAppDomainId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { FireEtwDomainModuleDCStart_V1(ullModuleId, ullAssemblyId, ullAppDomainId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId()); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) { FireEtwDomainModuleDCEnd_V1(ullModuleId, ullAssemblyId, ullAppDomainId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId()); } else { _ASSERTE((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd)); + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd)); } } else { - if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoad)) + if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoad)) { FireEtwModuleLoad_V1_or_V2(ullModuleId, ullAssemblyId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId(), &cvInfoIL.signature, cvInfoIL.age, managedPdbPath, &cvInfoNative.signature, cvInfoNative.age, nativePdbPath); } - else if(dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) + else if (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) { FireEtwModuleUnload_V1_or_V2(ullModuleId, ullAssemblyId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId(), &cvInfoIL.signature, cvInfoIL.age, managedPdbPath, &cvInfoNative.signature, cvInfoNative.age, nativePdbPath); } - else if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCStart)) + else if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCStart)) { FireEtwModuleDCStart_V1_or_V2(ullModuleId, ullAssemblyId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId(), &cvInfoIL.signature, cvInfoIL.age, managedPdbPath, &cvInfoNative.signature, cvInfoNative.age, nativePdbPath); } - else if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCEnd)) + else if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCEnd)) { FireEtwModuleDCEnd_V1_or_V2(ullModuleId, ullAssemblyId, ulFlags, ulReservedFlags, szDtraceOutput1, szDtraceOutput2, GetClrInstanceId(), &cvInfoIL.signature, cvInfoIL.age, managedPdbPath, &cvInfoNative.signature, cvInfoNative.age, nativePdbPath); } else { _ASSERTE((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleLoad) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeEnabledAny)); + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeEnabledAny)); } #if !defined(FEATURE_PAL) @@ -5303,55 +5311,55 @@ void ETW::LoaderLog::SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL /*****************************************************************/ /* This routine is used to send an ETW event just before a method starts jitting*/ /*****************************************************************/ -void ETW::MethodLog::SendMethodJitStartEvent(MethodDesc *pMethodDesc, SString *namespaceOrClassName, SString *methodName, SString *methodSignature) +void ETW::MethodLog::SendMethodJitStartEvent(MethodDesc* pMethodDesc, SString* namespaceOrClassName, SString* methodName, SString* methodSignature) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; - Module *pModule = NULL; - Module *pLoaderModule = NULL; // This must not be used except for getting the ModuleID + Module* pModule = NULL; + Module* pLoaderModule = NULL; // This must not be used except for getting the ModuleID - ULONGLONG ullMethodIdentifier=0; - ULONGLONG ullModuleID=0; - ULONG ulMethodToken=0; - ULONG ulMethodILSize=0; + ULONGLONG ullMethodIdentifier = 0; + ULONGLONG ullModuleID = 0; + ULONG ulMethodToken = 0; + ULONG ulMethodILSize = 0; #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L"",szDtraceOutput2=L"",szDtraceOutput3=L""; + PCWSTR szDtraceOutput1 = L"", szDtraceOutput2 = L"", szDtraceOutput3 = L""; #else CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; CHAR szDtraceOutput2[DTRACE_OUTPUT_STRING_LEN]; CHAR szDtraceOutput3[DTRACE_OUTPUT_STRING_LEN]; #endif // !FEATURE_DTRACE - if(pMethodDesc) { + if (pMethodDesc) { pModule = pMethodDesc->GetModule_NoLogging(); - if(!pMethodDesc->IsRestored()) { - return; + if (!pMethodDesc->IsRestored()) { + return; } bool bIsDynamicMethod = pMethodDesc->IsDynamicMethod(); BOOL bIsGenericMethod = FALSE; - if(pMethodDesc->GetMethodTable_NoLogging()) + if (pMethodDesc->GetMethodTable_NoLogging()) bIsGenericMethod = pMethodDesc->HasClassOrMethodInstantiation_NoLogging(); - ullModuleID = (ULONGLONG)(TADDR) pModule; + ullModuleID = (ULONGLONG)(TADDR)pModule; ullMethodIdentifier = (ULONGLONG)pMethodDesc; // Use MethodDesc if Dynamic or Generic methods - if( bIsDynamicMethod || bIsGenericMethod) + if (bIsDynamicMethod || bIsGenericMethod) { - if(bIsGenericMethod) + if (bIsGenericMethod) ulMethodToken = (ULONG)pMethodDesc->GetMemberDef_NoLogging(); - if(bIsDynamicMethod) // if its a generic and a dynamic method, we would set the methodtoken to 0 + if (bIsDynamicMethod) // if its a generic and a dynamic method, we would set the methodtoken to 0 ulMethodToken = (ULONG)0; } else ulMethodToken = (ULONG)pMethodDesc->GetMemberDef_NoLogging(); - if(pMethodDesc->IsIL()) + if (pMethodDesc->IsIL()) { COR_ILMETHOD_DECODER::DecoderStatus decoderstatus = COR_ILMETHOD_DECODER::FORMAT_ERROR; COR_ILMETHOD_DECODER ILHeader(pMethodDesc->GetILHeader(), pMethodDesc->GetMDImport(), &decoderstatus); @@ -5359,7 +5367,7 @@ void ETW::MethodLog::SendMethodJitStartEvent(MethodDesc *pMethodDesc, SString *n } SString tNamespace, tMethodName, tMethodSignature; - if(!namespaceOrClassName|| !methodName|| !methodSignature || (methodName->IsEmpty() && namespaceOrClassName->IsEmpty() && methodSignature->IsEmpty())) + if (!namespaceOrClassName || !methodName || !methodSignature || (methodName->IsEmpty() && namespaceOrClassName->IsEmpty() && methodSignature->IsEmpty())) { pMethodDesc->GetMethodInfo(tNamespace, tMethodName, tMethodSignature); namespaceOrClassName = &tNamespace; @@ -5387,35 +5395,35 @@ void ETW::MethodLog::SendMethodJitStartEvent(MethodDesc *pMethodDesc, SString *n #endif // !FEATURE_DTRACE FireEtwMethodJittingStarted_V1(ullMethodIdentifier, - ullModuleID, - ulMethodToken, - ulMethodILSize, - szDtraceOutput1, - szDtraceOutput2, - szDtraceOutput3, - GetClrInstanceId()); + ullModuleID, + ulMethodToken, + ulMethodILSize, + szDtraceOutput1, + szDtraceOutput2, + szDtraceOutput3, + GetClrInstanceId()); } } /****************************************************************************/ /* This routine is used to send a method load/unload or rundown event */ /****************************************************************************/ -void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptions, BOOL bIsJit, SString *namespaceOrClassName, SString *methodName, SString *methodSignature, SIZE_T pCode, ReJITID rejitID) +void ETW::MethodLog::SendMethodEvent(MethodDesc* pMethodDesc, DWORD dwEventOptions, BOOL bIsJit, SString* namespaceOrClassName, SString* methodName, SString* methodSignature, SIZE_T pCode, ReJITID rejitID) { - CONTRACTL { + CONTRACTL{ THROWS; GC_NOTRIGGER; SO_NOT_MAINLINE; } CONTRACTL_END; - Module *pModule = NULL; - Module *pLoaderModule = NULL; // This must not be used except for getting the ModuleID - ULONGLONG ullMethodStartAddress=0, ullColdMethodStartAddress=0, ullModuleID=0, ullMethodIdentifier=0; - ULONG ulMethodSize=0, ulColdMethodSize=0, ulMethodToken=0, ulMethodFlags=0, ulColdMethodFlags=0; - PWCHAR pMethodName=NULL, pNamespaceName=NULL, pMethodSignature=NULL; + Module* pModule = NULL; + Module* pLoaderModule = NULL; // This must not be used except for getting the ModuleID + ULONGLONG ullMethodStartAddress = 0, ullColdMethodStartAddress = 0, ullModuleID = 0, ullMethodIdentifier = 0; + ULONG ulMethodSize = 0, ulColdMethodSize = 0, ulMethodToken = 0, ulMethodFlags = 0, ulColdMethodFlags = 0; + PWCHAR pMethodName = NULL, pNamespaceName = NULL, pMethodSignature = NULL; BOOL bHasNativeImage = FALSE, bShowVerboseOutput = FALSE, bIsDynamicMethod = FALSE, bHasSharedGenericCode = FALSE, bIsGenericMethod = FALSE; #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L"",szDtraceOutput2=L"",szDtraceOutput3=L""; + PCWSTR szDtraceOutput1 = L"", szDtraceOutput2 = L"", szDtraceOutput3 = L""; #else CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; CHAR szDtraceOutput2[DTRACE_OUTPUT_STRING_LEN]; @@ -5423,25 +5431,25 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio #endif // !FEATURE_DTRACE BOOL bIsRundownProvider = ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCStart) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCStart) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCEnd)); + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCStart) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCEnd)); BOOL bIsRuntimeProvider = ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoad) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnload) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad) || - (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodUnload)); + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnload) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad) || + (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodUnload)); if (pMethodDesc == NULL) return; - if(!pMethodDesc->IsRestored()) + if (!pMethodDesc->IsRestored()) { // Forcibly restoring ngen methods can cause all sorts of deadlocks and contract violations // These events are therefore put under the private provider - if(ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_PRIVATENGENFORCERESTORE_KEYWORD)) + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_PRIVATENGENFORCERESTORE_KEYWORD)) { PERMANENT_CONTRACT_VIOLATION(GCViolation, ReasonNonShippingCode); pMethodDesc->CheckRestore(); @@ -5453,13 +5461,13 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio } - if(bIsRundownProvider) + if (bIsRundownProvider) { bShowVerboseOutput = ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_VERBOSE, KEYWORDZERO); } - else if(bIsRuntimeProvider) + else if (bIsRuntimeProvider) { bShowVerboseOutput = ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_VERBOSE, @@ -5473,7 +5481,7 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio bIsDynamicMethod = (BOOL)pMethodDesc->IsDynamicMethod(); bHasSharedGenericCode = pMethodDesc->IsSharedByGenericInstantiations(); - if(pMethodDesc->GetMethodTable_NoLogging()) + if (pMethodDesc->GetMethodTable_NoLogging()) bIsGenericMethod = pMethodDesc->HasClassOrMethodInstantiation_NoLogging(); ulMethodFlags = ((ulMethodFlags | @@ -5489,7 +5497,7 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio // MethodDesc ==> Code Address ==>JitMananger TADDR start = pCode ? pCode : PCODEToPINSTR(pMethodDesc->GetNativeCode()); - if(start == 0) { + if (start == 0) { // this method hasn't been jitted return; } @@ -5505,22 +5513,22 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio ullMethodStartAddress = (ULONGLONG)methodRegionInfo.hotStartAddress; ulMethodSize = (ULONG)methodRegionInfo.hotSize; - ullModuleID = (ULONGLONG)(TADDR) pModule; + ullModuleID = (ULONGLONG)(TADDR)pModule; ullMethodIdentifier = (ULONGLONG)pMethodDesc; // Use MethodDesc if Dynamic or Generic methods - if( bIsDynamicMethod || bIsGenericMethod) + if (bIsDynamicMethod || bIsGenericMethod) { bShowVerboseOutput = TRUE; - if(bIsGenericMethod) + if (bIsGenericMethod) ulMethodToken = (ULONG)pMethodDesc->GetMemberDef_NoLogging(); - if(bIsDynamicMethod) // if its a generic and a dynamic method, we would set the methodtoken to 0 + if (bIsDynamicMethod) // if its a generic and a dynamic method, we would set the methodtoken to 0 ulMethodToken = (ULONG)0; } else ulMethodToken = (ULONG)pMethodDesc->GetMemberDef_NoLogging(); - if(bHasNativeImage) + if (bHasNativeImage) { ullColdMethodStartAddress = (ULONGLONG)methodRegionInfo.coldStartAddress; ulColdMethodSize = (ULONG)methodRegionInfo.coldSize; // methodRegionInfo.coldSize is size_t and info.MethodLoadInfo.MethodSize is 32 bit; will give incorrect values on a 64-bit machine @@ -5530,9 +5538,9 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio // if verbose method load info needed, only then // find method name and signature and fire verbose method load info - if(bShowVerboseOutput) + if (bShowVerboseOutput) { - if(!namespaceOrClassName|| !methodName|| !methodSignature || (methodName->IsEmpty() && namespaceOrClassName->IsEmpty() && methodSignature->IsEmpty())) + if (!namespaceOrClassName || !methodName || !methodSignature || (methodName->IsEmpty() && namespaceOrClassName->IsEmpty() && methodSignature->IsEmpty())) { pMethodDesc->GetMethodInfo(tNamespace, tMethodName, tMethodSignature); namespaceOrClassName = &tNamespace; @@ -5564,10 +5572,10 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio return; #endif // !FEATURE_DTRACE - if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoad) || + if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoad) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad)) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodLoadVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5592,9 +5600,9 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio GetClrInstanceId(), rejitID); } - if(bFireEventForColdSection) + if (bFireEventForColdSection) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodLoadVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5621,10 +5629,10 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio } } } - else if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnload) || + else if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnload) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodUnload)) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodUnloadVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5649,9 +5657,9 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio GetClrInstanceId(), rejitID); } - if(bFireEventForColdSection) + if (bFireEventForColdSection) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodUnloadVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5678,10 +5686,10 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio } } } - else if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCStart) || + else if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCStart) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCStart)) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodDCStartVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5706,9 +5714,9 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio GetClrInstanceId(), rejitID); } - if(bFireEventForColdSection) + if (bFireEventForColdSection) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodDCStartVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5735,10 +5743,10 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio } } } - else if((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd) || + else if ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd) || (dwEventOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCEnd)) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodDCEndVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5763,9 +5771,9 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio GetClrInstanceId(), rejitID); } - if(bFireEventForColdSection) + if (bFireEventForColdSection) { - if(bShowVerboseOutput) + if (bShowVerboseOutput) { FireEtwMethodDCEndVerbose_V1_or_V2(ullMethodIdentifier, ullModuleID, @@ -5822,7 +5830,7 @@ void ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio // // static -void ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, ReJITID rejitID) +void ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc* pMethodDesc, DWORD dwEventOptions, ReJITID rejitID) { CONTRACTL { @@ -5899,42 +5907,42 @@ void ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWOR void ETW::MethodLog::SendHelperEvent(ULONGLONG ullHelperStartAddress, ULONG ulHelperSize, LPCWSTR pHelperName) { WRAPPER_NO_CONTRACT; - if(pHelperName) + if (pHelperName) { #ifndef FEATURE_DTRACE - PCWSTR szDtraceOutput1=L""; + PCWSTR szDtraceOutput1 = L""; #else - CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; + CHAR szDtraceOutput1[DTRACE_OUTPUT_STRING_LEN]; #endif // !FEATURE_DTRACE - ULONG methodFlags = ETW::MethodLog::MethodStructs::JitHelperMethod; // helper flag set + ULONG methodFlags = ETW::MethodLog::MethodStructs::JitHelperMethod; // helper flag set #ifndef FEATURE_DTRACE - FireEtwMethodLoadVerbose_V1(ullHelperStartAddress, - 0, - ullHelperStartAddress, - ulHelperSize, - 0, - methodFlags, - NULL, - pHelperName, - NULL, - GetClrInstanceId()); + FireEtwMethodLoadVerbose_V1(ullHelperStartAddress, + 0, + ullHelperStartAddress, + ulHelperSize, + 0, + methodFlags, + NULL, + pHelperName, + NULL, + GetClrInstanceId()); #else // !FEATURE_DTRACE // since DTrace do not support UNICODE string, they need to be converted to ANSI string - INT32 nTempHelperName = WideCharToMultiByte(pHelperName, szDtraceOutput1); - if (nTempHelperName == 0) - return; - // in the action, printf, of DTtrace, it cannot print an arg with value NULL when the format is set %s. - // Dtrace does not provide the condition statement so that we give a string "NULL" to it. - FireEtwMethodLoadVerbose_V1(ullHelperStartAddress, - 0, - ullHelperStartAddress, - ulHelperSize, - 0, - methodFlags, - szDtraceOutputNULL, - szDtraceOutput1, - szDtraceOutputNULL, - GetClrInstanceId()); + INT32 nTempHelperName = WideCharToMultiByte(pHelperName, szDtraceOutput1); + if (nTempHelperName == 0) + return; + // in the action, printf, of DTtrace, it cannot print an arg with value NULL when the format is set %s. + // Dtrace does not provide the condition statement so that we give a string "NULL" to it. + FireEtwMethodLoadVerbose_V1(ullHelperStartAddress, + 0, + ullHelperStartAddress, + ulHelperSize, + 0, + methodFlags, + szDtraceOutputNULL, + szDtraceOutput1, + szDtraceOutputNULL, + GetClrInstanceId()); #endif // !FEATURE_DTRACE } } @@ -5943,23 +5951,23 @@ void ETW::MethodLog::SendHelperEvent(ULONGLONG ullHelperStartAddress, ULONG ulHe /****************************************************************************/ /* This routine sends back method events of type 'dwEventOptions', for all NGEN methods in pModule */ -/****************************************************************************/ -void ETW::MethodLog::SendEventsForNgenMethods(Module *pModule, DWORD dwEventOptions) + /****************************************************************************/ +void ETW::MethodLog::SendEventsForNgenMethods(Module* pModule, DWORD dwEventOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; #ifdef FEATURE_PREJIT - if(!pModule || !pModule->HasNativeImage()) + if (!pModule || !pModule->HasNativeImage()) return; MethodIterator mi(pModule); - while(mi.Next()) + while (mi.Next()) { - MethodDesc *hotDesc = (MethodDesc *)mi.GetMethodDesc(); + MethodDesc* hotDesc = (MethodDesc*)mi.GetMethodDesc(); ETW::MethodLog::SendMethodEvent(hotDesc, dwEventOptions, FALSE); } #endif // FEATURE_PREJIT @@ -5970,10 +5978,10 @@ void ETW::MethodLog::SendEventsForNgenMethods(Module *pModule, DWORD dwEventOpti JITed methods in either a given LoaderAllocator (if pLoaderAllocatorFilter is non NULL) or in a given Domain (if pDomainFilter is non NULL) or for all methods (if both filters are null) */ -/****************************************************************************/ -void ETW::MethodLog::SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions) + /****************************************************************************/ +void ETW::MethodLog::SendEventsForJitMethods(BaseDomain* pDomainFilter, LoaderAllocator* pLoaderAllocatorFilter, DWORD dwEventOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; @@ -5983,19 +5991,19 @@ void ETW::MethodLog::SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAl // This is only called for JITted methods loading xor unloading BOOL fLoadOrDCStart = ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoadOrDCStartAny) != 0); BOOL fUnloadOrDCEnd = ((dwEventOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnloadOrDCEndAny) != 0); - _ASSERTE((fLoadOrDCStart || fUnloadOrDCEnd) && !(fLoadOrDCStart && fUnloadOrDCEnd)); + _ASSERTE((fLoadOrDCStart || fUnloadOrDCEnd) && !(fLoadOrDCStart&& fUnloadOrDCEnd)); BOOL fSendMethodEvent = (dwEventOptions & (ETW::EnumerationLog::EnumerationStructs::JitMethodLoad | - ETW::EnumerationLog::EnumerationStructs::JitMethodDCStart | - ETW::EnumerationLog::EnumerationStructs::JitMethodUnload | - ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd)) != 0; + ETW::EnumerationLog::EnumerationStructs::JitMethodDCStart | + ETW::EnumerationLog::EnumerationStructs::JitMethodUnload | + ETW::EnumerationLog::EnumerationStructs::JitMethodDCEnd)) != 0; BOOL fSendILToNativeMapEvent = (dwEventOptions & (ETW::EnumerationLog::EnumerationStructs::MethodDCStartILToNativeMap | - ETW::EnumerationLog::EnumerationStructs::MethodDCEndILToNativeMap)) != 0; + ETW::EnumerationLog::EnumerationStructs::MethodDCEndILToNativeMap)) != 0; BOOL fCollectibleLoaderAllocatorFilter = ((pLoaderAllocatorFilter != NULL) && (pLoaderAllocatorFilter->IsCollectible())); @@ -6014,9 +6022,9 @@ void ETW::MethodLog::SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAl #endif // WINXP_AND_WIN2K3_BUILD_SUPPORT EEJitManager::CodeHeapIterator heapIterator(pDomainFilter, pLoaderAllocatorFilter); - while(heapIterator.Next()) + while (heapIterator.Next()) { - MethodDesc * pMD = heapIterator.GetMethod(); + MethodDesc* pMD = heapIterator.GetMethod(); if (pMD == NULL) continue; @@ -6103,7 +6111,7 @@ void ETW::MethodLog::SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAl // enumerationOptions - Flags indicating what to enumerate. Just passed // straight through to IterateDomain // -void ETW::EnumerationLog::IterateAppDomain(AppDomain * pAppDomain, DWORD enumerationOptions) +void ETW::EnumerationLog::IterateAppDomain(AppDomain* pAppDomain, DWORD enumerationOptions) { CONTRACTL { @@ -6143,10 +6151,10 @@ void ETW::EnumerationLog::IterateAppDomain(AppDomain * pAppDomain, DWORD enumera JIT methods in them, and the NGEN methods in them based on enumerationOptions.*/ -/********************************************************************************/ -void ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOptions) + /********************************************************************************/ +void ETW::EnumerationLog::IterateDomain(BaseDomain* pDomain, DWORD enumerationOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; PRECONDITION(pDomain != NULL); @@ -6166,86 +6174,86 @@ void ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp EX_TRY { // DC Start events for Domain - if(enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { ETW::LoaderLog::SendDomainEvent(pDomain, enumerationOptions); } - // DC End or Unload Jit Method events - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnloadOrDCEndAny) - { - ETW::MethodLog::SendEventsForJitMethods(pDomain, NULL, enumerationOptions); - } + // DC End or Unload Jit Method events + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodUnloadOrDCEndAny) + { + ETW::MethodLog::SendEventsForJitMethods(pDomain, NULL, enumerationOptions); + } - if (pDomain->IsAppDomain()) + if (pDomain->IsAppDomain()) + { + AppDomain::AssemblyIterator assemblyIterator = pDomain->AsAppDomain()->IterateAssembliesEx( + (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)); + CollectibleAssemblyHolder pDomainAssembly; + while (assemblyIterator.Next(pDomainAssembly.This())) { - AppDomain::AssemblyIterator assemblyIterator = pDomain->AsAppDomain()->IterateAssembliesEx( - (AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution)); - CollectibleAssemblyHolder pDomainAssembly; - while (assemblyIterator.Next(pDomainAssembly.This())) + CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetLoadedAssembly(); + BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); + if (bIsDomainNeutral) + continue; + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { - CollectibleAssemblyHolder pAssembly = pDomainAssembly->GetAssembly(); - BOOL bIsDomainNeutral = pAssembly->IsDomainNeutral(); - if (bIsDomainNeutral) - continue; - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } + ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); + } - DomainModuleIterator domainModuleIterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); - while (domainModuleIterator.Next()) - { - Module * pModule = domainModuleIterator.GetModule(); - ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); - } + DomainModuleIterator domainModuleIterator = pDomainAssembly->IterateModules(kModIterIncludeLoaded); + while (domainModuleIterator.Next()) + { + Module* pModule = domainModuleIterator.GetModule(); + ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); + } - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) + { + ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); } } - else + } + else + { + SharedDomain::SharedAssemblyIterator sharedDomainIterator; + while (sharedDomainIterator.Next()) { - SharedDomain::SharedAssemblyIterator sharedDomainIterator; - while (sharedDomainIterator.Next()) + Assembly* pAssembly = sharedDomainIterator.GetAssembly(); + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { - Assembly * pAssembly = sharedDomainIterator.GetAssembly(); - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } + ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); + } - ModuleIterator domainModuleIterator = pAssembly->IterateModules(); - while (domainModuleIterator.Next()) - { - Module * pModule = domainModuleIterator.GetModule(); - ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); - } + ModuleIterator domainModuleIterator = pAssembly->IterateModules(); + while (domainModuleIterator.Next()) + { + Module* pModule = domainModuleIterator.GetModule(); + ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); + } - if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) - { - ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); - } + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) + { + ETW::EnumerationLog::IterateAssembly(pAssembly, enumerationOptions); } } + } - // DC Start or Load Jit Method events - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoadOrDCStartAny) - { - ETW::MethodLog::SendEventsForJitMethods(pDomain, NULL, enumerationOptions); - } + // DC Start or Load Jit Method events + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::JitMethodLoadOrDCStartAny) + { + ETW::MethodLog::SendEventsForJitMethods(pDomain, NULL, enumerationOptions); + } - // DC End or Unload events for Domain - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) - { - ETW::LoaderLog::SendDomainEvent(pDomain, enumerationOptions); - } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + // DC End or Unload events for Domain + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) + { + ETW::LoaderLog::SendDomainEvent(pDomain, enumerationOptions); + } + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } @@ -6257,10 +6265,10 @@ void ETW::EnumerationLog::IterateDomain(BaseDomain *pDomain, DWORD enumerationOp JIT methods in them, and the NGEN methods in them based on enumerationOptions.*/ -/********************************************************************************/ -void ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAllocator *pLoaderAllocator, DWORD enumerationOptions) + /********************************************************************************/ +void ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAllocator* pLoaderAllocator, DWORD enumerationOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; PRECONDITION(pLoaderAllocator != NULL); @@ -6274,13 +6282,13 @@ void ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAlloca ETW::MethodLog::SendEventsForJitMethods(NULL, pLoaderAllocator, enumerationOptions); } - Assembly *pAssembly = pLoaderAllocator->Id()->GetDomainAssembly()->GetAssembly(); + Assembly* pAssembly = pLoaderAllocator->Id()->GetDomainAssembly()->GetAssembly(); _ASSERTE(!pAssembly->IsDomainNeutral()); // Collectible Assemblies are not domain neutral. DomainModuleIterator domainModuleIterator = pLoaderAllocator->Id()->GetDomainAssembly()->IterateModules(kModIterIncludeLoaded); while (domainModuleIterator.Next()) { - Module *pModule = domainModuleIterator.GetModule(); + Module* pModule = domainModuleIterator.GetModule(); ETW::EnumerationLog::IterateModule(pModule, enumerationOptions); } @@ -6294,16 +6302,16 @@ void ETW::EnumerationLog::IterateCollectibleLoaderAllocator(AssemblyLoaderAlloca { ETW::MethodLog::SendEventsForJitMethods(NULL, pLoaderAllocator, enumerationOptions); } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /********************************************************************************/ /* This routine fires ETW events for Assembly and the DomainModule's in them based on enumerationOptions.*/ -/********************************************************************************/ -void ETW::EnumerationLog::IterateAssembly(Assembly *pAssembly, DWORD enumerationOptions) + /********************************************************************************/ +void ETW::EnumerationLog::IterateAssembly(Assembly* pAssembly, DWORD enumerationOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; PRECONDITION(pAssembly != NULL); @@ -6312,41 +6320,41 @@ void ETW::EnumerationLog::IterateAssembly(Assembly *pAssembly, DWORD enumeration EX_TRY { // DC Start events for Assembly - if(enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) { ETW::LoaderLog::SendAssemblyEvent(pAssembly, enumerationOptions); } - // DC Start, DCEnd, events for DomainModule - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart)) + // DC Start, DCEnd, events for DomainModule + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart)) + { + if (pAssembly->GetDomain()->IsAppDomain()) { - if(pAssembly->GetDomain()->IsAppDomain()) + DomainModuleIterator dmIterator = pAssembly->FindDomainAssembly(pAssembly->GetDomain()->AsAppDomain())->IterateModules(kModIterIncludeLoaded); + while (dmIterator.Next()) { - DomainModuleIterator dmIterator = pAssembly->FindDomainAssembly(pAssembly->GetDomain()->AsAppDomain())->IterateModules(kModIterIncludeLoaded); - while (dmIterator.Next()) - { - ETW::LoaderLog::SendModuleEvent(dmIterator.GetModule(), enumerationOptions, TRUE); - } + ETW::LoaderLog::SendModuleEvent(dmIterator.GetModule(), enumerationOptions, TRUE); } } + } - // DC End or Unload events for Assembly - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) - { - ETW::LoaderLog::SendAssemblyEvent(pAssembly, enumerationOptions); - } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + // DC End or Unload events for Assembly + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload)) + { + ETW::LoaderLog::SendAssemblyEvent(pAssembly, enumerationOptions); + } + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } /********************************************************************************/ /* This routine fires ETW events for Module, their range information and the NGEN methods in them based on enumerationOptions.*/ -/********************************************************************************/ -void ETW::EnumerationLog::IterateModule(Module *pModule, DWORD enumerationOptions) + /********************************************************************************/ +void ETW::EnumerationLog::IterateModule(Module* pModule, DWORD enumerationOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; PRECONDITION(pModule != NULL); @@ -6355,45 +6363,45 @@ void ETW::EnumerationLog::IterateModule(Module *pModule, DWORD enumerationOption EX_TRY { // DC Start events for Module - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCStart) || (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCStart)) { ETW::LoaderLog::SendModuleEvent(pModule, enumerationOptions); } - // DC Start or Load or DC End or Unload Ngen Method events - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCStart) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodUnload) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCEnd)) - { - ETW::MethodLog::SendEventsForNgenMethods(pModule, enumerationOptions); - } + // DC Start or Load or DC End or Unload Ngen Method events + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodLoad) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCStart) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodUnload) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::NgenMethodDCEnd)) + { + ETW::MethodLog::SendEventsForNgenMethods(pModule, enumerationOptions); + } - // DC End or Unload events for Module - if((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCEnd)) - { - ETW::LoaderLog::SendModuleEvent(pModule, enumerationOptions); - } + // DC End or Unload events for Module + if ((enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleDCEnd) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::DomainAssemblyModuleUnload) || + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeDCEnd)) + { + ETW::LoaderLog::SendModuleEvent(pModule, enumerationOptions); + } - // If we're logging types, then update the internal Type hash table to account - // for the module's unloading - if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::TypeUnload) - { - ETW::TypeSystemLog::OnModuleUnload(pModule); - } + // If we're logging types, then update the internal Type hash table to account + // for the module's unloading + if (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::TypeUnload) + { + ETW::TypeSystemLog::OnModuleUnload(pModule); + } - // ModuleRangeLoadPrivate events for module range information from attach/detach scenarios - if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, - TRACE_LEVEL_INFORMATION, - CLR_PERFTRACK_PRIVATE_KEYWORD) && - (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoadPrivate)) - { - ETW::LoaderLog::SendModuleEvent(pModule, enumerationOptions); - } - } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions); + // ModuleRangeLoadPrivate events for module range information from attach/detach scenarios + if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, + TRACE_LEVEL_INFORMATION, + CLR_PERFTRACK_PRIVATE_KEYWORD) && + (enumerationOptions & ETW::EnumerationLog::EnumerationStructs::ModuleRangeLoadPrivate)) + { + ETW::LoaderLog::SendModuleEvent(pModule, enumerationOptions); + } + } EX_CATCH{ } EX_END_CATCH(SwallowAllExceptions); } //--------------------------------------------------------------------------------------- @@ -6429,9 +6437,9 @@ void ETW::EnumerationLog::IterateModule(Module *pModule, DWORD enumerationOption // // static -void ETW::EnumerationLog::EnumerationHelper(Module *moduleFilter, BaseDomain *domainFilter, DWORD enumerationOptions) +void ETW::EnumerationLog::EnumerationHelper(Module* moduleFilter, BaseDomain* domainFilter, DWORD enumerationOptions) { - CONTRACTL { + CONTRACTL{ THROWS; GC_TRIGGERS; } CONTRACTL_END; @@ -6444,7 +6452,7 @@ void ETW::EnumerationLog::EnumerationHelper(Module *moduleFilter, BaseDomain *do // See code:#TableLockHolder ReJitManager::TableLockHolder lkRejitMgrSharedDomain(SharedDomain::GetDomain()->GetReJitManager()); - if(moduleFilter) + if (moduleFilter) { // See code:#TableLockHolder ReJitManager::TableLockHolder lkRejitMgrModule(moduleFilter->GetReJitManager()); @@ -6466,12 +6474,12 @@ void ETW::EnumerationLog::EnumerationHelper(Module *moduleFilter, BaseDomain *do } else { - if(domainFilter) + if (domainFilter) { // See code:#TableLockHolder ReJitManager::TableLockHolder lkRejitMgrAD(domainFilter->GetReJitManager()); - if(domainFilter->IsAppDomain()) + if (domainFilter->IsAppDomain()) { ETW::EnumerationLog::IterateAppDomain(domainFilter->AsAppDomain(), enumerationOptions); } @@ -6483,9 +6491,9 @@ void ETW::EnumerationLog::EnumerationHelper(Module *moduleFilter, BaseDomain *do else { AppDomainIterator appDomainIterator(FALSE); - while(appDomainIterator.Next()) + while (appDomainIterator.Next()) { - AppDomain *pDomain = appDomainIterator.GetDomain(); + AppDomain* pDomain = appDomainIterator.GetDomain(); if (pDomain != NULL) { // See code:#TableLockHolder diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index d602f9f920399..2a59376a36775 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2910,14 +2910,6 @@ DomainAssembly *AppDomain::LoadDomainAssemblyInternal(AssemblySpec* pIdentity, RETURN result; } // AppDomain::LoadDomainAssembly - -struct LoadFileArgs -{ - FileLoadLock *pLock; - FileLoadLevel targetLevel; - DomainAssembly *result; -}; - DomainAssembly *AppDomain::LoadDomainAssembly(FileLoadLock *pLock, FileLoadLevel targetLevel) { CONTRACT(DomainAssembly *) diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index a2a42d5ed6aaa..59eb6249a6a66 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -773,7 +773,7 @@ class FileLoadLock : public ListLockEntry { private: FileLoadLevel m_level; - DomainAssembly *m_pDomainAssembly; + DomainAssembly *m_pDomainAssembly; HRESULT m_cachedHR; public: diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index 7c4b967c22be7..a90f80433e388 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -56,16 +56,8 @@ struct CreateDynamicAssemblyArgs : CreateDynamicAssemblyArgsGC StackCrawlMark* stackMark; }; -// An assembly is the unit of deployment for managed code. Typically Assemblies are one to one with files -// (Modules), however this is not necessary, as an assembly can contain serveral files (typically you only -// do this so that you can resource-only modules that are national language specific) -// -// Conceptually Assemblies are loaded into code:AppDomain -// -// So in general an assemly is a list of code:Module, where a code:Module is 1-1 with a DLL or EXE file. -// -// One of the modules the code:Assembly.m_pModule is special in that it knows about all the other -// modules in an assembly (often it is the only one). +// An assembly is the unit of deployment for managed code. +// Assemblies are one to one with files since coreclr does not support multimodule assemblies. // class Assembly { diff --git a/src/coreclr/vm/methoditer.cpp b/src/coreclr/vm/methoditer.cpp index 41b22aa0032b1..da24a53d064a1 100644 --- a/src/coreclr/vm/methoditer.cpp +++ b/src/coreclr/vm/methoditer.cpp @@ -91,7 +91,7 @@ BOOL LoadedMethodDescIterator::Next( ADVANCE_TYPE: if (m_mainMD->HasClassInstantiation()) { - if (!GetModule()->GetAvailableParamTypes()->FindNext(&m_typeIterator, &m_typeIteratorEntry)) + if (!GetCurrentModule()->GetAvailableParamTypes()->FindNext(&m_typeIterator, &m_typeIteratorEntry)) goto ADVANCE_ASSEMBLY; if (CORCOMPILE_IS_POINTER_TAGGED(m_typeIteratorEntry->GetTypeHandle().AsTAddr())) goto ADVANCE_TYPE; @@ -145,7 +145,7 @@ BOOL LoadedMethodDescIterator::Next( ADVANCE_METHOD: if (m_mainMD->HasMethodInstantiation()) { - if (!GetModule()->GetInstMethodHashTable()->FindNext(&m_methodIterator, &m_methodIteratorEntry)) + if (!GetCurrentModule()->GetInstMethodHashTable()->FindNext(&m_methodIterator, &m_methodIteratorEntry)) goto ADVANCE_TYPE; if (CORCOMPILE_IS_POINTER_TAGGED(dac_cast(m_methodIteratorEntry->GetMethod()))) goto ADVANCE_METHOD; @@ -174,7 +174,7 @@ BOOL LoadedMethodDescIterator::Next( } // LoadedMethodDescIterator::Next -Module * LoadedMethodDescIterator::GetModule() +Module * LoadedMethodDescIterator::GetCurrentModule() { CONTRACTL { diff --git a/src/coreclr/vm/methoditer.h b/src/coreclr/vm/methoditer.h index e1835e6538a2e..fdc49e2ce5971 100644 --- a/src/coreclr/vm/methoditer.h +++ b/src/coreclr/vm/methoditer.h @@ -83,7 +83,7 @@ class LoadedMethodDescIterator LoadedMethodDescIterator(void); protected: - Module * GetModule(); + Module * GetCurrentModule(); }; // class LoadedMethodDescIterator From 0caa838cf99c40ff2614e00e731588dab2acf4e1 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Wed, 26 Jan 2022 19:08:34 -0800 Subject: [PATCH 25/25] more PR feedback --- src/coreclr/vm/appdomain.cpp | 22 +--------------------- src/coreclr/vm/appdomain.hpp | 1 - src/coreclr/vm/assembly.cpp | 1 - src/coreclr/vm/assembly.hpp | 3 --- 4 files changed, 1 insertion(+), 26 deletions(-) diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index 2a59376a36775..f998f5d1b1607 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -2522,26 +2522,6 @@ void AppDomain::LoadSystemAssemblies() LoadAssembly(NULL, SystemDomain::System()->SystemPEAssembly(), FILE_ACTIVE); } -FileLoadLevel AppDomain::GetDomainAssemblyLoadLevel(DomainAssembly *pFile) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END - - LoadLockHolder lock(this); - - FileLoadLock* pLockEntry = (FileLoadLock *) lock->FindFileLock(pFile->GetPEAssembly()); - - if (pLockEntry == NULL) - return pFile->GetLoadLevel(); - else - return pLockEntry->GetLoadLevel(); -} - // This checks if the thread has initiated (or completed) loading at the given level. A false guarantees that // (a) The current thread (or a thread blocking on the current thread) has not started loading the file // at the given level, and @@ -3018,7 +2998,7 @@ DomainAssembly *AppDomain::LoadDomainAssembly(FileLoadLock *pLock, FileLoadLevel // lower level. In such a case, we throw an exception which transiently fails the current // load, since it is likely we have not satisfied the caller. // (An alternate, and possibly preferable, strategy here would be for all callers to explicitly - // identify the minimum load level acceptable via CheckLoadDomainAssembly and throw from there.) + // specify the minimum load level acceptable and throw if not reached.) pFile->RequireLoadLevel((FileLoadLevel)(immediateTargetLevel-1)); diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index 59eb6249a6a66..fbe728ff7e1c0 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -1799,7 +1799,6 @@ class AppDomain : public BaseDomain CHECK CheckCanExecuteManagedCode(MethodDesc* pMD); CHECK CheckLoading(DomainAssembly *pFile, FileLoadLevel level); - FileLoadLevel GetDomainAssemblyLoadLevel(DomainAssembly *pFile); BOOL IsLoading(DomainAssembly *pFile, FileLoadLevel level); static FileLoadLevel GetThreadFileLoadLevel(); diff --git a/src/coreclr/vm/assembly.cpp b/src/coreclr/vm/assembly.cpp index d4f9e7bfcc974..c1a496c436200 100644 --- a/src/coreclr/vm/assembly.cpp +++ b/src/coreclr/vm/assembly.cpp @@ -133,7 +133,6 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pPEAssembly, DebuggerAssembl #ifdef FEATURE_COLLECTIBLE_TYPES m_isCollectible(fIsCollectible), #endif - m_nextAvailableModuleIndex(1), m_pLoaderAllocator(NULL), #ifdef FEATURE_COMINTEROP m_pITypeLib(NULL), diff --git a/src/coreclr/vm/assembly.hpp b/src/coreclr/vm/assembly.hpp index a90f80433e388..8c72128f3e4f6 100644 --- a/src/coreclr/vm/assembly.hpp +++ b/src/coreclr/vm/assembly.hpp @@ -326,8 +326,6 @@ class Assembly FORCEINLINE BOOL IsDynamic() { LIMITED_METHOD_CONTRACT; return m_isDynamic; } FORCEINLINE BOOL IsCollectible() { LIMITED_METHOD_DAC_CONTRACT; return m_isCollectible; } - DWORD GetNextModuleIndex() { LIMITED_METHOD_CONTRACT; return m_nextAvailableModuleIndex++; } - void AddType(Module* pModule, mdTypeDef cl); void AddExportedType(mdExportedType cl); @@ -481,7 +479,6 @@ class Assembly #ifdef FEATURE_COLLECTIBLE_TYPES BOOL m_isCollectible; #endif // FEATURE_COLLECTIBLE_TYPES - DWORD m_nextAvailableModuleIndex; PTR_LoaderAllocator m_pLoaderAllocator; #ifdef FEATURE_COMINTEROP