--- a/src/hotspot/share/jvmci/jvmciCompiler.cpp Tue Jan 22 08:50:49 2019 +0100
+++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp Tue Jan 22 10:12:05 2019 +0100
@@ -122,6 +122,7 @@
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;
}
@@ -160,17 +161,21 @@
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);