update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -16,12 +16,13 @@
#ifndef BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
#include <cstddef>
#include <boost/memory_order.hpp>
#include <boost/type_traits/make_signed.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/interlocked.hpp>
#include <boost/atomic/detail/storage_type.hpp>
#include <boost/atomic/detail/operations_fwd.hpp>
#include <boost/atomic/detail/type_traits/make_signed.hpp>
#include <boost/atomic/capabilities.hpp>
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
#include <boost/cstdint.hpp>
@@ -72,6 +73,7 @@ namespace detail {
struct msvc_x86_operations_base
{
static BOOST_CONSTEXPR_OR_CONST bool full_cas_based = false;
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
@@ -106,11 +108,15 @@ struct msvc_x86_operations_base
}
};
template< typename T, typename Derived >
template< std::size_t Size, bool Signed, typename Derived >
struct msvc_x86_operations :
public msvc_x86_operations_base
{
typedef T storage_type;
typedef typename make_storage_type< Size >::type storage_type;
typedef typename make_storage_type< Size >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = Size;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
@@ -135,7 +141,7 @@ struct msvc_x86_operations :
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
typedef typename make_signed< storage_type >::type signed_storage_type;
typedef typename boost::atomics::detail::make_signed< storage_type >::type signed_storage_type;
return Derived::fetch_add(storage, static_cast< storage_type >(-static_cast< signed_storage_type >(v)), order);
}
@@ -154,20 +160,14 @@ struct msvc_x86_operations :
{
store(storage, (storage_type)0, order);
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
template< bool Signed >
struct operations< 4u, Signed > :
public msvc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > >
public msvc_x86_operations< 4u, Signed, operations< 4u, Signed > >
{
typedef msvc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type;
typedef msvc_x86_operations< 4u, Signed, operations< 4u, Signed > > base_type;
typedef typename base_type::storage_type storage_type;
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
@@ -235,11 +235,10 @@ struct operations< 4u, Signed > :
template< bool Signed >
struct operations< 1u, Signed > :
public msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > >
public msvc_x86_operations< 1u, Signed, operations< 1u, Signed > >
{
typedef msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type;
typedef msvc_x86_operations< 1u, Signed, operations< 1u, Signed > > base_type;
typedef typename base_type::storage_type storage_type;
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
@@ -280,11 +279,10 @@ struct operations< 1u, Signed > :
template< bool Signed >
struct operations< 1u, Signed > :
public msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > >
public msvc_x86_operations< 1u, Signed, operations< 1u, Signed > >
{
typedef msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type;
typedef msvc_x86_operations< 1u, Signed, operations< 1u, Signed > > base_type;
typedef typename base_type::storage_type storage_type;
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
@@ -337,22 +335,19 @@ struct operations< 1u, Signed > :
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
int backup;
__asm
{
mov backup, ebx
xor edx, edx
mov edi, storage
movzx ebx, v
movzx ecx, v
xor edx, edx
movzx eax, byte ptr [edi]
align 16
again:
mov dl, al
and dl, bl
and dl, cl
lock cmpxchg byte ptr [edi], dl
jne again
mov v, al
mov ebx, backup
};
base_type::fence_after(order);
return v;
@@ -361,22 +356,19 @@ struct operations< 1u, Signed > :
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
int backup;
__asm
{
mov backup, ebx
xor edx, edx
mov edi, storage
movzx ebx, v
movzx ecx, v
xor edx, edx
movzx eax, byte ptr [edi]
align 16
again:
mov dl, al
or dl, bl
or dl, cl
lock cmpxchg byte ptr [edi], dl
jne again
mov v, al
mov ebx, backup
};
base_type::fence_after(order);
return v;
@@ -385,22 +377,19 @@ struct operations< 1u, Signed > :
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
int backup;
__asm
{
mov backup, ebx
xor edx, edx
mov edi, storage
movzx ebx, v
movzx ecx, v
xor edx, edx
movzx eax, byte ptr [edi]
align 16
again:
mov dl, al
xor dl, bl
xor dl, cl
lock cmpxchg byte ptr [edi], dl
jne again
mov v, al
mov ebx, backup
};
base_type::fence_after(order);
return v;
@@ -421,11 +410,10 @@ struct operations< 1u, Signed > :
template< bool Signed >
struct operations< 2u, Signed > :
public msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > >
public msvc_x86_operations< 2u, Signed, operations< 2u, Signed > >
{
typedef msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type;
typedef msvc_x86_operations< 2u, Signed, operations< 2u, Signed > > base_type;
typedef typename base_type::storage_type storage_type;
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
@@ -466,11 +454,10 @@ struct operations< 2u, Signed > :
template< bool Signed >
struct operations< 2u, Signed > :
public msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > >
public msvc_x86_operations< 2u, Signed, operations< 2u, Signed > >
{
typedef msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type;
typedef msvc_x86_operations< 2u, Signed, operations< 2u, Signed > > base_type;
typedef typename base_type::storage_type storage_type;
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
@@ -523,22 +510,19 @@ struct operations< 2u, Signed > :
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
int backup;
__asm
{
mov backup, ebx
xor edx, edx
mov edi, storage
movzx ebx, v
movzx ecx, v
xor edx, edx
movzx eax, word ptr [edi]
align 16
again:
mov dx, ax
and dx, bx
and dx, cx
lock cmpxchg word ptr [edi], dx
jne again
mov v, ax
mov ebx, backup
};
base_type::fence_after(order);
return v;
@@ -547,22 +531,19 @@ struct operations< 2u, Signed > :
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
int backup;
__asm
{
mov backup, ebx
xor edx, edx
mov edi, storage
movzx ebx, v
movzx ecx, v
xor edx, edx
movzx eax, word ptr [edi]
align 16
again:
mov dx, ax
or dx, bx
or dx, cx
lock cmpxchg word ptr [edi], dx
jne again
mov v, ax
mov ebx, backup
};
base_type::fence_after(order);
return v;
@@ -571,22 +552,19 @@ struct operations< 2u, Signed > :
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
base_type::fence_before(order);
int backup;
__asm
{
mov backup, ebx
xor edx, edx
mov edi, storage
movzx ebx, v
movzx ecx, v
xor edx, edx
movzx eax, word ptr [edi]
align 16
again:
mov dx, ax
xor dx, bx
xor dx, cx
lock cmpxchg word ptr [edi], dx
jne again
mov v, ax
mov ebx, backup
};
base_type::fence_after(order);
return v;
@@ -609,11 +587,15 @@ struct operations< 2u, Signed > :
template< bool Signed >
struct msvc_dcas_x86
{
typedef typename make_storage_type< 8u, Signed >::type storage_type;
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
typedef typename make_storage_type< 8u >::type storage_type;
typedef typename make_storage_type< 8u >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST bool full_cas_based = true;
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 8u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
// Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, 8.1.1. Guaranteed Atomic Operations:
//
// The Pentium processor (and newer processors since) guarantees that the following additional memory operations will always be carried out atomically:
@@ -656,7 +638,7 @@ struct msvc_dcas_x86
}
else
{
int backup;
uint32_t backup;
__asm
{
mov backup, ebx
@@ -744,7 +726,7 @@ struct msvc_dcas_x86
expected = old_val;
#else
bool result;
int backup;
uint32_t backup;
__asm
{
mov backup, ebx
@@ -777,7 +759,7 @@ struct msvc_dcas_x86
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
storage_type volatile* p = &storage;
int backup;
uint32_t backup;
__asm
{
mov backup, ebx
@@ -799,11 +781,6 @@ struct msvc_dcas_x86
return v;
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
template< bool Signed >
@@ -816,11 +793,10 @@ struct operations< 8u, Signed > :
template< bool Signed >
struct operations< 8u, Signed > :
public msvc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > >
public msvc_x86_operations< 8u, Signed, operations< 8u, Signed > >
{
typedef msvc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type;
typedef msvc_x86_operations< 8u, Signed, operations< 8u, Signed > > base_type;
typedef typename base_type::storage_type storage_type;
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
@@ -864,11 +840,15 @@ struct operations< 8u, Signed > :
template< bool Signed >
struct msvc_dcas_x86_64
{
typedef typename make_storage_type< 16u, Signed >::type storage_type;
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
typedef typename make_storage_type< 16u >::type storage_type;
typedef typename make_storage_type< 16u >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST bool full_cas_based = true;
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_CONSTEXPR_OR_CONST std::size_t storage_size = 16u;
static BOOST_CONSTEXPR_OR_CONST bool is_signed = Signed;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
storage_type value = const_cast< storage_type& >(storage);
@@ -893,11 +873,6 @@ struct msvc_dcas_x86_64
{
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
template< bool Signed >