RFR: 8341544: Restore fence() in Mutex

David Holmes dholmes at openjdk.org
Thu May 15 11:47:30 UTC 2025


On Wed, 14 May 2025 12:00:34 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> And it said fence() lock() acquire().

Yes though I think you are being too literal - in the old code that was all wrapped up in a single CAS. And I don't see any suggestion that we need to add an explicit `acquire()` after taking the lock because acquire semantics is known to be part of lock acquisition. At the moment the barriers on the leading edge of the actual lock() have a gap in them so currently we have `not_quite_fence(); lock(); acquire();`. After this change we will have `fence(); not_quite_fence(); lock(); acquire();`.

But okay lets just make this very explicit. To be honest mixing storeload style barrier descriptions with acquire/release semantics doesn't make sense anyway.

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

PR Comment: https://git.openjdk.org/jdk/pull/25033#issuecomment-2881501952


More information about the hotspot-runtime-dev mailing list