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;
#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;
}
#endif // DEBUG
-#if defined(DEBUG) || defined(INLINE_DATA)
-
#ifdef _MSC_VER
// Disable warning about new array member initialization behavior
#pragma warning( disable : 4351 )
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();
return;
}
+#endif // defined(DEBUG)
+
// Make additional observations based on the method info
MethodInfoObservations(methodInfo);
return m_ModelCodeSizeEstimate;
}
+#if defined(DEBUG) || defined(INLINE_DATA)
+
//------------------------------------------------------------------------
// DumpSchema: dump names for all the supporting data for the
// inline decision in CSV format.
fprintf(file, ",%d", m_PerCallInstructionEstimate);
}
+#endif // defined(DEBUG) || defined(INLINE_DATA)
+
//------------------------------------------------------------------------/
// ModelPolicy: construct a new ModelPolicy
//
}
}
+#if defined(DEBUG) || defined(INLINE_DATA)
+
//------------------------------------------------------------------------/
// FullPolicy: construct a new FullPolicy
//
//
// LegalPolicy - partial class providing common legality checks
// LegacyPolicy - policy that provides legacy inline behavior
+// DiscretionaryPolicy - legacy variant with uniform size policy
+// ModelPolicy - policy based on statistical modelling
//
// These experimental policies are available only in
// DEBUG or release+INLINE_DATA builds of the jit.
//
// RandomPolicy - randomized inlining
-// DiscretionaryPolicy - legacy variant with uniform size policy
-// ModelPolicy - policy based on statistical modelling
// FullPolicy - inlines everything up to size and depth limits
// SizePolicy - tries not to increase method sizes
#endif // DEBUG
-#if defined(DEBUG) || defined(INLINE_DATA)
-
// DiscretionaryPolicy is a variant of the legacy policy. It differs
// in that there is no ALWAYS_INLINE class, there is no IL size limit,
// and in prejit mode, discretionary failures do not set the "NEVER"
// Policy estimates
int CodeSizeEstimate() override;
+#if defined(DEBUG) || defined(INLINE_DATA)
+
// Externalize data
void DumpData(FILE* file) const override;
void DumpSchema(FILE* file) const override;
// Miscellaneous
const char* GetName() const override { return "DiscretionaryPolicy"; }
+#endif // defined(DEBUG) || defined(INLINE_DATA)
+
+
protected:
void ComputeOpcodeBin(OPCODE opcode);
// Policy determinations
void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override;
+ // Policy policies
+ bool PropagateNeverToRuntime() const override { return true; }
+
+#if defined(DEBUG) || defined(INLINE_DATA)
+
// Miscellaneous
const char* GetName() const override { return "ModelPolicy"; }
+
+#endif // defined(DEBUG) || defined(INLINE_DATA)
+
};
+#if defined(DEBUG) || defined(INLINE_DATA)
+
// FullPolicy is an experimental policy that will always inline if
// possible, subject to externally settable depth and size limits.
//
CONFIG_INTEGER(JitInlineDumpXml, W("JitInlineDumpXml"), 0) // 1 = full xml (all methods), 2 = minimal xml (only method with inlines)
CONFIG_INTEGER(JitInlineLimit, W("JitInlineLimit"), -1)
CONFIG_INTEGER(JitInlinePolicyDiscretionary, W("JitInlinePolicyDiscretionary"), 0)
-CONFIG_INTEGER(JitInlinePolicyModel, W("JitInlinePolicyModel"), 0)
CONFIG_INTEGER(JitInlinePolicyFull, W("JitInlinePolicyFull"), 0)
CONFIG_INTEGER(JitInlinePolicySize, W("JitInlinePolicySize"), 0)
CONFIG_INTEGER(JitInlinePolicyReplay, W("JitInlinePolicyReplay"), 0)
CONFIG_STRING(JitInlineReplayFile, W("JitInlineReplayFile"))
#endif // defined(DEBUG) || defined(INLINE_DATA)
+CONFIG_INTEGER(JitInlinePolicyModel, W("JitInlinePolicyModel"), 0)
+
#undef CONFIG_INTEGER
#undef CONFIG_STRING
#undef CONFIG_METHODSET