8190797: OSR compilation fails with "assert(__the_thread__->can_call_java()) failed: can not load classes with compiler thread"

Bail out with a meaningful error message in case we cannot throw a Java exception.

Reviewed-by: kvn, dholmes
This commit is contained in:
Tobias Hartmann 2017-11-10 13:10:54 +01:00
parent f6750599ef
commit b0c9129d6c
3 changed files with 119 additions and 10 deletions

View file

@ -2146,8 +2146,14 @@ void GenerateOopMap::error_work(const char *format, va_list ap) {
// Append method name
char msg_buffer2[512];
jio_snprintf(msg_buffer2, sizeof(msg_buffer2), "%s in method %s", msg_buffer, method()->name()->as_C_string());
_exception = Exceptions::new_exception(Thread::current(),
vmSymbols::java_lang_LinkageError(), msg_buffer2);
if (Thread::current()->can_call_java()) {
_exception = Exceptions::new_exception(Thread::current(),
vmSymbols::java_lang_LinkageError(), msg_buffer2);
} else {
// We cannot instantiate an exception object from a compiler thread.
// Exit the VM with a useful error message.
fatal("%s", msg_buffer2);
}
}
void GenerateOopMap::report_error(const char *format, ...) {
@ -2159,14 +2165,7 @@ void GenerateOopMap::report_error(const char *format, ...) {
void GenerateOopMap::verify_error(const char *format, ...) {
// We do not distinguish between different types of errors for verification
// errors. Let the verifier give a better message.
const char *msg = "Illegal class file encountered. Try running with -Xverify:all";
_got_error = true;
// Append method name
char msg_buffer2[512];
jio_snprintf(msg_buffer2, sizeof(msg_buffer2), "%s in method %s", msg,
method()->name()->as_C_string());
_exception = Exceptions::new_exception(Thread::current(),
vmSymbols::java_lang_LinkageError(), msg_buffer2);
report_error("Illegal class file encountered. Try running with -Xverify:all");
}
//