[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Jul 17 09:03:10 UTC 2018
src/Makefile.am | 1 +
src/hb-atomic-private.hh | 22 +++++++++++++++++++---
src/hb-object-private.hh | 2 +-
test/api/Makefile.am | 2 ++
4 files changed, 23 insertions(+), 4 deletions(-)
New commits:
commit 04b7b81bcbf19cb85d06d930192d6591ba45ef72
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 17 10:57:01 2018 +0200
Reland "Implement C++11-style GCC builtin atomic ops"
Fixed the crasher in it.
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 14960026..02cf6f38 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -46,21 +46,37 @@
/* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */
+#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE)
+
+/* C++11-style GCC primitives. */
+
+typedef int hb_atomic_int_impl_t;
+#define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add (&(AI), (V), __ATOMIC_ACQ_REL)
+
+#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_ACQUIRE)
+static inline bool
+_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
+{
+ const void *O = O_; // Need lvalue
+ return __atomic_compare_exchange_n ((void **) P, (void **) &O, (void *) N, true, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
+}
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N)))
+
#elif !defined(HB_NO_MT) && __cplusplus >= 201103L
-/* Prefer C++11 atomics. */
+/* C++11 atomics. */
#include <atomic>
typedef int hb_atomic_int_impl_t;
-#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add (V, std::memory_order_acq_rel))
+#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add ((V), std::memory_order_acq_rel))
#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_acquire))
static inline bool
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
{
const void *O = O_; // Need lvalue
- return reinterpret_cast<std::atomic<const void*> *> (P)->compare_exchange_weak ((O), (N), std::memory_order_acq_rel);
+ return reinterpret_cast<std::atomic<const void*> *> (P)->compare_exchange_weak (O, N, std::memory_order_acq_rel, std::memory_order_relaxed);
}
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N)))
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index fcdc9256..8199c4b8 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -94,7 +94,7 @@ struct hb_user_data_array_t
struct hb_object_header_t
{
hb_reference_count_t ref_count;
- hb_user_data_array_t *user_data;
+ mutable hb_user_data_array_t *user_data;
#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, nullptr}
commit 019d18e9ae643134bfc3861be65ac618a5892c92
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 17 10:59:19 2018 +0200
Minor
diff --git a/src/Makefile.am b/src/Makefile.am
index 6dfec3bf..66594bbc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,7 @@ check_PROGRAMS =
# Convenience targets:
lib: $(BUILT_SOURCES) libharfbuzz.la libharfbuzz-subset.la
+libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES)
fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la libharfbuzz-subset-fuzzing.la
lib_LTLIBRARIES = libharfbuzz.la
diff --git a/test/api/Makefile.am b/test/api/Makefile.am
index 65ceeda3..a2033449 100644
--- a/test/api/Makefile.am
+++ b/test/api/Makefile.am
@@ -9,6 +9,8 @@ MAINTAINERCLEANFILES =
# Convenience targets:
lib:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
+libs:
+ @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs
EXTRA_DIST += CMakeLists.txt
More information about the HarfBuzz
mailing list