diff options
author | Andy Ayers <andya@microsoft.com> | 2016-05-10 14:19:41 -0700 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2016-05-12 16:39:41 -0700 |
commit | 8861f53c06e0cfc9c54f3e067d4c377631736c5b (patch) | |
tree | 33c33fbeaee36b8240e6b9f4390491c5299efe2c /src/jit/inline.h | |
parent | 72b1ea011f28c1897fa2a668f0676a075bdb6b6e (diff) | |
download | coreclr-8861f53c06e0cfc9c54f3e067d4c377631736c5b.tar.gz coreclr-8861f53c06e0cfc9c54f3e067d4c377631736c5b.tar.bz2 coreclr-8861f53c06e0cfc9c54f3e067d4c377631736c5b.zip |
Inliner: introduce ReplayPolicy
The ReplayPolicy reads an external script to determine which inlines
to perform. The script is the same Xml syntax that's produced by
the inliner when JitInlineDumpXml is enabled. This format can be edited
by hand or tool to force particular inlining patterns to occur. Methods
or calls sites not mentioned in the script are considered as noinline.
There's a bunch of work still left to make this fully robust, but in
testing it works well enough for my immediate use case that I'll hold
off on further polish until it's needed. But, for future reference,
here's a laundry list:
* Need better ways to identify methods. Token and hash are not enough.
* Need better ways to identify call sites. Callee token is not enough.
* Consider preparsing or mapping the script into memory.
* Consider caching node positions in the InlineContexts.
* Make it robust for multithreading.
* Handle the prejit root case somehow.
* Possibly allow overriding of inline attributes.
Diffstat (limited to 'src/jit/inline.h')
-rw-r--r-- | src/jit/inline.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/jit/inline.h b/src/jit/inline.h index 19c3e2d09a..cac0fc8145 100644 --- a/src/jit/inline.h +++ b/src/jit/inline.h @@ -218,7 +218,7 @@ class InlinePolicy public: // Factory method for getting policies - static InlinePolicy* GetPolicy(Compiler* compiler, bool isPrejitRoot); + static InlinePolicy* GetPolicy(Compiler* compiler, InlineContext* context, bool isPrejitRoot); // Obligatory virtual dtor virtual ~InlinePolicy() {} @@ -289,13 +289,14 @@ public: // particular call for inlining. InlineResult(Compiler* compiler, GenTreeCall* call, - const char* context); + InlineContext* inlineContext, + const char* description); // Construct a new InlineResult to evaluate a particular // method to see if it is inlineable. InlineResult(Compiler* compiler, CORINFO_METHOD_HANDLE method, - const char* context); + const char* description); // Has the policy determined this inline should fail? bool IsFailure() const @@ -442,6 +443,12 @@ public: m_Reported = true; } + // Get the InlineContext for this inline + InlineContext* GetInlineContext() const + { + return m_InlineContext; + } + private: // No copying or assignment allowed. @@ -454,9 +461,10 @@ private: Compiler* m_RootCompiler; InlinePolicy* m_Policy; GenTreeCall* m_Call; + InlineContext* m_InlineContext; CORINFO_METHOD_HANDLE m_Caller; // immediate caller's handle CORINFO_METHOD_HANDLE m_Callee; - const char* m_Context; + const char* m_Description; bool m_Reported; }; @@ -570,6 +578,12 @@ public: // Dump full subtree in xml format void DumpXml(FILE* file = stderr, unsigned indent = 0); + // Get callee handle + CORINFO_METHOD_HANDLE GetCallee() const + { + return m_Callee; + } + #endif // defined(DEBUG) || defined(INLINE_DATA) // Get the parent context for this context. @@ -591,7 +605,7 @@ public: } // Get the observation that supported or disqualified this inline. - InlineObservation GetObservation() + InlineObservation GetObservation() const { return m_Observation; } @@ -608,6 +622,12 @@ public: return m_CodeSizeEstimate; } + // True if this is the root context + bool IsRoot() const + { + return m_Parent == nullptr; + } + private: InlineContext(InlineStrategy* strategy); |