diff options
author | Andy Ayers <andya@microsoft.com> | 2016-11-17 10:52:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-17 10:52:06 -0800 |
commit | db81622ed195624591e2151c4f2a009ddffef29e (patch) | |
tree | 90ebcd082bb792cc88ceb61f16a7981c232657b7 /src/jit/inlinepolicy.h | |
parent | ae29fa880afb6a0043941800c2b29b2a1024d137 (diff) | |
download | coreclr-db81622ed195624591e2151c4f2a009ddffef29e.tar.gz coreclr-db81622ed195624591e2151c4f2a009ddffef29e.tar.bz2 coreclr-db81622ed195624591e2151c4f2a009ddffef29e.zip |
Inliner: updates to RandomPolicy (#8128)
Fix issues with RandomPolicy setup in release builds with -DINLINE_DATA.
Reparent RandomPolicy on top of DiscretionaryPolicy to enable inline
data dumps from random inline runs. Remove some now-unneeded overrides.
Add a full dump mode to JitInlineDumpData that reports the inliner-visible
data for all inlines, as opposed to inliner-visible and post-inline
data for just the most recent inline. Small mods to the dumper code to
adjust comma placement for this new mode.
Have the RandomPolicy make the full set of profitability observations
for each accepted inline so they can be dumped.
Diffstat (limited to 'src/jit/inlinepolicy.h')
-rw-r--r-- | src/jit/inlinepolicy.h | 84 |
1 files changed, 29 insertions, 55 deletions
diff --git a/src/jit/inlinepolicy.h b/src/jit/inlinepolicy.h index c010a98eec..3239dcbe89 100644 --- a/src/jit/inlinepolicy.h +++ b/src/jit/inlinepolicy.h @@ -198,57 +198,6 @@ protected: bool m_IsNoReturnKnown : 1; }; -#if defined(DEBUG) || defined(INLINE_DATA) - -// 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); - - // 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 // defined(DEBUG) || defined(INLINE_DATA) - // 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 @@ -269,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; @@ -386,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. // |