src/hb-atomic-private.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit ad275627425c9b3c4fb1e69aa408067bd0bb77da Author: Behdad Esfahbod <[email protected]> Date: Tue Jul 31 23:01:05 2018 -0700 [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. diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index 0d0badfb..f60c46e3 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)) commit fd638d215feb058c2294e447cc68f6f50e2b481d Author: Behdad Esfahbod <[email protected]> Date: Tue Jul 31 23:00:15 2018 -0700 [atomic] Add XXX items around Solaris ops Since add_int and cas are both read-modify-write, I wonder if we also need a barrier after them. diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index ef72872a..0d0badfb 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -122,11 +122,11 @@ static inline void _hb_memory_barrier (void) { __sync_synchronize (); } #include <mbarrier.h> typedef unsigned int hb_atomic_int_impl_t; -#define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv ((AI), (V)) - (V)) +#define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv ((AI), (V)) - (V) /* XXX barrier again? */) static inline void _hb_memory_barrier (void) { __machine_rw_barrier (); } -#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false /* XXX barrier again? */) #elif !defined(HB_NO_MT) && defined(__APPLE__) _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
