8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string

Reviewed-by: kvn, thartmann
This commit is contained in:
Doug Simon 2019-01-22 10:12:05 +01:00
parent b8ff3c4dd2
commit 5f5d4425c2
6 changed files with 32 additions and 9 deletions

View file

@ -122,6 +122,7 @@ void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JV
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 @@ void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JV
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);