RFR: 8360654: AArch64: Remove redundant dmb from C1 compareAndSet [v2]

Samuel Chee duke at openjdk.org
Tue Aug 19 12:56:35 UTC 2025


On Wed, 6 Aug 2025 14:07:12 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> My proposal is:
>> 
>> 1. For `cmpxchg`, we add a trailingDMB option, and emit if `!useLSE && trailingDMB`, moving the dmbs from outside to inside the method. Have default value for trailingDMB be false so other call sites won't emit this dmb hence won't be affected.
>> 
>> 2. In a separate ticket, `cmpxchgptr` and `cmpxchgw` already have DMBs inside their method definitions, so add extra trailingDMB parameter defaulted to true. And emit dmb if true.
>> 
>> 3. In a separate ticket, apply same logic to `atomic_##NAME` to move DMB inside function and default trailingDMB to false to not affect other call sites.
>> 
>> Does this sound good to you?
>
>> My proposal is:
>> 
>>     1. For `cmpxchg`, we add a trailingDMB option, and emit if `!useLSE && trailingDMB`, moving the dmbs from outside to inside the method. Have default value for trailingDMB be false so other call sites won't emit this dmb hence won't be affected.
> 
> I think it would be better to refactor things so that the intent is clear. better have `cmpxchg_barrier` and use that for C1.
> 
>>     2. In a separate ticket, `cmpxchgptr` and `cmpxchgw` already have DMBs inside their method definitions, so add extra trailingDMB parameter defaulted to true. And emit dmb if true.
> 
> Likewise.
> 
>>     3. In a separate ticket, apply same logic to `atomic_##NAME` to move DMB inside function and default trailingDMB to false to not affect other call sites.
> 
> Likewise.

Have just addressed for this PR, should have one for cmpxchgptr up shortly in a seperate pr.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26000#discussion_r2285160803


More information about the hotspot-compiler-dev mailing list