< prev index next >

src/hotspot/share/jvmci/jvmciCompiler.cpp

Print this page

        

@@ -120,10 +120,11 @@
 
   bool is_osr = entry_bci != InvocationEntryBci;
   if (_bootstrapping && is_osr) {
       // no OSR compilations during bootstrap - the compiler is just too slow at this point,
       // and we know that there are no endless loops
+      env->set_failure(true, "No OSR during boostrap");
       return;
   }
 
   JVMCIRuntime::initialize_well_known_classes(CHECK_EXIT);
 

@@ -158,21 +159,25 @@
     java_lang_Throwable::java_printStackTrace(exception, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       CLEAR_PENDING_EXCEPTION;
     }
 
-    env->set_failure("exception throw", false);
+    env->set_failure(false, "unexpected exception thrown");
   } else {
     oop result_object = (oop) result.get_jobject();
     if (result_object != NULL) {
       oop failure_message = HotSpotCompilationRequestResult::failureMessage(result_object);
       if (failure_message != NULL) {
+        // Copy failure reason into resource memory first ...
         const char* failure_reason = java_lang_String::as_utf8_string(failure_message);
-        env->set_failure(failure_reason, HotSpotCompilationRequestResult::retry(result_object) != 0);
+        // ... and then into the C heap.
+        failure_reason = os::strdup(failure_reason, mtCompiler);
+        bool retryable = HotSpotCompilationRequestResult::retry(result_object) != 0;
+        env->set_failure(retryable, failure_reason, true);
       } else {
         if (env->task()->code() == NULL) {
-          env->set_failure("no nmethod produced", true);
+          env->set_failure(true, "no nmethod produced");
         } else {
           env->task()->set_num_inlined_bytecodes(HotSpotCompilationRequestResult::inlinedBytecodes(result_object));
           Atomic::inc(&_methods_compiled);
         }
       }
< prev index next >