[HarfBuzz] harfbuzz: Branch 'master' - 7 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Aug 1 21:15:16 UTC 2018
appveyor.yml | 1
docs/harfbuzz-sections.txt | 1
src/hb-atomic-private.hh | 75 ++++++++++++++++++++++----------
src/hb-ot-layout-common-private.hh | 14 ------
src/hb-ot-layout.cc | 86 -------------------------------------
src/hb-ot-layout.h | 8 ---
6 files changed, 53 insertions(+), 132 deletions(-)
New commits:
commit 13f4c137c686aed5c2888b5c47d9f16892be0d5e
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 1 14:13:59 2018 -0700
[atomic] Fix Solaris ones to add proper barriers
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 0e7a8414..0b043e69 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -62,7 +62,7 @@ _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)))
+#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
@@ -82,7 +82,7 @@ _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)))
+#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__))
@@ -127,9 +127,25 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_barrier() __machine_rw_barrier ()
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) /* XXX barrier again? */)
-#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? */)
+static inline int _hb_fetch_and_add (hb_atomic_int_impl_t *AI, int V)
+{
+ _hb_memory_w_barrier ();
+ int result = atomic_add_int_nv (AI, V);
+ _hb_memory_r_barrier ();
+ return result;
+}
+static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, const void *N)
+{
+ _hb_memory_w_barrier ();
+ int result = atomic_cas_ptr ((void **) P, (void *) O, (void *) N) == (void *) O;
+ _hb_memory_r_barrier ();
+ return result;
+}
+
+#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
+
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swap_ptr ((const void **) (P), (O), (N))
#elif !defined(HB_NO_MT) && defined(__APPLE__)
@@ -161,25 +177,29 @@ typedef int32_t hb_atomic_int_impl_t;
#include <builtins.h>
-static inline int _hb_fetch_and_add (int* AI, unsigned int V) {
- __lwsync();
- int result = __fetch_and_add(AI, V);
- __lwsync();
+#define _hb_memory_barrier() __lwsync ()
+
+typedef int hb_atomic_int_impl_t;
+
+static inline int _hb_fetch_and_add (hb_atomic_int_impl_t *AI, int V)
+{
+ _hb_memory_barrier ();
+ int result = __fetch_and_add (AI, V);
+ _hb_memory_barrier ();
return result;
}
-static inline int _hb_compare_and_swaplp (long* P, long O, long N) {
- __lwsync();
- int result = __compare_and_swaplp (P, &O, N);
- __lwsync();
+static inline bool _hb_compare_and_swaplp (long *P, long O, long N)
+{
+ _hb_memory_barrier ();
+ bool result = __compare_and_swaplp (P, &O, N);
+ _hb_memory_barrier ();
return result;
}
-#define _hb_memory_barrier() __lwsync ()
-
-typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
-#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long *) (P), (long) (O), (long) (N))
+static_assert ((sizeof (long) == sizeof (void *)), "");
#elif !defined(HB_NO_MT)
commit 19dfaa351568887a74cee2c46d6acfcc3fa718ff
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 1 14:02:39 2018 -0700
[atomic] Remove volatile from IBM impl signature
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 3239193a..0e7a8414 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -161,13 +161,13 @@ typedef int32_t hb_atomic_int_impl_t;
#include <builtins.h>
-static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) {
+static inline int _hb_fetch_and_add (int* AI, unsigned int V) {
__lwsync();
int result = __fetch_and_add(AI, V);
__lwsync();
return result;
}
-static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) {
+static inline int _hb_compare_and_swaplp (long* P, long O, long N) {
__lwsync();
int result = __compare_and_swaplp (P, &O, N);
__lwsync();
commit 2093a3e0cbb98c2daa39f308d50a12f0a719bc81
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 1 14:00:46 2018 -0700
[atomic] Oops
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index bd28a563..3239193a 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -123,7 +123,7 @@ typedef int hb_atomic_int_impl_t;
#include <mbarrier.h>
#define _hb_memory_r_barrier() __machine_r_barrier ()
-#define _hb_memory_w_barrier() __machine_r_barrier ()
+#define _hb_memory_w_barrier() __machine_w_barrier ()
#define _hb_memory_barrier() __machine_rw_barrier ()
typedef unsigned int hb_atomic_int_impl_t;
commit 19b98348ffc660501e518bf48cd63d232f7585e7
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 1 13:59:59 2018 -0700
[atomic] Use read-barrier for get()
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 3c321020..bd28a563 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -223,7 +223,7 @@ typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_get_relaxed(AI) (*(AI))
#endif
#ifndef hb_atomic_ptr_impl_get
-inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; _hb_memory_barrier (); return v; }
+inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; _hb_memory_r_barrier (); return v; }
#endif
commit 006d4f031a30dd04f5bb9c3d1daca187ef6b7f1e
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 1 13:59:31 2018 -0700
[atomic] Some more minor tweaks
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 852b2242..3c321020 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -99,6 +99,7 @@ static inline void _hb_memory_barrier (void)
MemoryBarrier ();
#endif
}
+#define _hb_memory_barrier() _hb_memory_barrier ()
typedef LONG hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((AI), (V))
@@ -108,11 +109,11 @@ typedef LONG hb_atomic_int_impl_t;
#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
+#define _hb_memory_barrier() __sync_synchronize ()
+
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add ((AI), (V))
-static inline void _hb_memory_barrier (void) { __sync_synchronize (); }
-
#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
@@ -121,11 +122,13 @@ static inline void _hb_memory_barrier (void) { __sync_synchronize (); }
#include <atomic.h>
#include <mbarrier.h>
+#define _hb_memory_r_barrier() __machine_r_barrier ()
+#define _hb_memory_w_barrier() __machine_r_barrier ()
+#define _hb_memory_barrier() __machine_rw_barrier ()
+
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) /* 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 /* XXX barrier again? */)
@@ -138,12 +141,11 @@ static inline void _hb_memory_barrier (void) { __machine_rw_barrier (); }
#include <Availability.h>
#endif
+#define _hb_memory_barrier() OSMemoryBarrier ()
typedef int32_t hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) (OSAtomicAdd32Barrier ((V), (AI)) - (V))
-static inline void _hb_memory_barrier (void) { OSMemoryBarrier (); }
-
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
#else
@@ -159,7 +161,6 @@ static inline void _hb_memory_barrier (void) { OSMemoryBarrier (); }
#include <builtins.h>
-
static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) {
__lwsync();
int result = __fetch_and_add(AI, V);
@@ -173,21 +174,23 @@ static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) {
return result;
}
+#define _hb_memory_barrier() __lwsync ()
+
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) { __lwsync(); }
-
#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. */
+#define _hb_memory_barrier()
+
typedef volatile int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
-static inline void _hb_memory_barrier (void) {}
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
@@ -196,7 +199,7 @@ static inline void _hb_memory_barrier (void) {}
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
-static inline void _hb_memory_barrier (void) {}
+#define _hb_memory_barrier()
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false)
@@ -204,6 +207,12 @@ static inline void _hb_memory_barrier (void) {}
#endif
+#ifndef _hb_memory_r_barrier
+#define _hb_memory_r_barrier() _hb_memory_barrier ()
+#endif
+#ifndef _hb_memory_w_barrier
+#define _hb_memory_w_barrier() _hb_memory_barrier ()
+#endif
#ifndef HB_ATOMIC_INT_INIT
#define HB_ATOMIC_INT_INIT(V) {V}
#endif
commit 28d03a8afcc1f0ba6d9d0d88f669cc53bb030dd8
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Thu Aug 2 00:11:43 2018 +0430
[ci] Fix Appveyor bot (#1123)
diff --git a/appveyor.yml b/appveyor.yml
index 6250a91e..cc4acec1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -44,6 +44,7 @@ build_script:
- 'if "%compiler%"=="msvc" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%'
- 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" ctest --output-on-failure -C %configuration%'
+ - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syyu mingw-w64-$MSYS2_ARCH-gcc"'
- 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config,python2}"'
- 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "curl https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h > %MINGW_PREFIX%/%MINGW_CHOST%/include/dwrite_1.h"'
- 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || .ci/fail.sh"'
commit 1a7fed631880fff8a947ebec9c7427efff581916
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Wed Aug 1 12:15:44 2018 +0430
Revert "Add a new API, hb_ot_layout_get_feature_name_ids (#976)" (#1121)
This reverts commit 0c1b287b72e91e0898d75acb5d5acf1c6b9a7498.
diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index db4e71af..65ea1f90 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -453,7 +453,6 @@ hb_ot_layout_collect_features
hb_ot_layout_feature_get_lookups
hb_ot_layout_feature_with_variations_get_lookups
hb_ot_layout_get_attach_points
-hb_ot_layout_get_feature_name_ids
hb_ot_layout_get_glyph_class
hb_ot_layout_get_glyphs_in_class
hb_ot_layout_get_ligature_carets
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index 76ad30cf..2da6e315 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -494,20 +494,6 @@ struct FeatureParams
return Null(FeatureParamsSize);
}
- inline const FeatureParamsStylisticSet& get_stylistic_set_params (hb_tag_t tag) const
- {
- if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
- return u.stylisticSet;
- return Null(FeatureParamsStylisticSet);
- }
-
- inline const FeatureParamsCharacterVariants& get_character_variants_params (hb_tag_t tag) const
- {
- if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
- return u.characterVariants;
- return Null(FeatureParamsCharacterVariants);
- }
-
private:
union {
FeatureParamsSize size;
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index db782348..1cb0c3ad 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1029,24 +1029,6 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
OT::GPOS::position_finish_offsets (font, buffer);
}
-static const OT::FeatureParams&
-_get_gsubgpos_matched_feature_params (hb_face_t *face, hb_tag_t feature)
-{
- const OT::GSUB &gsub = _get_gsub (face);
- unsigned int gsub_num_features = gsub.get_feature_count ();
- for (unsigned int i = 0; i < gsub_num_features; i++)
- if (feature == gsub.get_feature_tag (i))
- return gsub.get_feature (i).get_feature_params ();
-
- const OT::GPOS &gpos = _get_gpos (face);
- unsigned int gpos_num_features = gpos.get_feature_count ();
- for (unsigned int i = 0; i < gpos_num_features; i++)
- if (feature == gpos.get_feature_tag (i))
- return gpos.get_feature (i).get_feature_params ();
-
- return Null (OT::FeatureParams);
-}
-
/**
* hb_ot_layout_get_size_params:
*
@@ -1097,74 +1079,6 @@ hb_ot_layout_get_size_params (hb_face_t *face,
return false;
}
-/**
- * hb_ot_layout_get_feature_name_ids:
- * @face: #hb_face_t to work upon
- * @feature: ssXX and cvXX tag
- * @label_id: (out) (allow-none): The ‘name’ table name ID that specifies a string
- * for a user-interface label for this feature. (May be NULL.)
- * @tooltip_id: (out) (allow-none): The ‘name’ table name ID that specifies a string
- * that an application can use for tooltip text for this
- * feature. (May be NULL.)
- * @sample_id: (out) (allow-none): The ‘name’ table name ID that specifies sample text
- * that illustrates the effect of this feature. (May be NULL.)
- * @num_named_parameters: (out) (allow-none): Number of named parameters. (May be zero.)
- * @first_param_id: (out) (allow-none): The first ‘name’ table name ID used to specify
- * strings for user-interface labels for the feature
- * parameters. (Must be zero if numParameters is zero.)
- *
- * Return value: true if could find any feature with the tag, false otherwise
- *
- * Since: REPLACEME
- **/
-hb_bool_t
-hb_ot_layout_get_feature_name_ids (hb_face_t *face,
- hb_tag_t feature,
- unsigned int *label_id, /* OUT. May be nullptr */
- unsigned int *tooltip_id, /* OUT. May be nullptr */
- unsigned int *sample_id, /* OUT. May be nullptr */
- unsigned int *num_named_parameters, /* OUT. May be nullptr */
- unsigned int *first_param_id /* OUT. May be nullptr */)
-{
- const OT::FeatureParams &feature_params =
- _get_gsubgpos_matched_feature_params (face, feature);
- if (&feature_params != &Null (OT::FeatureParams))
- {
- const OT::FeatureParamsStylisticSet& ss_params =
- feature_params.get_stylistic_set_params (feature);
- if (&ss_params != &Null (OT::FeatureParamsStylisticSet)) /* ssXX */
- {
-#define PARAM(a, A) if (a) *a = A
- PARAM(label_id, ss_params.uiNameID);
- // ssXX features don't have the rest
- PARAM(tooltip_id, 0);
- PARAM(sample_id, 0);
- PARAM(num_named_parameters, 0);
- PARAM(first_param_id, 0);
- return true;
- }
- const OT::FeatureParamsCharacterVariants& cv_params =
- feature_params.get_character_variants_params (feature);
- if (&cv_params != &Null (OT::FeatureParamsCharacterVariants)) /* cvXX */
- {
- PARAM(label_id, cv_params.featUILableNameID);
- PARAM(tooltip_id, cv_params.featUITooltipTextNameID);
- PARAM(sample_id, cv_params.sampleTextNameID);
- PARAM(num_named_parameters, cv_params.numNamedParameters);
- PARAM(first_param_id, cv_params.firstParamUILabelNameID);
- return true;
- }
- }
-
- PARAM(label_id, 0);
- PARAM(tooltip_id, 0);
- PARAM(sample_id, 0);
- PARAM(num_named_parameters, 0);
- PARAM(first_param_id, 0);
-#undef PARAM
- return false;
-}
-
/*
* Parts of different types are implemented here such that they have direct
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index f81b9dd4..586fb151 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -329,14 +329,6 @@ hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *range_start, /* OUT. May be NULL */
unsigned int *range_end /* OUT. May be NULL */);
-HB_EXTERN hb_bool_t
-hb_ot_layout_get_feature_name_ids (hb_face_t *face,
- hb_tag_t feature,
- unsigned int *label_id /* OUT. May be NULL */,
- unsigned int *tooltip_id /* OUT. May be NULL */,
- unsigned int *sample_id /* OUT. May be NULL */,
- unsigned int *num_named_parameters /* OUT. May be NULL */,
- unsigned int *first_param_id /* OUT. May be NULL */);
/*
* BASE
More information about the HarfBuzz
mailing list