src/hotspot/share/runtime/tieredThresholdPolicy.cpp
changeset 54647 c0d9bc9b4e1f
parent 54015 cd701366fcf8
child 54669 ad45b3802d4e
--- a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Fri Mar 08 18:21:52 2019 -0800
+++ b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Wed Apr 24 09:10:45 2019 -0700
@@ -91,6 +91,21 @@
   return false;
 }
 
+bool TieredThresholdPolicy::should_compile_at_level_simple(Method* method) {
+  if (TieredThresholdPolicy::is_trivial(method)) {
+    return true;
+  }
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    AbstractCompiler* comp = CompileBroker::compiler(CompLevel_full_optimization);
+    if (comp != NULL && comp->is_jvmci() && ((JVMCICompiler*) comp)->force_comp_at_level_simple(method)) {
+      return true;
+    }
+  }
+#endif
+  return false;
+}
+
 CompLevel TieredThresholdPolicy::comp_level(Method* method) {
   CompiledMethod *nm = method->code();
   if (nm != NULL && nm->is_in_use()) {
@@ -613,7 +628,7 @@
 
 // Determine is a method is mature.
 bool TieredThresholdPolicy::is_mature(Method* method) {
-  if (is_trivial(method)) return true;
+  if (should_compile_at_level_simple(method)) return true;
   MethodData* mdo = method->method_data();
   if (mdo != NULL) {
     int i = mdo->invocation_count();
@@ -709,7 +724,7 @@
   int i = method->invocation_count();
   int b = method->backedge_count();
 
-  if (is_trivial(method)) {
+  if (should_compile_at_level_simple(method)) {
     next_level = CompLevel_simple;
   } else {
     switch(cur_level) {
@@ -825,11 +840,6 @@
   } else {
     next_level = MAX2(osr_level, next_level);
   }
-#if INCLUDE_JVMCI
-  if (UseJVMCICompiler) {
-    next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);
-  }
-#endif
   return next_level;
 }
 
@@ -844,11 +854,6 @@
       return osr_level;
     }
   }
-#if INCLUDE_JVMCI
-  if (UseJVMCICompiler) {
-    next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);
-  }
-#endif
   return next_level;
 }