Skip to content

Commit 7f4eb85

Browse files
authored
Make JitPrintInlinedMethods less verbose (#61208)
1 parent 6547b55 commit 7f4eb85

File tree

4 files changed

+46
-36
lines changed

4 files changed

+46
-36
lines changed

src/coreclr/jit/fginline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ PhaseStatus Compiler::fgInline()
226226
{
227227
JITDUMP("**************** Inline Tree");
228228
printf("\n");
229-
m_inlineStrategy->Dump(verbose);
229+
m_inlineStrategy->Dump(verbose || JitConfig.JitPrintInlinedMethodsVerbose());
230230
}
231231

232232
#endif // DEBUG

src/coreclr/jit/inline.cpp

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,14 @@ InlineContext::InlineContext(InlineStrategy* strategy)
356356
//
357357
// Arguments:
358358
// indent - indentation level for this node
359+
// verbose - more verbose output if true
359360

360-
void InlineContext::Dump(unsigned indent)
361+
void InlineContext::Dump(bool verbose, unsigned indent)
361362
{
362363
// Handle fact that siblings are in reverse order.
363364
if (m_Sibling != nullptr)
364365
{
365-
m_Sibling->Dump(indent);
366+
m_Sibling->Dump(verbose, indent);
366367
}
367368

368369
// We may not know callee name in some of the failing cases
@@ -391,35 +392,52 @@ void InlineContext::Dump(unsigned indent)
391392
{
392393
// Root method
393394
InlinePolicy* policy = InlinePolicy::GetPolicy(compiler, true);
394-
printf("Inlines into %08X [via %s] %s\n", calleeToken, policy->GetName(), calleeName);
395+
396+
if (verbose)
397+
{
398+
printf("\nInlines into %08X [via %s] %s:\n", calleeToken, policy->GetName(), calleeName);
399+
}
400+
else
401+
{
402+
printf("\nInlines into %s:\n", calleeName);
403+
}
395404
}
396405
else
397406
{
398407
// Inline attempt.
399408
const char* inlineTarget = InlGetTargetString(m_Observation);
400409
const char* inlineReason = InlGetObservationString(m_Observation);
401-
const char* inlineResult = m_Success ? "" : "FAILED: ";
402-
const char* devirtualized = m_Devirtualized ? " devirt" : "";
403-
const char* guarded = m_Guarded ? " guarded" : "";
404-
const char* unboxed = m_Unboxed ? " unboxed" : "";
410+
const char* inlineResult = m_Success ? "INLINED: " : "FAILED: ";
411+
const char* devirtualized = m_Devirtualized ? " DEVIRT" : "";
412+
const char* guarded = m_Guarded ? " GUARDED" : "";
413+
const char* unboxed = m_Unboxed ? " UNBOXED" : "";
405414

406-
if (m_Offset == BAD_IL_OFFSET)
415+
if (verbose)
407416
{
408-
printf("%*s[%u IL=???? TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal, m_TreeID, calleeToken,
409-
inlineResult, inlineTarget, inlineReason, guarded, devirtualized, unboxed, calleeName);
417+
if (m_Offset == BAD_IL_OFFSET)
418+
{
419+
printf("%*s[%u IL=???? TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal, m_TreeID,
420+
calleeToken, inlineResult, inlineTarget, inlineReason, guarded, devirtualized, unboxed,
421+
calleeName);
422+
}
423+
else
424+
{
425+
printf("%*s[%u IL=%04d TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal,
426+
jitGetILoffs(m_Offset), m_TreeID, calleeToken, inlineResult, inlineTarget, inlineReason, guarded,
427+
devirtualized, unboxed, calleeName);
428+
}
410429
}
411430
else
412431
{
413-
IL_OFFSET offset = jitGetILoffs(m_Offset);
414-
printf("%*s[%u IL=%04d TR=%06u %08X] [%s%s: %s%s%s%s] %s\n", indent, "", m_Ordinal, offset, m_TreeID,
415-
calleeToken, inlineResult, inlineTarget, inlineReason, guarded, devirtualized, unboxed, calleeName);
432+
printf("%*s[%s%s%s%s%s] %s\n", indent, "", inlineResult, inlineReason, guarded, devirtualized, unboxed,
433+
calleeName);
416434
}
417435
}
418436

419437
// Recurse to first child
420438
if (m_Child != nullptr)
421439
{
422-
m_Child->Dump(indent + 2);
440+
m_Child->Dump(verbose, indent + 2);
423441
}
424442
}
425443

@@ -763,21 +781,7 @@ void InlineResult::Report()
763781

764782
if ((m_Callee != nullptr) && (obs != InlineObservation::CALLEE_IS_NOINLINE))
765783
{
766-
767-
#ifdef DEBUG
768-
769-
const char* obsString = InlGetObservationString(obs);
770-
771-
if (VERBOSE)
772-
{
773-
JITDUMP("\nINLINER: Marking %s as NOINLINE because of %s\n", callee, obsString);
774-
}
775-
else if (m_RootCompiler->fgPrintInlinedMethods)
776-
{
777-
printf("Marking %s as NOINLINE because of %s\n", callee, obsString);
778-
}
779-
780-
#endif // DEBUG
784+
JITDUMP("\nINLINER: Marking %s as NOINLINE because of %s\n", callee, InlGetObservationString(obs));
781785

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

1366-
void InlineStrategy::Dump(bool showBudget)
1370+
void InlineStrategy::Dump(bool verbose)
13671371
{
1368-
m_RootContext->Dump();
1372+
m_RootContext->Dump(verbose);
13691373

1370-
if (!showBudget)
1374+
if (!verbose)
13711375
{
13721376
return;
13731377
}

src/coreclr/jit/inline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ class InlineContext
695695
#if defined(DEBUG) || defined(INLINE_DATA)
696696

697697
// Dump the full subtree, including failures
698-
void Dump(unsigned indent = 0);
698+
void Dump(bool verbose, unsigned indent = 0);
699699

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

925925
// Dump textual description of inlines done so far.
926-
void Dump(bool showBudget);
926+
void Dump(bool verbose);
927927

928928
// Dump data-format description of inlines done so far.
929929
void DumpData();

src/coreclr/jit/jitconfigvalues.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@ CONFIG_INTEGER(JitQueryCurrentStaticFieldClass, W("JitQueryCurrentStaticFieldCla
125125
CONFIG_INTEGER(JitReportFastTailCallDecisions, W("JitReportFastTailCallDecisions"), 0)
126126
CONFIG_INTEGER(JitPInvokeCheckEnabled, W("JITPInvokeCheckEnabled"), 0)
127127
CONFIG_INTEGER(JitPInvokeEnabled, W("JITPInvokeEnabled"), 1)
128+
129+
// Controls verbosity for JitPrintInlinedMethods. Ignored for JitDump/NgenDump where
130+
// it's always set.
131+
CONFIG_INTEGER(JitPrintInlinedMethodsVerbose, W("JitPrintInlinedMethodsVerboseLevel"), 0)
132+
// Prints a tree of inlinees for a specific method (use '*' for all methods)
128133
CONFIG_METHODSET(JitPrintInlinedMethods, W("JitPrintInlinedMethods"))
134+
129135
CONFIG_METHODSET(JitPrintDevirtualizedMethods, W("JitPrintDevirtualizedMethods"))
130136
CONFIG_INTEGER(JitProfileChecks, W("JitProfileChecks"), 0) // 1 enable in dumps, 2 assert if issues found
131137
CONFIG_INTEGER(JitRequired, W("JITRequired"), -1)

0 commit comments

Comments
 (0)