From 0488870e5fd953348c6bfa7482a113124f911164 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 26 Nov 2009 15:23:17 +0100 Subject: [PATCH] lockfree: use pointer compression on both x86_64 and on alpha alpha: cas needs to be emulated with an ll/sc pair x86_64: pointer compression seems to be faster than cmpxchg16b Signed-off-by: Tim Blechmann --- boost/lockfree/detail/cas.hpp | 2 +- boost/lockfree/detail/prefix.hpp | 7 +++---- boost/lockfree/detail/tagged_ptr_ptrcompression.hpp | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/boost/lockfree/detail/cas.hpp b/boost/lockfree/detail/cas.hpp index ec47a00..569a23b 100644 --- a/boost/lockfree/detail/cas.hpp +++ b/boost/lockfree/detail/cas.hpp @@ -121,7 +121,7 @@ struct atomic_cas64 { #if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \ (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 1) \ - || ((__GNUC__ == 4) && (__GNUC_MINOR__ == 1)))) && defined(__x86_64__)) \ + || ((__GNUC__ == 4) && (__GNUC_MINOR__ == 1)))) && (defined(__x86_64__) || defined(__alpha__) ) ) \ || defined(__INTEL_COMPILER) return __sync_bool_compare_and_swap(addr, old, nw); #elif defined(_M_IX86) diff --git a/boost/lockfree/detail/prefix.hpp b/boost/lockfree/detail/prefix.hpp index 16a81e6..2387796 100644 --- a/boost/lockfree/detail/prefix.hpp +++ b/boost/lockfree/detail/prefix.hpp @@ -49,11 +49,10 @@ #elif defined(__ppc__) #define BOOST_LOCKFREE_DCAS_ALIGNMENT #elif defined(__x86_64__) - - #if !(defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)) - #define BOOST_LOCKFREE_PTR_COMPRESSION 1 - #endif + #define BOOST_LOCKFREE_PTR_COMPRESSION 1 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __attribute__((aligned(16))) +#elif defined(__alpha__) + #define BOOST_LOCKFREE_PTR_COMPRESSION 1 #endif diff --git a/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp b/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp index 2b69348..224f0f4 100644 --- a/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp +++ b/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp @@ -23,10 +23,10 @@ namespace boost namespace lockfree { -#if defined (__x86_64__) || defined (_M_X64) +#if defined (__x86_64__) || defined (_M_X64) || defined(__alpha__) template -class BOOST_LOCKFREE_DCAS_ALIGNMENT tagged_ptr +class tagged_ptr { typedef boost::uint64_t compressed_ptr_t; typedef boost::uint16_t tag_t; -- 2.11.4.GIT