RFR: 8341544: Restore fence() in Mutex

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


On Tue, 13 May 2025 15:15:45 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> > As per JBS comment I still think we only need to add the missing storeload part of the full-fence, to complement the existing barriers the platform sync primitives provide.
> 
> Pretty sure the comment that the old mutex implementation we removed had, describing the API guarantees, said the semantics was fence() lock() acquire(). Since we are putting back what used to be there - shouldn't that simply be fence()?

@fisk you seemed to agree with my JBS comment that what we are missing is only the storeload part of the combined "fence". The sync primitives already provide the necessary roach-motel barriers, they just lack the storeload that would provide the full "fence". The old code simply used a CAS that had "full bi-directional fence semantics" which itself implemented the lock part.

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

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


More information about the hotspot-runtime-dev mailing list