RFR: 8366671: Refactor Thread::SpinAcquire and Thread::SpinRelease [v8]
Coleen Phillimore
coleenp at openjdk.org
Thu Nov 20 22:29:01 UTC 2025
On Thu, 20 Nov 2025 10:37:21 GMT, Anton Artemov <aartemov at openjdk.org> wrote:
>> Hi,
>>
>> please consider the following changes:
>>
>> In this PR `Thread::SpinAcquire()` and `Thread::SpinRelease()` methods are refactored into a utility class `SpinCriticalSection`. The motivation is to make it easier for developers to use this lightweight synchronization mechanism in the codebase. The two aforementioned methods were used in JFR to create short critical sections with a helper class, but that was not the case for the object monitor code.
>>
>> Tested in tiers 1 - 5.
>
> Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
>
> 8366671: Addressed reviewers' comments.
I like the new reduced version of this a lot. Thank you for working through the comments and discussions. I think this turned out well.
I don't think it should be a commonly used utility but it's in a central place for code that needs it, like ObjectMonitor, can use it and not have to dig through thread to find something like this.
-------------
Marked as reviewed by coleenp (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28264#pullrequestreview-3490236503
More information about the hotspot-dev
mailing list