Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove BaseDomain use in LoaderAllocator and event tracing helpers #107481

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/coreclr/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ class Module;
class Assembly;
class MethodDesc;
class MethodTable;
class BaseDomain;
class AppDomain;
class SString;
class CrawlFrame;
Expand Down Expand Up @@ -750,12 +749,11 @@ namespace ETW
#ifdef FEATURE_EVENT_TRACE
static VOID SendThreadRundownEvent();
static VOID SendGCRundownEvent();
static VOID IterateDomain(BaseDomain *pDomain, DWORD enumerationOptions);
static VOID IterateAppDomain(AppDomain * pAppDomain, DWORD enumerationOptions);
static VOID IterateAppDomain(DWORD enumerationOptions);
static VOID IterateCollectibleLoaderAllocator(AssemblyLoaderAllocator *pLoaderAllocator, DWORD enumerationOptions);
static VOID IterateAssembly(Assembly *pAssembly, DWORD enumerationOptions);
static VOID IterateModule(Module *pModule, DWORD enumerationOptions);
static VOID EnumerationHelper(Module *moduleFilter, BaseDomain *domainFilter, DWORD enumerationOptions);
static VOID EnumerationHelper(Module *moduleFilter, DWORD enumerationOptions);
static DWORD GetEnumerationOptionsFromRuntimeKeywords();
public:
typedef union _EnumerationStructs
Expand Down Expand Up @@ -839,7 +837,7 @@ namespace ETW
static VOID SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL bFireDomainModuleEvents=FALSE);
static ULONG SendModuleRange(_In_ Module *pModule, _In_ DWORD dwEventOptions);
static VOID SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions);
static VOID SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptions, LPCWSTR wszFriendlyName=NULL);
static VOID SendDomainEvent(DWORD dwEventOptions, LPCWSTR wszFriendlyName=NULL);
public:
typedef union _LoaderStructs
{
Expand Down Expand Up @@ -877,23 +875,23 @@ namespace ETW

}LoaderStructs;

static VOID DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL);
static VOID DomainLoadReal(_In_opt_ LPWSTR wszFriendlyName=NULL);

static VOID DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName = NULL)
static VOID DomainLoad(_In_opt_ LPWSTR wszFriendlyName = NULL)
{
if (ETW_PROVIDER_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER))
{
DomainLoadReal(pDomain, wszFriendlyName);
DomainLoadReal(wszFriendlyName);
}
}

static VOID DomainUnload(AppDomain *pDomain);
static VOID DomainUnload();
static VOID CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator);
static VOID ModuleLoad(Module *pModule, LONG liReportedSharedModule);
#else
public:
static VOID DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL) {};
static VOID DomainUnload(AppDomain *pDomain) {};
static VOID DomainLoad(_In_opt_ LPWSTR wszFriendlyName=NULL) {};
static VOID DomainUnload() {};
static VOID CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator) {};
static VOID ModuleLoad(Module *pModule, LONG liReportedSharedModule) {};
#endif // FEATURE_EVENT_TRACE
Expand All @@ -904,7 +902,7 @@ namespace ETW
{
friend class ETW::EnumerationLog;
#ifdef FEATURE_EVENT_TRACE
static VOID SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions);
static VOID SendEventsForJitMethods(BOOL getCodeVersionIds, LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions);
static VOID SendEventsForJitMethodsHelper(
LoaderAllocator *pLoaderAllocatorFilter,
DWORD dwEventOptions,
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,7 @@ class SystemDomain : public BaseDomain

m_pDelayedUnloadListOfLoaderAllocators=NULL;

m_GlobalAllocator.Init(this);
m_GlobalAllocator.Init();
}
#endif

Expand All @@ -2023,7 +2023,6 @@ class SystemDomain : public BaseDomain

GlobalLoaderAllocator m_GlobalAllocator;


InlineSString<100> m_BaseLibrary;

InlineSString<100> m_SystemDirectory;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ Assembly *Assembly::CreateDynamic(AssemblyBinder* pBinder, NativeAssemblyNamePar

// Some of the initialization functions are not virtual. Call through the derived class
// to prevent calling the base class version.
pCollectibleLoaderAllocator->Init(pDomain);
pCollectibleLoaderAllocator->Init();

// Setup the managed proxy now, but do not actually transfer ownership to it.
// Once everything is setup and nothing can fail anymore, the ownership will be
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/assemblynative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ extern "C" INT_PTR QCALLTYPE AssemblyNative_InitializeAssemblyLoadContext(INT_PT
GCX_PREEMP();
// Some of the initialization functions are not virtual. Call through the derived class
// to prevent calling the base class version.
loaderAllocator->Init(pCurDomain);
loaderAllocator->Init();
loaderAllocator->InitVirtualCallStubManager();

// Setup the managed proxy now, but do not actually transfer ownership to it.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/corhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ HRESULT CorHost2::CreateAppDomainWithManager(

BEGIN_EXTERNAL_ENTRYPOINT(&hr);

AppDomain* pDomain = SystemDomain::System()->DefaultDomain();
AppDomain* pDomain = AppDomain::GetCurrentDomain();

pDomain->SetFriendlyName(wszFriendlyName);

ETW::LoaderLog::DomainLoad(pDomain, (LPWSTR)wszFriendlyName);
ETW::LoaderLog::DomainLoad((LPWSTR)wszFriendlyName);

if (dwFlags & APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS)
pDomain->SetIgnoreUnhandledExceptions();
Expand Down
Loading