8265327: Remove check_safepoint_and_suspend_for_native_trans()
Reviewed-by: dcubed, dholmes, rrich
This commit is contained in:
parent
c9b70c8042
commit
8e312297d8
src/hotspot/share/runtime
@ -111,18 +111,18 @@ class ThreadStateTransition : public StackObj {
|
||||
static inline void transition_from_native(JavaThread *thread, JavaThreadState to) {
|
||||
assert((to & 1) == 0, "odd numbers are transitions states");
|
||||
assert(thread->thread_state() == _thread_in_native, "coming from wrong thread state");
|
||||
assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "Unwalkable stack in native->vm transition");
|
||||
|
||||
// Change to transition state and ensure it is seen by the VM thread.
|
||||
thread->set_thread_state_fence(_thread_in_native_trans);
|
||||
|
||||
// We never install asynchronous exceptions when coming (back) in
|
||||
// to the runtime from native code because the runtime is not set
|
||||
// up to handle exceptions floating around at arbitrary points.
|
||||
if (SafepointMechanism::should_process(thread) || thread->is_suspend_after_native()) {
|
||||
JavaThread::check_safepoint_and_suspend_for_native_trans(thread);
|
||||
}
|
||||
|
||||
SafepointMechanism::process_if_requested_with_exit_check(thread, false /* check asyncs */);
|
||||
thread->set_thread_state(to);
|
||||
}
|
||||
|
||||
protected:
|
||||
void trans(JavaThreadState from, JavaThreadState to) { transition(_thread, from, to); }
|
||||
void trans_from_java(JavaThreadState to) { transition_from_java(_thread, to); }
|
||||
|
@ -1869,32 +1869,19 @@ void JavaThread::verify_not_published() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Slow path when the native==>VM/Java barriers detect a safepoint is in
|
||||
// progress or when _suspend_flags is non-zero.
|
||||
// Current thread needs to self-suspend if there is a suspend request and/or
|
||||
// block if a safepoint is in progress.
|
||||
// Async exception ISN'T checked.
|
||||
// Note only the ThreadInVMfromNative transition can call this function
|
||||
// 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");
|
||||
|
||||
SafepointMechanism::process_if_requested_with_exit_check(thread, false /* check asyncs */);
|
||||
}
|
||||
|
||||
// Slow path when the native==>VM/Java barriers detect a safepoint is in
|
||||
// progress or when _suspend_flags is non-zero.
|
||||
// Current thread needs to self-suspend if there is a suspend request and/or
|
||||
// block if a safepoint is in progress.
|
||||
// Also check for pending async exception (not including unsafe access error).
|
||||
// Note only the native==>VM/Java barriers can call this function and when
|
||||
// thread state is _thread_in_native_trans.
|
||||
// Slow path when the native==>Java barriers detect a safepoint/handshake is
|
||||
// pending, when _suspend_flags is non-zero or when we need to process a stack
|
||||
// watermark. Also check for pending async exceptions (except unsafe access error).
|
||||
// Note only the native==>Java barriers can call this function when thread state
|
||||
// is _thread_in_native_trans.
|
||||
void JavaThread::check_special_condition_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->Java transition");
|
||||
|
||||
// Enable WXWrite: called directly from interpreter native wrapper.
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
|
||||
|
||||
check_safepoint_and_suspend_for_native_trans(thread);
|
||||
SafepointMechanism::process_if_requested_with_exit_check(thread, false /* check asyncs */);
|
||||
|
||||
// After returning from native, it could be that the stack frames are not
|
||||
// yet safe to use. We catch such situations in the subsequent stack watermark
|
||||
|
@ -1145,16 +1145,9 @@ class JavaThread: public Thread {
|
||||
bool java_resume(); // higher-level resume logic called by the public APIs
|
||||
bool is_suspended() { return _handshake.is_suspended(); }
|
||||
|
||||
static void check_safepoint_and_suspend_for_native_trans(JavaThread *thread);
|
||||
// Check for async exception in addition to safepoint.
|
||||
static void check_special_condition_for_native_trans(JavaThread *thread);
|
||||
|
||||
// Whenever a thread transitions from native to vm/java it must suspend
|
||||
// if deopt suspend is present.
|
||||
bool is_suspend_after_native() const {
|
||||
return (_suspend_flags & (_obj_deopt JFR_ONLY(| _trace_flag))) != 0;
|
||||
}
|
||||
|
||||
// Synchronize with another thread that is deoptimizing objects of the
|
||||
// current thread, i.e. reverts optimizations based on escape analysis.
|
||||
void wait_for_object_deoptimization();
|
||||
@ -1178,7 +1171,8 @@ class JavaThread: public Thread {
|
||||
// Return true if JavaThread has an asynchronous condition or
|
||||
// if external suspension is requested.
|
||||
bool has_special_runtime_exit_condition() {
|
||||
return (_special_runtime_exit_condition != _no_async_condition) || is_trace_suspend() || is_obj_deopt_suspend();
|
||||
return (_special_runtime_exit_condition != _no_async_condition) ||
|
||||
(_suspend_flags & (_obj_deopt JFR_ONLY(| _trace_flag))) != 0;
|
||||
}
|
||||
|
||||
void set_pending_unsafe_access_error() { _special_runtime_exit_condition = _async_unsafe_access_error; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user