RFR: 8366671: Refactor Thread::SpinAcquire and Thread::SpinRelease [v2]

Anton Artemov aartemov at openjdk.org
Fri Nov 14 12:19:18 UTC 2025


> 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. 
> 
> Additionally, `SpinSingleSection` class is added, which allows to execute a payload code inside of a functor by only one thread. 
> 
> Tested in tiers 1 - 5.

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 six additional commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into JDK-8366671-refactor-spin-acquire-spin-release
 - Merge remote-tracking branch 'origin/master' into JDK-8366671-refactor-spin-acquire-spin-release
 - 8366671: Fixed whitespaces.
 - 8366671: Fixed whitespaces.
 - 8366671: Fixed whitespaces.
 - 8366671: Refactor SpinAcquire/SpinRelease into SpinCriticalSection

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28264/files
  - new: https://git.openjdk.org/jdk/pull/28264/files/d7f6f345..23b9f1d6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28264&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28264&range=00-01

  Stats: 4731 lines in 117 files changed: 3559 ins; 666 del; 506 mod
  Patch: https://git.openjdk.org/jdk/pull/28264.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28264/head:pull/28264

PR: https://git.openjdk.org/jdk/pull/28264


More information about the hotspot-dev mailing list