From ad275627425c9b3c4fb1e69aa408067bd0bb77da Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 31 Jul 2018 23:01:05 -0700 Subject: [PATCH] [atomic] On IBM, use light-weight sync for everything lwsync() is a full read/write-barrier. That's all we need, never need sync(). I'm not sure why an isync() was used in fetch_and_add, but since that's a read-modify-write, I just changed it to have lwsync() on both sides. --- src/hb-atomic-private.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index 0d0badfb4..f60c46e30 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -163,20 +163,20 @@ static inline void _hb_memory_barrier (void) { OSMemoryBarrier (); } static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) { __lwsync(); int result = __fetch_and_add(AI, V); - __isync(); + __lwsync(); return result; } static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) { - __sync(); + __lwsync(); int result = __compare_and_swaplp (P, &O, N); - __sync(); + __lwsync(); return result; } typedef int hb_atomic_int_impl_t; #define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V)) -static inline void _hb_memory_barrier (void) { __sync(); } +static inline void _hb_memory_barrier (void) { __lwsync(); } #define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))