RFR: 8265754: Move suspend/resume API from HandshakeState [v2]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Wed May 28 18:38:56 UTC 2025
On Mon, 26 May 2025 13:30:11 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 HandshakeSuspender. 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
>
> - Merge remote-tracking branch 'origin/master' into JDK-8265754
> - Merge remote-tracking branch 'origin/master' into JDK-8265754
> - 8265754: Refactoring to static methods.
> - 8265754: Fixed indentation.
> - 8265754: Fixed indentation
> - 8265754: Fixed indentation and lost newline.
> - 8265754: Fixed whitespaces errors.
> - 8265754: More work.
> - Merge remote-tracking branch 'origin/master' into JDK-8265754
> - 8265754: Refactoring suspend/resume in the HandshakeState away
In order to fully move suspend/resume code outside of `HandshakeState` we should also move `_suspended`/`_async_suspend_handshake`, otherwise we are just adding an extra indirection with class `HandshakeSuspender` IMO. The idea behind this bug was to define suspend/resume and related HandshakeClosure definitions without needing extra knowledge in `HandshakeState`, like any other HandshakeClosures. The reason why this is not straightforward is because of the interaction with the `HandshakeState` lock. But if we are going to give access to it to `HandshakeSuspender` we might as well give it to `JavaThread` instead and move everything there as that’s where all methods naturally belong. Something like this: https://github.com/pchilano/jdk/commit/4e870069e207ad2e8ba11ab1904a8df04961cef3
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25407#issuecomment-2917264751
More information about the hotspot-runtime-dev
mailing list