summaryrefslogtreecommitdiff
path: root/src/jit/inlinepolicy.h
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-05-10 14:19:41 -0700
committerAndy Ayers <andya@microsoft.com>2016-05-12 16:39:41 -0700
commit8861f53c06e0cfc9c54f3e067d4c377631736c5b (patch)
tree33c33fbeaee36b8240e6b9f4390491c5299efe2c /src/jit/inlinepolicy.h
parent72b1ea011f28c1897fa2a668f0676a075bdb6b6e (diff)
downloadcoreclr-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/inlinepolicy.h')
-rw-r--r--src/jit/inlinepolicy.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/jit/inlinepolicy.h b/src/jit/inlinepolicy.h
index 31a686e52f..29e6af40c0 100644
--- a/src/jit/inlinepolicy.h
+++ b/src/jit/inlinepolicy.h
@@ -338,6 +338,35 @@ public:
const char* GetName() const override { return "SizePolicy"; }
};
+// The ReplayPolicy performs only inlines specified by an external
+// inline replay log.
+
+class ReplayPolicy : public DiscretionaryPolicy
+{
+public:
+
+ // Construct a ReplayPolicy
+ ReplayPolicy(Compiler* compiler, InlineContext* inlineContext, bool isPrejitRoot);
+
+ // Policy determinations
+ void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override;
+
+ // Miscellaneous
+ const char* GetName() const override { return "ReplayPolicy"; }
+
+ static void FinalizeXml();
+
+private:
+
+ bool FindMethod();
+ bool FindContext(InlineContext* context);
+ bool FindInline(CORINFO_METHOD_HANDLE callee);
+ bool FindInline(unsigned token);
+
+ static bool s_WroteReplayBanner;
+ static FILE* s_ReplayFile;
+ InlineContext* m_InlineContext;
+};
#endif // defined(DEBUG) || defined(INLINE_DATA)