RFR: 8265754: Move suspend/resume API from HandshakeState [v9]

Patricio Chilano Mateo pchilanomate at openjdk.org
Mon Jun 9 16:34:01 UTC 2025


On Thu, 5 Jun 2025 08:48:37 GMT, Anton Artemov <duke at openjdk.org> wrote:

>> Hi,
>> 
>> in this PR the suspend/resume methods are moved away from the HandshakeState class into a new separate class SuspendResumeManager. The idea is that the state class should be a state keeper and should not be responsible for actions which change the state. Such actions should be done by a separate class. 
>> 
>> Tested in tiers 1-4.
>
> Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8265754: Changed handshakee to target.

src/hotspot/share/runtime/handshake.hpp line 187:

> 185: 
> 186:   bool suspend(bool register_vthread_SR);
> 187:   bool resume(bool register_vthread_SR);

We should also remove the class and friend declarations for `ThreadSelfSuspensionHandshake`
 and `SuspendThreadHandshake`.

src/hotspot/share/runtime/suspendResumeManager.hpp line 27:

> 25: #ifndef SHARE_RUNTIME_SUSPENDRESUMEMANAGER_HPP
> 26: #define SHARE_RUNTIME_SUSPENDRESUMEMANAGER_HPP
> 27: 

We need to add `class SuspendThreadHandshake;` and `class ThreadSelfSuspensionHandshake;` here (currently relying on the declarations in handshake.hpp).

src/hotspot/share/runtime/suspendResumeManager.hpp line 37:

> 35: 
> 36: public:
> 37:   SuspendResumeManager(JavaThread* thread, Monitor* state_lock);

Maybe this should also be private given that `JavaThread` is a friend already?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25407#discussion_r2136016839
PR Review Comment: https://git.openjdk.org/jdk/pull/25407#discussion_r2136025270
PR Review Comment: https://git.openjdk.org/jdk/pull/25407#discussion_r2136029358


More information about the hotspot-runtime-dev mailing list