summaryrefslogtreecommitdiff
path: root/src/vm/method.hpp
diff options
context:
space:
mode:
authornoahfalk <noahfalk@microsoft.com>2017-03-24 22:43:47 -0700
committernoahfalk <noahfalk@microsoft.com>2017-03-29 19:09:24 -0700
commit850164ee70077e0970d7ab4e4bf2ca51809b92e8 (patch)
treef9262fab3e2540b7b920bb54dd0d7cc8288b3e05 /src/vm/method.hpp
parente3eecaa56ec08d47941bc7191656a7559ac8b3c0 (diff)
downloadcoreclr-850164ee70077e0970d7ab4e4bf2ca51809b92e8.tar.gz
coreclr-850164ee70077e0970d7ab4e4bf2ca51809b92e8.tar.bz2
coreclr-850164ee70077e0970d7ab4e4bf2ca51809b92e8.zip
Tiered Compilation step 1
Tiered compilation is a new feature we are experimenting with that aims to improve startup times. Initially we jit methods non-optimized, then switch to an optimized version once the method has been called a number of times. More details about the current feature operation are in the comments of TieredCompilation.cpp. This is only the first step in a longer process building the feature. The primary goal for now is to avoid regressing any runtime behavior in the shipping configuration in which the complus variable is OFF, while putting enough code in place that we can measure performance in the daily builds and make incremental progress visible to collaborators and reviewers. The design of the TieredCompilationManager is likely to change substantively, and the call counter may also change.
Diffstat (limited to 'src/vm/method.hpp')
-rw-r--r--src/vm/method.hpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/vm/method.hpp b/src/vm/method.hpp
index bbcb012d54..9545da2248 100644
--- a/src/vm/method.hpp
+++ b/src/vm/method.hpp
@@ -1290,6 +1290,58 @@ public:
public:
+#ifdef FEATURE_TIERED_COMPILATION
+ // Is this method allowed to be recompiled and the entrypoint redirected so that we
+ // can optimize its performance? Eligibility is invariant for the lifetime of a method.
+ BOOL IsEligibleForTieredCompilation()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ // This policy will need to change some more before tiered compilation feature
+ // can be properly supported across a broad range of scenarios. For instance it
+ // wouldn't interact correctly debugging or profiling at the moment because we
+ // enable it too aggresively and it conflicts with the operations of those features.
+
+ //Keep in-sync with MethodTableBuilder::NeedsNativeCodeSlot(bmtMDMethod * pMDMethod)
+ //In the future we might want mutable vtable slots too, but that would require
+ //more work around the runtime to prevent those mutable pointers from leaking
+ return g_pConfig->TieredCompilation() &&
+ !GetModule()->HasNativeOrReadyToRunImage() &&
+ !IsEnCMethod() &&
+ HasNativeCodeSlot();
+
+ }
+#endif
+
+ // Does this method force the NativeCodeSlot to stay fixed after it
+ // is first initialized to native code? Consumers of the native code
+ // pointer need to be very careful about if and when they cache it
+ // if it is not stable.
+ //
+ // The stability of the native code pointer is separate from the
+ // stability of the entrypoint. A stable entrypoint can be a precode
+ // which dispatches to an unstable native code pointer.
+ BOOL IsNativeCodeStableAfterInit()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return
+#ifdef FEATURE_TIERED_COMPILATION
+ !IsEligibleForTieredCompilation() &&
+#endif
+ !IsEnCMethod();
+ }
+
+ //Is this method currently pointing to native code that will never change?
+ BOOL IsPointingToStableNativeCode()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ if (!IsNativeCodeStableAfterInit())
+ return FALSE;
+
+ return IsPointingToNativeCode();
+ }
+
// Note: We are skipping the prestub based on addition information from the JIT.
// (e.g. that the call is on same this ptr or that the this ptr is not null).
// Thus we can end up with a running NGENed method for which IsPointingToNativeCode is false!