summaryrefslogtreecommitdiff
path: root/src/jit/inlinepolicy.cpp
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-06-28 15:07:01 -0700
committerAndy Ayers <andya@microsoft.com>2016-06-30 13:40:50 -0700
commit73ec3f5e0a240d3c9bd56f4159c94ca06d3c5392 (patch)
tree091520875aff700e1567a2926e38a0b4b1727580 /src/jit/inlinepolicy.cpp
parent2364d603e7d1357ccc4da6b0761a5a2575511297 (diff)
downloadcoreclr-73ec3f5e0a240d3c9bd56f4159c94ca06d3c5392.tar.gz
coreclr-73ec3f5e0a240d3c9bd56f4159c94ca06d3c5392.tar.bz2
coreclr-73ec3f5e0a240d3c9bd56f4159c94ca06d3c5392.zip
Inliner: make ModelPolicy available in release builds
Make the ModelPolicy available in release builds of the jit. Enable this policy by setting: COMPLUS_JitInlinePolicyModel=1 This works for either jitting or prejitting. Update the ModelPolicy so callee never inline decisions are always propagated back to the runtime.
Diffstat (limited to 'src/jit/inlinepolicy.cpp')
-rw-r--r--src/jit/inlinepolicy.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/jit/inlinepolicy.cpp b/src/jit/inlinepolicy.cpp
index 209a18a402..30ec8f593d 100644
--- a/src/jit/inlinepolicy.cpp
+++ b/src/jit/inlinepolicy.cpp
@@ -67,14 +67,6 @@ InlinePolicy* InlinePolicy::GetPolicy(Compiler* compiler, bool isPrejitRoot)
return new (compiler, CMK_Inlining) FullPolicy(compiler, isPrejitRoot);
}
- // Optionally install the ModelPolicy.
- bool useModelPolicy = JitConfig.JitInlinePolicyModel() != 0;
-
- if (useModelPolicy)
- {
- return new (compiler, CMK_Inlining) ModelPolicy(compiler, isPrejitRoot);
- }
-
// Optionally install the DiscretionaryPolicy.
bool useDiscretionaryPolicy = JitConfig.JitInlinePolicyDiscretionary() != 0;
@@ -85,8 +77,19 @@ InlinePolicy* InlinePolicy::GetPolicy(Compiler* compiler, bool isPrejitRoot)
#endif // defined(DEBUG) || defined(INLINE_DATA)
- // Use the legacy policy
- InlinePolicy* policy = new (compiler, CMK_Inlining) LegacyPolicy(compiler, isPrejitRoot);
+ InlinePolicy* policy = nullptr;
+ bool useModelPolicy = JitConfig.JitInlinePolicyModel() != 0;
+
+ if (useModelPolicy)
+ {
+ // Optionally install the ModelPolicy.
+ policy = new (compiler, CMK_Inlining) ModelPolicy(compiler, isPrejitRoot);
+ }
+ else
+ {
+ // Use the legacy policy
+ policy = new (compiler, CMK_Inlining) LegacyPolicy(compiler, isPrejitRoot);
+ }
return policy;
}
@@ -1087,8 +1090,6 @@ void RandomPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo)
#endif // DEBUG
-#if defined(DEBUG) || defined(INLINE_DATA)
-
#ifdef _MSC_VER
// Disable warning about new array member initialization behavior
#pragma warning( disable : 4351 )
@@ -1521,6 +1522,9 @@ bool DiscretionaryPolicy::PropagateNeverToRuntime() const
void DiscretionaryPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo)
{
+
+#if defined(DEBUG)
+
// Punt if we're inlining and we've reached the acceptance limit.
int limit = JitConfig.JitInlineLimit();
unsigned current = m_RootCompiler->m_inlineStrategy->GetInlineCount();
@@ -1533,6 +1537,8 @@ void DiscretionaryPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo
return;
}
+#endif // defined(DEBUG)
+
// Make additional observations based on the method info
MethodInfoObservations(methodInfo);
@@ -1740,6 +1746,8 @@ int DiscretionaryPolicy::CodeSizeEstimate()
return m_ModelCodeSizeEstimate;
}
+#if defined(DEBUG) || defined(INLINE_DATA)
+
//------------------------------------------------------------------------
// DumpSchema: dump names for all the supporting data for the
// inline decision in CSV format.
@@ -1890,6 +1898,8 @@ void DiscretionaryPolicy::DumpData(FILE* file) const
fprintf(file, ",%d", m_PerCallInstructionEstimate);
}
+#endif // defined(DEBUG) || defined(INLINE_DATA)
+
//------------------------------------------------------------------------/
// ModelPolicy: construct a new ModelPolicy
//
@@ -2025,6 +2035,8 @@ void ModelPolicy::DetermineProfitability(CORINFO_METHOD_INFO* methodInfo)
}
}
+#if defined(DEBUG) || defined(INLINE_DATA)
+
//------------------------------------------------------------------------/
// FullPolicy: construct a new FullPolicy
//