summaryrefslogtreecommitdiff
path: root/src/jit/inlinepolicy.h
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-03-16 16:02:54 -0700
committerAndy Ayers <andya@microsoft.com>2016-03-16 17:55:02 -0700
commit548582b31d9e627dcb252bce2914002bdd5ebe6c (patch)
treea147f22ede21d6a9a55004ff2b6612f48b621ce1 /src/jit/inlinepolicy.h
parent8258a31961abbf37a157c6374f4e0ebd59f0c686 (diff)
downloadcoreclr-548582b31d9e627dcb252bce2914002bdd5ebe6c.tar.gz
coreclr-548582b31d9e627dcb252bce2914002bdd5ebe6c.tar.bz2
coreclr-548582b31d9e627dcb252bce2914002bdd5ebe6c.zip
Inliner: create DiscretionaryPolicy
The `DiscretionaryPolicy` is similar to the `LegacyPolicy`, but does not use size limits. So there is no "always" inline class and no "too big to inline" class. Also, discretionary failures do not trigger noinline stamping. It is installed if `JitInlinePolicyDiscretionary` is set nonzero. See #3775 for some background on where this new policy will be used. This is a first cut and further refinement is likely. Also removed the unused `NoteDouble` methods since the double-valued observations now are kept internally within `LegacyPolicy` and it's not very likely we'll introduce new cases where doubles are needed.
Diffstat (limited to 'src/jit/inlinepolicy.h')
-rw-r--r--src/jit/inlinepolicy.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/jit/inlinepolicy.h b/src/jit/inlinepolicy.h
index cf26b3f084..8d3472202c 100644
--- a/src/jit/inlinepolicy.h
+++ b/src/jit/inlinepolicy.h
@@ -10,6 +10,8 @@
// -- CLASSES --
//
// LegacyPolicy - policy to provide legacy inline behavior
+// RandomPolicy - randomized inlining
+// DiscretionaryPolicy - legacy variant with uniform size policy
#ifndef _INLINE_POLICY_H_
#define _INLINE_POLICY_H_
@@ -63,7 +65,6 @@ public:
void NoteBool(InlineObservation obs, bool value) override;
void NoteFatal(InlineObservation obs) override;
void NoteInt(InlineObservation obs, int value) override;
- void NoteDouble(InlineObservation obs, double value) override;
// Policy determinations
void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override;
@@ -75,7 +76,7 @@ public:
const char* GetName() const override { return "LegacyPolicy"; }
#endif
-private:
+protected:
// Helper methods
void NoteInternal(InlineObservation obs);
@@ -123,7 +124,6 @@ public:
void NoteBool(InlineObservation obs, bool value) override;
void NoteFatal(InlineObservation obs) override;
void NoteInt(InlineObservation obs, int value) override;
- void NoteDouble(InlineObservation obs, double value) override;
// Policy determinations
void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override;
@@ -149,6 +149,29 @@ private:
bool m_IsForceInlineKnown :1;
};
+// 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"
+// inline bit.
+//
+// It is useful for gathering data about inline costs.
+
+class DiscretionaryPolicy : public LegacyPolicy
+{
+public:
+
+ // Construct a DiscretionaryPolicy
+ DiscretionaryPolicy(Compiler* compiler, bool isPrejitRoot);
+
+ // Policy observations
+ void NoteInt(InlineObservation obs, int value) override;
+
+ // Policy policies
+ bool PropagateNeverToRuntime() const override;
+
+ const char* GetName() const override { return "DiscretionaryPolicy"; }
+};
+
#endif // DEBUG
#endif // _INLINE_POLICY_H_