summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-08-14 23:58:28 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-08-14 23:58:28 +0000
commit6af38938c1752bf61b8855db1f1524d0e9ed6097 (patch)
tree06d78158db2546416bbfd6f990f7f5c1264d3fa1 /Build/source
parenta54d196b0fc4715e3d2dbcfe62cfccea6aae57fe (diff)
harfbuzz 1.8.8
git-svn-id: svn://tug.org/texlive/trunk@48403 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/libs/README2
-rw-r--r--Build/source/libs/harfbuzz/ChangeLog5
-rw-r--r--Build/source/libs/harfbuzz/TLpatches/ChangeLog5
-rw-r--r--Build/source/libs/harfbuzz/TLpatches/TL-Changes2
-rwxr-xr-xBuild/source/libs/harfbuzz/configure24
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog423
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/NEWS18
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/configure.ac2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh68
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc84
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh3
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc6
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc112
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc49
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc16
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc66
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh200
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh34
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc56
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh4
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh9
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc9
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh15
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc19
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc74
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh2
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh16
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc78
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc50
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc59
-rw-r--r--Build/source/libs/harfbuzz/version.ac2
35 files changed, 1030 insertions, 491 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README
index 49aacddb45b..cbcf42211b2 100644
--- a/Build/source/libs/README
+++ b/Build/source/libs/README
@@ -24,7 +24,7 @@ gmp 6.1.2 - checked 16dec16
graphite2 1.3.11 - checked 05mar18
http://sourceforge.net/projects/silgraphite/files/graphite2/
-harfbuzz 1.8.7 - checked 09aug18
+harfbuzz 1.8.8 - checked 15aug18
http://www.freedesktop.org/software/harfbuzz/release/
icu 61.1 - checked 29mar18
diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog
index ec41cac0aba..f6663a60671 100644
--- a/Build/source/libs/harfbuzz/ChangeLog
+++ b/Build/source/libs/harfbuzz/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ Import harfbuzz-1.8.8.
+ * version.ac: Adjusted.
+
2018-08-09 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Import harfbuzz-1.8.7.
diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog
index 5fe9d972cfe..34acd8fe52d 100644
--- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog
+++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ Imported harfbuzz-1.8.8 source tree from:
+ http://www.freedesktop.org/software/harfbuzz/release/
+
2018-08-09 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Imported harfbuzz-1.8.7 source tree from:
diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes
index 5b1920c3e39..ed5f79ba8f6 100644
--- a/Build/source/libs/harfbuzz/TLpatches/TL-Changes
+++ b/Build/source/libs/harfbuzz/TLpatches/TL-Changes
@@ -1,4 +1,4 @@
-Changes applied to the harfbuzz-1.8.7/ tree as obtained from:
+Changes applied to the harfbuzz-1.8.8/ tree as obtained from:
http://www.freedesktop.org/software/harfbuzz/release/
Removed:
diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure
index 22dfe9adf79..ce1b6cf0d6e 100755
--- a/Build/source/libs/harfbuzz/configure
+++ b/Build/source/libs/harfbuzz/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 1.8.7.
+# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 1.8.8.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='harfbuzz (TeX Live)'
PACKAGE_TARNAME='harfbuzz--tex-live-'
-PACKAGE_VERSION='1.8.7'
-PACKAGE_STRING='harfbuzz (TeX Live) 1.8.7'
+PACKAGE_VERSION='1.8.8'
+PACKAGE_STRING='harfbuzz (TeX Live) 1.8.8'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1317,7 +1317,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures harfbuzz (TeX Live) 1.8.7 to adapt to many kinds of systems.
+\`configure' configures harfbuzz (TeX Live) 1.8.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1388,7 +1388,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of harfbuzz (TeX Live) 1.8.7:";;
+ short | recursive ) echo "Configuration of harfbuzz (TeX Live) 1.8.8:";;
esac
cat <<\_ACEOF
@@ -1495,7 +1495,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-harfbuzz (TeX Live) configure 1.8.7
+harfbuzz (TeX Live) configure 1.8.8
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2131,7 +2131,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by harfbuzz (TeX Live) $as_me 1.8.7, which was
+It was created by harfbuzz (TeX Live) $as_me 1.8.8, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -4054,7 +4054,7 @@ fi
# Define the identity of the package.
PACKAGE='harfbuzz--tex-live-'
- VERSION='1.8.7'
+ VERSION='1.8.8'
# Some tools Automake needs.
@@ -4248,8 +4248,8 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags
HB_VERSION_MAJOR=1
HB_VERSION_MINOR=8
-HB_VERSION_MICRO=7
-HB_VERSION=1.8.7
+HB_VERSION_MICRO=8
+HB_VERSION=1.8.8
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -8140,7 +8140,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by harfbuzz (TeX Live) $as_me 1.8.7, which was
+This file was extended by harfbuzz (TeX Live) $as_me 1.8.8, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8206,7 +8206,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-harfbuzz (TeX Live) config.status 1.8.7
+harfbuzz (TeX Live) config.status 1.8.8
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog
index cc6f946d4f8..a9bca1bb51d 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog
@@ -1,3 +1,426 @@
+commit c9a22fa124310c98c73b8d7b495ed354542a75de
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Mon Aug 13 17:02:21 2018 -0700
+
+ [icu] Pass normalizer instance down as user_data
+
+ src/hb-icu.cc | 23 +++++++++--------------
+ 1 file changed, 9 insertions(+), 14 deletions(-)
+
+commit f0ef096b8cab33aa9e26edba9b15696bf907e268
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Mon Aug 13 10:30:41 2018 -0700
+
+ Don't add reference in get_unicode_funcs() functions
+
+ Users don't expect a new reference returned from a get() function.
+ Indeed, all users of that API I foud where NOT destroying the
+ reference.
+ Just change the implementations to NOT return a reference.
+
+ This applies to the following APIs:
+ hb_unicode_funcs_get_default()
+ hb_glib_get_unicode_funcs()
+ hb_icu_get_unicode_funcs()
+
+ Fixes https://github.com/harfbuzz/harfbuzz/issues/1134
+
+ src/hb-buffer.cc | 3 +--
+ src/hb-glib.cc | 2 +-
+ src/hb-icu.cc | 2 +-
+ src/hb-ucdn.cc | 2 +-
+ 4 files changed, 4 insertions(+), 5 deletions(-)
+
+commit 9bbd1cdf068635f4a737f1fc9ab54ba075601a5d
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 18:20:53 2018 -0700
+
+ [uniscribe] Use lazy loader
+
+ Fixes https://github.com/harfbuzz/harfbuzz/issues/1129
+
+ src/hb-uniscribe.cc | 56
+ +++++++++++++++++++++++++++--------------------------
+ 1 file changed, 29 insertions(+), 27 deletions(-)
+
+commit 266368993625e0cfb6eef9188f8b9aa29fb97391
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 18:10:59 2018 -0700
+
+ Another clang bot fix
+
+ src/hb-shape.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 989e71a982658145f28f83f2111bdab9561f3db0
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 17:47:59 2018 -0700
+
+ Silence clang
+
+ src/hb-machinery-private.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 6750ec692cdd682bd33cb1c37b137cf3bb641d43
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 17:42:16 2018 -0700
+
+ [lazy] Use for C_locale
+
+ src/hb-common.cc | 60
+ ++++++++++++++++++++++++++++----------------------------
+ 1 file changed, 30 insertions(+), 30 deletions(-)
+
+commit 747d2564e6bdcc15cf6a197e543fb732924159c5
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 17:32:10 2018 -0700
+
+ [lazy] Port more
+
+ src/hb-machinery-private.hh | 1 -
+ src/hb-shaper.cc | 78
+ ++++++++++++++++++++-------------------------
+ src/hb-uniscribe.cc | 3 +-
+ 3 files changed, 37 insertions(+), 45 deletions(-)
+
+commit 7bd508a0c4ce426f474bfcc729cb39207dd1f7b4
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 17:19:55 2018 -0700
+
+ [lazy] Rename free()
+
+ src/hb-ft.cc | 4 ++--
+ src/hb-glib.cc | 2 +-
+ src/hb-icu.cc | 2 +-
+ src/hb-machinery-private.hh | 4 ++--
+ src/hb-ot-font.cc | 2 +-
+ src/hb-shape.cc | 6 +++---
+ src/hb-ucdn.cc | 2 +-
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+commit a3b97db910662e26bafe6e6bc1c36b437f4ed931
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 17:14:32 2018 -0700
+
+ [lazy] Port more to it
+
+ src/hb-shape.cc | 75
+ +++++++++++++++++++++++++++++----------------------------
+ 1 file changed, 38 insertions(+), 37 deletions(-)
+
+commit 6901090945d7e16102f3a2b168465434032b9a09
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:57:06 2018 -0700
+
+ [lazy] Make hb_lazy_loader_t<> more usable
+
+ src/hb-ft.cc | 7 +++---
+ src/hb-machinery-private.hh | 57
+ +++++++++++++++++++++++++++------------------
+ 2 files changed, 37 insertions(+), 27 deletions(-)
+
+commit bb905e9afcc3eb28a22ba78c09e661a814d04c1f
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:40:08 2018 -0700
+
+ [lazy] Minor
+
+ src/hb-machinery-private.hh | 36 ++++++++++++++++++------------------
+ src/hb-ot-font.cc | 8 ++++----
+ 2 files changed, 22 insertions(+), 22 deletions(-)
+
+commit 3945cd78a96bdd287e203a0261bac490df1314b0
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:33:48 2018 -0700
+
+ Minor
+
+ src/hb-machinery-private.hh | 4 ----
+ 1 file changed, 4 deletions(-)
+
+commit c21a1b95dffedb6ed66b384f4adf07e6d05d4b9f
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:30:39 2018 -0700
+
+ [icu] Use get_relaxed for normalizer access
+
+ We've had the proper barriers already. No need for more with
+ every access.
+
+ src/hb-icu.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 125fefa2a6b23cf7eb4559904b23aff3731d5dba
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:29:41 2018 -0700
+
+ [icu] Fix for breakage after recent change
+
+ src/hb-icu.cc | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+commit 53442be1edc73993bdcaffc4b895c07f1ea03ba0
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:20:11 2018 -0700
+
+ [lazy] Use for ft_library
+
+ src/hb-ft.cc | 61
+ ++++++++++++++++++++++-----------------------
+ src/hb-glib.cc | 2 +-
+ src/hb-icu.cc | 2 +-
+ src/hb-machinery-private.hh | 2 +-
+ src/hb-ot-font.cc | 2 +-
+ src/hb-ucdn.cc | 2 +-
+ 6 files changed, 35 insertions(+), 36 deletions(-)
+
+commit 7a8d480378af4094645dfb1527a61a94b4786b54
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 16:00:13 2018 -0700
+
+ [lazy] Add .free()
+
+ src/hb-ft.cc | 2 +-
+ src/hb-glib.cc | 2 +-
+ src/hb-icu.cc | 2 +-
+ src/hb-machinery-private.hh | 4 ++++
+ src/hb-ot-font.cc | 2 +-
+ src/hb-ucdn.cc | 2 +-
+ 6 files changed, 9 insertions(+), 5 deletions(-)
+
+commit c7ca30a5337cb660e650d51ddd17d389909357c2
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 13:46:53 2018 -0700
+
+ [ot/ft] Port font_funcs statis to lazy-loader
+
+ src/hb-ft.cc | 56
+ ++++++++++++++++++++++-----------------------
+ src/hb-machinery-private.hh | 14 ++++++++++++
+ src/hb-ot-font.cc | 49 +++++++++++++++++----------------------
+ 3 files changed, 62 insertions(+), 57 deletions(-)
+
+commit cb3fc3685c03c8ed07bcf05188f5d6c582fd5aaa
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 13:39:01 2018 -0700
+
+ [ucdn/glib/icu] Port unicode_funcs statics to lazy-loader
+
+ src/hb-glib.cc | 50 ++++++++++++++++++--------------------
+ src/hb-icu.cc | 59
+ ++++++++++++++++-----------------------------
+ src/hb-machinery-private.hh | 28 ++++++++++++++++-----
+ src/hb-ucdn.cc | 51 +++++++++++++++++----------------------
+ 4 files changed, 88 insertions(+), 100 deletions(-)
+
+commit 1b6b481262465ae1865c66c4d499b4b2c8d297fb
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 13:16:40 2018 -0700
+
+ [lazy] Allow calling fini() multiple times
+
+ src/hb-machinery-private.hh | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+commit 918ad9f5d9b85384f24157523272a4ffc1927d16
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 13:12:29 2018 -0700
+
+ [lazy] More
+
+ src/hb-machinery-private.hh | 45
+ +++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 37 insertions(+), 8 deletions(-)
+
+commit 5abdf5eebadf9a4fbd50c1a893c9654de74d22ac
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 12:40:24 2018 -0700
+
+ [lazy] More shuffle
+
+ src/hb-machinery-private.hh | 80
+ +++++++++++++++++++--------------------------
+ 1 file changed, 34 insertions(+), 46 deletions(-)
+
+commit 5d9863be6ecf873033cbab732207dd420f3866e7
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 12:27:47 2018 -0700
+
+ Minor
+
+ src/hb-machinery-private.hh | 6 ++++--
+ src/hb-ot-layout-private.hh | 2 +-
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+commit f9a3eab81008c01a458d16f274b1a0eaaae00e7c
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 12:21:56 2018 -0700
+
+ Add explicit_operator
+
+ Fixes https://github.com/harfbuzz/harfbuzz/issues/1127
+
+ src/hb-iter-private.hh | 2 +-
+ src/hb-private.hh | 15 ++++++++++++++-
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+commit 470acb6c322fc64556d59847d829d95caa2d51e6
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Sun Aug 12 12:09:20 2018 -0700
+
+ Rename
+
+ src/hb-machinery-private.hh | 19 ++++++++++++-------
+ 1 file changed, 12 insertions(+), 7 deletions(-)
+
+commit 39607dc98e433ef577c1de0f309ce40fc40529be
+Author: Martin Hosken <martin_hosken@sil.org>
+Date: Thu Aug 9 15:16:32 2018 +0700
+
+ Support _ in feature ids
+
+ src/hb-common.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 652cd45c650b1cdce2585dcee614e5a9cdda530c
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Thu Aug 9 01:02:02 2018 -0700
+
+ [coretext] Another try
+
+ src/hb-coretext.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 3f3585ca1406edd74138f78739612c167ab57913
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Thu Aug 9 00:58:17 2018 -0700
+
+ Fix coretext build (hopefully)
+
+ src/hb-coretext.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit aa3b6017ed71fc251522ff1bedcdae965b4c1c1c
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Thu Aug 9 00:56:28 2018 -0700
+
+ Revert "[iter] Make operator bool explicit"
+
+ This reverts commit 66920a6bace7c54c8166c4ed938b6ffc5fabcf2b.
+
+ Some of our bots (Oracle Studio and Apple gcc 4.2) do not allow
+ explicit except for constructors.
+
+ https://github.com/harfbuzz/harfbuzz/issues/1127
+
+ src/hb-iter-private.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e1a2354220c369bd5a62d255acc42c60cd14c473
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Thu Aug 9 00:53:25 2018 -0700
+
+ [atomic] More
+
+ src/hb-atomic-private.hh | 2 --
+ src/hb-object-private.hh | 7 +++++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+commit f1f4b45ac3d228a6b11e33357725de065e2ba2be
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Thu Aug 9 00:28:40 2018 -0700
+
+ Fix lazy_loader fini()
+
+ Was creating object even if wasn't there.
+
+ src/hb-machinery-private.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 1f7380944df9aa81cd48a4764c763d692533c4a6
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Thu Aug 9 00:22:37 2018 -0700
+
+ [atomic] Add hb_atomic_ptr_t<> and port all uses
+
+ Found and fixed a couple bugs.
+
+ Found a couple multithreading issues. Marked them with "XXX-MT-bug".
+
+ src/hb-atomic-private.hh | 34 +++++++++++++++++++++++++++++++---
+ src/hb-common.cc | 34 ++++++++++++++++++----------------
+ src/hb-face-private.hh | 3 ++-
+ src/hb-face.cc | 6 +++---
+ src/hb-font.cc | 2 +-
+ src/hb-ft.cc | 22 ++++++++++++----------
+ src/hb-glib.cc | 11 ++++++-----
+ src/hb-graphite2.cc | 16 +++++++++-------
+ src/hb-icu.cc | 22 ++++++++++++----------
+ src/hb-machinery-private.hh | 17 +++++++++--------
+ src/hb-object-private.hh | 29 +++++++++++++++--------------
+ src/hb-ot-font.cc | 11 ++++++-----
+ src/hb-ot-layout-private.hh | 2 +-
+ src/hb-ot-post-table.hh | 9 +++++----
+ src/hb-ot-shape-complex-arabic.cc | 9 +++++----
+ src/hb-shape-plan.cc | 19 +++++++++++--------
+ src/hb-shape.cc | 11 ++++++-----
+ src/hb-shaper-impl-private.hh | 2 +-
+ src/hb-shaper-private.hh | 16 +++++++++-------
+ src/hb-shaper.cc | 18 ++++++++++--------
+ src/hb-ucdn.cc | 11 ++++++-----
+ src/hb-uniscribe.cc | 14 +++++++-------
+ 22 files changed, 185 insertions(+), 133 deletions(-)
+
+commit 6e42f4c53ff52cc242051e80600e19513136f6d1
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Wed Aug 8 22:51:35 2018 -0700
+
+ [atomic] Remove hb_atomic_int_impl_t now that it's always int
+
+ src/hb-atomic-private.hh | 14 +++++---------
+ 1 file changed, 5 insertions(+), 9 deletions(-)
+
+commit 1227a9e5a5befffa688c1cce141533fd80144d14
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Wed Aug 8 22:45:49 2018 -0700
+
+ [atomic] Unify typedef
+
+ Removes volatile from fallback implementation. That was handwavy
+ anyway.
+
+ src/hb-atomic-private.hh | 22 ++++++++--------------
+ 1 file changed, 8 insertions(+), 14 deletions(-)
+
+commit 5cd1888c9dcb8b32bcfe08be38bdd13fd8a09b5e
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Wed Aug 8 22:43:53 2018 -0700
+
+ [atomic] Change Mac atomic int type to int
+
+ If ever int is not 32bit, we'll fix this...
+
+ src/hb-atomic-private.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e1de86eac188e804c6737fcad66ae09cf25ef221
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Wed Aug 8 22:42:33 2018 -0700
+
+ [atomic] Change Windows atomic int type to int
+
+ src/hb-atomic-private.hh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit aee2d10b2bf09814b32bccdecd4c3fbebafc542e
+Author: Behdad Esfahbod <behdad@behdad.org>
+Date: Wed Aug 8 22:40:10 2018 -0700
+
+ [atomic] Change Solaris atomic int to signed
+
+ src/hb-atomic-private.hh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
commit b6fdcf4f8bd09e065c767939125861c9dc8ff18f
Author: Behdad Esfahbod <behdad@behdad.org>
Date: Wed Aug 8 21:54:08 2018 -0700
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS
index 87907ca8cc5..3ae857ef329 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS
@@ -1,3 +1,21 @@
+Overview of changes leading to 1.8.8
+Tuesday, August 14, 2018
+====================================
+- Fix hb-icu crash on architectures where compare_exchange_weak() can
+ fail falsely. This bug was introduced in 1.8.4.
+ https://bugs.chromium.org/p/chromium/issues/detail?id=873568
+- More internal refactoring of atomic operations and singletons.
+- API changes:
+ The following functions do NOT reference their return value before
+ returning:
+ * hb_unicode_funcs_get_default()
+ * hb_glib_get_unicode_funcs()
+ * hb_icu_get_unicode_funcs()
+ This is consistent with their naming ("get", instead of "reference")
+ as well as how they are used in the wild (ie. no one calls destroy()
+ on their return value.)
+
+
Overview of changes leading to 1.8.7
Wednesday, August 8, 2018
====================================
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac
index a32b863261c..55cc12b3f40 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ([2.64])
AC_INIT([HarfBuzz],
- [1.8.7],
+ [1.8.8],
[https://github.com/harfbuzz/harfbuzz/issues/new],
[harfbuzz],
[http://harfbuzz.org/])
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 0b043e69864..297c646986c 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
@@ -35,7 +35,10 @@
#include "hb-private.hh"
-/* atomic_int */
+/*
+ * Atomic integers and pointers.
+ */
+
/* We need external help for these */
@@ -43,18 +46,19 @@
&& defined(hb_atomic_ptr_impl_get) \
&& defined(hb_atomic_ptr_impl_cmpexch)
-/* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */
+/* Defined externally, i.e. in config.h. */
#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME)
/* 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_int_impl_set_relaxed(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELAXED)
#define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), __ATOMIC_RELAXED)
+#define hb_atomic_ptr_impl_set_relaxed(P, V) __atomic_store_n ((P), (V), __ATOMIC_RELAXED)
+#define hb_atomic_ptr_impl_get_relaxed(P) __atomic_load_n ((P), __ATOMIC_RELAXED)
#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_CONSUME)
static inline bool
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
@@ -70,11 +74,12 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
#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_set_relaxed(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->store ((V), std::memory_order_relaxed))
#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast<std::atomic<int> *> (AI)->load (std::memory_order_relaxed))
+#define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast<std::atomic<void*> *> (P)->store ((V), std::memory_order_relaxed))
+#define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_relaxed))
#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_consume))
static inline bool
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
@@ -101,8 +106,7 @@ static inline void _hb_memory_barrier (void)
}
#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))
+#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((unsigned *) (AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
@@ -111,7 +115,6 @@ typedef LONG hb_atomic_int_impl_t;
#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))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
@@ -126,12 +129,10 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_w_barrier() __machine_w_barrier ()
#define _hb_memory_barrier() __machine_rw_barrier ()
-typedef unsigned int hb_atomic_int_impl_t;
-
-static inline int _hb_fetch_and_add (hb_atomic_int_impl_t *AI, int V)
+static inline int _hb_fetch_and_add (int *AI, int V)
{
_hb_memory_w_barrier ();
- int result = atomic_add_int_nv (AI, V);
+ int result = atomic_add_int_nv ((uint_t *) AI, V);
_hb_memory_r_barrier ();
return result;
}
@@ -159,7 +160,6 @@ static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, cons
#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))
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
@@ -179,9 +179,7 @@ typedef int32_t hb_atomic_int_impl_t;
#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)
+static inline int _hb_fetch_and_add (int *AI, int V)
{
_hb_memory_barrier ();
int result = __fetch_and_add (AI, V);
@@ -208,15 +206,13 @@ static_assert ((sizeof (long) == sizeof (void *)), "");
#define _hb_memory_barrier()
-typedef volatile int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
-#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false)
#else /* HB_NO_MT */
-typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define _hb_memory_barrier()
@@ -233,33 +229,53 @@ typedef int hb_atomic_int_impl_t;
#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
#ifndef hb_atomic_int_impl_set_relaxed
#define hb_atomic_int_impl_set_relaxed(AI, V) (*(AI) = (V))
#endif
#ifndef hb_atomic_int_impl_get_relaxed
#define hb_atomic_int_impl_get_relaxed(AI) (*(AI))
#endif
+
+#ifndef hb_atomic_ptr_impl_set_relaxed
+#define hb_atomic_ptr_impl_set_relaxed(P, V) (*(P) = (V))
+#endif
+#ifndef hb_atomic_ptr_impl_get_relaxed
+#define hb_atomic_ptr_impl_get_relaxed(P) (*(P))
+#endif
#ifndef hb_atomic_ptr_impl_get
inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; _hb_memory_r_barrier (); return v; }
#endif
+#define HB_ATOMIC_INT_INIT(V) {V}
struct hb_atomic_int_t
{
- mutable hb_atomic_int_impl_t v;
-
- inline void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
+ inline void set_relaxed (int v_) const { hb_atomic_int_impl_set_relaxed (&v, v_); }
inline int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed (&v); }
inline int inc (void) { return hb_atomic_int_impl_add (&v, 1); }
inline int dec (void) { return hb_atomic_int_impl_add (&v, -1); }
+
+ mutable int v;
};
-#define hb_atomic_ptr_get(P) hb_atomic_ptr_impl_get((void **) P)
-#define hb_atomic_ptr_cmpexch(P,O,N) hb_atomic_ptr_impl_cmpexch((P),(O),(N))
+template <typename T> struct hb_remove_ptr_t { typedef T value; };
+template <typename T> struct hb_remove_ptr_t<T *> { typedef T value; };
+
+#define HB_ATOMIC_PTR_INIT(V) {V}
+template <typename P>
+struct hb_atomic_ptr_t
+{
+ typedef typename hb_remove_ptr_t<P>::value T;
+
+ inline void init (T* v_ = nullptr) { set_relaxed (v_); }
+ inline void set_relaxed (T* v_) const { hb_atomic_ptr_impl_set_relaxed (&v, v_); }
+ inline T *get_relaxed (void) const { return hb_atomic_ptr_impl_get_relaxed (&v); }
+ inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
+ inline bool cmpexch (const T *old, T *new_) const{ return hb_atomic_ptr_impl_cmpexch (&v, old, new_); }
+
+ mutable T *v;
+};
#endif /* HB_ATOMIC_PRIVATE_HH */
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
index e79b45ae4aa..eb7b01caafa 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
@@ -216,7 +216,7 @@ hb_buffer_t::reset (void)
return;
hb_unicode_funcs_destroy (unicode);
- unicode = hb_unicode_funcs_get_default ();
+ unicode = hb_unicode_funcs_reference (hb_unicode_funcs_get_default ());
flags = HB_BUFFER_FLAG_DEFAULT;
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
@@ -908,7 +908,6 @@ hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
if (!unicode_funcs)
unicode_funcs = hb_unicode_funcs_get_default ();
-
hb_unicode_funcs_reference (unicode_funcs);
hb_unicode_funcs_destroy (buffer->unicode);
buffer->unicode = unicode_funcs;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc
index bab1a66344e..22dd52f49d8 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc
@@ -28,6 +28,7 @@
#include "hb-private.hh"
+#include "hb-machinery-private.hh"
#include <locale.h>
#ifdef HAVE_XLOCALE_H
@@ -244,15 +245,15 @@ struct hb_language_item_t {
/* Thread-safe lock-free language list */
-static hb_language_item_t *langs;
+static hb_atomic_ptr_t <hb_language_item_t> langs;
#ifdef HB_USE_ATEXIT
static void
free_langs (void)
{
retry:
- hb_language_item_t *first_lang = (hb_language_item_t *) hb_atomic_ptr_get (&langs);
- if (!hb_atomic_ptr_cmpexch (&langs, first_lang, nullptr))
+ hb_language_item_t *first_lang = langs.get ();
+ if (unlikely (!langs.cmpexch (first_lang, nullptr)))
goto retry;
while (first_lang) {
@@ -268,7 +269,7 @@ static hb_language_item_t *
lang_find_or_insert (const char *key)
{
retry:
- hb_language_item_t *first_lang = (hb_language_item_t *) hb_atomic_ptr_get (&langs);
+ hb_language_item_t *first_lang = langs.get ();
for (hb_language_item_t *lang = first_lang; lang; lang = lang->next)
if (*lang == key)
@@ -286,7 +287,8 @@ retry:
return nullptr;
}
- if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
+ if (unlikely (!langs.cmpexch (first_lang, lang)))
+ {
lang->fini ();
free (lang);
goto retry;
@@ -368,15 +370,16 @@ hb_language_to_string (hb_language_t language)
hb_language_t
hb_language_get_default (void)
{
- static hb_language_t default_language = HB_LANGUAGE_INVALID;
+ static hb_atomic_ptr_t <hb_language_t> default_language;
- hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
- if (unlikely (language == HB_LANGUAGE_INVALID)) {
+ hb_language_t language = default_language.get ();
+ if (unlikely (language == HB_LANGUAGE_INVALID))
+ {
language = hb_language_from_string (setlocale (LC_CTYPE, nullptr), -1);
- (void) hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
+ (void) default_language.cmpexch (HB_LANGUAGE_INVALID, language);
}
- return default_language;
+ return language;
}
@@ -728,48 +731,47 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv)
#ifdef USE_XLOCALE
-static HB_LOCALE_T C_locale;
-
-#ifdef HB_USE_ATEXIT
-static void
-free_C_locale (void)
-{
-retry:
- HB_LOCALE_T locale = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale);
-
- if (!hb_atomic_ptr_cmpexch (&C_locale, locale, nullptr))
- goto retry;
- if (locale)
- HB_FREE_LOCALE (locale);
-}
-#endif
+static void free_static_C_locale (void);
-static HB_LOCALE_T
-get_C_locale (void)
+static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<HB_LOCALE_T>::value,
+ hb_C_locale_lazy_loader_t>
{
-retry:
- HB_LOCALE_T C = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale);
-
- if (unlikely (!C))
+ static inline HB_LOCALE_T create (void)
{
- C = HB_CREATE_LOCALE ("C");
-
- if (!hb_atomic_ptr_cmpexch (&C_locale, nullptr, C))
- {
- HB_FREE_LOCALE (C_locale);
- goto retry;
- }
+ HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
#ifdef HB_USE_ATEXIT
- atexit (free_C_locale); /* First person registers atexit() callback. */
+ atexit (free_static_C_locale);
#endif
+
+ return C_locale;
+ }
+ static inline void destroy (HB_LOCALE_T p)
+ {
+ HB_FREE_LOCALE (p);
+ }
+ static inline HB_LOCALE_T get_null (void)
+ {
+ return nullptr;
}
+} static_C_locale;
- return C;
+#ifdef HB_USE_ATEXIT
+static
+void free_static_C_locale (void)
+{
+ static_C_locale.free_instance ();
}
#endif
+static HB_LOCALE_T
+get_C_locale (void)
+{
+ return static_C_locale.get_unconst ();
+}
+#endif /* USE_XLOCALE */
+
static bool
parse_float (const char **pp, const char *end, float *pv)
{
@@ -845,7 +847,7 @@ parse_tag (const char **pp, const char *end, hb_tag_t *tag)
}
const char *p = *pp;
- while (*pp < end && ISALNUM(**pp))
+ while (*pp < end && (ISALNUM(**pp) || **pp == '_'))
(*pp)++;
if (p == *pp || *pp - p > 4)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
index 13ab988651f..1b916a53d34 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
@@ -348,7 +348,7 @@ hb_coretext_font_create (CTFontRef ct_font)
hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));
/* Let there be dragons here... */
- HB_SHAPER_DATA_GET (font) = (hb_coretext_font_data_t *) CFRetain (ct_font);
+ HB_SHAPER_DATA (HB_SHAPER, font).set_relaxed ((hb_coretext_font_data_t *) CFRetain (ct_font));
return font;
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh
index a4b2cd36d6a..086ce6e96d1 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh
@@ -61,7 +61,8 @@ struct hb_face_t
{
hb_shape_plan_t *shape_plan;
plan_node_t *next;
- } *shape_plans;
+ };
+ hb_atomic_ptr_t<plan_node_t> shape_plans;
inline hb_blob_t *reference_table (hb_tag_t tag) const
{
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
index e1492756cfc..49f29d3fa87 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc
@@ -78,12 +78,12 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
0, /* num_glyphs */
{
-#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
+#define HB_SHAPER_IMPLEMENT(shaper) HB_ATOMIC_PTR_INIT (HB_SHAPER_DATA_INVALID),
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
},
- nullptr, /* shape_plans */
+ HB_ATOMIC_PTR_INIT (nullptr), /* shape_plans */
};
@@ -249,7 +249,7 @@ hb_face_destroy (hb_face_t *face)
{
if (!hb_object_destroy (face)) return;
- for (hb_face_t::plan_node_t *node = face->shape_plans; node; )
+ for (hb_face_t::plan_node_t *node = face->shape_plans.get (); node; )
{
hb_face_t::plan_node_t *next = node->next;
hb_shape_plan_destroy (node->shape_plan);
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc
index 80768d6d517..857b8f57734 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc
@@ -1247,7 +1247,7 @@ DEFINE_NULL_INSTANCE (hb_font_t) =
nullptr, /* destroy */
{
-#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
+#define HB_SHAPER_IMPLEMENT(shaper) HB_ATOMIC_PTR_INIT (HB_SHAPER_DATA_INVALID),
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
index f8a6b0c4681..01341b604a1 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
@@ -32,6 +32,7 @@
#include "hb-ft.h"
#include "hb-font-private.hh"
+#include "hb-machinery-private.hh"
#include FT_ADVANCES_H
#include FT_MULTIPLE_MASTERS_H
@@ -416,30 +417,13 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
return true;
}
-static hb_font_funcs_t *static_ft_funcs = nullptr;
+static void free_static_ft_funcs (void);
-#ifdef HB_USE_ATEXIT
-static
-void free_static_ft_funcs (void)
+static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft_font_funcs_lazy_loader_t>
{
-retry:
- hb_font_funcs_t *ft_funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, ft_funcs, nullptr))
- goto retry;
-
- hb_font_funcs_destroy (ft_funcs);
-}
-#endif
-
-static void
-_hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
-{
-retry:
- hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_funcs);
-
- if (unlikely (!funcs))
+ static inline hb_font_funcs_t *create (void)
{
- funcs = hb_font_funcs_create ();
+ hb_font_funcs_t *funcs = hb_font_funcs_create ();
hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, nullptr, nullptr);
//hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, nullptr, nullptr);
@@ -458,20 +442,35 @@ retry:
hb_font_funcs_make_immutable (funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, nullptr, funcs)) {
- hb_font_funcs_destroy (funcs);
- goto retry;
- }
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_ft_funcs);
+#endif
+
+ return funcs;
+ }
+} static_ft_funcs;
#ifdef HB_USE_ATEXIT
- atexit (free_static_ft_funcs); /* First person registers atexit() callback. */
+static
+void free_static_ft_funcs (void)
+{
+ static_ft_funcs.free_instance ();
+}
#endif
- };
+static hb_font_funcs_t *
+_hb_ft_get_font_funcs (void)
+{
+ return static_ft_funcs.get_unconst ();
+}
+
+static void
+_hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
+{
bool symbol = ft_face->charmap && ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL;
hb_font_set_funcs (font,
- funcs,
+ _hb_ft_get_font_funcs (),
_hb_ft_font_create (ft_face, symbol, unref),
_hb_ft_font_destroy);
}
@@ -684,46 +683,45 @@ hb_ft_font_create_referenced (FT_Face ft_face)
}
-/* Thread-safe, lock-free, FT_Library */
+static void free_static_ft_library (void);
-static FT_Library ft_library;
+static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<FT_Library>::value,
+ hb_ft_library_lazy_loader_t>
+{
+ static inline FT_Library create (void)
+ {
+ FT_Library l;
+ if (FT_Init_FreeType (&l))
+ return nullptr;
+
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_ft_library);
+#endif
+
+ return l;
+ }
+ static inline void destroy (FT_Library l)
+ {
+ FT_Done_FreeType (l);
+ }
+ static inline FT_Library get_null (void)
+ {
+ return nullptr;
+ }
+} static_ft_library;
#ifdef HB_USE_ATEXIT
static
-void free_ft_library (void)
+void free_static_ft_library (void)
{
-retry:
- FT_Library library = (FT_Library) hb_atomic_ptr_get (&ft_library);
- if (!hb_atomic_ptr_cmpexch (&ft_library, library, nullptr))
- goto retry;
-
- FT_Done_FreeType (library);
+ static_ft_library.free_instance ();
}
#endif
static FT_Library
get_ft_library (void)
{
-retry:
- FT_Library library = (FT_Library) hb_atomic_ptr_get (&ft_library);
-
- if (unlikely (!library))
- {
- /* Not found; allocate one. */
- if (FT_Init_FreeType (&library))
- return nullptr;
-
- if (!hb_atomic_ptr_cmpexch (&ft_library, nullptr, library)) {
- FT_Done_FreeType (library);
- goto retry;
- }
-
-#ifdef HB_USE_ATEXIT
- atexit (free_ft_library); /* First person registers atexit() callback. */
-#endif
- }
-
- return library;
+ return static_ft_library.get_unconst ();
}
static void
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc
index 246380a7350..809b22f6b46 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc
@@ -31,6 +31,7 @@
#include "hb-glib.h"
#include "hb-unicode-private.hh"
+#include "hb-machinery-private.hh"
#if !GLIB_CHECK_VERSION(2,29,14)
@@ -364,30 +365,15 @@ hb_glib_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED,
return utf8_decomposed_len;
}
-static hb_unicode_funcs_t *static_glib_funcs = nullptr;
-#ifdef HB_USE_ATEXIT
-static
-void free_static_glib_funcs (void)
-{
-retry:
- hb_unicode_funcs_t *glib_funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_glib_funcs);
- if (!hb_atomic_ptr_cmpexch (&static_glib_funcs, glib_funcs, nullptr))
- goto retry;
- hb_unicode_funcs_destroy (glib_funcs);
-}
-#endif
+static void free_static_glib_funcs (void);
-hb_unicode_funcs_t *
-hb_glib_get_unicode_funcs (void)
+static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_glib_unicode_funcs_lazy_loader_t>
{
-retry:
- hb_unicode_funcs_t *funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_glib_funcs);
-
- if (unlikely (!funcs))
+ static inline hb_unicode_funcs_t *create (void)
{
- funcs = hb_unicode_funcs_create (nullptr);
+ hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
#define HB_UNICODE_FUNC_IMPLEMENT(name) \
hb_unicode_funcs_set_##name##_func (funcs, hb_glib_unicode_##name, nullptr, nullptr);
@@ -396,19 +382,30 @@ retry:
hb_unicode_funcs_make_immutable (funcs);
- if (!hb_atomic_ptr_cmpexch (&static_glib_funcs, nullptr, funcs)) {
- hb_unicode_funcs_destroy (funcs);
- goto retry;
- }
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_glib_funcs);
+#endif
+
+ return funcs;
+ }
+} static_glib_funcs;
#ifdef HB_USE_ATEXIT
- atexit (free_static_glib_funcs); /* First person registers atexit() callback. */
+static
+void free_static_glib_funcs (void)
+{
+ static_glib_funcs.free_instance ();
+}
#endif
- };
- return hb_unicode_funcs_reference (funcs);
+hb_unicode_funcs_t *
+hb_glib_get_unicode_funcs (void)
+{
+ return static_glib_funcs.get_unconst ();
}
+
+
#if GLIB_CHECK_VERSION(2,31,10)
static void
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc
index 2ba905d6df1..1f42a36f35a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc
@@ -42,22 +42,24 @@ HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font)
* shaper face data
*/
-typedef struct hb_graphite2_tablelist_t {
+typedef struct hb_graphite2_tablelist_t
+{
struct hb_graphite2_tablelist_t *next;
hb_blob_t *blob;
unsigned int tag;
} hb_graphite2_tablelist_t;
-struct hb_graphite2_face_data_t {
+struct hb_graphite2_face_data_t
+{
hb_face_t *face;
gr_face *grface;
- hb_graphite2_tablelist_t *tlist;
+ hb_atomic_ptr_t<hb_graphite2_tablelist_t> tlist;
};
static const void *hb_graphite2_get_table (const void *data, unsigned int tag, size_t *len)
{
hb_graphite2_face_data_t *face_data = (hb_graphite2_face_data_t *) data;
- hb_graphite2_tablelist_t *tlist = face_data->tlist;
+ hb_graphite2_tablelist_t *tlist = face_data->tlist.get ();
hb_blob_t *blob = nullptr;
@@ -80,10 +82,10 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
p->tag = tag;
retry:
- hb_graphite2_tablelist_t *tlist = (hb_graphite2_tablelist_t *) hb_atomic_ptr_get (&face_data->tlist);
+ hb_graphite2_tablelist_t *tlist = face_data->tlist.get ();
p->next = tlist;
- if (!hb_atomic_ptr_cmpexch (&face_data->tlist, tlist, p))
+ if (unlikely (!face_data->tlist.cmpexch (tlist, p)))
goto retry;
}
@@ -124,7 +126,7 @@ _hb_graphite2_shaper_face_data_create (hb_face_t *face)
void
_hb_graphite2_shaper_face_data_destroy (hb_graphite2_face_data_t *data)
{
- hb_graphite2_tablelist_t *tlist = data->tlist;
+ hb_graphite2_tablelist_t *tlist = data->tlist.get ();
while (tlist)
{
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc
index c52e165bac9..2e3ad367544 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc
@@ -32,6 +32,7 @@
#include "hb-icu.h"
#include "hb-unicode-private.hh"
+#include "hb-machinery-private.hh"
#include <unicode/uchar.h>
#include <unicode/unorm2.h>
@@ -164,10 +165,6 @@ hb_icu_unicode_script (hb_unicode_funcs_t *ufuncs HB_UNUSED,
return hb_icu_script_to_script (scriptCode);
}
-#if U_ICU_VERSION_MAJOR_NUM >= 49
-static const UNormalizer2 *normalizer;
-#endif
-
static hb_bool_t
hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t a,
@@ -177,6 +174,7 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
{
#if U_ICU_VERSION_MAJOR_NUM >= 49
{
+ const UNormalizer2 *normalizer = (const UNormalizer2 *) user_data;
UChar32 ret = unorm2_composePair (normalizer, a, b);
if (ret < 0) return false;
*ab = ret;
@@ -222,6 +220,7 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
{
#if U_ICU_VERSION_MAJOR_NUM >= 49
{
+ const UNormalizer2 *normalizer = (const UNormalizer2 *) user_data;
UChar decomposed[4];
int len;
UErrorCode icu_err = U_ZERO_ERROR;
@@ -345,55 +344,46 @@ hb_icu_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED,
}
-static hb_unicode_funcs_t *static_icu_funcs = nullptr;
-
-#ifdef HB_USE_ATEXIT
-static
-void free_static_icu_funcs (void)
-{
-retry:
- hb_unicode_funcs_t *icu_funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_icu_funcs);
- if (!hb_atomic_ptr_cmpexch (&static_icu_funcs, icu_funcs, nullptr))
- goto retry;
-
- hb_unicode_funcs_destroy (icu_funcs);
-}
-#endif
+static void free_static_icu_funcs (void);
-hb_unicode_funcs_t *
-hb_icu_get_unicode_funcs (void)
+static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_icu_unicode_funcs_lazy_loader_t>
{
-retry:
- hb_unicode_funcs_t *funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_icu_funcs);
-
- if (unlikely (!funcs))
+ static inline hb_unicode_funcs_t *create (void)
{
+ void *user_data = nullptr;
#if U_ICU_VERSION_MAJOR_NUM >= 49
- if (!hb_atomic_ptr_get (&normalizer)) {
- UErrorCode icu_err = U_ZERO_ERROR;
- /* We ignore failure in getNFCInstace(). */
- (void) hb_atomic_ptr_cmpexch (&normalizer, nullptr, unorm2_getNFCInstance (&icu_err));
- }
+ UErrorCode icu_err = U_ZERO_ERROR;
+ user_data = (void *) unorm2_getNFCInstance (&icu_err);
+ assert (user_data);
#endif
- funcs = hb_unicode_funcs_create (nullptr);
+ hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
#define HB_UNICODE_FUNC_IMPLEMENT(name) \
- hb_unicode_funcs_set_##name##_func (funcs, hb_icu_unicode_##name, nullptr, nullptr);
+ hb_unicode_funcs_set_##name##_func (funcs, hb_icu_unicode_##name, user_data, nullptr);
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_UNICODE_FUNC_IMPLEMENT
hb_unicode_funcs_make_immutable (funcs);
- if (!hb_atomic_ptr_cmpexch (&static_icu_funcs, nullptr, funcs)) {
- hb_unicode_funcs_destroy (funcs);
- goto retry;
- }
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_icu_funcs);
+#endif
+
+ return funcs;
+ }
+} static_icu_funcs;
#ifdef HB_USE_ATEXIT
- atexit (free_static_icu_funcs); /* First person registers atexit() callback. */
+static
+void free_static_icu_funcs (void)
+{
+ static_icu_funcs.free_instance ();
+}
#endif
- };
- return hb_unicode_funcs_reference (funcs);
+hb_unicode_funcs_t *
+hb_icu_get_unicode_funcs (void)
+{
+ return static_icu_funcs.get_unconst ();
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh
index 039a7734837..314133ade70 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh
@@ -72,7 +72,7 @@ struct Iter<T *>
array (array_), length (length_) {}
/* Emptiness. */
- explicit inline operator bool (void) const { return bool (length); }
+ explicit_operator inline operator bool (void) const { return bool (length); }
/* Current item. */
inline T &operator * (void)
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh
index ec41e2bcf69..99ef485a307 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh
@@ -590,47 +590,93 @@ struct BEInt<Type, 4>
* Lazy loaders.
*/
-template <unsigned int WheresFace,
- typename Subclass,
- typename Returned,
- typename Stored = Returned>
-struct hb_lazy_loader_t
+template <typename Data, unsigned int WheresData>
+struct hb_data_wrapper_t
{
- static_assert (WheresFace > 0, "");
+ static_assert (WheresData > 0, "");
- /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
- inline const Subclass* thiz (void) const { return static_cast<const Subclass *> (this); }
- inline Subclass* thiz (void) { return static_cast<Subclass *> (this); }
+ inline Data * get_data (void) const
+ {
+ return *(((Data **) (void *) this) - WheresData);
+ }
- inline void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */
- inline void init (void)
+ template <typename Stored, typename Subclass>
+ inline Stored * call_create (void) const
{
- instance = nullptr;
+ Data *data = this->get_data ();
+ return likely (data) ? Subclass::create (data) : nullptr;
}
+};
+template <>
+struct hb_data_wrapper_t<void, 0>
+{
+ template <typename Stored, typename Funcs>
+ inline Stored * call_create (void) const
+ {
+ return Funcs::create ();
+ }
+};
+
+template <typename T1, typename T2> struct hb_non_void_t { typedef T1 value; };
+template <typename T2> struct hb_non_void_t<void, T2> { typedef T2 value; };
+
+template <typename Returned,
+ typename Subclass = void,
+ typename Data = void,
+ unsigned int WheresData = 0,
+ typename Stored = Returned>
+struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
+{
+ typedef typename hb_non_void_t<Subclass,
+ hb_lazy_loader_t<Returned,Subclass,Data,WheresData,Stored>
+ >::value Funcs;
+
+ inline void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */
+ inline void init (void) { instance.set_relaxed (nullptr); }
inline void fini (void)
{
- if (instance)
- thiz ()->destroy (instance);
+ do_destroy (instance.get ());
+ }
+ inline void free_instance (void)
+ {
+ retry:
+ Stored *p = instance.get ();
+ if (unlikely (p && !this->instance.cmpexch (p, nullptr)))
+ goto retry;
+ do_destroy (p);
}
- inline const Returned * operator -> (void) const { return thiz ()->get (); }
- inline const Returned & operator * (void) const { return *thiz ()->get (); }
+ inline Stored * do_create (void) const
+ {
+ Stored *p = this->template call_create<Stored, Funcs> ();
+ if (unlikely (!p))
+ p = const_cast<Stored *> (Funcs::get_null ());
+ return p;
+ }
+ static inline void do_destroy (Stored *p)
+ {
+ if (p && p != Funcs::get_null ())
+ Funcs::destroy (p);
+ }
+
+ inline const Returned * operator -> (void) const { return get (); }
+ inline const Returned & operator * (void) const { return *get (); }
+
+ inline Data * get_data (void) const
+ {
+ return *(((Data **) this) - WheresData);
+ }
inline Stored * get_stored (void) const
{
retry:
- Stored *p = (Stored *) hb_atomic_ptr_get (&this->instance);
+ Stored *p = this->instance.get ();
if (unlikely (!p))
{
- hb_face_t *face = *(((hb_face_t **) this) - WheresFace);
- if (likely (!p))
- p = thiz ()->create (face);
- if (unlikely (!p))
- p = thiz ()->create (nullptr); /* Produce nil object. */
- assert (p);
- if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<Stored **>(&this->instance), nullptr, p)))
+ p = do_create ();
+ if (unlikely (!this->instance.cmpexch (nullptr, p)))
{
- thiz ()->destroy (p);
+ do_destroy (p);
goto retry;
}
}
@@ -642,69 +688,70 @@ struct hb_lazy_loader_t
/* This *must* be called when there are no other threads accessing.
* However, to make TSan, etc, happy, we using cmpexch. */
retry:
- Stored *p = (Stored *) hb_atomic_ptr_get (&this->instance);
- if (p)
- {
- if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<Stored **>(&this->instance), p, instance_)))
- goto retry;
- thiz ()->destroy (p);
- }
+ Stored *p = this->instance.get ();
+ if (unlikely (!this->instance.cmpexch (p, instance_)))
+ goto retry;
+ do_destroy (p);
}
- inline const Returned * get (void) const
+ inline const Returned * get (void) const { return Funcs::convert (get_stored ()); }
+ inline Returned * get_unconst (void) const { return const_cast<Returned *> (Funcs::convert (get_stored ())); }
+
+ /* To be possibly overloaded by subclasses. */
+ static inline Returned* convert (Stored *p) { return p; }
+
+ /* By default null/init/fini the object. */
+ static inline const Stored* get_null (void) { return &Null(Stored); }
+ static inline Stored *create (Data *data)
{
- return thiz ()->convert (get_stored ());
+ Stored *p = (Stored *) calloc (1, sizeof (Stored));
+ if (likely (p))
+ p->init (data);
+ return p;
}
-
- static inline const Returned* convert (const Stored *p)
+ static inline Stored *create (void)
{
+ Stored *p = (Stored *) calloc (1, sizeof (Stored));
+ if (likely (p))
+ p->init ();
return p;
}
+ static inline void destroy (Stored *p)
+ {
+ p->fini ();
+ free (p);
+ }
private:
/* Must only have one pointer. */
- mutable Stored *instance;
+ hb_atomic_ptr_t<Stored *> instance;
};
/* Specializations. */
template <unsigned int WheresFace, typename T>
-struct hb_object_lazy_loader_t : hb_lazy_loader_t<WheresFace, hb_object_lazy_loader_t<WheresFace, T>, T>
-{
- static inline T *create (hb_face_t *face)
- {
- if (unlikely (!face))
- return const_cast<T *> (&Null(T));
- T *p = (T *) calloc (1, sizeof (T));
- if (unlikely (!p))
- p = const_cast<T *> (&Null(T));
- else
- p->init (face);
- return p;
- }
- static inline void destroy (T *p)
- {
- if (p != &Null(T))
- {
- p->fini();
- free (p);
- }
- }
-};
-
-template <unsigned int WheresFace, typename T>
-struct hb_table_lazy_loader_t : hb_lazy_loader_t<WheresFace, hb_table_lazy_loader_t<WheresFace, T>, T, hb_blob_t>
+struct hb_face_lazy_loader_t : hb_lazy_loader_t<T,
+ hb_face_lazy_loader_t<WheresFace, T>,
+ hb_face_t, WheresFace> {};
+
+template <typename T, unsigned int WheresFace>
+struct hb_table_lazy_loader_t : hb_lazy_loader_t<T,
+ hb_table_lazy_loader_t<T, WheresFace>,
+ hb_face_t, WheresFace,
+ hb_blob_t>
{
static inline hb_blob_t *create (hb_face_t *face)
{
- if (unlikely (!face))
- return hb_blob_get_empty ();
return hb_sanitize_context_t ().reference_table<T> (face);
}
static inline void destroy (hb_blob_t *p)
{
hb_blob_destroy (p);
}
+ static inline const hb_blob_t *get_null (void)
+ {
+ return hb_blob_get_empty ();
+ }
static inline const T* convert (const hb_blob_t *blob)
{
return blob->as<T> ();
@@ -716,5 +763,30 @@ struct hb_table_lazy_loader_t : hb_lazy_loader_t<WheresFace, hb_table_lazy_loade
}
};
+template <typename Subclass>
+struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass>
+{
+ static inline void destroy (hb_font_funcs_t *p)
+ {
+ hb_font_funcs_destroy (p);
+ }
+ static inline const hb_font_funcs_t *get_null (void)
+ {
+ return hb_font_funcs_get_empty ();
+ }
+};
+template <typename Subclass>
+struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Subclass>
+{
+ static inline void destroy (hb_unicode_funcs_t *p)
+ {
+ hb_unicode_funcs_destroy (p);
+ }
+ static inline const hb_unicode_funcs_t *get_null (void)
+ {
+ return hb_unicode_funcs_get_empty ();
+ }
+};
+
#endif /* HB_MACHINERY_PRIVATE_HH */
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 47255488274..4955a68dc3c 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
@@ -143,12 +143,12 @@ struct hb_lockable_set_t
struct hb_reference_count_t
{
- hb_atomic_int_t ref_count;
+ mutable hb_atomic_int_t ref_count;
- inline void init (int v) { ref_count.set_relaxed (v); }
+ inline void init (int v = 1) { ref_count.set_relaxed (v); }
inline int get_relaxed (void) const { return ref_count.get_relaxed (); }
- inline int inc (void) { return ref_count.inc (); }
- inline int dec (void) { return ref_count.dec (); }
+ inline int inc (void) const { return ref_count.inc (); }
+ inline int dec (void) const { return ref_count.dec (); }
inline void fini (void) { ref_count.set_relaxed (HB_REFERENCE_COUNT_POISON_VALUE); }
inline bool is_inert (void) const { return ref_count.get_relaxed () == HB_REFERENCE_COUNT_INERT_VALUE; }
@@ -194,9 +194,9 @@ struct hb_user_data_array_t
struct hb_object_header_t
{
hb_reference_count_t ref_count;
- mutable hb_user_data_array_t *user_data;
+ hb_atomic_ptr_t<hb_user_data_array_t> user_data;
-#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, nullptr}
+#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, HB_ATOMIC_PTR_INIT (nullptr)}
private:
ASSERT_POD ();
@@ -231,8 +231,8 @@ static inline Type *hb_object_create (void)
template <typename Type>
static inline void hb_object_init (Type *obj)
{
- obj->header.ref_count.init (1);
- obj->header.user_data = nullptr;
+ obj->header.ref_count.init ();
+ obj->header.user_data.init ();
}
template <typename Type>
static inline bool hb_object_is_inert (const Type *obj)
@@ -271,10 +271,11 @@ template <typename Type>
static inline void hb_object_fini (Type *obj)
{
obj->header.ref_count.fini (); /* Do this before user_data */
- if (obj->header.user_data)
+ hb_user_data_array_t *user_data = obj->header.user_data.get ();
+ if (user_data)
{
- obj->header.user_data->fini ();
- free (obj->header.user_data);
+ user_data->fini ();
+ free (user_data);
}
}
template <typename Type>
@@ -289,14 +290,14 @@ static inline bool hb_object_set_user_data (Type *obj,
assert (hb_object_is_valid (obj));
retry:
- hb_user_data_array_t *user_data = (hb_user_data_array_t *) hb_atomic_ptr_get (&obj->header.user_data);
+ hb_user_data_array_t *user_data = obj->header.user_data.get ();
if (unlikely (!user_data))
{
user_data = (hb_user_data_array_t *) calloc (sizeof (hb_user_data_array_t), 1);
if (unlikely (!user_data))
return false;
user_data->init ();
- if (unlikely (!hb_atomic_ptr_cmpexch (&obj->header.user_data, nullptr, user_data)))
+ if (unlikely (!obj->header.user_data.cmpexch (nullptr, user_data)))
{
user_data->fini ();
free (user_data);
@@ -311,10 +312,13 @@ template <typename Type>
static inline void *hb_object_get_user_data (Type *obj,
hb_user_data_key_t *key)
{
- if (unlikely (!obj || hb_object_is_inert (obj) || !obj->header.user_data))
+ if (unlikely (!obj || hb_object_is_inert (obj)))
return nullptr;
assert (hb_object_is_valid (obj));
- return obj->header.user_data->get (key);
+ hb_user_data_array_t *user_data = obj->header.user_data.get ();
+ if (!user_data)
+ return nullptr;
+ return user_data->get (key);
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc
index 025f943762c..9da8fc7d497 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc
@@ -29,6 +29,7 @@
#include "hb-ot.h"
#include "hb-font-private.hh"
+#include "hb-machinery-private.hh"
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
@@ -70,10 +71,10 @@ struct hb_ot_font_t
OT::vmtx::accelerator_t v_metrics;
hb_face_t *face; /* MUST be JUST before the lazy loaders. */
- hb_object_lazy_loader_t<1, OT::glyf::accelerator_t> glyf;
- hb_object_lazy_loader_t<2, OT::CBDT::accelerator_t> cbdt;
- hb_object_lazy_loader_t<3, OT::post::accelerator_t> post;
- hb_object_lazy_loader_t<4, OT::kern::accelerator_t> kern;
+ hb_face_lazy_loader_t<1, OT::glyf::accelerator_t> glyf;
+ hb_face_lazy_loader_t<2, OT::CBDT::accelerator_t> cbdt;
+ hb_face_lazy_loader_t<3, OT::post::accelerator_t> post;
+ hb_face_lazy_loader_t<4, OT::kern::accelerator_t> kern;
};
@@ -225,30 +226,14 @@ hb_ot_get_font_v_extents (hb_font_t *font,
return ot_font->v_metrics.has_font_extents;
}
-static hb_font_funcs_t *static_ot_funcs = nullptr;
-#ifdef HB_USE_ATEXIT
-static
-void free_static_ot_funcs (void)
-{
-retry:
- hb_font_funcs_t *ot_funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ot_funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, ot_funcs, nullptr))
- goto retry;
+static void free_static_ot_funcs (void);
- hb_font_funcs_destroy (ot_funcs);
-}
-#endif
-
-static hb_font_funcs_t *
-_hb_ot_get_font_funcs (void)
+static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot_font_funcs_lazy_loader_t>
{
-retry:
- hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ot_funcs);
-
- if (unlikely (!funcs))
+ static inline hb_font_funcs_t *create (void)
{
- funcs = hb_font_funcs_create ();
+ hb_font_funcs_t *funcs = hb_font_funcs_create ();
hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, nullptr, nullptr);
hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, nullptr, nullptr);
@@ -267,17 +252,26 @@ retry:
hb_font_funcs_make_immutable (funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, nullptr, funcs)) {
- hb_font_funcs_destroy (funcs);
- goto retry;
- }
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_ot_funcs);
+#endif
+
+ return funcs;
+ }
+} static_ot_funcs;
#ifdef HB_USE_ATEXIT
- atexit (free_static_ot_funcs); /* First person registers atexit() callback. */
+static
+void free_static_ot_funcs (void)
+{
+ static_ot_funcs.free_instance ();
+}
#endif
- };
- return funcs;
+static hb_font_funcs_t *
+_hb_ot_get_font_funcs (void)
+{
+ return static_ot_funcs.get_unconst ();
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh
index 2a74135c8d2..612bc7fce38 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh
@@ -205,7 +205,7 @@ struct hb_ot_layout_t
hb_face_t *face; /* MUST be JUST before the lazy loaders. */
#define HB_OT_LAYOUT_TABLE(Namespace, Type) \
- hb_table_lazy_loader_t<HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), struct Namespace::Type> Type;
+ hb_table_lazy_loader_t<struct Namespace::Type, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type;
HB_OT_LAYOUT_TABLES
#undef HB_OT_LAYOUT_TABLE
} table;
@@ -219,7 +219,7 @@ HB_INTERNAL void
_hb_ot_layout_destroy (hb_ot_layout_t *layout);
-#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot)
+#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot.get_relaxed ())
/*
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh
index 9766f315244..4f08a51a2c1 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh
@@ -130,7 +130,7 @@ struct post
inline void fini (void)
{
index_to_offset.fini ();
- free (gids_sorted_by_name);
+ free (gids_sorted_by_name.get ());
}
inline bool get_glyph_name (hb_codepoint_t glyph,
@@ -162,7 +162,7 @@ struct post
return false;
retry:
- uint16_t *gids = (uint16_t *) hb_atomic_ptr_get (&gids_sorted_by_name);
+ uint16_t *gids = gids_sorted_by_name.get ();
if (unlikely (!gids))
{
@@ -174,7 +174,8 @@ struct post
gids[i] = i;
hb_sort_r (gids, count, sizeof (gids[0]), cmp_gids, (void *) this);
- if (!hb_atomic_ptr_cmpexch (&gids_sorted_by_name, nullptr, gids)) {
+ if (unlikely (!gids_sorted_by_name.cmpexch (nullptr, gids)))
+ {
free (gids);
goto retry;
}
@@ -255,7 +256,7 @@ struct post
const ArrayOf<HBUINT16> *glyphNameIndex;
hb_vector_t<uint32_t, 1> index_to_offset;
const uint8_t *pool;
- mutable uint16_t *gids_sorted_by_name;
+ hb_atomic_ptr_t<uint16_t *> gids_sorted_by_name;
};
public:
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 0c4948dfdf4..f4b397b932c 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];
- mutable arabic_fallback_plan_t *fallback_plan;
+ hb_atomic_ptr_t<arabic_fallback_plan_t> fallback_plan;
unsigned int do_fallback : 1;
unsigned int has_stch : 1;
@@ -280,7 +280,7 @@ data_destroy_arabic (void *data)
{
arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) data;
- arabic_fallback_plan_destroy (arabic_plan->fallback_plan);
+ arabic_fallback_plan_destroy (arabic_plan->fallback_plan.get ());
free (data);
}
@@ -403,12 +403,13 @@ arabic_fallback_shape (const hb_ot_shape_plan_t *plan,
return;
retry:
- arabic_fallback_plan_t *fallback_plan = (arabic_fallback_plan_t *) hb_atomic_ptr_get (&arabic_plan->fallback_plan);
+ arabic_fallback_plan_t *fallback_plan = arabic_plan->fallback_plan.get ();
if (unlikely (!fallback_plan))
{
/* This sucks. We need a font to build the fallback plan... */
fallback_plan = arabic_fallback_plan_create (plan, font);
- if (unlikely (!hb_atomic_ptr_cmpexch (&(const_cast<arabic_shape_plan_t *> (arabic_plan))->fallback_plan, nullptr, fallback_plan))) {
+ if (unlikely (!arabic_plan->fallback_plan.cmpexch (nullptr, fallback_plan)))
+ {
arabic_fallback_plan_destroy (fallback_plan);
goto retry;
}
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 1bc996edba8..efe7bda9e38 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh
@@ -125,7 +125,20 @@ struct _hb_alignof
#define alignof(x) (_hb_alignof<x>::value)
#endif
-#endif // __cplusplus < 201103L
+/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
+#ifndef explicit_operator
+#define explicit_operator
+#endif
+
+#else /* __cplusplus >= 201103L */
+
+/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
+#ifndef explicit_operator
+#define explicit_operator explicit
+#endif
+
+#endif /* __cplusplus < 201103L */
+
#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
#define likely(expr) (__builtin_expect (!!(expr), 1))
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc
index cc1834c4758..0d61d9e1f2a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc
@@ -49,11 +49,13 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
#define HB_SHAPER_PLAN(shaper) \
HB_STMT_START { \
- if (hb_##shaper##_shaper_face_data_ensure (shape_plan->face_unsafe)) { \
- HB_SHAPER_DATA (shaper, shape_plan) = \
+ if (hb_##shaper##_shaper_face_data_ensure (shape_plan->face_unsafe)) \
+ { \
+ /* XXX-MT-bug What happened to *ensure*ing this?!!!! */ \
+ HB_SHAPER_DATA (shaper, shape_plan).set_relaxed ( \
HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, \
user_features, num_user_features, \
- coords, num_coords); \
+ coords, num_coords)); \
shape_plan->shaper_func = _hb_##shaper##_shape; \
shape_plan->shaper_name = #shaper; \
return; \
@@ -106,10 +108,10 @@ DEFINE_NULL_INSTANCE (hb_shape_plan_t) =
0, /* num_coords */
{
-#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
+#define HB_SHAPER_IMPLEMENT(shaper) HB_ATOMIC_PTR_INIT (HB_SHAPER_DATA_INVALID),
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
- }
+ },
};
@@ -339,7 +341,7 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
#define HB_SHAPER_EXECUTE(shaper) \
HB_STMT_START { \
- return HB_SHAPER_DATA (shaper, shape_plan) && \
+ return HB_SHAPER_DATA (shaper, shape_plan).get () && \
hb_##shaper##_shaper_font_data_ensure (font) && \
_hb_##shaper##_shape (shape_plan, font, buffer, features, num_features); \
} HB_STMT_END
@@ -517,7 +519,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
retry:
- hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans);
+ hb_face_t::plan_node_t *cached_plan_nodes = face->shape_plans.get ();
/* Don't look for plan in the cache if there were variation coordinates XXX Fix me. */
if (!hb_coords_present (coords, num_coords))
@@ -552,7 +554,8 @@ retry:
node->shape_plan = shape_plan;
node->next = cached_plan_nodes;
- if (!hb_atomic_ptr_cmpexch (&face->shape_plans, cached_plan_nodes, node)) {
+ if (unlikely (!face->shape_plans.cmpexch (cached_plan_nodes, node)))
+ {
hb_shape_plan_destroy (shape_plan);
free (node);
goto retry;
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc
index c1e73656c17..3c2e6c4a969 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc
@@ -32,6 +32,7 @@
#include "hb-shape-plan-private.hh"
#include "hb-buffer-private.hh"
#include "hb-font-private.hh"
+#include "hb-machinery-private.hh"
/**
* SECTION:hb-shape
@@ -45,21 +46,50 @@
* contains the output glyphs and their positions.
**/
-static const char **static_shaper_list;
+
+static void free_static_shaper_list (void);
+static const char *nil_shaper_list[] = {nullptr};
+
+static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
+ hb_shaper_list_lazy_loader_t>
+{
+ static inline const char ** create (void)
+ {
+ const char **shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
+ if (unlikely (!shaper_list))
+ return nullptr;
+
+ const hb_shaper_pair_t *shapers = _hb_shapers_get ();
+ unsigned int i;
+ for (i = 0; i < HB_SHAPERS_COUNT; i++)
+ shaper_list[i] = shapers[i].name;
+ shaper_list[i] = nullptr;
+
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_shaper_list);
+#endif
+
+ return shaper_list;
+ }
+ static inline void destroy (const char **l)
+ {
+ free (l);
+ }
+ static inline const char ** get_null (void)
+ {
+ return nil_shaper_list;
+ }
+} static_shaper_list;
#ifdef HB_USE_ATEXIT
static
void free_static_shaper_list (void)
{
-retry:
- const char **shaper_list = (const char **) hb_atomic_ptr_get (&static_shaper_list);
- if (!hb_atomic_ptr_cmpexch (&static_shaper_list, shaper_list, nullptr))
- goto retry;
-
- free (shaper_list);
+ static_shaper_list.free_instance ();
}
#endif
+
/**
* hb_shape_list_shapers:
*
@@ -73,35 +103,7 @@ retry:
const char **
hb_shape_list_shapers (void)
{
-retry:
- const char **shaper_list = (const char **) hb_atomic_ptr_get (&static_shaper_list);
-
- if (unlikely (!shaper_list))
- {
- /* Not found; allocate one. */
- shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
- if (unlikely (!shaper_list)) {
- static const char *nil_shaper_list[] = {nullptr};
- return nil_shaper_list;
- }
-
- const hb_shaper_pair_t *shapers = _hb_shapers_get ();
- unsigned int i;
- for (i = 0; i < HB_SHAPERS_COUNT; i++)
- shaper_list[i] = shapers[i].name;
- shaper_list[i] = nullptr;
-
- if (!hb_atomic_ptr_cmpexch (&static_shaper_list, nullptr, shaper_list)) {
- free (shaper_list);
- goto retry;
- }
-
-#ifdef HB_USE_ATEXIT
- atexit (free_static_shaper_list); /* First person registers atexit() callback. */
-#endif
- }
-
- return shaper_list;
+ return static_shaper_list.get_unconst ();
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh
index 7844081e95b..4a10279c794 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh
@@ -36,7 +36,7 @@
#ifdef HB_SHAPER
-#define HB_SHAPER_DATA_GET(object) HB_SHAPER_DATA (HB_SHAPER, object)
+#define HB_SHAPER_DATA_GET(object) HB_SHAPER_DATA (HB_SHAPER, object).get ()
#endif
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh
index 457cd957bfb..fb04bbc3cf5 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh
@@ -56,7 +56,7 @@ _hb_shapers_get (void);
#define HB_SHAPER_DATA_TYPE_NAME(shaper, object) hb_##shaper##_##object##_data_t
#define HB_SHAPER_DATA_TYPE(shaper, object) struct HB_SHAPER_DATA_TYPE_NAME(shaper, object)
-#define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* (HB_SHAPER_DATA_TYPE(shaper, object) **) &(instance)->shaper_data.shaper)
+#define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* reinterpret_cast<hb_atomic_ptr_t<HB_SHAPER_DATA_TYPE(shaper, object) *> *> (&(instance)->shaper_data.shaper))
#define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE(shaper, object, object)
#define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_create
#define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_destroy
@@ -72,7 +72,7 @@ _hb_shapers_get (void);
HB_SHAPER_DATA_ENSURE_FUNC (shaper, object) (hb_##object##_t *object)
#define HB_SHAPER_DATA_DESTROY(shaper, object) \
- if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \
+ if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object).get ()) \
if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data);
@@ -84,9 +84,10 @@ bool \
HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
{\
retry: \
- HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \
+ HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object).get (); \
if (likely (data) && !(condition)) { \
- /* Note that evaluating condition above can be dangerous if another thread \
+ /* XXX-MT-bug \
+ * Note that evaluating condition above can be dangerous if another thread \
* got here first and destructed data. That's, as always, bad use pattern. \
* If you modify the font (change font size), other threads must not be \
* using it at the same time. However, since this check is delayed to \
@@ -99,7 +100,8 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
/* Drop and recreate. */ \
/* If someone dropped it in the mean time, throw it away and don't touch it. \
* Otherwise, destruct it. */ \
- if (hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), data, nullptr)) { \
+ if (likely (HB_SHAPER_DATA (shaper, object).cmpexch (data, nullptr))) \
+ { \
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \
} \
goto retry; \
@@ -108,7 +110,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \
if (unlikely (!data)) \
data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \
- if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), nullptr, data)) { \
+ if (unlikely (!HB_SHAPER_DATA (shaper, object).cmpexch (nullptr, data))) { \
if (data && \
data != HB_SHAPER_DATA_INVALID && \
data != HB_SHAPER_DATA_SUCCEEDED) \
@@ -122,7 +124,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
/* For embedding in face / font / ... */
struct hb_shaper_data_t {
-#define HB_SHAPER_IMPLEMENT(shaper) void *shaper;
+#define HB_SHAPER_IMPLEMENT(shaper) hb_atomic_ptr_t<void *> shaper;
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
};
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc
index d44d8c91212..e423f2557c5 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc
@@ -26,7 +26,7 @@
#include "hb-private.hh"
#include "hb-shaper-private.hh"
-#include "hb-atomic-private.hh"
+#include "hb-machinery-private.hh"
static const hb_shaper_pair_t all_shapers[] = {
@@ -36,51 +36,28 @@ static const hb_shaper_pair_t all_shapers[] = {
};
-/* Thread-safe, lock-free, shapers */
+static void free_static_shapers (void);
-static const hb_shaper_pair_t *static_shapers;
-
-#ifdef HB_USE_ATEXIT
-static
-void free_static_shapers (void)
-{
-retry:
- hb_shaper_pair_t *shapers = (hb_shaper_pair_t *) hb_atomic_ptr_get (&static_shapers);
- if (!hb_atomic_ptr_cmpexch (&static_shapers, shapers, nullptr))
- goto retry;
-
- if (unlikely (shapers != all_shapers))
- free ((void *) shapers);
-}
-#endif
-
-const hb_shaper_pair_t *
-_hb_shapers_get (void)
+static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_pair_t,
+ hb_shapers_lazy_loader_t>
{
-retry:
- hb_shaper_pair_t *shapers = (hb_shaper_pair_t *) hb_atomic_ptr_get (&static_shapers);
-
- if (unlikely (!shapers))
+ static inline hb_shaper_pair_t *create (void)
{
char *env = getenv ("HB_SHAPER_LIST");
- if (!env || !*env) {
- (void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
- return (const hb_shaper_pair_t *) all_shapers;
- }
+ if (!env || !*env)
+ return nullptr;
- /* Not found; allocate one. */
- shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
- if (unlikely (!shapers)) {
- (void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
- return (const hb_shaper_pair_t *) all_shapers;
- }
+ hb_shaper_pair_t *shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
+ if (unlikely (!shapers))
+ return nullptr;
memcpy (shapers, all_shapers, sizeof (all_shapers));
/* Reorder shaper list to prefer requested shapers. */
unsigned int i = 0;
char *end, *p = env;
- for (;;) {
+ for (;;)
+ {
end = strchr (p, ',');
if (!end)
end = p + strlen (p);
@@ -102,15 +79,32 @@ retry:
p = end + 1;
}
- if (!hb_atomic_ptr_cmpexch (&static_shapers, nullptr, shapers)) {
- free (shapers);
- goto retry;
- }
-
#ifdef HB_USE_ATEXIT
- atexit (free_static_shapers); /* First person registers atexit() callback. */
+ atexit (free_static_shapers);
#endif
+
+ return shapers;
+ }
+ static inline void destroy (const hb_shaper_pair_t *p)
+ {
+ free ((void *) p);
+ }
+ static inline const hb_shaper_pair_t *get_null (void)
+ {
+ return all_shapers;
}
+} static_shapers;
- return shapers;
+#ifdef HB_USE_ATEXIT
+static
+void free_static_shapers (void)
+{
+ static_shapers.free_instance ();
+}
+#endif
+
+const hb_shaper_pair_t *
+_hb_shapers_get (void)
+{
+ return static_shapers.get_unconst ();
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc
index 2c08718648a..56d13e7cd28 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc
@@ -17,6 +17,7 @@
#include "hb-private.hh"
#include "hb-unicode-private.hh"
+#include "hb-machinery-private.hh"
#include "ucdn.h"
@@ -238,31 +239,14 @@ hb_ucdn_decompose_compatibility(hb_unicode_funcs_t *ufuncs HB_UNUSED,
return ucdn_compat_decompose(u, decomposed);
}
-static hb_unicode_funcs_t *static_ucdn_funcs = nullptr;
-#ifdef HB_USE_ATEXIT
-static
-void free_static_ucdn_funcs (void)
-{
-retry:
- hb_unicode_funcs_t *ucdn_funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_ucdn_funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ucdn_funcs, ucdn_funcs, nullptr))
- goto retry;
+static void free_static_ucdn_funcs (void);
- hb_unicode_funcs_destroy (ucdn_funcs);
-}
-#endif
-
-extern "C" HB_INTERNAL
-hb_unicode_funcs_t *
-hb_ucdn_get_unicode_funcs (void)
+static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_ucdn_unicode_funcs_lazy_loader_t>
{
-retry:
- hb_unicode_funcs_t *funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_ucdn_funcs);
-
- if (unlikely (!funcs))
+ static inline hb_unicode_funcs_t *create (void)
{
- funcs = hb_unicode_funcs_create (nullptr);
+ hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
#define HB_UNICODE_FUNC_IMPLEMENT(name) \
hb_unicode_funcs_set_##name##_func (funcs, hb_ucdn_##name, nullptr, nullptr);
@@ -271,15 +255,25 @@ retry:
hb_unicode_funcs_make_immutable (funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ucdn_funcs, nullptr, funcs)) {
- hb_unicode_funcs_destroy (funcs);
- goto retry;
- }
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_ucdn_funcs);
+#endif
+
+ return funcs;
+ }
+} static_ucdn_funcs;
#ifdef HB_USE_ATEXIT
- atexit (free_static_ucdn_funcs); /* First person registers atexit() callback. */
+static
+void free_static_ucdn_funcs (void)
+{
+ static_ucdn_funcs.free_instance ();
+}
#endif
- };
- return hb_unicode_funcs_reference (funcs);
+extern "C" HB_INTERNAL
+hb_unicode_funcs_t *
+hb_ucdn_get_unicode_funcs (void)
+{
+ return static_ucdn_funcs.get_unconst ();
}
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc
index 94e6bb551bc..11b7384fa77 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc
@@ -190,7 +190,8 @@ hb_ScriptPlaceOpenType(
}
-struct hb_uniscribe_shaper_funcs_t {
+struct hb_uniscribe_shaper_funcs_t
+{
SIOT ScriptItemizeOpenType;
SSOT ScriptShapeOpenType;
SPOT ScriptPlaceOpenType;
@@ -220,47 +221,49 @@ struct hb_uniscribe_shaper_funcs_t {
}
}
};
-static hb_uniscribe_shaper_funcs_t *uniscribe_funcs;
-#ifdef HB_USE_ATEXIT
-static inline void
-free_uniscribe_funcs (void)
-{
-retry:
- hb_uniscribe_shaper_funcs_t *local_uniscribe_funcs =
- (hb_uniscribe_shaper_funcs_t *) hb_atomic_ptr_get (&uniscribe_funcs);
- if (!hb_atomic_ptr_cmpexch (&uniscribe_funcs, local_uniscribe_funcs, nullptr))
- goto retry;
- free (uniscribe_funcs);
-}
-#endif
+static void free_static_uniscribe_shaper_funcs (void);
-static hb_uniscribe_shaper_funcs_t *
-hb_uniscribe_shaper_get_funcs (void)
+static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t<hb_uniscribe_shaper_funcs_t,
+ hb_uniscribe_shaper_funcs_lazy_loader_t>
{
-retry:
- hb_uniscribe_shaper_funcs_t *funcs = (hb_uniscribe_shaper_funcs_t *) hb_atomic_ptr_get (&uniscribe_funcs);
-
- if (unlikely (!funcs))
+ static inline hb_uniscribe_shaper_funcs_t *create (void)
{
- funcs = (hb_uniscribe_shaper_funcs_t *) calloc (1, sizeof (hb_uniscribe_shaper_funcs_t));
+ hb_uniscribe_shaper_funcs_t *funcs = (hb_uniscribe_shaper_funcs_t *) calloc (1, sizeof (hb_uniscribe_shaper_funcs_t));
if (unlikely (!funcs))
return nullptr;
funcs->init ();
- if (!hb_atomic_ptr_cmpexch (&uniscribe_funcs, nullptr, funcs)) {
- free (funcs);
- goto retry;
- }
-
#ifdef HB_USE_ATEXIT
- atexit (free_uniscribe_funcs); /* First person registers atexit() callback. */
+ atexit (free_static_uniscribe_shaper_funcs);
#endif
+
+ return funcs;
}
+ static inline void destroy (hb_uniscribe_shaper_funcs_t *p)
+ {
+ free ((void *) p);
+ }
+ static inline hb_uniscribe_shaper_funcs_t *get_null (void)
+ {
+ return nullptr;
+ }
+} static_uniscribe_shaper_funcs;
- return funcs;
+#ifdef HB_USE_ATEXIT
+static
+void free_static_uniscribe_shaper_funcs (void)
+{
+ static_uniscribe_shaper_funcs.free_instance ();
+}
+#endif
+
+static hb_uniscribe_shaper_funcs_t *
+hb_uniscribe_shaper_get_funcs (void)
+{
+ return static_uniscribe_shaper_funcs.get_unconst ();
}
diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac
index 1e28cff0888..46aa323f31e 100644
--- a/Build/source/libs/harfbuzz/version.ac
+++ b/Build/source/libs/harfbuzz/version.ac
@@ -8,4 +8,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current harfbuzz version
-m4_define([harfbuzz_version], [1.8.7])
+m4_define([harfbuzz_version], [1.8.8])