changeset 23294:5d04cfbd1945

reduced delta against jvmci-9
author Doug Simon <doug.simon@oracle.com>
date Fri, 29 Jan 2016 21:52:36 +0100
parents 071a85b9e631
children c3ebefa1c743
files src/share/vm/compiler/compileBroker.cpp src/share/vm/compiler/compileBroker.hpp src/share/vm/runtime/thread.cpp
diffstat 3 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Jan 28 20:18:25 2016 -0800
+++ b/src/share/vm/compiler/compileBroker.cpp	Fri Jan 29 21:52:36 2016 +0100
@@ -51,6 +51,7 @@
 #endif
 #if INCLUDE_JVMCI
 #include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciJavaClasses.hpp"
 #ifdef COMPILERJVMCI
 #include "jvmci/jvmciRuntime.hpp"
 #include "runtime/vframe.hpp"
@@ -930,7 +931,7 @@
 // CompileBroker::compilation_init
 //
 // Initialize the Compilation object
-void CompileBroker::compilation_init() {
+void CompileBroker::compilation_init(TRAPS) {
   _last_method_compiled[0] = '\0';
 
   // No need to initialize compilation system if we do not use it.
@@ -959,6 +960,16 @@
   } else {
     c1_count = JVMCIHostThreads;
   }
+  if (!UseInterpreter || !BackgroundCompilation) {
+    // Force initialization of JVMCI compiler otherwise JVMCI
+    // compilations will not block until JVMCI is initialized
+    ResourceMark rm;
+    TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
+    TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
+    Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
+    JavaValue result(T_OBJECT);
+    JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
+  }
 #endif // COMPILERJVMCI
 
 #ifdef COMPILER1
@@ -1733,7 +1744,8 @@
 bool CompileBroker::wait_for_jvmci_completion(CompileTask* task, JavaThread* thread) {
   MutexLocker waiter(task->lock(), thread);
   int consecutively_blocked = 0;
-  while (task->lock()->wait(!Mutex::_no_safepoint_check_flag, BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE)) {
+  while (!task->is_complete() && !is_compilation_disabled_forever() &&
+         task->lock()->wait(!Mutex::_no_safepoint_check_flag, BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE)) {
     CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
     if (jvmci_compiler_thread != NULL) {
       JavaThreadState state;
--- a/src/share/vm/compiler/compileBroker.hpp	Thu Jan 28 20:18:25 2016 -0800
+++ b/src/share/vm/compiler/compileBroker.hpp	Fri Jan 29 21:52:36 2016 +0100
@@ -415,7 +415,7 @@
     CompileQueue *q = compile_queue(comp_level);
     return q != NULL ? q->size() : 0;
   }
-  static void compilation_init();
+  static void compilation_init(TRAPS);
   static void init_compiler_thread_log();
   static nmethod* compile_method(methodHandle method,
                                  int osr_bci,
--- a/src/share/vm/runtime/thread.cpp	Thu Jan 28 20:18:25 2016 -0800
+++ b/src/share/vm/runtime/thread.cpp	Fri Jan 29 21:52:36 2016 +0100
@@ -3714,7 +3714,10 @@
 
   // initialize compiler(s)
 #if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERJVMCI)
-  CompileBroker::compilation_init();
+  CompileBroker::compilation_init(THREAD);
+  if (HAS_PENDING_EXCEPTION) {
+    vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
+  }
 #endif
 
   if (EnableInvokeDynamic) {