[aarch64-port-dev ] RFR: aarch64: minor improvements of atomic operations

Andrew Haley aph at redhat.com
Mon Nov 11 17:53:06 UTC 2019


On 11/11/19 5:11 PM, Erik Österlund wrote:
> Hi Felix,
> 
> Would uou mind pasting a link to the proposed change? I can not determine its validity otherwise.



Patch:

diff -r 2700c409ff10 src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp
--- a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp Sun Nov 03 18:02:29 2019 -0500
+++ b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp Wed Nov 06 14:13:00 2019 +0800
@@ -40,8 +40,7 @@
{
   template<typename I, typename D>
   D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const {
-    D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
-    FULL_MEM_BARRIER;
+    D res = __atomic_add_fetch(dest, add_value, __ATOMIC_ACQ_REL);
     return res;
   }
};
@@ -52,8 +51,7 @@
                                                      T volatile* dest,
                                                      atomic_memory_order order) const {
   STATIC_ASSERT(byte_size == sizeof(T));
-  T res = __sync_lock_test_and_set(dest, exchange_value);
-  FULL_MEM_BARRIER;
+  T res = __atomic_exchange_n(dest, exchange_value, __ATOMIC_ACQ_REL);
   return res;
}



-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-dev mailing list