Skip to content

Commit

Permalink
JIT: fix inline policy handling of call site depth (#38399)
Browse files Browse the repository at this point in the history
In #38163 I added a depth field to one of the inline policy base classes.
A derived class already had a similar field. Unify in favor of the base class
field.

The inline policies implemented by these derived policy classes are sometimes
used during jit stress (eg for random inlining).

Fixes #38374.
  • Loading branch information
AndyAyersMS committed Jun 25, 2020
1 parent f40c6b6 commit 894e930
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/coreclr/src/jit/inlinepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,6 @@ void RandomPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo)
// clang-format off
DiscretionaryPolicy::DiscretionaryPolicy(Compiler* compiler, bool isPrejitRoot)
: DefaultPolicy(compiler, isPrejitRoot)
, m_Depth(0)
, m_BlockCount(0)
, m_Maxstack(0)
, m_ArgCount(0)
Expand Down Expand Up @@ -1272,10 +1271,6 @@ void DiscretionaryPolicy::NoteInt(InlineObservation obs, int value)
m_BlockCount = value;
break;

case InlineObservation::CALLSITE_DEPTH:
m_Depth = value;
break;

case InlineObservation::CALLSITE_WEIGHT:
m_CallSiteWeight = static_cast<unsigned>(value);
break;
Expand Down Expand Up @@ -1810,7 +1805,6 @@ void DiscretionaryPolicy::DumpSchema(FILE* file) const
fprintf(file, ",CallsiteFrequency");
fprintf(file, ",InstructionCount");
fprintf(file, ",LoadStoreCount");
fprintf(file, ",Depth");
fprintf(file, ",BlockCount");
fprintf(file, ",Maxstack");
fprintf(file, ",ArgCount");
Expand Down Expand Up @@ -1893,7 +1887,6 @@ void DiscretionaryPolicy::DumpData(FILE* file) const
fprintf(file, ",%u", m_CallsiteFrequency);
fprintf(file, ",%u", m_InstructionCount);
fprintf(file, ",%u", m_LoadStoreCount);
fprintf(file, ",%u", m_Depth);
fprintf(file, ",%u", m_BlockCount);
fprintf(file, ",%u", m_Maxstack);
fprintf(file, ",%u", m_ArgCount);
Expand Down Expand Up @@ -2034,7 +2027,7 @@ void ModelPolicy::NoteInt(InlineObservation obs, int value)
{
unsigned depthLimit = m_RootCompiler->m_inlineStrategy->GetMaxInlineDepth();

if (m_Depth > depthLimit)
if (m_CallsiteDepth > depthLimit)
{
SetFailure(InlineObservation::CALLSITE_IS_TOO_DEEP);
return;
Expand Down Expand Up @@ -2199,7 +2192,7 @@ void FullPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo)

unsigned depthLimit = m_RootCompiler->m_inlineStrategy->GetMaxInlineDepth();

if (m_Depth > depthLimit)
if (m_CallsiteDepth > depthLimit)
{
SetFailure(InlineObservation::CALLSITE_IS_TOO_DEEP);
return;
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/jit/inlinepolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ class DiscretionaryPolicy : public DefaultPolicy
MAX_ARGS = 6
};

unsigned m_Depth;
unsigned m_BlockCount;
unsigned m_Maxstack;
unsigned m_ArgCount;
Expand Down

0 comments on commit 894e930

Please sign in to comment.