src/hotspot/share/jvmci/jvmciRuntime.cpp
changeset 55206 2fe2063fe567
parent 54973 0927d8c7296f
child 55273 64b76867851b
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp	Tue Jun 04 11:55:51 2019 -0700
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp	Tue Jun 04 12:44:53 2019 -0700
@@ -938,8 +938,6 @@
     if (exception->is_a(SystemDictionary::ThreadDeath_klass())) {
       // Don't print anything if we are being killed.
     } else {
-      java_lang_Throwable::print(exception(), tty);
-      tty->cr();
       java_lang_Throwable::print_stack_trace(exception, tty);
 
       // Clear and ignore any exceptions raised during printing
@@ -1397,11 +1395,18 @@
       assert(false, "JVMCICompiler.compileMethod should always return non-null");
     }
   } else {
-    // An uncaught exception was thrown during compilation. Generally these
-    // should be handled by the Java code in some useful way but if they leak
-    // through to here report them instead of dying or silently ignoring them.
-    JVMCIENV->describe_pending_exception(true);
-    compile_state->set_failure(false, "unexpected exception thrown");
+    // 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);
   }
   if (compiler->is_bootstrapping()) {
     compiler->set_bootstrap_compilation_request_handled();