diff options
author | Andy Ayers <andya@microsoft.com> | 2016-02-08 11:08:57 -0800 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2016-02-16 11:34:49 -0800 |
commit | aafcd1a1793e9d1853ef7aa1445447fa11f26a85 (patch) | |
tree | ba2417963271cab37e8ecb8ec719e797a90ce959 /src/jit/inline.h | |
parent | e031b222453b0599d9f3909fdb66787eb4d0d2ff (diff) | |
download | coreclr-aafcd1a1793e9d1853ef7aa1445447fa11f26a85.tar.gz coreclr-aafcd1a1793e9d1853ef7aa1445447fa11f26a85.tar.bz2 coreclr-aafcd1a1793e9d1853ef7aa1445447fa11f26a85.zip |
Inline refactoring: start untangling observation and policy
Create set of observations that can be made during inlining. These
are implemented as a set of static tables plus some helper methods.
Each observation has an enum name, a type, a description string,
an impact, and a target.
For now most observations are about blocking issues and are classified
as having FATAL impact. There are a handful of INFORMATIONAL and
PERFORMANCE observations but they're not widely used yet.
This change also updates the bulk of the jit code to report
observations to the JitInlineResult instead of directly requesting
changes to the JitInlineResult state. Over on the JitInlineResult side,
the current legacy policy is implemented and fails fast if any blocking
observation is made. For now, any any FATAL impact observation must be
made via `noteFatal`, and all other observations be made via `note`.
As with the previous refactorings, this change tries not to alter
any code generation. There are a few cases where observations that
are made solely about the callee are now targeted that way instead of
being targeted at callsites. For instance a method that is marked by
COMPLUS_JitNoInline will never be inlined. This can sometimes lead to
localized code diffs, since the jit creates slightly different IR for a
call to an inline candidate than a call to a non-candidate, and is not
always able to undo this later if inlining fails. However the number of
diffs should be small. Will verify diffs further before merging. There
are no inlining changes crossgenning mscorlib.
Some of the message strings associated with inlining failures have
changed. The messages use `caller` and `callee` to describe the two
methods involved, and `callsite` for the instance in question, and
deprecate `inlinee`. These message strings can be seen in the jit
dumps and logs and are reported back to the VM where they presumably
make their way into other diagnostic reporting streams.
Subsequent work will re-examine the FATAL observations and likely
reclassify a number of them to have less dramatic immediate impact.
Subsequent work will also begin extracting the policy into a separate
class to lay the groundwork for supporting alternate policies while
still being able to fall back to the legacy policy.
Diffstat (limited to 'src/jit/inline.h')
-rw-r--r-- | src/jit/inline.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/jit/inline.h b/src/jit/inline.h new file mode 100644 index 0000000000..6be3d46777 --- /dev/null +++ b/src/jit/inline.h @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#ifndef _INLINE_H_ +#define _INLINE_H_ + +// InlineDecision describes the various states the jit goes through when +// evaluating an inline candidate. It is distinct from CorInfoInline +// because it must capture internal states that don't get reported back +// to the runtime. + +enum class InlineDecision +{ + UNDECIDED, + CANDIDATE, + SUCCESS, + FAILURE, + NEVER +}; + +// Possible targets of an inline observation + +enum class InlineTarget +{ + CALLEE, // observation applies to all calls to this callee + CALLER, // observation applies to all calls made by this caller + CALLSITE // observation applies to a specific call site +}; + +// Possible impact of an inline observation + +enum class InlineImpact +{ + FATAL, // inlining impossible, unsafe to evaluate further + FUNDAMENTAL, // inlining impossible for fundamental reasons, deeper exploration safe + LIMITATION, // inlining impossible because of jit limitations, deeper exploration safe + PERFORMANCE, // inlining inadvisable because of performance concerns + INFORMATION // policy-free observation to provide data for later decision making +}; + +// The set of possible inline observations + +enum class InlineObservation +{ +#define INLINE_OBSERVATION(name, type, description, impact, scope) scope ## _ ## name, +#include "inline.def" +#undef INLINE_OBSERVATION +}; + +// Get a string describing this observation + +const char* inlGetDescriptionString(InlineObservation obs); + +// Get a string describing the target of this observation + +const char* inlGetTargetString(InlineObservation obs); + +// Get a string describing the impact of this observation + +const char* inlGetImpactString(InlineObservation obs); + +// Get the target of this observation + +InlineTarget inlGetTarget(InlineObservation obs); + +// Get the impact of this observation + +InlineImpact inlGetImpact(InlineObservation obs); + +#endif // _INLINE_H_ + |