summaryrefslogtreecommitdiff
path: root/src/jit/inlinepolicy.cpp
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-11-01 16:22:10 -0700
committerAndy Ayers <andya@microsoft.com>2016-11-03 00:41:02 -0700
commitaf4464a5b0c9a117d53fea16badeb7ca32f92d75 (patch)
tree44268c394c74a061211267da7e061932f2041dc4 /src/jit/inlinepolicy.cpp
parent8a05dcd07441b8779ec5b9eff9bdcb90f24fcb8e (diff)
downloadcoreclr-af4464a5b0c9a117d53fea16badeb7ca32f92d75.tar.gz
coreclr-af4464a5b0c9a117d53fea16badeb7ca32f92d75.tar.bz2
coreclr-af4464a5b0c9a117d53fea16badeb7ca32f92d75.zip
Inliner: capture new observations
Rebase the DiscretionaryPolicy on the EnhancedLegacyPolicy, and capture and report some of the new observations that have been added recently. This change adds a new HAS_GC_STRUCT observation in addition to the more specific RARE_GC_STRUCT, so that the DiscretionaryPolicy can be notified of GC struct locals and temps for all candidates, not just ones invoked from rare call sites. No changes in codegen.
Diffstat (limited to 'src/jit/inlinepolicy.cpp')
-rw-r--r--src/jit/inlinepolicy.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/jit/inlinepolicy.cpp b/src/jit/inlinepolicy.cpp
index 94a619815e..ff584d0e46 100644
--- a/src/jit/inlinepolicy.cpp
+++ b/src/jit/inlinepolicy.cpp
@@ -1210,7 +1210,7 @@ void RandomPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo)
// clang-format off
DiscretionaryPolicy::DiscretionaryPolicy(Compiler* compiler, bool isPrejitRoot)
- : LegacyPolicy(compiler, isPrejitRoot)
+ : EnhancedLegacyPolicy(compiler, isPrejitRoot)
, m_Depth(0)
, m_BlockCount(0)
, m_Maxstack(0)
@@ -1256,6 +1256,7 @@ DiscretionaryPolicy::DiscretionaryPolicy(Compiler* compiler, bool isPrejitRoot)
, m_IsSameThis(false)
, m_CallerHasNewArray(false)
, m_CallerHasNewObj(false)
+ , m_CalleeHasGCStruct(false)
{
// Empty
}
@@ -1307,8 +1308,17 @@ void DiscretionaryPolicy::NoteBool(InlineObservation obs, bool value)
m_CallerHasNewObj = value;
break;
+ case InlineObservation::CALLEE_HAS_GC_STRUCT:
+ m_CalleeHasGCStruct = value;
+ break;
+
+ case InlineObservation::CALLSITE_RARE_GC_STRUCT:
+ // This is redundant since this policy tracks call site
+ // hotness for all candidates. So ignore.
+ break;
+
default:
- LegacyPolicy::NoteBool(obs, value);
+ EnhancedLegacyPolicy::NoteBool(obs, value);
break;
}
}
@@ -1352,7 +1362,7 @@ void DiscretionaryPolicy::NoteInt(InlineObservation obs, int value)
// on similarity of impact on codegen.
OPCODE opcode = static_cast<OPCODE>(value);
ComputeOpcodeBin(opcode);
- LegacyPolicy::NoteInt(obs, value);
+ EnhancedLegacyPolicy::NoteInt(obs, value);
break;
}
@@ -1373,8 +1383,8 @@ void DiscretionaryPolicy::NoteInt(InlineObservation obs, int value)
break;
default:
- // Delegate remainder to the LegacyPolicy.
- LegacyPolicy::NoteInt(obs, value);
+ // Delegate remainder to the super class.
+ EnhancedLegacyPolicy::NoteInt(obs, value);
break;
}
}
@@ -1689,8 +1699,8 @@ void DiscretionaryPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo
// model for actual inlining.
EstimatePerformanceImpact();
- // Delegate to LegacyPolicy for the rest
- LegacyPolicy::DetermineProfitability(methodInfo);
+ // Delegate to super class for the rest
+ EnhancedLegacyPolicy::DetermineProfitability(methodInfo);
}
//------------------------------------------------------------------------
@@ -1967,6 +1977,8 @@ void DiscretionaryPolicy::DumpSchema(FILE* file) const
fprintf(file, ",IsSameThis");
fprintf(file, ",CallerHasNewArray");
fprintf(file, ",CallerHasNewObj");
+ fprintf(file, ",CalleeDoesNotReturn");
+ fprintf(file, ",CalleeHasGCStruct");
}
//------------------------------------------------------------------------
@@ -2047,6 +2059,8 @@ void DiscretionaryPolicy::DumpData(FILE* file) const
fprintf(file, ",%u", m_IsSameThis ? 1 : 0);
fprintf(file, ",%u", m_CallerHasNewArray ? 1 : 0);
fprintf(file, ",%u", m_CallerHasNewObj ? 1 : 0);
+ fprintf(file, ",%u", m_IsNoReturn ? 1 : 0);
+ fprintf(file, ",%u", m_CalleeHasGCStruct ? 1 : 0);
}
#endif // defined(DEBUG) || defined(INLINE_DATA)