--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp Thu Jan 21 16:22:01 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp Fri Jan 22 11:08:07 2016 -0800
@@ -134,7 +134,6 @@
JVMCIRuntime::initialize_well_known_classes(CHECK_ABORT);
HandleMark hm;
- ResourceMark rm;
Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
JavaValue method_result(T_OBJECT);
@@ -143,8 +142,8 @@
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());
@@ -164,10 +163,25 @@
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 {
- _methodsCompiled++;
+ 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 = java_lang_String::as_utf8_string(failure_message);
+ env->set_failure(failure_reason, CompilationRequestResult::retry(result_object) != 0);
+ } 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++;
+ }
+ }
+ } else {
+ assert(false, "JVMCICompiler.compileMethod should always return non-null");
+ }
}
}