8145077: AIX: fix harfbuzz support
authorsimonis
Fri, 11 Dec 2015 16:16:55 +0100
changeset 34542 380f00c8ed95
parent 34541 7f475f6f0d56
child 34543 7c2e29c8d285
8145077: AIX: fix harfbuzz support Reviewed-by: prr
jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh
--- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Fri Dec 11 09:34:56 2015 -0500
+++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Fri Dec 11 16:16:55 2015 +0100
@@ -119,6 +119,31 @@
 #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)
 
 
+#elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
+
+#include <builtins.h>
+
+
+static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) {
+  __lwsync();
+  int result = __fetch_and_add(AI, V);
+  __isync();
+  return result;
+}
+static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
+  __sync();
+  int result = __compare_and_swaplp (P, &O, N);
+  __sync();
+  return result;
+}
+
+typedef int hb_atomic_int_impl_t;
+#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
+#define hb_atomic_int_impl_add(AI, V)           hb_fetch_and_add (&(AI), (V))
+
+#define hb_atomic_ptr_impl_get(P)               (__sync(), (void *) *(P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)       hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
+
 #elif !defined(HB_NO_MT)
 
 #define HB_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */