diff options
author | Andy Ayers <andya@microsoft.com> | 2016-02-16 14:28:08 -0800 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2016-02-17 10:36:28 -0800 |
commit | 241860f7578fd6f064807a5477dec212b5e35941 (patch) | |
tree | 44a783138d07710c2d5568b412a67d4fa30a5639 /src/jit/inline.cpp | |
parent | 89c4544c2e9849abc09f1d2ec0ca2b1276234da3 (diff) | |
download | coreclr-241860f7578fd6f064807a5477dec212b5e35941.tar.gz coreclr-241860f7578fd6f064807a5477dec212b5e35941.tar.bz2 coreclr-241860f7578fd6f064807a5477dec212b5e35941.zip |
Inline refactoring: header cleanup and some renaming
Move inlining classes and related bits of code into inline.h.
Rename `JitInlineResult` to `InlineResult` and `InlInlineHints` to
`InlineHints`.
Diffstat (limited to 'src/jit/inline.cpp')
-rw-r--r-- | src/jit/inline.cpp | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/jit/inline.cpp b/src/jit/inline.cpp index bb9cd916c7..c562500ee8 100644 --- a/src/jit/inline.cpp +++ b/src/jit/inline.cpp @@ -9,7 +9,7 @@ // Lookup table for inline description strings -static const char* InlineDescriptions[] = +static const char* InlineDescriptions[] = { #define INLINE_OBSERVATION(name, type, description, impact, target) description, #include "inline.def" @@ -95,7 +95,7 @@ InlineTarget inlGetTarget(InlineObservation obs) const char* inlGetTargetstring(InlineObservation obs) { InlineTarget t = inlGetTarget(obs); - switch (t) + switch (t) { case InlineTarget::CALLER: return "caller"; @@ -135,7 +135,7 @@ InlineImpact inlGetImpact(InlineObservation obs) const char* inlGetImpactString(InlineObservation obs) { InlineImpact i = inlGetImpact(obs); - switch (i) + switch (i) { case InlineImpact::FATAL: return "correctness -- fatal"; @@ -152,3 +152,48 @@ const char* inlGetImpactString(InlineObservation obs) } } +//------------------------------------------------------------------------ +// report: Dump, log, and report information about an inline decision. +// +// Notes: +// +// Called (automatically via the InlineResult dtor) when the inliner +// is done evaluating a candidate. +// +// Dumps state of the inline candidate, and if a decision was reached +// sends it to the log and reports the decision back to the EE. +// +// All this can be suppressed if desired by calling setReported() before +// the InlineResult goes out of scope. + +void InlineResult::report() +{ + // User may have suppressed reporting via setReported(). If so, do nothing. + if (inlReported) + { + return; + } + + inlReported = true; + +#ifdef DEBUG + + if (VERBOSE) + { + const char* format = "INLINER: during '%s' result '%s' reason '%s' for '%s' calling '%s'\n"; + const char* caller = (inlInliner == nullptr) ? "n/a" : inlCompiler->eeGetMethodFullName(inlInliner); + const char* callee = (inlInlinee == nullptr) ? "n/a" : inlCompiler->eeGetMethodFullName(inlInlinee); + + JITDUMP(format, inlContext, resultString(), inlReason, caller, callee); + } + +#endif // DEBUG + + if (isDecided()) + { + const char* format = "INLINER: during '%s' result '%s' reason '%s'\n"; + JITLOG_THIS(inlCompiler, (LL_INFO100000, format, inlContext, resultString(), inlReason)); + COMP_HANDLE comp = inlCompiler->info.compCompHnd; + comp->reportInliningDecision(inlInliner, inlInlinee, result(), inlReason); + } +} |