diff src/share/vm/runtime/advancedThresholdPolicy.cpp @ 22762:9d78d44d3aac

improved JVMCI support for blocking compilation (GRAAL-1387)
author Doug Simon <doug.simon@oracle.com>
date Fri, 08 Jan 2016 17:30:33 +0100
parents 569c82ebb96e
children 24505bf61633
line wrap: on
line diff
--- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed Dec 30 17:55:07 2015 +0100
+++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Fri Jan 08 17:30:33 2016 +0100
@@ -161,6 +161,9 @@
 
 // Called with the queue locked and with at least one element
 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
+#ifdef COMPILERJVMCI
+  CompileTask *max_blocking_task = NULL;
+#endif
   CompileTask *max_task = NULL;
   Method* max_method = NULL;
   jlong t = os::javaTimeMillis();
@@ -191,9 +194,28 @@
         max_method = method;
       }
     }
+#ifdef COMPILERJVMCI
+    if (task->is_blocking()) {
+      if (max_blocking_task == NULL || compare_methods(method, max_blocking_task->method())) {
+        max_blocking_task = task;
+      }
+    }
+#endif
     task = next_task;
   }
 
+#ifdef COMPILERJVMCI
+  if (max_blocking_task != NULL) {
+    // In blocking compilation mode, the CompileBroker will make
+    // compilations submitted by a JVMCI compiler thread non-blocking. These
+    // compilations should be scheduled after all blocking compilations
+    // to service non-compiler related compilations sooner and reduce the
+    // chance of such compilations timing out.
+    max_task = max_blocking_task;
+    max_method = max_task->method();
+  }
+#endif
+
   if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
       && is_method_profiled(max_method)) {
     max_task->set_comp_level(CompLevel_limited_profile);