Commit Graph

44 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 391f1ff5d8 Fix _InterlockedCompareExchangePointer on x86 2012-07-13 09:04:07 -04:00
Behdad Esfahbod 12f5c0a222 Fix check for Intel atomic ops 2012-06-26 11:16:13 -04:00
Behdad Esfahbod 4a3a9897b3 Disable Intel atomic ops on mingw32
Apparently the configure test is not enough...
2012-06-05 20:39:07 -04:00
Behdad Esfahbod 0594a24484 Cleanup TRUE/FALSE vs true/false 2012-06-05 20:35:40 -04:00
Behdad Esfahbod 04bc1eebe7 Add configure tests for Intel atomic intrinsics 2012-06-05 20:16:56 -04:00
Behdad Esfahbod 6843ce01be Add atomic-pointer functions
Gonig to use these for lock-free linked-lists, to be used for
hb_language_t among other things.
2012-06-05 17:27:20 -04:00
Behdad Esfahbod cdafe3a7d8 Add gcc intrinsics implementations for atomic and mutex 2012-06-05 16:40:23 -04:00
Behdad Esfahbod d970d2899b Add gcc implementation for atomic ops 2012-06-05 16:06:28 -04:00
Behdad Esfahbod 0558d55bac Remove hb_atomic_int_set/get()
We never use them in fact...

I'm just adjusting these as I better understand the requirements of
the code and the guarantees of each operation.
2012-05-28 10:46:47 -04:00
Behdad Esfahbod a3547330fa Cleanup atomic ops on OS X 2012-05-27 10:20:47 -04:00
Behdad Esfahbod 819faa0530 Minor 2012-05-27 10:09:18 -04:00
Behdad Esfahbod 303d5850ec Fix Windows atomic get/set
According to:
http://msdn.microsoft.com/en-us/library/65tt87y8.aspx

MemoryBarrier() is the right macro to protect these, not _ReadBarrier()
and/or _WriteBarrier().
2012-05-27 10:01:13 -04:00
Behdad Esfahbod cde1c0114b Fix hb_atomic_int_set() implementation for HB_NO_MT
As pointed out by Jonathan Kew.
2012-05-24 10:46:39 -04:00
Behdad Esfahbod bd908b4f10 Implement hb_atomic_int_set() for OS X 2012-05-17 22:02:08 -04:00
Behdad Esfahbod 022a05ae90 Minor 2012-05-17 21:53:24 -04:00
Behdad Esfahbod 22afd66a30 Add hb_atomic_int_set() again 2012-05-17 21:23:49 -04:00
Behdad Esfahbod 34961e3198 Prefer native atomic/mutex ops to glib's 2012-05-17 20:50:38 -04:00
Behdad Esfahbod ec3ba4b96f Move atomic ops into their own header 2012-05-17 20:30:46 -04:00