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

Make JitPrintInlinedMethods less verbose #61208

Merged
merged 4 commits into from
Nov 6, 2021
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
2 changes: 1 addition & 1 deletion src/coreclr/jit/fginline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ PhaseStatus Compiler::fgInline()
{
JITDUMP("**************** Inline Tree");
printf("\n");
m_inlineStrategy->Dump(verbose);
m_inlineStrategy->Dump(verbose || JitConfig.JitPrintInlinedMethodsVerbose());
}

#endif // DEBUG
Expand Down
70 changes: 37 additions & 33 deletions src/coreclr/jit/inline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,14 @@ InlineContext::InlineContext(InlineStrategy* strategy)
//
// Arguments:
// indent - indentation level for this node
// verbose - more verbose output if true

void InlineContext::Dump(unsigned indent)
void InlineContext::Dump(bool verbose, unsigned indent)
{
// Handle fact that siblings are in reverse order.
if (m_Sibling != nullptr)
{
m_Sibling->Dump(indent);
m_Sibling->Dump(verbose, indent);
}

// We may not know callee name in some of the failing cases
Expand Down Expand Up @@ -391,35 +392,52 @@ void InlineContext::Dump(unsigned indent)
{
// Root method
InlinePolicy* policy = InlinePolicy::GetPolicy(compiler, true);
printf("Inlines into %08X [via %s] %s\n", calleeToken, policy->GetName(), calleeName);

if (verbose)
{
printf("\nInlines into %08X [via %s] %s:\n", calleeToken, policy->GetName(), calleeName);
}
else
{
printf("\nInlines into %s:\n", calleeName);
}
}
else
{
// Inline attempt.
const char* inlineTarget = InlGetTargetString(m_Observation);
const char* inlineReason = InlGetObservationString(m_Observation);
const char* inlineResult = m_Success ? "" : "FAILED: ";
const char* devirtualized = m_Devirtualized ? " devirt" : "";
const char* guarded = m_Guarded ? " guarded" : "";
const char* unboxed = m_Unboxed ? " unboxed" : "";
const char* inlineResult = m_Success ? "INLINED: " : "FAILED: ";
const char* devirtualized = m_Devirtualized ? " DEVIRT" : "";
const char* guarded = m_Guarded ? " GUARDED" : "";
const char* unboxed = m_Unboxed ? " UNBOXED" : "";

if (m_Offset == BAD_IL_OFFSET)
if (verbose)
{
printf("%*s[%u IL=???? TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal, m_TreeID, calleeToken,
inlineResult, inlineTarget, inlineReason, guarded, devirtualized, unboxed, calleeName);
if (m_Offset == BAD_IL_OFFSET)
{
printf("%*s[%u IL=???? TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal, m_TreeID,
calleeToken, inlineResult, inlineTarget, inlineReason, guarded, devirtualized, unboxed,
calleeName);
}
else
{
printf("%*s[%u IL=%04d TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal,
jitGetILoffs(m_Offset), m_TreeID, calleeToken, inlineResult, inlineTarget, inlineReason, guarded,
devirtualized, unboxed, calleeName);
}
}
else
{
IL_OFFSET offset = jitGetILoffs(m_Offset);
printf("%*s[%u IL=%04d TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal, offset, m_TreeID,
calleeToken, inlineResult, inlineTarget, inlineReason, guarded, devirtualized, unboxed, calleeName);
printf("%*s[%s%s%s%s%s] %s\n", indent, "", inlineResult, inlineReason, guarded, devirtualized, unboxed,
calleeName);
}
}

// Recurse to first child
if (m_Child != nullptr)
{
m_Child->Dump(indent + 2);
m_Child->Dump(verbose, indent + 2);
}
}

Expand Down Expand Up @@ -763,21 +781,7 @@ void InlineResult::Report()

if ((m_Callee != nullptr) && (obs != InlineObservation::CALLEE_IS_NOINLINE))
{

#ifdef DEBUG

const char* obsString = InlGetObservationString(obs);

if (VERBOSE)
{
JITDUMP("\nINLINER: Marking %s as NOINLINE because of %s\n", callee, obsString);
}
else if (m_RootCompiler->fgPrintInlinedMethods)
{
printf("Marking %s as NOINLINE because of %s\n", callee, obsString);
}

#endif // DEBUG
JITDUMP("\nINLINER: Marking %s as NOINLINE because of %s\n", callee, InlGetObservationString(obs));

COMP_HANDLE comp = m_RootCompiler->info.compCompHnd;
comp->setMethodAttribs(m_Callee, CORINFO_FLG_BAD_INLINEE);
Expand Down Expand Up @@ -1361,13 +1365,13 @@ InlineContext* InlineStrategy::NewFailure(Statement* stmt, InlineResult* inlineR
// Dump: dump description of inline behavior
//
// Arguments:
// showBudget - also dump final budget values
// verbose - print more details such as final budget values and IL offsets

void InlineStrategy::Dump(bool showBudget)
void InlineStrategy::Dump(bool verbose)
{
m_RootContext->Dump();
m_RootContext->Dump(verbose);

if (!showBudget)
if (!verbose)
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ class InlineContext
#if defined(DEBUG) || defined(INLINE_DATA)

// Dump the full subtree, including failures
void Dump(unsigned indent = 0);
void Dump(bool verbose, unsigned indent = 0);

// Dump only the success subtree, with rich data
void DumpData(unsigned indent = 0);
Expand Down Expand Up @@ -923,7 +923,7 @@ class InlineStrategy
#if defined(DEBUG) || defined(INLINE_DATA)

// Dump textual description of inlines done so far.
void Dump(bool showBudget);
void Dump(bool verbose);

// Dump data-format description of inlines done so far.
void DumpData();
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ CONFIG_INTEGER(JitQueryCurrentStaticFieldClass, W("JitQueryCurrentStaticFieldCla
CONFIG_INTEGER(JitReportFastTailCallDecisions, W("JitReportFastTailCallDecisions"), 0)
CONFIG_INTEGER(JitPInvokeCheckEnabled, W("JITPInvokeCheckEnabled"), 0)
CONFIG_INTEGER(JitPInvokeEnabled, W("JITPInvokeEnabled"), 1)

// Controls verbosity for JitPrintInlinedMethods. Ignored for JitDump/NgenDump where
// it's always set.
CONFIG_INTEGER(JitPrintInlinedMethodsVerbose, W("JitPrintInlinedMethodsVerboseLevel"), 0)
// Prints a tree of inlinees for a specific method (use '*' for all methods)
CONFIG_METHODSET(JitPrintInlinedMethods, W("JitPrintInlinedMethods"))

CONFIG_METHODSET(JitPrintDevirtualizedMethods, W("JitPrintDevirtualizedMethods"))
CONFIG_INTEGER(JitProfileChecks, W("JitProfileChecks"), 0) // 1 enable in dumps, 2 assert if issues found
CONFIG_INTEGER(JitRequired, W("JITRequired"), -1)
Expand Down