RFR: 8341544: Restore fence() in Mutex

Erik Österlund eosterlund at openjdk.org
Thu May 15 11:47:31 UTC 2025


On Mon, 5 May 2025 11:13:05 GMT, Anton Artemov <duke at openjdk.org> wrote:

> Added a fence in the mutex code in order to make the critical section provided by the mutex follow the roach-motel semantics. 
> 
> No significant performance impact observed in an extending testing.
> 
> Tested in tiers 1-3.

src/hotspot/share/runtime/handshake.cpp line 259:

> 257:     if (UseSystemMemoryBarrier) {
> 258:       SystemMemoryBarrier::emit();
> 259:     } else {

I don't think this change should mess around with random handshaking code. This PR is concerned with fortifying the memory ordering of Mutex, which is orthogonal.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25033#discussion_r2084012400


More information about the hotspot-runtime-dev mailing list