Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PreJIT to jitdump
Browse files Browse the repository at this point in the history
sdmaclea committed Oct 3, 2019
1 parent 9bd19d0 commit 2c25dff
Showing 3 changed files with 44 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/vm/perfmap.cpp
Original file line number Diff line number Diff line change
@@ -269,6 +269,42 @@ void PerfMap::LogJITCompiledMethod(MethodDesc * pMethod, PCODE pCode, size_t cod
s_Current->LogMethod(pMethod, pCode, codeSize, optimizationTier);
}

// Log a pre-compiled method to the perfmap.
void PerfMap::LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode)
{
LIMITED_METHOD_CONTRACT;

// Get information about the NGEN'd method code.
EECodeInfo codeInfo(pCode);
_ASSERTE(codeInfo.IsValid());

IJitManager::MethodRegionInfo methodRegionInfo;
codeInfo.GetMethodRegionInfo(&methodRegionInfo);

// Logging failures should not cause any exceptions to flow upstream.
EX_TRY
{
// Get the full method signature.
SString name;
pMethod->GetFullMethodInfo(name);

StackScratchBuffer scratch;

// NGEN can split code between hot and cold sections which are separate in memory.
// Emit an entry for each section if it is used.
if (methodRegionInfo.hotSize > 0)
{
PerfJitDump::LogMethod((void*)methodRegionInfo.hotStartAddress, methodRegionInfo.hotSize, name.GetANSI(scratch));
}

if (methodRegionInfo.coldSize > 0)
{
PerfJitDump::LogMethod((void*)methodRegionInfo.coldStartAddress, methodRegionInfo.coldSize, name.GetANSI(scratch));
}
}
EX_CATCH{} EX_END_CATCH(SwallowAllExceptions);
}

// Log a set of stub to the map.
void PerfMap::LogStubs(const char* stubType, const char* stubOwner, PCODE pCode, size_t codeSize)
{
3 changes: 3 additions & 0 deletions src/vm/perfmap.h
Original file line number Diff line number Diff line change
@@ -70,6 +70,9 @@ class PerfMap
// Log a JIT compiled method to the map.
static void LogJITCompiledMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize, PrepareCodeConfig *pConfig);

// Log a pre-compiled method to the map.
static void LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode);

// Log a set of stub to the map.
static void LogStubs(const char* stubType, const char* stubOwner, PCODE pCode, size_t codeSize);

5 changes: 5 additions & 0 deletions src/vm/prestub.cpp
Original file line number Diff line number Diff line change
@@ -384,6 +384,11 @@ PCODE MethodDesc::PrepareILBasedCode(PrepareCodeConfig* pConfig)

if (pCode == NULL)
pCode = GetPrecompiledCode(pConfig);

#ifdef FEATURE_PERFMAP
if (pCode != NULL)
PerfMap::LogPreCompiledMethod(this, pCode);
#endif
}

if (pCode == NULL)

0 comments on commit 2c25dff

Please sign in to comment.