[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.
This commit is contained in:
Behdad Esfahbod 2018-07-31 23:01:05 -07:00
parent fd638d215f
commit ad27562742
1 changed files with 4 additions and 4 deletions

View File

@ -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))