8255384: Remove special_runtime_exit_condition() check from SS::block()
Reviewed-by: dholmes, rrich, dcubed
This commit is contained in:
parent
f611fdfee8
commit
3675653c20
@ -102,11 +102,14 @@
|
||||
There really shouldn't be any handles remaining to trash but this is cheap
|
||||
in relation to a safepoint.
|
||||
*/
|
||||
#define SAFEPOINT \
|
||||
{ \
|
||||
/* zap freed handles rather than GC'ing them */ \
|
||||
HandleMarkCleaner __hmc(THREAD); \
|
||||
CALL_VM(SafepointMechanism::process_if_requested(THREAD), handle_exception); \
|
||||
#define SAFEPOINT \
|
||||
{ \
|
||||
/* zap freed handles rather than GC'ing them */ \
|
||||
HandleMarkCleaner __hmc(THREAD); \
|
||||
if (SafepointMechanism::should_process(THREAD)) { \
|
||||
CALL_VM(SafepointMechanism::process_if_requested_with_exit_check(THREAD, true /* check asyncs */), \
|
||||
handle_exception); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -737,29 +737,6 @@ void SafepointSynchronize::block(JavaThread *thread) {
|
||||
guarantee(thread->safepoint_state()->get_safepoint_id() == InactiveSafepointCounter,
|
||||
"The safepoint id should be set only in block path");
|
||||
|
||||
// Check for pending. async. exceptions or suspends - except if the
|
||||
// thread was blocked inside the VM. has_special_runtime_exit_condition()
|
||||
// is called last since it grabs a lock and we only want to do that when
|
||||
// we must.
|
||||
//
|
||||
// Note: we never deliver an async exception at a polling point as the
|
||||
// compiler may not have an exception handler for it. The polling
|
||||
// code will notice the async and deoptimize and the exception will
|
||||
// be delivered. (Polling at a return point is ok though). Sure is
|
||||
// a lot of bother for a deprecated feature...
|
||||
//
|
||||
// We don't deliver an async exception if the thread state is
|
||||
// _thread_in_native_trans so JNI functions won't be called with
|
||||
// a surprising pending exception. If the thread state is going back to java,
|
||||
// async exception is checked in check_special_condition_for_native_trans().
|
||||
|
||||
if (state != _thread_blocked_trans &&
|
||||
state != _thread_in_vm_trans &&
|
||||
thread->has_special_runtime_exit_condition()) {
|
||||
thread->handle_special_runtime_exit_condition(
|
||||
!thread->is_at_poll_safepoint() && (state != _thread_in_native_trans));
|
||||
}
|
||||
|
||||
// cross_modify_fence is done by SafepointMechanism::process_if_requested
|
||||
// which is the only caller here.
|
||||
}
|
||||
@ -955,12 +932,7 @@ void ThreadSafepointState::handle_polling_page_exception() {
|
||||
StackWatermarkSet::after_unwind(self);
|
||||
|
||||
// Process pending operation
|
||||
SafepointMechanism::process_if_requested(self);
|
||||
// We have to wait if we are here because of a handshake for object deoptimization.
|
||||
if (self->is_obj_deopt_suspend()) {
|
||||
self->wait_for_object_deoptimization();
|
||||
}
|
||||
self->check_and_handle_async_exceptions();
|
||||
SafepointMechanism::process_if_requested_with_exit_check(self, true /* check asyncs */);
|
||||
|
||||
// restore oop result, if any
|
||||
if (return_oop) {
|
||||
@ -970,17 +942,18 @@ void ThreadSafepointState::handle_polling_page_exception() {
|
||||
|
||||
// This is a safepoint poll. Verify the return address and block.
|
||||
else {
|
||||
set_at_poll_safepoint(true);
|
||||
|
||||
// verify the blob built the "return address" correctly
|
||||
assert(real_return_addr == caller_fr.pc(), "must match");
|
||||
|
||||
set_at_poll_safepoint(true);
|
||||
// Process pending operation
|
||||
SafepointMechanism::process_if_requested(self);
|
||||
// We have to wait if we are here because of a handshake for object deoptimization.
|
||||
if (self->is_obj_deopt_suspend()) {
|
||||
self->wait_for_object_deoptimization();
|
||||
}
|
||||
// We never deliver an async exception at a polling point as the
|
||||
// compiler may not have an exception handler for it. The polling
|
||||
// code will notice the pending async exception, deoptimize and
|
||||
// the exception will be delivered. (Polling at a return point
|
||||
// is ok though). Sure is a lot of bother for a deprecated feature...
|
||||
SafepointMechanism::process_if_requested_with_exit_check(self, false /* check asyncs */);
|
||||
set_at_poll_safepoint(false);
|
||||
|
||||
// If we have a pending async exception deoptimize the frame
|
||||
|
@ -80,7 +80,7 @@ void SafepointMechanism::process(JavaThread *thread) {
|
||||
// Any load in ::block must not pass the global poll load.
|
||||
// Otherwise we might load an old safepoint counter (for example).
|
||||
OrderAccess::loadload();
|
||||
SafepointSynchronize::block(thread); // Recursive
|
||||
SafepointSynchronize::block(thread);
|
||||
}
|
||||
|
||||
// The call to on_safepoint fixes the thread's oops and the first few frames.
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
|
||||
// Processes a pending requested operation.
|
||||
static inline void process_if_requested(JavaThread* thread);
|
||||
static inline void process_if_requested_with_exit_check(JavaThread* thread, bool check_asyncs);
|
||||
// Compute what the poll values should be and install them.
|
||||
static void update_poll_values(JavaThread* thread);
|
||||
|
||||
|
@ -80,6 +80,13 @@ void SafepointMechanism::process_if_requested(JavaThread *thread) {
|
||||
process_if_requested_slow(thread);
|
||||
}
|
||||
|
||||
void SafepointMechanism::process_if_requested_with_exit_check(JavaThread* thread, bool check_asyncs) {
|
||||
process_if_requested(thread);
|
||||
if (thread->has_special_runtime_exit_condition()) {
|
||||
thread->handle_special_runtime_exit_condition(check_asyncs);
|
||||
}
|
||||
}
|
||||
|
||||
void SafepointMechanism::arm_local_poll(JavaThread* thread) {
|
||||
thread->poll_data()->set_polling_word(_poll_word_armed_value);
|
||||
thread->poll_data()->set_polling_page(_poll_page_armed_value);
|
||||
|
@ -2409,11 +2409,11 @@ void JavaThread::java_suspend_self_with_safepoint_check() {
|
||||
// might return to _thread_in_Java and execute bytecodes for an arbitrary
|
||||
// long time.
|
||||
set_thread_state_fence(state);
|
||||
} while (is_external_suspend());
|
||||
|
||||
if (state != _thread_in_native) {
|
||||
SafepointMechanism::process_if_requested(this);
|
||||
}
|
||||
if (state != _thread_in_native) {
|
||||
SafepointMechanism::process_if_requested(this);
|
||||
}
|
||||
} while (is_external_suspend());
|
||||
}
|
||||
|
||||
// Wait for another thread to perform object reallocation and relocking on behalf of
|
||||
@ -2493,20 +2493,9 @@ void JavaThread::verify_not_published() {
|
||||
// directly and when thread state is _thread_in_native_trans
|
||||
void JavaThread::check_safepoint_and_suspend_for_native_trans(JavaThread *thread) {
|
||||
assert(thread->thread_state() == _thread_in_native_trans, "wrong state");
|
||||
|
||||
assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "Unwalkable stack in native->vm transition");
|
||||
|
||||
if (thread->is_external_suspend()) {
|
||||
thread->java_suspend_self_with_safepoint_check();
|
||||
} else {
|
||||
SafepointMechanism::process_if_requested(thread);
|
||||
}
|
||||
|
||||
if (thread->is_obj_deopt_suspend()) {
|
||||
thread->wait_for_object_deoptimization();
|
||||
}
|
||||
|
||||
JFR_ONLY(SUSPEND_THREAD_CONDITIONAL(thread);)
|
||||
SafepointMechanism::process_if_requested_with_exit_check(thread, false /* check asyncs */);
|
||||
}
|
||||
|
||||
// Slow path when the native==>VM/Java barriers detect a safepoint is in
|
||||
|
Loading…
Reference in New Issue
Block a user