summaryrefslogtreecommitdiff
path: root/src/jit/inlinepolicy.h
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-03-04 14:16:58 -0800
committerAndy Ayers <andya@microsoft.com>2016-03-07 19:53:23 -0800
commit1876230e5098541c150f2893644fda413484426c (patch)
tree0c38d12ba66428df0e4cd51e48b9a77be8461b0a /src/jit/inlinepolicy.h
parent40b9ef6f3cc647ec0413e583b4a9e55b55b885bb (diff)
downloadcoreclr-1876230e5098541c150f2893644fda413484426c.tar.gz
coreclr-1876230e5098541c150f2893644fda413484426c.tar.bz2
coreclr-1876230e5098541c150f2893644fda413484426c.zip
Inline refactoring: move state machine into LegacyPolicy
The state machine used to estimate callee native code size is now an internal part of the LegacyPolicy. During `fgFindJumpTargets` the policy determines if the state machine is need, and if so, sets one up. `fgFindJumpTargets` then notifies the policy of the various opcodes in the method, and the policy uses this to drive the state machine forward. When the IL scan is completed, the `fgFindJumpTargets` notifies the policy, then, for the discretionary inline case, grabs the native size estimate, and uses that to evaluate inlinability. The knowledge of when inlines are "always", "forced", or "discretionary" is now encapsulated by the policy instead of being distributed in various places in the code.
Diffstat (limited to 'src/jit/inlinepolicy.h')
-rw-r--r--src/jit/inlinepolicy.h34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/jit/inlinepolicy.h b/src/jit/inlinepolicy.h
index 4f831a1e77..45faba9085 100644
--- a/src/jit/inlinepolicy.h
+++ b/src/jit/inlinepolicy.h
@@ -17,6 +17,8 @@
#include "jit.h"
#include "inline.h"
+class CodeSeqSM;
+
// LegacyPolicy implements the inlining policy used by the jit in its
// initial release.
//
@@ -39,6 +41,9 @@ public:
LegacyPolicy(Compiler* compiler, bool isPrejitRoot)
: InlinePolicy(isPrejitRoot)
, inlCompiler(compiler)
+ , inlStateMachine(nullptr)
+ , inlCodeSize(0)
+ , inlNativeSizeEstimate(NATIVE_SIZE_INVALID)
, inlIsForceInline(false)
, inlIsForceInlineKnown(false)
, inlIsInstanceCtor(false)
@@ -55,13 +60,15 @@ public:
// Policy observations
void noteSuccess() override;
- void noteFatal(InlineObservation obs) override;
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
double determineMultiplier() override;
+ int determineNativeSizeEstimate() override;
+ bool hasNativeSizeEstimate() override;
// Policy policies
bool propagateNeverToRuntime() const override { return true; }
@@ -82,17 +89,20 @@ private:
const unsigned MAX_BASIC_BLOCKS = 5;
// Data members
- Compiler* inlCompiler;
- bool inlIsForceInline :1;
- bool inlIsForceInlineKnown :1;
- bool inlIsInstanceCtor :1;
- bool inlIsFromPromotableValueClass :1;
- bool inlHasSimd :1;
- bool inlLooksLikeWrapperMethod :1;
- bool inlArgFeedsConstantTest :1;
- bool inlMethodIsMostlyLoadStore :1;
- bool inlArgFeedsRangeCheck :1;
- bool inlConstantFeedsConstantTest :1;
+ Compiler* inlCompiler;
+ CodeSeqSM* inlStateMachine;
+ unsigned inlCodeSize;
+ int inlNativeSizeEstimate;
+ bool inlIsForceInline :1;
+ bool inlIsForceInlineKnown :1;
+ bool inlIsInstanceCtor :1;
+ bool inlIsFromPromotableValueClass :1;
+ bool inlHasSimd :1;
+ bool inlLooksLikeWrapperMethod :1;
+ bool inlArgFeedsConstantTest :1;
+ bool inlMethodIsMostlyLoadStore :1;
+ bool inlArgFeedsRangeCheck :1;
+ bool inlConstantFeedsConstantTest :1;
};
#endif // _INLINE_POLICY_H_