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

[6.0] Re-create MultiCoreJIT profile data on profile-use-only mode #71754

Merged
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
12 changes: 5 additions & 7 deletions src/coreclr/vm/multicorejit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,16 +1202,13 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin

if ((pProfile != NULL) && (pProfile[0] != 0)) // Ignore empty file name, just same as StopProfile
{
bool gatherProfile = (int)CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MultiCoreJitNoProfileGather) == 0;

MulticoreJitRecorder * pRecorder = new (nothrow) MulticoreJitRecorder(
pDomain,
pBinderContext,
gatherProfile);
pBinderContext);

if (pRecorder != NULL)
{
gatherProfile = pRecorder->CanGatherProfile();
bool gatherProfile = (int)CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MultiCoreJitNoProfileGather) == 0;

m_pMulticoreJitRecorder = pRecorder;

Expand All @@ -1221,9 +1218,10 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin

MulticoreJitTrace(("MulticoreJitRecorder session %d created: %x", sessionID, hr));

if ((hr == COR_E_BADIMAGEFORMAT) || SUCCEEDED(hr)) // Ignore COR_E_BADIMAGEFORMAT, always record new profile
if ((hr == COR_E_BADIMAGEFORMAT) || (SUCCEEDED(hr) && gatherProfile)) // Ignore COR_E_BADIMAGEFORMAT, always record new profile
{
m_fRecorderActive = gatherProfile;
m_pMulticoreJitRecorder->Activate();
m_fRecorderActive = m_pMulticoreJitRecorder->CanGatherProfile();
}

_FireEtwMulticoreJit(W("STARTPROFILE"), W("Recorder"), m_fRecorderActive, hr, 0);
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/vm/multicorejitimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ class MulticoreJitRecorder

public:

MulticoreJitRecorder(AppDomain * pDomain, ICLRPrivBinder * pBinderContext, bool fRecorderActive)
MulticoreJitRecorder(AppDomain * pDomain, ICLRPrivBinder * pBinderContext)
: m_stats(pDomain->GetMulticoreJitManager().GetStats())
, m_ModuleList(nullptr)
, m_JitInfoArray(nullptr)
Expand All @@ -665,18 +665,10 @@ class MulticoreJitRecorder
m_pDomain = pDomain;
m_pBinderContext = pBinderContext;

if (fRecorderActive)
{
m_ModuleList = new (nothrow) RecorderModuleInfo[MAX_MODULES];
}
m_ModuleCount = 0;

m_ModuleDepCount = 0;

if (fRecorderActive)
{
m_JitInfoArray = new (nothrow) RecorderInfo[MAX_METHODS];
}
m_JitInfoCount = 0;

m_fFirstMethod = true;
Expand Down Expand Up @@ -726,6 +718,14 @@ class MulticoreJitRecorder
(m_ModuleCount >= MAX_MODULES);
}

void Activate()
{
LIMITED_METHOD_CONTRACT;

m_ModuleList = new (nothrow) RecorderModuleInfo[MAX_MODULES];
m_JitInfoArray = new (nothrow) RecorderInfo[MAX_METHODS];
}

void RecordMethodJitOrLoad(MethodDesc * pMethod, bool application);

MulticoreJitCodeInfo RequestMethodCode(MethodDesc * pMethod, MulticoreJitManager * pManager);
Expand Down