RFR: 8365147: AArch64: Replace DMB + LD + DMB with LDAR for C1 volatile field loads [v4]

Andrew Haley aph at openjdk.org
Thu Jan 15 09:43:07 UTC 2026


On Wed, 19 Nov 2025 12:47:18 GMT, Samuel Chee <duke at openjdk.org> wrote:

>> Replaces the DMB ISH + LD + DMB ISHLD sequence with LDAR for volatile field loads - for example, AtomicLong::get.
>> 
>> This is valid, as originally the DMBs were necessary due to the case described here - https://bugs.openjdk.org/browse/JDK-8179954. As in the rare case where the LD can be reordered with an LDAR or STLR from the C2 implementation for stores and loads, these DMBs are required.
>> However, acquire/release operations use a sequentially consistent model which does not allow reordering between them. Hence, the LD can be replaced with an LDAR to disallow reordering with a STLR/LDAR and the first DMB can be removed.
>> 
>> The LDAR has acquire semantics, so it's impossible for memory accesses after to be reordered before; the DMB ISHLD is not required. Therefore, a singular LDAR is sufficient.
>
> Samuel Chee has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Rename load_generic -> load_relaxed

This is a string of volatile stores. It'd be nice to get it fixed too.


   2.94%      │   │   ↘↘↘│││  0x0000ffff35382988:   movz		w0, #0, lsl #16
   1.26%      │   │      │││  0x0000ffff3538298c:   dmb		ish
   4.04%      │   │      │││  0x0000ffff35382990:   str		w0, [x1, #0xc]
              │   │      │││  0x0000ffff35382994:   dmb		ish                 ;*putfield intField1 {reexecute=0 rethrow=0 return_oop=0}
              │   │      │││                                                            ; - org.openjdk.bench.vm.compiler.PostAllocationStores$TestWithNullVolatileStores::<init>@21 (line 120)
   4.41%      │   │      │││  0x0000ffff35382998:   movz		w0, #0, lsl #16
              │   │      │││  0x0000ffff3538299c:   dmb		ish
   3.14%      │   │      │││  0x0000ffff353829a0:   str		w0, [x1, #0x18]
              │   │      │││  0x0000ffff353829a4:   dmb		ish                 ;*putfield intField2 {reexecute=0 rethrow=0 return_oop=0}
              │   │      │││                                                            ; - org.openjdk.bench.vm.compiler.PostAllocationStores$TestWithNullVolatileStores::<init>@26 (line 121)
   2.91%      │   │      │││  0x0000ffff353829a8:   mov		x0, #0
              │   │      │││  0x0000ffff353829ac:   dmb		ish
   1.75%      │   │      │││  0x0000ffff353829b0:   str		x0, [x1, #0x10]
              │   │      │││  0x0000ffff353829b4:   dmb		ish                 ;*putfield longField1 {reexecute=0 rethrow=0 return_oop=0}
              │   │      │││                                                            ; - org.openjdk.bench.vm.compiler.PostAllocationStores$TestWithNullVolatileStores::<in

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

PR Comment: https://git.openjdk.org/jdk/pull/26748#issuecomment-3753791741


More information about the hotspot-dev mailing list