8249451: Unconditional exceptions clearing logic in compiler code should honor Async Exceptions.

Reviewed-by: dholmes, iveresov
This commit is contained in:
Jamsheed Mohammed C M 2020-09-18 05:48:14 +00:00
parent 3ef2efb1f4
commit 73c9088b81
21 changed files with 179 additions and 114 deletions

View file

@ -2327,8 +2327,6 @@ void JavaThread::remove_monitor_chunk(MonitorChunk* chunk) {
// _thread_in_native_trans state (such as from
// check_special_condition_for_native_trans()).
void JavaThread::check_and_handle_async_exceptions(bool check_unsafe_error) {
// May be we are at method entry and requires to save do not unlock flag.
UnlockFlagSaver fs(this);
if (has_last_Java_frame() && has_async_condition()) {
// If we are at a polling page safepoint (not a poll return)
// then we must defer async exception because live registers
@ -2391,21 +2389,26 @@ void JavaThread::check_and_handle_async_exceptions(bool check_unsafe_error) {
if (check_unsafe_error &&
condition == _async_unsafe_access_error && !has_pending_exception()) {
// We may be at method entry which requires we save the do-not-unlock flag.
UnlockFlagSaver fs(this);
condition = _no_async_condition; // done
switch (thread_state()) {
case _thread_in_vm: {
JavaThread* THREAD = this;
THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation");
Exceptions::throw_unsafe_access_internal_error(THREAD, __FILE__, __LINE__, "a fault occurred in an unsafe memory access operation");
return;
}
case _thread_in_native: {
ThreadInVMfromNative tiv(this);
JavaThread* THREAD = this;
THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation");
Exceptions::throw_unsafe_access_internal_error(THREAD, __FILE__, __LINE__, "a fault occurred in an unsafe memory access operation");
return;
}
case _thread_in_Java: {
ThreadInVMfromJava tiv(this);
JavaThread* THREAD = this;
THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in a recent unsafe memory access operation in compiled Java code");
Exceptions::throw_unsafe_access_internal_error(THREAD, __FILE__, __LINE__, "a fault occurred in a recent unsafe memory access operation in compiled Java code");
return;
}
default:
ShouldNotReachHere();