@@ -653,7 +653,7 @@ static bool safepoint_safe_with(JavaThread *thread, JavaThreadState state) {
653
653
}
654
654
655
655
bool SafepointSynchronize::handshake_safe (JavaThread *thread) {
656
- if (thread->is_ext_suspended () || thread-> is_terminated ()) {
656
+ if (thread->is_terminated ()) {
657
657
return true ;
658
658
}
659
659
JavaThreadState stable_state;
@@ -890,32 +890,6 @@ void ThreadSafepointState::examine_state_of_thread(uint64_t safepoint_count) {
890
890
return ;
891
891
}
892
892
893
- // Check for a thread that is suspended. Note that thread resume tries
894
- // to grab the Threads_lock which we own here, so a thread cannot be
895
- // resumed during safepoint synchronization.
896
-
897
- // We check to see if this thread is suspended without locking to
898
- // avoid deadlocking with a third thread that is waiting for this
899
- // thread to be suspended. The third thread can notice the safepoint
900
- // that we're trying to start at the beginning of its SR_lock->wait()
901
- // call. If that happens, then the third thread will block on the
902
- // safepoint while still holding the underlying SR_lock. We won't be
903
- // able to get the SR_lock and we'll deadlock.
904
- //
905
- // We don't need to grab the SR_lock here for two reasons:
906
- // 1) The suspend flags are both volatile and are set with an
907
- // Atomic::cmpxchg() call so we should see the suspended
908
- // state right away.
909
- // 2) We're being called from the safepoint polling loop; if
910
- // we don't see the suspended state on this iteration, then
911
- // we'll come around again.
912
- //
913
- bool is_suspended = _thread->is_ext_suspended ();
914
- if (is_suspended) {
915
- account_safe_thread ();
916
- return ;
917
- }
918
-
919
893
if (safepoint_safe_with (_thread, stable_state)) {
920
894
check_for_lazy_critical_native (_thread, stable_state);
921
895
account_safe_thread ();
0 commit comments