summaryrefslogtreecommitdiff
path: root/src/jit/inlinepolicy.cpp
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-05-05 16:48:53 -0700
committerAndy Ayers <andya@microsoft.com>2016-05-05 16:48:53 -0700
commit0feeb4ff48a6f0beb614ee2e3d3604e85dfbca27 (patch)
treebc939d40adf3bd8f5d46f96805f6867edde6bd0d /src/jit/inlinepolicy.cpp
parent3ddd9c43821bf617621f87d8d1519229e7d3b789 (diff)
downloadcoreclr-0feeb4ff48a6f0beb614ee2e3d3604e85dfbca27.tar.gz
coreclr-0feeb4ff48a6f0beb614ee2e3d3604e85dfbca27.tar.bz2
coreclr-0feeb4ff48a6f0beb614ee2e3d3604e85dfbca27.zip
Inliner: add JitInlineLimit check to LegacyPolicy under debug
Adds the ability to limit the number of inlines done by the LegacyPolicy. Useful in trying to binary search for inlines that cause correctness issues. This limit impacts inlining in all methods, so effective isolation may also require use of JitNoInlineRange to hone in on the root method that is the source of problems.
Diffstat (limited to 'src/jit/inlinepolicy.cpp')
-rw-r--r--src/jit/inlinepolicy.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/jit/inlinepolicy.cpp b/src/jit/inlinepolicy.cpp
index 73e22d4530..5aade9f25c 100644
--- a/src/jit/inlinepolicy.cpp
+++ b/src/jit/inlinepolicy.cpp
@@ -736,6 +736,23 @@ int LegacyPolicy::DetermineCallsiteNativeSizeEstimate(CORINFO_METHOD_INFO* methI
void LegacyPolicy::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();
+
+ if (!m_IsPrejitRoot &&
+ (limit >= 0) &&
+ (current >= static_cast<unsigned>(limit)))
+ {
+ SetFailure(InlineObservation::CALLSITE_OVER_INLINE_LIMIT);
+ return;
+ }
+
+#endif // defined(DEBUG)
+
assert(InlDecisionIsCandidate(m_Decision));
assert(m_Observation == InlineObservation::CALLEE_IS_DISCRETIONARY_INLINE);