diff src/share/vm/compiler/compileBroker.cpp @ 23303:633cf7bea01d

thread waiting for blocking JVMCI compilation should not wait on compiler queue forever (JDK-8148507) [part 2]
author Doug Simon <doug.simon@oracle.com>
date Thu, 04 Feb 2016 19:18:52 +0100
parents 90f7b4c21cfb
children 3ef45d0a6d77
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Feb 04 15:21:43 2016 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Thu Feb 04 19:18:52 2016 +0100
@@ -50,7 +50,6 @@
 #include "c1/c1_Compiler.hpp"
 #endif
 #if INCLUDE_JVMCI
-#include "jvmci/jvmciCompiler.hpp"
 #include "jvmci/jvmciJavaClasses.hpp"
 #ifdef COMPILERJVMCI
 #include "jvmci/jvmciRuntime.hpp"
@@ -1741,12 +1740,10 @@
  *
  * @return true if this thread needs to free/recycle the task
  */
-bool CompileBroker::wait_for_jvmci_completion(AbstractCompiler* comp, CompileTask* task, JavaThread* thread) {
+bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask* task, JavaThread* thread) {
   MutexLocker waiter(task->lock(), thread);
-  assert(comp->is_jvmci(), "must be");
-  JVMCICompiler* jvmci = (JVMCICompiler*) comp;
   int progress_wait_attempts = 0;
-  int methods_compiled = jvmci->approx_num_methods_compiled();
+  int methods_compiled = jvmci->methods_compiled();
   while (!task->is_complete() && !is_compilation_disabled_forever() &&
          task->lock()->wait(!Mutex::_no_safepoint_check_flag, JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
     CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
@@ -1760,7 +1757,7 @@
       // that all JVMCI compiler threads are blocked on. We use the counter for
       // successful JVMCI compilations to determine whether JVMCI compilation
       // is still making progress through the JVMCI compiler queue.
-      progress = jvmci->approx_num_methods_compiled() != methods_compiled;
+      progress = jvmci->methods_compiled() != methods_compiled;
     }
 
     if (!progress) {
@@ -1773,7 +1770,7 @@
     } else {
       progress_wait_attempts = 0;
       if (jvmci_compiler_thread == NULL) {
-        methods_compiled = jvmci->approx_num_methods_compiled();
+        methods_compiled = jvmci->methods_compiled();
       }
     }
   }
@@ -1801,7 +1798,7 @@
 #ifdef COMPILERJVMCI
   AbstractCompiler* comp = compiler(task->comp_level());
   if (comp->is_jvmci()) {
-    free_task = wait_for_jvmci_completion(comp, task, thread);
+    free_task = wait_for_jvmci_completion((JVMCICompiler*) comp, task, thread);
   } else
 #endif
   {