]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/atomic/detail/platform.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / atomic / detail / platform.hpp
index df4cc305ac1e109606bff9daa2f61acf45e69baf..36607283f9cb14b6be74f5ec89955c9d9b890fc4 100644 (file)
@@ -4,7 +4,7 @@
  * http://www.boost.org/LICENSE_1_0.txt)
  *
  * Copyright (c) 2009 Helge Bahmann
- * Copyright (c) 2014 Andrey Semashev
+ * Copyright (c) 2014-2018, 2020 Andrey Semashev
  */
 /*!
  * \file   atomic/detail/platform.hpp
 
 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_x86
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_x86
 #define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_x86
 
-#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__))
+#elif defined(__GNUC__) && defined(__aarch64__)
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_ppc
-#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_ppc
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_aarch64
+#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_aarch64
 
-#elif defined(__GNUC__) && defined(__arm__) && (BOOST_ATOMIC_DETAIL_ARM_ARCH+0) >= 6
+#elif defined(__GNUC__) && defined(__arm__) && (BOOST_ATOMIC_DETAIL_ARM_ARCH >= 6)
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_arm
+#if (BOOST_ATOMIC_DETAIL_ARM_ARCH >= 8)
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_aarch32
+#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_aarch32
+#else
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_arm
 #define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_arm
+#endif
+
+#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__))
+
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_ppc
+#define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND gcc_ppc
 
 #elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__sparcv8plus) || defined(__sparc_v9__))
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_sparc
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_sparc
 
 #elif defined(__GNUC__) && defined(__alpha__)
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_alpha
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND gcc_alpha
 
 #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM msvc_x86
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND msvc_x86
 
 #elif defined(_MSC_VER) && _MSC_VER >= 1700 && (defined(_M_ARM) || defined(_M_ARM64))
 
-#define BOOST_ATOMIC_DETAIL_PLATFORM msvc_arm
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND msvc_arm
 
 #endif
 
         (__GCC_ATOMIC_LLONG_LOCK_FREE + 0) == 2\
     )
 
-#define BOOST_ATOMIC_DETAIL_BACKEND gcc_atomic
-
-#elif defined(BOOST_ATOMIC_DETAIL_PLATFORM)
+#define BOOST_ATOMIC_DETAIL_CORE_BACKEND gcc_atomic
 
-#define BOOST_ATOMIC_DETAIL_BACKEND BOOST_ATOMIC_DETAIL_PLATFORM
-
-#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 401) &&\
+// GCC __sync* instrinsics backend is less efficient than asm-based backends, so use it only when nothing better is available.
+#elif !defined(BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND) &&\
+    defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 401) &&\
     (\
         defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) ||\
         defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) ||\
         defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)\
     )
 
-#define BOOST_ATOMIC_DETAIL_BACKEND gcc_sync
+#define BOOST_ATOMIC_DETAIL_CORE_BACKEND gcc_sync
 
 #endif
 
 // OS-based backends
 
-#if !defined(BOOST_ATOMIC_DETAIL_BACKEND)
+#if !defined(BOOST_ATOMIC_DETAIL_CORE_BACKEND) && !defined(BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND)
 
 #if defined(__linux__) && defined(__arm__)
 
-#define BOOST_ATOMIC_DETAIL_BACKEND linux_arm
+#define BOOST_ATOMIC_DETAIL_CORE_BACKEND linux_arm
 
 #elif defined(BOOST_WINDOWS) || defined(_WIN32_CE)
 
-#define BOOST_ATOMIC_DETAIL_BACKEND windows
+#define BOOST_ATOMIC_DETAIL_CORE_BACKEND windows
 
 #endif
 
-#endif // !defined(BOOST_ATOMIC_DETAIL_BACKEND)
+#endif // !defined(BOOST_ATOMIC_DETAIL_CORE_BACKEND)
 
-#endif // !defined(BOOST_ATOMIC_FORCE_FALLBACK)
+// Waiting and notifying operations backends
+#if defined(BOOST_WINDOWS)
 
-#if !defined(BOOST_ATOMIC_DETAIL_BACKEND)
-#define BOOST_ATOMIC_DETAIL_BACKEND emulated
-#define BOOST_ATOMIC_EMULATED
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND windows
+
+#else // defined(BOOST_WINDOWS)
+
+#include <boost/atomic/detail/futex.hpp>
+
+#if defined(BOOST_ATOMIC_DETAIL_HAS_FUTEX)
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND futex
+#elif defined(__FreeBSD__)
+#include <sys/param.h>
+// FreeBSD prior to 7.0 had _umtx_op with a different signature
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 700000
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND freebsd_umtx
+#endif // defined(__FreeBSD_version) && __FreeBSD_version >= 700000
+#elif defined(__DragonFly__)
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND dragonfly_umtx
 #endif
 
+#endif // defined(BOOST_WINDOWS)
+
+#endif // !defined(BOOST_ATOMIC_FORCE_FALLBACK)
+
 #if !defined(BOOST_ATOMIC_DETAIL_FP_BACKEND)
 #define BOOST_ATOMIC_DETAIL_FP_BACKEND generic
 #define BOOST_ATOMIC_DETAIL_FP_BACKEND_GENERIC
 #define BOOST_ATOMIC_DETAIL_EXTRA_FP_BACKEND_GENERIC
 #endif
 
-#define BOOST_ATOMIC_DETAIL_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_BACKEND).hpp>
+#if !defined(BOOST_ATOMIC_DETAIL_WAIT_BACKEND)
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND generic
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND_GENERIC
+#endif
+
+#if defined(BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND)
+#define BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_CORE_ARCH_BACKEND).hpp>
+#endif
+#if defined(BOOST_ATOMIC_DETAIL_CORE_BACKEND)
+#define BOOST_ATOMIC_DETAIL_CORE_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_CORE_BACKEND).hpp>
+#endif
 #define BOOST_ATOMIC_DETAIL_FP_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_FP_BACKEND).hpp>
 #define BOOST_ATOMIC_DETAIL_EXTRA_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_EXTRA_BACKEND).hpp>
 #define BOOST_ATOMIC_DETAIL_EXTRA_FP_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_EXTRA_FP_BACKEND).hpp>
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_WAIT_BACKEND).hpp>
 
 #endif // BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_