summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am1
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh43
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh11
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh90
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc4
8 files changed, 100 insertions, 55 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
index 6dfec3bfa70..66594bbcd19 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/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/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh
index 12caacaaba7..02cf6f38811 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh
@@ -46,6 +46,41 @@
/* 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
+
+/* 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_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, std::memory_order_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) && (defined(_WIN32) || defined(__CYGWIN__))
#include <windows.h>
@@ -162,16 +197,18 @@ typedef int hb_atomic_int_impl_t;
#endif
+#ifndef HB_ATOMIC_INT_INIT
#define HB_ATOMIC_INT_INIT(V) {V}
+#endif
struct hb_atomic_int_t
{
- hb_atomic_int_impl_t v;
+ mutable hb_atomic_int_impl_t v;
inline void set_unsafe (int v_) { v = v_; }
inline int get_unsafe (void) const { return v; }
- inline int inc (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_int_impl_t &> (v), 1); }
- inline int dec (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_int_impl_t &> (v), -1); }
+ inline int inc (void) { return hb_atomic_int_impl_add (v, 1); }
+ inline int dec (void) { return hb_atomic_int_impl_add (v, -1); }
};
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh
index 6a8ddaa995b..fc7d1f0a904 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh
@@ -450,8 +450,7 @@ template <typename Type, unsigned int StaticSize=8>
struct hb_vector_t
{
unsigned int len;
- unsigned int allocated;
- bool successful;
+ unsigned int allocated; /* == 0 means allocation failed. */
Type *arrayZ;
Type static_array[StaticSize];
@@ -459,7 +458,6 @@ struct hb_vector_t
{
len = 0;
allocated = ARRAY_LENGTH (static_array);
- successful = true;
arrayZ = static_array;
}
@@ -492,7 +490,7 @@ struct hb_vector_t
/* Allocate for size but don't adjust len. */
inline bool alloc (unsigned int size)
{
- if (unlikely (!successful))
+ if (unlikely (!allocated))
return false;
if (likely (size <= allocated))
@@ -521,7 +519,7 @@ struct hb_vector_t
if (unlikely (!new_array))
{
- successful = false;
+ allocated = 0;
return false;
}
@@ -854,8 +852,7 @@ struct hb_vector_size_t
union {
elt_t v[byte_size / sizeof (elt_t)];
#if HB_VECTOR_SIZE
- typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
- vec_t vec[byte_size / sizeof (vec_t)];
+ hb_vector_size_impl_t vec[byte_size / sizeof (hb_vector_size_impl_t)];
#endif
} u;
};
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh
index fcdc9256d9b..8199c4b8407 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/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}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh
index 207f6e0e204..f6113c33aaf 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh
@@ -1247,7 +1247,7 @@ struct hb_lazy_loader_t
private:
hb_face_t *face;
- T *instance;
+ mutable T *instance;
};
/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
index b1cba1c711d..0c4948dfdf4 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
@@ -250,7 +250,7 @@ struct arabic_shape_plan_t
* mask_array[NONE] == 0. */
hb_mask_t mask_array[ARABIC_NUM_FEATURES + 1];
- arabic_fallback_plan_t *fallback_plan;
+ mutable arabic_fallback_plan_t *fallback_plan;
unsigned int do_fallback : 1;
unsigned int has_stch : 1;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
index ff339df4dca..ddb256f80d5 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
@@ -84,19 +84,9 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
#endif
-/* Compiler attributes */
-
-
-template <typename T>
-struct _hb_alignof
-{
- struct s
- {
- char c;
- T t;
- };
- static constexpr unsigned int value = offsetof (s, t);
-};
+/*
+ * Compiler attributes
+ * */
#if __cplusplus < 201103L
@@ -122,6 +112,16 @@ struct _hb_alignof
#define thread_local
#endif
+template <typename T>
+struct _hb_alignof
+{
+ struct s
+ {
+ char c;
+ T t;
+ };
+ static constexpr size_t value = offsetof (s, t);
+};
#ifndef alignof
#define alignof(x) (_hb_alignof<x>::value)
#endif // alignof
@@ -334,6 +334,39 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
TypeName(const TypeName&); \
void operator=(const TypeName&)
+
+/*
+ * Compiler-assisted vectorization parameters.
+ */
+
+/*
+ * Disable vectorization for now. To correctly use them, we should
+ * use posix_memalign() to allocate in hb_vector_t. Otherwise, can
+ * cause misaligned access.
+ *
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=860184
+ */
+#if !defined(HB_VECTOR_SIZE)
+# define HB_VECTOR_SIZE 0
+#endif
+
+/* The `vector_size' attribute was introduced in gcc 3.1. */
+#if !defined(HB_VECTOR_SIZE)
+# if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
+# define HB_VECTOR_SIZE 128
+# else
+# define HB_VECTOR_SIZE 0
+# endif
+#endif
+static_assert (0 == (HB_VECTOR_SIZE & (HB_VECTOR_SIZE - 1)), "HB_VECTOR_SIZE is not power of 2.");
+static_assert (0 == (HB_VECTOR_SIZE % 64), "HB_VECTOR_SIZE is not multiple of 64.");
+#if HB_VECTOR_SIZE
+typedef uint64_t hb_vector_size_impl_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
+#else
+typedef uint64_t hb_vector_size_impl_t;
+#endif
+
+
/*
* Static pools
*/
@@ -341,18 +374,18 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
/* Global nul-content Null pool. Enlarge as necessary. */
#define HB_NULL_POOL_SIZE 264
-static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
#ifdef HB_NO_VISIBILITY
static
#else
extern HB_INTERNAL
#endif
-void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)]
+hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)]
#ifdef HB_NO_VISIBILITY
= {}
#endif
;
+
/* Generic nul-content Null objects. */
template <typename Type>
static inline Type const & Null (void) {
@@ -385,11 +418,12 @@ static
#else
extern HB_INTERNAL
#endif
-/*thread_local*/ void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)]
+/*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)]
#ifdef HB_NO_VISIBILITY
= {}
#endif
;
+
/* CRAP pool: Common Region for Access Protection. */
template <typename Type>
static inline Type& Crap (void) {
@@ -503,30 +537,6 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
#define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
-
-/* Compiler-assisted vectorization. */
-
-/*
- * Disable vectorization for now. To correctly use them, we should
- * use posix_memalign() to allocate them. Otherwise, can cause
- * misaligned access.
- *
- * https://bugs.chromium.org/p/chromium/issues/detail?id=860184
- */
-#if !defined(HB_VECTOR_SIZE)
-# define HB_VECTOR_SIZE 0
-#endif
-
-/* The `vector_size' attribute was introduced in gcc 3.1. */
-#if !defined(HB_VECTOR_SIZE)
-# if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
-# define HB_VECTOR_SIZE 128
-# else
-# define HB_VECTOR_SIZE 0
-# endif
-#endif
-
-
/* Global runtime options. */
struct hb_options_t
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc
index e26e5c80154..ee17cd3481c 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc
@@ -27,6 +27,6 @@
#include "hb-private.hh"
#ifndef HB_NO_VISIBILITY
-void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
-/*thread_local*/ void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
+hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {};
+/*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {};
#endif