Behdad Esfahbod
1227a9e5a5
[atomic] Unify typedef
...
Removes volatile from fallback implementation. That was handwavy
anyway.
2018-08-08 22:45:49 -07:00
Behdad Esfahbod
5cd1888c9d
[atomic] Change Mac atomic int type to int
...
If ever int is not 32bit, we'll fix this...
2018-08-08 22:43:53 -07:00
Behdad Esfahbod
e1de86eac1
[atomic] Change Windows atomic int type to int
2018-08-08 22:42:33 -07:00
Behdad Esfahbod
aee2d10b2b
[atomic] Change Solaris atomic int to signed
2018-08-08 22:40:10 -07:00
Behdad Esfahbod
13f4c137c6
[atomic] Fix Solaris ones to add proper barriers
2018-08-01 14:15:00 -07:00
Behdad Esfahbod
19dfaa3515
[atomic] Remove volatile from IBM impl signature
2018-08-01 14:15:00 -07:00
Behdad Esfahbod
2093a3e0cb
[atomic] Oops
2018-08-01 14:15:00 -07:00
Behdad Esfahbod
19b98348ff
[atomic] Use read-barrier for get()
2018-08-01 14:15:00 -07:00
Behdad Esfahbod
006d4f031a
[atomic] Some more minor tweaks
2018-08-01 14:15:00 -07:00
Behdad Esfahbod
dfc86e4b35
[atomic] Fix cast to fallback ptr_get()
2018-08-01 00:22:18 -07:00
Behdad Esfahbod
ad27562742
[atomic] On IBM, use light-weight sync for everything
...
lwsync() is a full read/write-barrier. That's all we need, never
need sync(). I'm not sure why an isync() was used in fetch_and_add,
but since that's a read-modify-write, I just changed it to have
lwsync() on both sides.
2018-07-31 23:01:05 -07:00
Behdad Esfahbod
fd638d215f
[atomic] Add XXX items around Solaris ops
...
Since add_int and cas are both read-modify-write, I wonder if we
also need a barrier after them.
2018-07-31 23:00:15 -07:00
Behdad Esfahbod
896ff15ae6
[atomic] Fix get() impl
...
Originally, glib's atomic_get was implemented as "memory_barrier; load".
I copied this into cairo, fontconfig, and harfbuzz. However, that's
wrong. Correct way is "load; memory_barrier". The details are long
and hard to fully grasp. Best to read:
https://www.kernel.org/doc/Documentation/memory-barriers.txt
Also see my report against GNOME:
https://gitlab.gnome.org/GNOME/glib/issues/1449
Note that this is irrelevant if C++11-like atomic ops are available.
2018-07-31 22:51:38 -07:00
Behdad Esfahbod
63c74e8d1d
[atomic] Fix fallback impl
2018-07-31 22:21:21 -07:00
Behdad Esfahbod
4bc16aca47
[atomic] Add get_relaxed / set_relaxed
...
To help TSan and be more "correct".
2018-07-31 21:29:18 -07:00
Behdad Esfahbod
3dd1b88765
[atomic] Use CONSUME, not ACQUIRE, memory-order for get()
...
Although, all implementations just elevate that to ACQUIRE.
But requirement for us is just CONSUME.
2018-07-31 20:28:36 -07:00
Behdad Esfahbod
06b91d935d
Revert "[atomic] Make pointer get op relaxed instead of acquire"
...
This reverts commit b1e5650c67
.
After lots of head-scratching and finally finding the only truly
readable source to be the good old:
https://www.kernel.org/doc/Documentation/memory-barriers.txt
I've convinced myself that we need consume memory-ordering on get().
The location of memory-barrier in a load should be after, not before
the load. That needs fixing. I'll do that separately.
2018-07-31 20:28:36 -07:00
Behdad Esfahbod
b1e5650c67
[atomic] Make pointer get op relaxed instead of acquire
...
We only use it before cmpexch, so relaxed is fine and faster for
common case.
2018-07-31 01:02:31 -07:00
Behdad Esfahbod
04b7b81bcb
Reland "Implement C++11-style GCC builtin atomic ops"
...
Fixed the crasher in it.
2018-07-17 11:02:38 +02:00
Behdad Esfahbod
3edef5a19b
Revert "Implement C++11-style GCC builtin atomic ops"
...
This reverts commit 21fa170f0b
.
Is crashing. Oops.
2018-07-17 10:50:01 +02:00
Behdad Esfahbod
21fa170f0b
Implement C++11-style GCC builtin atomic ops
...
Hopefully fixes bots.
2018-07-16 17:58:02 +02:00
Behdad Esfahbod
804b59cf49
Relax C++11 atomic ops memory order to acquire-release
2018-07-16 15:45:22 +02:00
Behdad Esfahbod
bda242409f
Implement C++11 <atomic> operations
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/345
2018-07-16 15:45:22 +02:00
Behdad Esfahbod
e36cd1dfd3
Remove trivial HB_ATOMIC_INT_INIT()
2018-05-31 19:31:39 -07:00
Bruce Mitchener
8a0952db7e
atomics: Favor compiler primitives over macOS APIs. ( #676 )
...
In macOS 10.12, the `OSMemoryBarrier` and related APIs were deprecated
in favor of using `std::atomic`. On the way to supporting `std::atomic`,
we can favor using the "Intel primitives" which are also available on
macOS.
2018-01-04 15:10:10 +03:30
Behdad Esfahbod
42d518513c
Towards compiling with pre-C++11 compilers and nullptr fallback
...
https://github.com/behdad/harfbuzz/issues/585
2017-10-27 00:25:11 -06:00
Behdad Esfahbod
1817221620
Minor
2017-05-16 14:26:28 -07:00
Behdad Esfahbod
49e72634af
Limit use of AIX intrinsics to IBM's compiler
2015-12-10 17:44:19 +01:00
Behdad Esfahbod
70b33edae7
Add atomic ops for AIX
...
Patch from Volker Simonis.
2015-12-10 15:54:42 +01:00
Behdad Esfahbod
9c974360fe
Minor rename
2015-04-09 12:04:14 -07:00
Behdad Esfahbod
2958f2c147
Fixup
2015-04-08 16:26:16 -07:00
Konstantin Ritt
3f174cd020
Minor refactoring to the atomics implementation
...
s/atomic_int/atomic_int_impl/ and s/atomic_ptr/atomic_ptr_impl/
to bring it in par with hb_mutex_impl_t, then re-introduce
hb_atomic_int_t as a wrapper around hb_atomic_int_impl_t.
In hb_reference_count_t, make it clear the non-atomic get and set
are intentional due to nature of the cases they are used in
(comparison to -1 and the debug output/tracing).
2015-04-08 13:04:22 -07:00
Behdad Esfahbod
45a8b46f47
Allow implementing atomic and mutex ops in config
...
Motivated by
https://github.com/behdad/harfbuzz/pull/92
2015-04-08 12:49:38 -07:00
Behdad Esfahbod
db30828048
[win] Consolidate windows.h include tips and tricks
2014-07-19 16:32:04 -04:00
Behdad Esfahbod
f26d59d468
More fixing MemoryBarrier() on Mingw32
...
Set requested windows header to Vista. See discussion:
fbb2847f54 (commitcomment-7054700)
2014-07-19 16:10:21 -04:00
Primiano Tucci
05870ed62e
Use __aarch64__ for 64-bit ARM detection, not __arm64__
...
Many GCC versions don't define __arm64__
2014-04-02 12:41:11 -07:00
Behdad Esfahbod
fbb2847f54
Improve MemoryBarrier() implementation
...
See thread "[HarfBuzz] compilation error of 0.9.26 with MinGW"
started by Werner.
2014-02-05 08:22:06 -05:00
Behdad Esfahbod
0bb31e4497
Bug 71845 - Use 64-bit cmpexch on ARM64 iOS
2013-11-20 14:21:07 -05:00
Behdad Esfahbod
1f97060985
Put back MemoryBarrier fallback implementation on MINGW32
...
This almost reverts 2761e8a632
,
but only if under MINGW32, so it doesn't affect MSVC.
2013-04-04 15:02:03 -04:00
Behdad Esfahbod
2761e8a632
[win32] Remove MemoryBarrier() fallback implementation
...
I added these because the older mingw32 toolchain didn't have
MemoryBarrier(). The newer mingw-w64 toolchain however has.
As reported by John Emmas this was causing build failure with
MSVC (on glib) because of inline issues. But that reminded me
that we may be taking this path even if the system implements
MemoryBarrier as a function, which is a waste. So, just remove
it.
2013-03-07 20:51:30 -05:00
Behdad Esfahbod
a6c1e040e5
Improve check for Windows platforms
...
Instead of checking for compiler, check for platform.
2013-02-12 15:31:58 -05:00
Behdad Esfahbod
b842780138
Minor
2013-02-11 17:02:17 -05:00
Behdad Esfahbod
de649f07f1
Fix residuals from fontconfig changes
2013-01-14 00:26:43 -06:00
Behdad Esfahbod
2dcb333f52
Add atomic ops for Solaris
...
Based on fontconfig patch from Raimund Steger.
2013-01-10 01:18:10 -06:00
Behdad Esfahbod
11d2956553
Minor
2013-01-02 17:41:27 -06:00
Behdad Esfahbod
0e9f0f3e5f
Fix atomic ops on iOS
...
Patch from John Ralls.
2012-12-10 15:25:21 -05:00
Behdad Esfahbod
071d5b831e
Work around missing OSAtomicCompareAndSwapPtrBarrier() on OS X 10.4
...
Not sure how to handle iOS.
2012-12-10 00:57:00 -05:00
Behdad Esfahbod
0e292eb2a2
Remove Glib thread-safety support
...
Now that we have pthread detection in configure, we don't need Glib
anymore. Glib will only be a Unicode data provider.
2012-10-02 15:09:38 -04:00
Behdad Esfahbod
52ff2681d8
Use VisualStudio-style atomic intrinsics on mingw32
2012-08-28 18:03:35 -04:00
Behdad Esfahbod
fa2bd9fb63
Further simplify atomic ops on Visual Studio
2012-07-14 12:15:54 -04:00