RFR: 8261027: AArch64: Support for LSE atomics C++ HotSpot code [v2]

Stefan Karlsson stefank at openjdk.java.net
Tue Feb 9 08:51:51 UTC 2021


On Mon, 8 Feb 2021 17:40:27 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp line 88:
>> 
>>> 86:   template<typename D, typename I>
>>> 87:   D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const {
>>> 88:     D old_value = fetch_and_add(dest, add_value, order) + add_value;
>> 
>> I'm not sure this should be called old_value. It is actually old_value + add_value i.e. it really ought to be called eiter new_value (or just value?).
>
> Sure. This templated code is copied from os_cpu/linux_x86, so I kept the names the same as in that file. But you're right, that would make more sense.

FTR, the linux_x86 code doesn't use old_value for the add_and_fetch version:
  template<typename D, typename I>
  D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const {
    return fetch_and_add(dest, add_value, order) + add_value;
  }
only the fetch_and_add functions do. But I think that's correct.

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

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


More information about the hotspot-dev mailing list