summaryrefslogtreecommitdiff
path: root/src/jit/inline.h
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-03-07 12:23:09 -0800
committerAndy Ayers <andya@microsoft.com>2016-03-07 13:29:27 -0800
commit96783862204ea1dd91e55ef4c44179535ff68514 (patch)
treef5d8f593ead8af856a6129838a01af17c29e43da /src/jit/inline.h
parentb440fdf5e0ed03e511a9adcb9196ce324ab2e09a (diff)
downloadcoreclr-96783862204ea1dd91e55ef4c44179535ff68514.tar.gz
coreclr-96783862204ea1dd91e55ef4c44179535ff68514.tar.bz2
coreclr-96783862204ea1dd91e55ef4c44179535ff68514.zip
Inline refactoring: revise candidacy determination
Rework the code to determine the key aspects of candidacy up front rather than figuring it out eventually. In particular this ensures that the two stages of evaulation for inlines both start at the same point for candidates. This will help streamline subsequent work to move the state machine into the policy, since the state machine is only needed for the case where the candidate is a discretionary inline, and the policy now tracks this directly. For the `LegacyPolicy`, if an inline is both smaller than the always inline size and marked force inline, attribute its inlining to its small size. Remove bulk of the of the "evaluation in progress" candidate observations since they don't add much value. As a result `noteCandidate` is not needed as an external API, and can be repurposed internally as `setCandidate`. Change how the prejit root case is tracked to make it explicit from the context rather than a callback to the compiler.
Diffstat (limited to 'src/jit/inline.h')
-rw-r--r--src/jit/inline.h44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/jit/inline.h b/src/jit/inline.h
index 75367faca9..625e1ea7ed 100644
--- a/src/jit/inline.h
+++ b/src/jit/inline.h
@@ -208,7 +208,7 @@ class InlinePolicy
public:
// Factory method for getting policies
- static InlinePolicy* getPolicy(Compiler* compiler);
+ static InlinePolicy* getPolicy(Compiler* compiler, bool isPrejitRoot);
// Obligatory virtual dtor
virtual ~InlinePolicy() {}
@@ -220,9 +220,8 @@ public:
InlineObservation getObservation() const { return inlObservation; }
// Policy observations
- virtual void noteCandidate(InlineObservation obs) = 0;
virtual void noteSuccess() = 0;
- virtual void note(InlineObservation obs) = 0;
+ virtual void noteBool(InlineObservation obs, bool value) = 0;
virtual void noteFatal(InlineObservation obs) = 0;
virtual void noteInt(InlineObservation obs, int value) = 0;
virtual void noteDouble(InlineObservation obs, double value) = 0;
@@ -240,9 +239,10 @@ public:
protected:
- InlinePolicy()
+ InlinePolicy(bool isPrejitRoot)
: inlDecision(InlineDecision::UNDECIDED)
, inlObservation(InlineObservation::CALLEE_UNUSED_INITIAL)
+ , inlIsPrejitRoot(isPrejitRoot)
{
// empty
}
@@ -255,8 +255,9 @@ private:
protected:
- InlineDecision inlDecision;
+ InlineDecision inlDecision;
InlineObservation inlObservation;
+ bool inlIsPrejitRoot;
};
// InlineResult summarizes what is known about the viability of a
@@ -309,24 +310,6 @@ public:
return inlDecisionIsDecided(inlPolicy->getDecision());
}
- // noteCandidate indicates the prospective inline has passed at least
- // some of the correctness checks and is still a viable inline
- // candidate, but no decision has been made yet.
- //
- // This may be called multiple times as various tests are performed
- // and the candidate gets closer and closer to actually getting
- // inlined.
- void noteCandidate(InlineObservation obs)
- {
- assert(!isDecided());
-
- // Check the impact, it should be INFORMATION
- InlineImpact impact = inlGetImpact(obs);
- assert(impact == InlineImpact::INFORMATION);
-
- inlPolicy->noteCandidate(obs);
- }
-
// noteSuccess means the all the various checks have passed and
// the inline can happen.
void noteSuccess()
@@ -335,13 +318,24 @@ public:
inlPolicy->noteSuccess();
}
- // Make an observation, and update internal state appropriately.
+ // Make a true observation, and update internal state
+ // appropriately.
//
// Caller is expected to call isFailure after this to see whether
// more observation is desired.
void note(InlineObservation obs)
{
- inlPolicy->note(obs);
+ inlPolicy->noteBool(obs, true);
+ }
+
+ // Make a boolean observation, and update internal state
+ // appropriately.
+ //
+ // Caller is expected to call isFailure after this to see whether
+ // more observation is desired.
+ void noteBool(InlineObservation obs, bool value)
+ {
+ inlPolicy->noteBool(obs, value);
}
// Make an observation that must lead to immediate failure.