diff options
Diffstat (limited to 'src/jit/inlinepolicy.h')
-rw-r--r-- | src/jit/inlinepolicy.h | 98 |
1 files changed, 38 insertions, 60 deletions
diff --git a/src/jit/inlinepolicy.h b/src/jit/inlinepolicy.h index 62031c86a0..3239dcbe89 100644 --- a/src/jit/inlinepolicy.h +++ b/src/jit/inlinepolicy.h @@ -98,6 +98,7 @@ public: , m_HasSimd(false) , m_LooksLikeWrapperMethod(false) , m_MethodIsMostlyLoadStore(false) + , m_CallsiteIsInTryRegion(false) { // empty } @@ -165,6 +166,7 @@ protected: bool m_HasSimd : 1; bool m_LooksLikeWrapperMethod : 1; bool m_MethodIsMostlyLoadStore : 1; + bool m_CallsiteIsInTryRegion : 1; }; // EnhancedLegacyPolicy extends the legacy policy by rejecting @@ -196,65 +198,15 @@ protected: bool m_IsNoReturnKnown : 1; }; -#ifdef DEBUG - -// RandomPolicy implements a policy that inlines at random. -// It is mostly useful for stress testing. - -class RandomPolicy : public LegalPolicy -{ -public: - // Construct a RandomPolicy - RandomPolicy(Compiler* compiler, bool isPrejitRoot, unsigned seed); - - // Policy observations - void NoteSuccess() override; - void NoteBool(InlineObservation obs, bool value) override; - void NoteInt(InlineObservation obs, int value) override; - - // Policy determinations - void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override; - - // Policy policies - bool PropagateNeverToRuntime() const override - { - return true; - } - bool IsLegacyPolicy() const override - { - return false; - } - - // Policy estimates - int CodeSizeEstimate() override - { - return 0; - } - - const char* GetName() const override - { - return "RandomPolicy"; - } - -private: - // Data members - Compiler* m_RootCompiler; - CLRRandom* m_Random; - unsigned m_CodeSize; - bool m_IsForceInline : 1; - bool m_IsForceInlineKnown : 1; -}; - -#endif // DEBUG - -// DiscretionaryPolicy is a variant of the legacy policy. It differs -// in that there is no ALWAYS_INLINE class, there is no IL size limit, -// it does not try and maintain legacy compatabilty, and in prejit mode, -// discretionary failures do not set the "NEVER" inline bit. +// DiscretionaryPolicy is a variant of the enhanced legacy policy. It +// differs in that there is no ALWAYS_INLINE class, there is no IL +// size limit, it does not try and maintain legacy compatabilty, 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 +class DiscretionaryPolicy : public EnhancedLegacyPolicy { public: // Construct a DiscretionaryPolicy @@ -266,10 +218,6 @@ public: // Policy policies bool PropagateNeverToRuntime() const override; - bool IsLegacyPolicy() const override - { - return false; - } // Policy determinations void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override; @@ -346,6 +294,7 @@ protected: bool m_IsSameThis; bool m_CallerHasNewArray; bool m_CallerHasNewObj; + bool m_CalleeHasGCStruct; }; // ModelPolicy is an experimental policy that uses the results @@ -382,6 +331,35 @@ public: #if defined(DEBUG) || defined(INLINE_DATA) +// RandomPolicy implements a policy that inlines at random. +// It is mostly useful for stress testing. + +class RandomPolicy : public DiscretionaryPolicy +{ +public: + // Construct a RandomPolicy + RandomPolicy(Compiler* compiler, bool isPrejitRoot); + + // Policy observations + void NoteInt(InlineObservation obs, int value) override; + + // Policy determinations + void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override; + + const char* GetName() const override + { + return "RandomPolicy"; + } + +private: + // Data members + CLRRandom* m_Random; +}; + +#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. // |