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

@@ -0,0 +1,32 @@
// boost lockfree: allocator rebind helper
//
// Copyright (C) 2017 Minmin Gong
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED
#define BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED
#include <memory>
namespace boost {
namespace lockfree {
namespace detail {
template <class allocator_type, class value_type>
struct allocator_rebind_helper
{
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
typedef typename std::allocator_traits<allocator_type>::template rebind_alloc<value_type> type;
#else
typedef typename allocator_type::template rebind<value_type>::other type;
#endif
};
} /* namespace detail */
} /* namespace lockfree */
} /* namespace boost */
#endif /* BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED */

View File

@@ -104,7 +104,7 @@ public:
}
template <bool ThreadSafe>
void destruct (tagged_node_handle tagged_ptr)
void destruct (tagged_node_handle const & tagged_ptr)
{
T * n = tagged_ptr.get_ptr();
n->~T();
@@ -482,7 +482,7 @@ public:
void destruct (T * n)
{
n->~T();
deallocate<ThreadSafe>(n - NodeStorage::nodes());
deallocate<ThreadSafe>(static_cast<index_t>(n - NodeStorage::nodes()));
}
bool is_lock_free(void) const

View File

@@ -15,6 +15,8 @@
#include <boost/mpl/void.hpp>
#include <boost/lockfree/detail/allocator_rebind_helper.hpp>
namespace boost {
namespace lockfree {
@@ -54,7 +56,7 @@ struct extract_allocator
std::allocator<T>
>::type allocator_arg;
typedef typename allocator_arg::template rebind<T>::other type;
typedef typename detail::allocator_rebind_helper<allocator_arg, T>::type type;
};
template <typename bound_args, bool default_ = false>

View File

@@ -13,8 +13,9 @@
of the virtual address space as tag (at least 16bit)
*/
// PowerPC caches support 128-byte cache lines.
#if defined(powerpc) || defined(__powerpc__) || defined(__ppc__)
#if defined(__s390__) || defined(__s390x__)
#define BOOST_LOCKFREE_CACHELINE_BYTES 256
#elif defined(powerpc) || defined(__powerpc__) || defined(__ppc__)
#define BOOST_LOCKFREE_CACHELINE_BYTES 128
#else
#define BOOST_LOCKFREE_CACHELINE_BYTES 64
@@ -22,7 +23,7 @@
#include <boost/predef.h>
#ifdef BOOST_ARCH_X86_64
#if BOOST_ARCH_X86_64 || defined (__aarch64__)
#define BOOST_LOCKFREE_PTR_COMPRESSION 1
#endif

View File

@@ -21,7 +21,15 @@ namespace detail {
template <class T>
class BOOST_ALIGNMENT(2 * sizeof(void*)) tagged_ptr
class
#if BOOST_COMP_MSVC && BOOST_ARCH_X86_64
BOOST_ALIGNMENT(16)
#elif BOOST_COMP_MSVC && BOOST_ARCH_X86_32
BOOST_ALIGNMENT(8)
#else
BOOST_ALIGNMENT(2 * sizeof(void*))
#endif
tagged_ptr
{
public:
typedef std::size_t tag_t;

View File

@@ -19,7 +19,7 @@ namespace boost {
namespace lockfree {
namespace detail {
#ifdef BOOST_ARCH_X86_64
#if BOOST_ARCH_X86_64 || defined (__aarch64__)
template <class T>
class tagged_ptr

View File

@@ -17,6 +17,7 @@
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/config.hpp> // for BOOST_LIKELY & BOOST_ALIGNMENT
#include <boost/lockfree/detail/allocator_rebind_helper.hpp>
#include <boost/lockfree/detail/atomic.hpp>
#include <boost/lockfree/detail/copy_payload.hpp>
#include <boost/lockfree/detail/freelist.hpp>
@@ -35,6 +36,14 @@
#pragma warning(disable: 4324) // structure was padded due to __declspec(align())
#endif
#if defined(BOOST_INTEL) && (BOOST_INTEL_CXX_VERSION > 1000)
#pragma warning(push)
#pragma warning(disable:488) // template parameter unused in declaring parameter types,
// gets erronously triggered the queue constructor which
// takes an allocator of another type and rebinds it
#endif
namespace boost {
namespace lockfree {
@@ -181,7 +190,7 @@ public:
}
template <typename U>
explicit queue(typename node_allocator::template rebind<U>::other const & alloc):
explicit queue(typename detail::allocator_rebind_helper<node_allocator, U>::type const & alloc):
head_(tagged_node_handle(0, 0)),
tail_(tagged_node_handle(0, 0)),
pool(alloc, capacity)
@@ -212,7 +221,7 @@ public:
}
template <typename U>
queue(size_type n, typename node_allocator::template rebind<U>::other const & alloc):
queue(size_type n, typename detail::allocator_rebind_helper<node_allocator, U>::type const & alloc):
head_(tagged_node_handle(0, 0)),
tail_(tagged_node_handle(0, 0)),
pool(alloc, n + 1)
@@ -544,6 +553,10 @@ private:
} /* namespace lockfree */
} /* namespace boost */
#if defined(BOOST_INTEL) && (BOOST_INTEL_CXX_VERSION > 1000)
#pragma warning(pop)
#endif
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@@ -17,12 +17,14 @@
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility.hpp>
#include <boost/next_prior.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/config.hpp> // for BOOST_LIKELY
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/lockfree/detail/allocator_rebind_helper.hpp>
#include <boost/lockfree/detail/atomic.hpp>
#include <boost/lockfree/detail/copy_payload.hpp>
#include <boost/lockfree/detail/parameter.hpp>
@@ -522,7 +524,12 @@ class runtime_sized_ringbuffer:
{
typedef std::size_t size_type;
size_type max_elements_;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename Alloc::pointer pointer;
#else
typedef std::allocator_traits<Alloc> allocator_traits;
typedef typename allocator_traits::pointer pointer;
#endif
pointer array_;
protected:
@@ -535,20 +542,35 @@ public:
explicit runtime_sized_ringbuffer(size_type max_elements):
max_elements_(max_elements + 1)
{
#ifdef BOOST_NO_CXX11_ALLOCATOR
array_ = Alloc::allocate(max_elements_);
#else
Alloc& alloc = *this;
array_ = allocator_traits::allocate(alloc, max_elements_);
#endif
}
template <typename U>
runtime_sized_ringbuffer(typename Alloc::template rebind<U>::other const & alloc, size_type max_elements):
runtime_sized_ringbuffer(typename detail::allocator_rebind_helper<Alloc, U>::type const & alloc, size_type max_elements):
Alloc(alloc), max_elements_(max_elements + 1)
{
#ifdef BOOST_NO_CXX11_ALLOCATOR
array_ = Alloc::allocate(max_elements_);
#else
Alloc& allocator = *this;
array_ = allocator_traits::allocate(allocator, max_elements_);
#endif
}
runtime_sized_ringbuffer(Alloc const & alloc, size_type max_elements):
Alloc(alloc), max_elements_(max_elements + 1)
{
#ifdef BOOST_NO_CXX11_ALLOCATOR
array_ = Alloc::allocate(max_elements_);
#else
Alloc& allocator = *this;
array_ = allocator_traits::allocate(allocator, max_elements_);
#endif
}
~runtime_sized_ringbuffer(void)
@@ -557,7 +579,12 @@ public:
T out;
while (pop(&out, 1)) {}
#ifdef BOOST_NO_CXX11_ALLOCATOR
Alloc::deallocate(array_, max_elements_);
#else
Alloc& allocator = *this;
allocator_traits::deallocate(allocator, array_, max_elements_);
#endif
}
bool push(T const & t)
@@ -729,7 +756,7 @@ public:
}
template <typename U>
explicit spsc_queue(typename allocator::template rebind<U>::other const &)
explicit spsc_queue(typename detail::allocator_rebind_helper<allocator, U>::type const &)
{
// just for API compatibility: we don't actually need an allocator
BOOST_STATIC_ASSERT(!runtime_sized);
@@ -755,7 +782,7 @@ public:
}
template <typename U>
spsc_queue(size_type element_count, typename allocator::template rebind<U>::other const & alloc):
spsc_queue(size_type element_count, typename detail::allocator_rebind_helper<allocator, U>::type const & alloc):
base_type(alloc, element_count)
{
BOOST_STATIC_ASSERT(runtime_sized);

View File

@@ -15,6 +15,7 @@
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_copy_constructible.hpp>
#include <boost/lockfree/detail/allocator_rebind_helper.hpp>
#include <boost/lockfree/detail/atomic.hpp>
#include <boost/lockfree/detail/copy_payload.hpp>
#include <boost/lockfree/detail/freelist.hpp>
@@ -144,7 +145,7 @@ public:
}
template <typename U>
explicit stack(typename node_allocator::template rebind<U>::other const & alloc):
explicit stack(typename detail::allocator_rebind_helper<node_allocator, U>::type const & alloc):
pool(alloc, capacity)
{
BOOST_STATIC_ASSERT(has_capacity);
@@ -169,7 +170,7 @@ public:
}
template <typename U>
stack(size_type n, typename node_allocator::template rebind<U>::other const & alloc):
stack(size_type n, typename detail::allocator_rebind_helper<node_allocator, U>::type const & alloc):
pool(alloc, n)
{
BOOST_STATIC_ASSERT(!has_capacity);