RFR: 8366671: Refactor Thread::SpinAcquire and Thread::SpinRelease [v9]
David Holmes
dholmes at openjdk.org
Mon Nov 24 01:38:02 UTC 2025
On Fri, 21 Nov 2025 09:25:27 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 reviewer's comments.
src/hotspot/share/utilities/spinCriticalSection.hpp line 37:
> 35: // we're concerned about native mutex_t or HotSpot Mutex:: latency.
> 36: // The class uses low-level leaf-lock primitives to implement
> 37: // synchronization. Not for general synchronization use.
Suggestion:
// This class uses low-level leaf-lock primitives to implement
// synchronization and is not for general synchronization use.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28264#discussion_r2554480028
More information about the hotspot-dev
mailing list