RFR: 8253241: Update comment on java_suspend_self_with_safepoint_check()

David Holmes dholmes at openjdk.java.net
Mon Sep 21 04:17:29 UTC 2020


On Thu, 17 Sep 2020 13:57:04 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

> After JDK-8252414 the safepoint/handshake code does not take _suspend_flags into accout anymore in its assessment if a
> thread is safepoint/handshake safe. This change updates the comment on
> JavaThread::java_suspend_self_with_safepoint_check().  I have (not yet) fixed the line breaks (fill-paragraph in emacs
> lingo) for a clearer diff.
> Also I could inline the (*) footnote.

src/hotspot/share/runtime/thread.cpp line 2599:

> 2597: // safepoint/handshake code will count it as safepoint/handshake safe. Also it allows
> 2598: // another thread to continue if it is waiting in is_ext_suspend_completed() for this
> 2599: // thread to change state from _thread_in_native_trans to the target state.

The revised wording doesn't really convey the situation to me. We _have_ to set the thread-state to _thread_blocked so
that a thread waiting in _is_ext_suspend_completed can proceed (there is no generic "target" state - it must be
_thread_blocked). I would simplify and rephrase as follows:

"We have to set the thread state directly to _thread_blocked so that it will be seen to be safepoint/handshake safe
whilst suspended. This is also necessary to allow a thread in is_ext_suspend_completed, that observed the
_thread_in_native_trans state, to proceed."

-------------

PR: https://git.openjdk.java.net/jdk/pull/225


More information about the hotspot-runtime-dev mailing list