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

David Holmes dholmes at openjdk.org
Thu Nov 20 06:10:57 UTC 2025


On Wed, 19 Nov 2025 20:26:02 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> I believe it is for historical reasons?
>
> I think it's because `bool` is (typically? always? I don't recall) of size 1,
> and size 1 cmpxchg isn't supported by a lot of hardware, so we emuluate it for
> those. Mostly we don't worry about that, but this is supposed to be low-level
> and performance-critical (else why aren't we just using a mutex?). Or maybe it
> is historical, and the starting point for some of this code is so old that it
> predates our emulation of 1-byte cmpxchg for some platforms. :)

I think it is because a 32-bit atomic op is mostly likely the most performant variant even if larger and smaller entities are supported by an architecture.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28264#discussion_r2544469222


More information about the hotspot-dev mailing list