changeset 23296:f41d4011035d

reduced delta against jvmci-9
author Doug Simon <doug.simon@oracle.com>
date Sun, 31 Jan 2016 22:39:09 +0100
parents c3ebefa1c743
children 4b58c92e939b
files src/share/vm/compiler/compileBroker.cpp src/share/vm/compiler/compileBroker.hpp src/share/vm/jvmci/jvmciCompiler.cpp src/share/vm/jvmci/jvmciRuntime.cpp src/share/vm/runtime/thread.cpp
diffstat 5 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Fri Jan 29 22:55:42 2016 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Sun Jan 31 22:39:09 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,17 @@
   } else {
     c1_count = JVMCIHostThreads;
   }
+  if (!UseInterpreter || !BackgroundCompilation) {
+    // Force initialization of JVMCI compiler otherwise JVMCI
+    // compilations will not block until JVMCI is initialized
+    JVMCIRuntime::ensure_jvmci_class_loader_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 +1745,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	Fri Jan 29 22:55:42 2016 +0100
+++ b/src/share/vm/compiler/compileBroker.hpp	Sun Jan 31 22:39:09 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/jvmci/jvmciCompiler.cpp	Fri Jan 29 22:55:42 2016 +0100
+++ b/src/share/vm/jvmci/jvmciCompiler.cpp	Sun Jan 31 22:39:09 2016 +0100
@@ -127,7 +127,6 @@
   }
 
   JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
-  JVMCIJavaClasses::compute_offsets(THREAD);
   HandleMark hm;
   Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
 
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Fri Jan 29 22:55:42 2016 +0100
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Sun Jan 31 22:39:09 2016 +0100
@@ -763,8 +763,6 @@
 
   JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
 
-  JVMCIJavaClasses::compute_offsets(thread);
-
   {
     ThreadToNativeFromVM trans(thread);
 
@@ -820,6 +818,8 @@
     klass->initialize(CHECK_ABORT);
     _FactoryKlass = klass();
     assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized");
+
+    JVMCIJavaClasses::compute_offsets(THREAD);
   }
 }
 
@@ -978,10 +978,12 @@
 }
 
 Klass* JVMCIRuntime::resolve_or_null(Symbol* name, TRAPS) {
+  assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized");
   return SystemDictionary::resolve_or_null(name, SystemDictionary::jvmci_loader(), Handle(), CHECK_NULL);
 }
 
 Klass* JVMCIRuntime::resolve_or_fail(Symbol* name, TRAPS) {
+  assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized");
   return SystemDictionary::resolve_or_fail(name, SystemDictionary::jvmci_loader(), Handle(), true, CHECK_NULL);
 }
 
--- a/src/share/vm/runtime/thread.cpp	Fri Jan 29 22:55:42 2016 +0100
+++ b/src/share/vm/runtime/thread.cpp	Sun Jan 31 22:39:09 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) {