RFR: 8366038: Thread::SpinRelease should use Atomic::release_store

Anton Artemov duke at openjdk.org
Tue Sep 2 07:43:27 UTC 2025


Hi, please consider the following changes:

`Thread::SpinRelease()` uses an `OrderAccess::fence()` to prevent loads and stores from within the critical section to float down out of the section. A full fence is expensive and it is an overkill on most platforms. Instead, one can achieve the same effect with `Atomic::release_store()`. 

Tested in tiers 1 - 3.

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

Commit messages:
 - 8366038: Replaced fence with release_store in Thread::SpinRelease().

Changes: https://git.openjdk.org/jdk/pull/27035/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27035&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366038
  Stats: 4 lines in 1 file changed: 2 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/27035.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27035/head:pull/27035

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


More information about the hotspot-runtime-dev mailing list