< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
@@ -2342,18 +2342,13 @@
(!check_unsafe_error && condition == _async_unsafe_access_error),
"must have handled the async condition, if no exception");
}
void JavaThread::handle_special_runtime_exit_condition(bool check_asyncs) {
- //
+
// Check for pending external suspend.
- // If JNIEnv proxies are allowed, don't self-suspend if the target
- // thread is not the current thread. In older versions of jdbx, jdbx
- // threads could call into the VM with another thread's JNIEnv so we
- // can be here operating on behalf of a suspended thread (4432884).
- bool do_self_suspend = is_external_suspend_with_lock();
- if (do_self_suspend && (!AllowJNIEnvProxy || this == JavaThread::current())) {
+ if (is_external_suspend_with_lock()) {
frame_anchor()->make_walkable(this);
java_suspend_self_with_safepoint_check();
}
// We might be here for reasons in addition to the self-suspend request
@@ -2574,23 +2569,16 @@
// 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");
- JavaThread *curJT = JavaThread::current();
- bool do_self_suspend = thread->is_external_suspend();
-
- assert(!curJT->has_last_Java_frame() || curJT->frame_anchor()->walkable(), "Unwalkable stack in native->vm transition");
+ assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "Unwalkable stack in native->vm transition");
- // If JNIEnv proxies are allowed, don't self-suspend if the target
- // thread is not the current thread. In older versions of jdbx, jdbx
- // threads could call into the VM with another thread's JNIEnv so we
- // can be here operating on behalf of a suspended thread (4432884).
- if (do_self_suspend && (!AllowJNIEnvProxy || curJT == thread)) {
+ if (thread->is_external_suspend()) {
thread->java_suspend_self_with_safepoint_check();
} else {
- SafepointMechanism::block_if_requested(curJT);
+ SafepointMechanism::block_if_requested(thread);
}
JFR_ONLY(SUSPEND_THREAD_CONDITIONAL(thread);)
}
< prev index next >