< prev index next >

src/share/vm/jvmci/jvmciCompiler.cpp

Print this page
rev 9941 : 8147432: JVMCI should report bailouts in PrintCompilation output

@@ -132,21 +132,20 @@
   }
 
   JVMCIRuntime::initialize_well_known_classes(CHECK_ABORT);
 
   HandleMark hm;
-  ResourceMark rm;
   Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
 
   JavaValue method_result(T_OBJECT);
   JavaCallArguments args;
   args.push_long((jlong) (address) method());
   JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(),
                          vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, THREAD);
 
+  JavaValue result(T_OBJECT);
   if (!HAS_PENDING_EXCEPTION) {
-    JavaValue result(T_VOID);
     JavaCallArguments args;
     args.push_oop(receiver);
     args.push_oop((oop)method_result.get_jobject());
     args.push_int(entry_bci);
     args.push_long((jlong) (address) env);

@@ -162,15 +161,28 @@
     Handle exception(THREAD, PENDING_EXCEPTION);
     CLEAR_PENDING_EXCEPTION;
 
     java_lang_Throwable::java_printStackTrace(exception, THREAD);
 
-    // Something went wrong so disable compilation at this level
-    method->set_not_compilable(CompLevel_full_optimization);
+    env->set_failure("exception throw", false);
   } else {
+    oop result_object = (oop) result.get_jobject();
+    if (result_object != NULL) {
+      oop failure_message = CompilationRequestResult::failureMessage(result_object);
+      if (failure_message != NULL) {
+        const char* failure_reason = failure_message != NULL ? java_lang_String::as_utf8_string(failure_message) : "unknown reason";
+        env->set_failure(failure_reason, CompilationRequestResult::retry(result_object));
+      } else {
+        if (env->task()->code() == NULL) {
+          env->set_failure("no nmethod produced", true);
+        } else {
+          env->task()->set_num_inlined_bytecodes(CompilationRequestResult::inlinedBytecodes(result_object));
     _methodsCompiled++;
   }
+      }
+    }
+  }
 }
 
 /**
  * Aborts the VM due to an unexpected exception.
  */
< prev index next >