RFR: 8270894: Use acquire semantics in ObjectSynchronizer::read_stable_mark()

David Holmes dholmes at openjdk.java.net
Fri Jul 23 11:50:04 UTC 2021


On Mon, 19 Jul 2021 19:13:59 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> Currently, the object header is read using plain loads in read_stable_mark() (synchronizer.cpp). The matching stores use release semantics in corresponding CAS and release_store(). It seems reasonable to use acquire-semantics for the loads of the object header.
> 
> See also discussion here:
> https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2021-July/050132.html
> 
> I propose to use MO_ACQUIRE when reading the object header in read_stable_mark() and some related loads of the header. As discussed in the thread, current_thread_holds_lock() is the only place where we could do without acquire, but it doesn't seem worth to introduce extra complexity just to make this access relaxed, because it does not seem to be used in any place that looks very performance sensitive.
> 
> If it were me, I'd probably also change the other mark() calls to MO_ACQUIRE for consistency, but that might be overkill.
> 
> Testing:
>  - [x] tier1
>  - [x] tier2

@rkennke two reviews are required for hotspot changes!

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

PR: https://git.openjdk.java.net/jdk/pull/4829


More information about the hotspot-dev mailing list