8225492: Update JVMCI
authordnsimon
Mon, 10 Jun 2019 15:55:11 -0700
changeset 55317 b76aee290002
parent 55316 218f5a414379
child 55318 040e1c6dab96
8225492: Update JVMCI Reviewed-by: iveresov, kvn
src/hotspot/share/jvmci/jvmciRuntime.cpp
src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp	Mon Jun 10 13:42:11 2019 -0400
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp	Mon Jun 10 15:55:11 2019 -0700
@@ -1339,6 +1339,18 @@
   return JVMCI::dependencies_invalid;
 }
 
+// Reports a pending exception and exits the VM.
+static void fatal_exception_in_compile(JVMCIEnv* JVMCIENV, JavaThread* thread, const char* msg) {
+  // Only report a fatal JVMCI compilation exception once
+  static volatile int report_init_failure = 0;
+  if (!report_init_failure && Atomic::cmpxchg(1, &report_init_failure, 0) == 0) {
+      tty->print_cr("%s:", msg);
+      JVMCIENV->describe_pending_exception(true);
+  }
+  JVMCIENV->clear_pending_exception();
+  before_exit(thread);
+  vm_exit(-1);
+}
 
 void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, const methodHandle& method, int entry_bci) {
   JVMCI_EXCEPTION_CONTEXT
@@ -1360,9 +1372,7 @@
   HandleMark hm;
   JVMCIObject receiver = get_HotSpotJVMCIRuntime(JVMCIENV);
   if (JVMCIENV->has_pending_exception()) {
-    JVMCIENV->describe_pending_exception(true);
-    compile_state->set_failure(false, "exception getting HotSpotJVMCIRuntime object");
-    return;
+    fatal_exception_in_compile(JVMCIENV, thread, "Exception during HotSpotJVMCIRuntime initialization");
   }
   JVMCIObject jvmci_method = JVMCIENV->get_jvmci_method(method, JVMCIENV);
   if (JVMCIENV->has_pending_exception()) {
@@ -1397,16 +1407,7 @@
   } else {
     // An uncaught exception here implies failure during compiler initialization.
     // The only sensible thing to do here is to exit the VM.
-
-    // Only report initialization failure once
-    static volatile int report_init_failure = 0;
-    if (!report_init_failure && Atomic::cmpxchg(1, &report_init_failure, 0) == 0) {
-        tty->print_cr("Exception during JVMCI compiler initialization:");
-        JVMCIENV->describe_pending_exception(true);
-    }
-    JVMCIENV->clear_pending_exception();
-    before_exit((JavaThread*) THREAD);
-    vm_exit(-1);
+    fatal_exception_in_compile(JVMCIENV, thread, "Exception during JVMCI compiler initialization");
   }
   if (compiler->is_bootstrapping()) {
     compiler->set_bootstrap_compilation_request_handled();
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java	Mon Jun 10 13:42:11 2019 -0400
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java	Mon Jun 10 15:55:11 2019 -0700
@@ -71,6 +71,8 @@
                         errorMessage.format("Currently used Java home directory is %s.%n", javaHome);
                         errorMessage.format("Currently used VM configuration is: %s", vmName);
                         throw new UnsupportedOperationException(errorMessage.toString());
+                    } finally {
+                        initializing = false;
                     }
                 }
             }