aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/smart_ptr/detail
diff options
context:
space:
mode:
Diffstat (limited to 'cutl/details/boost/smart_ptr/detail')
-rw-r--r--cutl/details/boost/smart_ptr/detail/operator_bool.hpp25
-rw-r--r--cutl/details/boost/smart_ptr/detail/shared_count.hpp165
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_convertible.hpp15
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp21
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp143
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp10
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp162
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp151
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp1
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp27
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp26
-rw-r--r--cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp45
-rw-r--r--cutl/details/boost/smart_ptr/detail/spinlock.hpp5
-rw-r--r--cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp41
-rw-r--r--cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp4
25 files changed, 824 insertions, 27 deletions
diff --git a/cutl/details/boost/smart_ptr/detail/operator_bool.hpp b/cutl/details/boost/smart_ptr/detail/operator_bool.hpp
index 842a05d..8ae1527 100644
--- a/cutl/details/boost/smart_ptr/detail/operator_bool.hpp
+++ b/cutl/details/boost/smart_ptr/detail/operator_bool.hpp
@@ -1,14 +1,21 @@
// This header intentionally has no include guards.
//
-// Copyright (c) 2001-2009 Peter Dimov
+// Copyright (c) 2001-2009, 2012 Peter Dimov
//
// 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
-#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
+#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )
- operator bool () const
+ explicit operator bool () const BOOST_NOEXCEPT
+ {
+ return px != 0;
+ }
+
+#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
+
+ operator bool () const BOOST_NOEXCEPT
{
return px != 0;
}
@@ -21,7 +28,7 @@
typedef void (*unspecified_bool_type)( this_type*** );
- operator unspecified_bool_type() const // never throws
+ operator unspecified_bool_type() const BOOST_NOEXCEPT
{
return px == 0? 0: unspecified_bool;
}
@@ -31,18 +38,18 @@
( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
- typedef T * (this_type::*unspecified_bool_type)() const;
+ typedef element_type * (this_type::*unspecified_bool_type)() const;
- operator unspecified_bool_type() const // never throws
+ operator unspecified_bool_type() const BOOST_NOEXCEPT
{
return px == 0? 0: &this_type::get;
}
#else
- typedef T * this_type::*unspecified_bool_type;
+ typedef element_type * this_type::*unspecified_bool_type;
- operator unspecified_bool_type() const // never throws
+ operator unspecified_bool_type() const BOOST_NOEXCEPT
{
return px == 0? 0: &this_type::px;
}
@@ -50,7 +57,7 @@
#endif
// operator! is redundant, but some compilers need it
- bool operator! () const // never throws
+ bool operator! () const BOOST_NOEXCEPT
{
return px == 0;
}
diff --git a/cutl/details/boost/smart_ptr/detail/shared_count.hpp b/cutl/details/boost/smart_ptr/detail/shared_count.hpp
index 16d6527..77aea5c 100644
--- a/cutl/details/boost/smart_ptr/detail/shared_count.hpp
+++ b/cutl/details/boost/smart_ptr/detail/shared_count.hpp
@@ -35,7 +35,14 @@
// rather than including <memory> directly:
#include <cutl/details/boost/config/no_tr1/memory.hpp> // std::auto_ptr
#include <functional> // std::less
-#include <new> // std::bad_alloc
+
+#ifdef BOOST_NO_EXCEPTIONS
+# include <new> // std::bad_alloc
+#endif
+
+#if !defined( BOOST_NO_CXX11_SMART_PTR )
+# include <cutl/details/boost/utility/addressof.hpp>
+#endif
namespace cutl_details_boost
{
@@ -52,6 +59,42 @@ int const weak_count_id = 0x298C38A4;
struct sp_nothrow_tag {};
+template< class D > struct sp_inplace_tag
+{
+};
+
+#if !defined( BOOST_NO_CXX11_SMART_PTR )
+
+template< class T > class sp_reference_wrapper
+{
+public:
+
+ explicit sp_reference_wrapper( T & t): t_( cutl_details_boost::addressof( t ) )
+ {
+ }
+
+ template< class Y > void operator()( Y * p ) const
+ {
+ (*t_)( p );
+ }
+
+private:
+
+ T * t_;
+};
+
+template< class D > struct sp_convert_reference
+{
+ typedef D type;
+};
+
+template< class D > struct sp_convert_reference< D& >
+{
+ typedef sp_reference_wrapper< D > type;
+};
+
+#endif
+
class weak_count;
class shared_count
@@ -142,6 +185,40 @@ public:
#endif
}
+#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
+
+ template< class P, class D > shared_count( P p, sp_inplace_tag<D> ): pi_( 0 )
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+
+ try
+ {
+ pi_ = new sp_counted_impl_pd< P, D >( p );
+ }
+ catch( ... )
+ {
+ D::operator_fn( p ); // delete p
+ throw;
+ }
+
+#else
+
+ pi_ = new sp_counted_impl_pd< P, D >( p );
+
+ if( pi_ == 0 )
+ {
+ D::operator_fn( p ); // delete p
+ cutl_details_boost::throw_exception( std::bad_alloc() );
+ }
+
+#endif // #ifndef BOOST_NO_EXCEPTIONS
+ }
+
+#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
+
template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 )
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id)
@@ -188,6 +265,56 @@ public:
#endif
}
+#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
+
+ template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 )
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ typedef sp_counted_impl_pda< P, D, A > impl_type;
+ typedef typename A::template rebind< impl_type >::other A2;
+
+ A2 a2( a );
+
+#ifndef BOOST_NO_EXCEPTIONS
+
+ try
+ {
+ pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
+ new( static_cast< void* >( pi_ ) ) impl_type( p, a );
+ }
+ catch(...)
+ {
+ D::operator_fn( p );
+
+ if( pi_ != 0 )
+ {
+ a2.deallocate( static_cast< impl_type* >( pi_ ), 1 );
+ }
+
+ throw;
+ }
+
+#else
+
+ pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
+
+ if( pi_ != 0 )
+ {
+ new( static_cast< void* >( pi_ ) ) impl_type( p, a );
+ }
+ else
+ {
+ D::operator_fn( p );
+ cutl_details_boost::throw_exception( std::bad_alloc() );
+ }
+
+#endif // #ifndef BOOST_NO_EXCEPTIONS
+ }
+
+#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
+
#ifndef BOOST_NO_AUTO_PTR
// auto_ptr<Y> is special cased to provide the strong guarantee
@@ -212,6 +339,33 @@ public:
#endif
+#if !defined( BOOST_NO_CXX11_SMART_PTR )
+
+ template<class Y, class D>
+ explicit shared_count( std::unique_ptr<Y, D> & r ): pi_( 0 )
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ typedef typename sp_convert_reference<D>::type D2;
+
+ D2 d2( r.get_deleter() );
+ pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), d2 );
+
+#ifdef BOOST_NO_EXCEPTIONS
+
+ if( pi_ == 0 )
+ {
+ cutl_details_boost::throw_exception( std::bad_alloc() );
+ }
+
+#endif
+
+ r.release();
+ }
+
+#endif
+
~shared_count() // nothrow
{
if( pi_ != 0 ) pi_->release();
@@ -228,7 +382,7 @@ public:
if( pi_ != 0 ) pi_->add_ref_copy();
}
-#if defined( BOOST_HAS_RVALUE_REFS )
+#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
shared_count(shared_count && r): pi_(r.pi_) // nothrow
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
@@ -293,6 +447,11 @@ public:
{
return pi_? pi_->get_deleter( ti ): 0;
}
+
+ void * get_untyped_deleter() const
+ {
+ return pi_? pi_->get_untyped_deleter(): 0;
+ }
};
@@ -335,7 +494,7 @@ public:
// Move support
-#if defined( BOOST_HAS_RVALUE_REFS )
+#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
weak_count(weak_count && r): pi_(r.pi_) // nothrow
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
diff --git a/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp b/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp
index f8317c4..f9ee9e0 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_convertible.hpp
@@ -48,6 +48,21 @@ template< class Y, class T > struct sp_convertible
enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
};
+template< class Y, class T > struct sp_convertible< Y, T[] >
+{
+ enum _vt { value = false };
+};
+
+template< class Y, class T > struct sp_convertible< Y[], T[] >
+{
+ enum _vt { value = sp_convertible< Y[1], T[1] >::value };
+};
+
+template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] >
+{
+ enum _vt { value = sp_convertible< Y[1], T[1] >::value };
+};
+
struct sp_empty
{
};
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp
index d256482..9a36bf9 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base.hpp
@@ -32,22 +32,28 @@
#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 )
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp>
-#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
-# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp>
+#elif defined( __SNC__ )
+# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp>
-#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER )
-# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp>
+#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__)
+# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp>
#elif defined(__HP_aCC) && defined(__ia64)
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp>
+#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__)
+# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp>
+
+#elif defined( __IBMCPP__ ) && defined( __powerpc )
+# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp>
+
#elif defined( __MWERKS__ ) && defined( __POWERPC__ )
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp>
-#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) )
+#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX )
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp>
-#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) )
+#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__)
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp>
#elif defined( BOOST_SP_HAS_SYNC )
@@ -59,6 +65,9 @@
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__)
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp>
+#elif defined( _AIX )
+# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp>
+
#elif !defined( BOOST_HAS_THREADS )
# include <cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp>
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp
index 07438de..6b3b551 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp
@@ -104,6 +104,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp
new file mode 100644
index 0000000..6b66a7b
--- /dev/null
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_aix.hpp
@@ -0,0 +1,143 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED
+
+//
+// detail/sp_counted_base_aix.hpp
+// based on: detail/sp_counted_base_w32.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+// Copyright 2006 Michael van der Westhuizen
+//
+// 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)
+//
+//
+// Lock-free algorithm by Alexander Terekhov
+//
+// Thanks to Ben Hitchings for the #weak + (#shared != 0)
+// formulation
+//
+
+#include <cutl/details/boost/detail/sp_typeinfo.hpp>
+#include <builtins.h>
+#include <sys/atomic_op.h>
+
+namespace cutl_details_boost
+{
+
+namespace detail
+{
+
+inline void atomic_increment( int32_t* pw )
+{
+ // ++*pw;
+
+ fetch_and_add( pw, 1 );
+}
+
+inline int32_t atomic_decrement( int32_t * pw )
+{
+ // return --*pw;
+
+ int32_t originalValue;
+
+ __lwsync();
+ originalValue = fetch_and_add( pw, -1 );
+ __isync();
+
+ return (originalValue - 1);
+}
+
+inline int32_t atomic_conditional_increment( int32_t * pw )
+{
+ // if( *pw != 0 ) ++*pw;
+ // return *pw;
+
+ int32_t tmp = fetch_and_add( pw, 0 );
+ for( ;; )
+ {
+ if( tmp == 0 ) return 0;
+ if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1);
+ }
+}
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ int32_t use_count_; // #shared
+ int32_t weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
+
+ void add_ref_copy()
+ {
+ atomic_increment( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ return atomic_conditional_increment( &use_count_ ) != 0;
+ }
+
+ void release() // nothrow
+ {
+ if( atomic_decrement( &use_count_ ) == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ atomic_increment( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( atomic_decrement( &weak_count_ ) == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return fetch_and_add( const_cast<int32_t*>(&use_count_), 0 );
+ }
+};
+
+} // namespace detail
+
+} // namespace cutl_details_boost
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp
index c7bd3bb..4500914 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp
@@ -124,6 +124,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp
index 4ada0a2..d04f19f 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp
@@ -111,6 +111,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp
index 3b2b578..0fd16f3 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp
@@ -37,9 +37,12 @@ inline void atomic_increment( int * pw )
__asm__ __volatile__
(
"0:\n\t"
+ ".set push\n\t"
+ ".set mips2\n\t"
"ll %0, %1\n\t"
"addiu %0, 1\n\t"
"sc %0, %1\n\t"
+ ".set pop\n\t"
"beqz %0, 0b":
"=&r"( tmp ), "=m"( *pw ):
"m"( *pw )
@@ -55,9 +58,12 @@ inline int atomic_decrement( int * pw )
__asm__ __volatile__
(
"0:\n\t"
+ ".set push\n\t"
+ ".set mips2\n\t"
"ll %1, %2\n\t"
"addiu %0, %1, -1\n\t"
"sc %0, %2\n\t"
+ ".set pop\n\t"
"beqz %0, 0b\n\t"
"addiu %0, %1, -1":
"=&r"( rv ), "=&r"( tmp ), "=m"( *pw ):
@@ -78,10 +84,13 @@ inline int atomic_conditional_increment( int * pw )
__asm__ __volatile__
(
"0:\n\t"
+ ".set push\n\t"
+ ".set mips2\n\t"
"ll %0, %2\n\t"
"beqz %0, 1f\n\t"
"addiu %1, %0, 1\n\t"
"sc %1, %2\n\t"
+ ".set pop\n\t"
"beqz %1, 0b\n\t"
"addiu %0, %0, 1\n\t"
"1:":
@@ -126,6 +135,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp
index d00f1d1..a302b3a 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp
@@ -135,6 +135,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
index fca4802..8121760 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
@@ -120,6 +120,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp
index 68f0646..fc3d72b 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp
@@ -127,6 +127,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp
index 89dff6b..92c1ee2 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_nt.hpp
@@ -59,6 +59,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp
index a0e63f8..7ba3867 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_pt.hpp
@@ -70,6 +70,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp
new file mode 100644
index 0000000..56fce3d
--- /dev/null
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp
@@ -0,0 +1,162 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+
+//
+// Copyright (c) 2006 Piotr Wyderski
+// Copyright (c) 2006 Tomas Puverle
+// Copyright (c) 2006 Peter Dimov
+// Copyright (c) 2011 Emil Dotchevski
+//
+// 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
+//
+// Thanks to Michael van der Westhuizen
+
+#include <cutl/details/boost/detail/sp_typeinfo.hpp>
+#include <inttypes.h> // uint32_t
+
+namespace cutl_details_boost
+{
+
+namespace detail
+{
+
+inline uint32_t compare_and_swap( uint32_t * dest_, uint32_t compare_, uint32_t swap_ )
+{
+ return __builtin_cellAtomicCompareAndSwap32(dest_,compare_,swap_);
+}
+
+inline uint32_t atomic_fetch_and_add( uint32_t * pw, uint32_t dv )
+{
+ // long r = *pw;
+ // *pw += dv;
+ // return r;
+
+ for( ;; )
+ {
+ uint32_t r = *pw;
+
+ if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) )
+ {
+ return r;
+ }
+ }
+}
+
+inline void atomic_increment( uint32_t * pw )
+{
+ (void) __builtin_cellAtomicIncr32( pw );
+}
+
+inline uint32_t atomic_decrement( uint32_t * pw )
+{
+ return __builtin_cellAtomicDecr32( pw );
+}
+
+inline uint32_t atomic_conditional_increment( uint32_t * pw )
+{
+ // long r = *pw;
+ // if( r != 0 ) ++*pw;
+ // return r;
+
+ for( ;; )
+ {
+ uint32_t r = *pw;
+
+ if( r == 0 )
+ {
+ return r;
+ }
+
+ if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) )
+ {
+ return r;
+ }
+ }
+}
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ uint32_t use_count_; // #shared
+ uint32_t weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
+
+ void add_ref_copy()
+ {
+ atomic_increment( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ return atomic_conditional_increment( &use_count_ ) != 0;
+ }
+
+ void release() // nothrow
+ {
+ if( atomic_decrement( &use_count_ ) == 1 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ atomic_increment( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( atomic_decrement( &weak_count_ ) == 1 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return const_cast< uint32_t const volatile & >( use_count_ );
+ }
+};
+
+} // namespace detail
+
+} // namespace cutl_details_boost
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp
index 0d17517..0f95421 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_spin.hpp
@@ -84,6 +84,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp
index 2814ce7..b1a0b35 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_sync.hpp
@@ -109,6 +109,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp
new file mode 100644
index 0000000..3973606
--- /dev/null
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp
@@ -0,0 +1,151 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED
+
+//
+// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER
+// based on: detail/sp_counted_base_w32.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+// Copyright 2006 Michael van der Westhuizen
+// Copyright 2012 IBM Corp.
+//
+// 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)
+//
+//
+// Lock-free algorithm by Alexander Terekhov
+//
+// Thanks to Ben Hitchings for the #weak + (#shared != 0)
+// formulation
+//
+
+#include <cutl/details/boost/detail/sp_typeinfo.hpp>
+
+extern "builtin" void __lwsync(void);
+extern "builtin" void __isync(void);
+extern "builtin" int __fetch_and_add(volatile int* addr, int val);
+extern "builtin" int __compare_and_swap(volatile int*, int*, int);
+
+namespace cutl_details_boost
+{
+
+namespace detail
+{
+
+inline void atomic_increment( int *pw )
+{
+ // ++*pw;
+ __lwsync();
+ __fetch_and_add(pw, 1);
+ __isync();
+}
+
+inline int atomic_decrement( int *pw )
+{
+ // return --*pw;
+ __lwsync();
+ int originalValue = __fetch_and_add(pw, -1);
+ __isync();
+
+ return (originalValue - 1);
+}
+
+inline int atomic_conditional_increment( int *pw )
+{
+ // if( *pw != 0 ) ++*pw;
+ // return *pw;
+
+ __lwsync();
+ int v = *const_cast<volatile int*>(pw);
+ for (;;)
+ // loop until state is known
+ {
+ if (v == 0) return 0;
+ if (__compare_and_swap(pw, &v, v + 1))
+ {
+ __isync(); return (v + 1);
+ }
+ }
+}
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ int use_count_; // #shared
+ int weak_count_; // #weak + (#shared != 0)
+ char pad[64] __attribute__((__aligned__(64)));
+ // pad to prevent false sharing
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
+
+ void add_ref_copy()
+ {
+ atomic_increment( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ return atomic_conditional_increment( &use_count_ ) != 0;
+ }
+
+ void release() // nothrow
+ {
+ if( atomic_decrement( &use_count_ ) == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ atomic_increment( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( atomic_decrement( &weak_count_ ) == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return *const_cast<volatile int*>(&use_count_);
+ }
+};
+
+} // namespace detail
+
+} // namespace cutl_details_boost
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp
index f69c68d..63c7d7e 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_base_w32.hpp
@@ -67,6 +67,7 @@ public:
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
+ virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
diff --git a/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp b/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp
index 5707803..d958544 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_counted_impl.hpp
@@ -83,6 +83,11 @@ public:
return 0;
}
+ virtual void * get_untyped_deleter()
+ {
+ return 0;
+ }
+
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
void * operator new( std::size_t )
@@ -135,7 +140,11 @@ public:
// pre: d(p) must not throw
- sp_counted_impl_pd( P p, D d ): ptr(p), del(d)
+ sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
+ {
+ }
+
+ sp_counted_impl_pd( P p ): ptr( p ), del()
{
}
@@ -149,6 +158,11 @@ public:
return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
}
+ virtual void * get_untyped_deleter()
+ {
+ return &reinterpret_cast<char&>( del );
+ }
+
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
void * operator new( std::size_t )
@@ -195,7 +209,11 @@ public:
// pre: d( p ) must not throw
- sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a )
+ sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a )
+ {
+ }
+
+ sp_counted_impl_pda( P p, A a ): p_( p ), d_(), a_( a )
{
}
@@ -218,6 +236,11 @@ public:
{
return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
}
+
+ virtual void * get_untyped_deleter()
+ {
+ return &reinterpret_cast<char&>( d_ );
+ }
};
#ifdef __CODEGUARD__
diff --git a/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp b/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp
index 7fcd09e..16de21d 100644
--- a/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp
+++ b/cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp
@@ -20,7 +20,17 @@
// are available.
//
-#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
+#ifndef BOOST_SP_NO_SYNC
+
+#if defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 )
+
+# define BOOST_SP_HAS_SYNC
+
+#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 )
+
+# define BOOST_SP_HAS_SYNC
+
+#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
#define BOOST_SP_HAS_SYNC
@@ -36,14 +46,24 @@
#undef BOOST_SP_HAS_SYNC
#endif
+#if defined( __sh__ )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
#if defined( __sparc__ )
#undef BOOST_SP_HAS_SYNC
#endif
-#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1100 )
+#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
+#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9))
#undef BOOST_SP_HAS_SYNC
#endif
-#endif // __GNUC__ * 100 + __GNUC_MINOR__ >= 401
+#endif
+
+#endif // #ifndef BOOST_SP_NO_SYNC
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED
diff --git a/cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp b/cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp
new file mode 100644
index 0000000..245dd22
--- /dev/null
+++ b/cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp
@@ -0,0 +1,45 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// detail/sp_nullptr_t.hpp
+//
+// Copyright 2013 Peter Dimov
+//
+// 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
+
+#include <cutl/details/boost/config.hpp>
+#include <cstddef>
+
+#if !defined( BOOST_NO_CXX11_NULLPTR )
+
+namespace cutl_details_boost
+{
+
+namespace detail
+{
+
+#if defined( __clang__ ) && !defined( _LIBCPP_VERSION ) && !defined( BOOST_NO_CXX11_DECLTYPE )
+
+ typedef decltype(nullptr) sp_nullptr_t;
+
+#else
+
+ typedef std::nullptr_t sp_nullptr_t;
+
+#endif
+
+} // namespace detail
+
+} // namespace cutl_details_boost
+
+#endif // !defined( BOOST_NO_CXX11_NULLPTR )
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
diff --git a/cutl/details/boost/smart_ptr/detail/spinlock.hpp b/cutl/details/boost/smart_ptr/detail/spinlock.hpp
index b943ac3..ffc70c5 100644
--- a/cutl/details/boost/smart_ptr/detail/spinlock.hpp
+++ b/cutl/details/boost/smart_ptr/detail/spinlock.hpp
@@ -31,7 +31,10 @@
#include <cutl/details/boost/config.hpp>
#include <cutl/details/boost/smart_ptr/detail/sp_has_sync.hpp>
-#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
+#if defined( BOOST_SP_USE_PTHREADS )
+# include <cutl/details/boost/smart_ptr/detail/spinlock_pt.hpp>
+
+#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
# include <cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp>
#elif defined( BOOST_SP_HAS_SYNC )
diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
index cfee653..752c830 100644
--- a/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+++ b/cutl/details/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
@@ -2,7 +2,7 @@
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
//
-// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2008, 2011 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
@@ -11,6 +11,22 @@
#include <cutl/details/boost/smart_ptr/detail/yield_k.hpp>
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__)
+
+# define BOOST_SP_ARM_BARRIER "dmb"
+# define BOOST_SP_ARM_HAS_LDREX
+
+#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)
+
+# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5"
+# define BOOST_SP_ARM_HAS_LDREX
+
+#else
+
+# define BOOST_SP_ARM_BARRIER ""
+
+#endif
+
namespace cutl_details_boost
{
@@ -29,12 +45,28 @@ public:
{
int r;
+#ifdef BOOST_SP_ARM_HAS_LDREX
+
__asm__ __volatile__(
- "swp %0, %1, [%2]":
+ "ldrex %0, [%2]; \n"
+ "cmp %0, %1; \n"
+ "strexne %0, %1, [%2]; \n"
+ BOOST_SP_ARM_BARRIER :
"=&r"( r ): // outputs
"r"( 1 ), "r"( &v_ ): // inputs
"memory", "cc" );
+#else
+
+ __asm__ __volatile__(
+ "swp %0, %1, [%2];\n"
+ BOOST_SP_ARM_BARRIER :
+ "=&r"( r ): // outputs
+ "r"( 1 ), "r"( &v_ ): // inputs
+ "memory", "cc" );
+
+#endif
+
return r == 0;
}
@@ -48,7 +80,7 @@ public:
void unlock()
{
- __asm__ __volatile__( "" ::: "memory" );
+ __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" );
*const_cast< int volatile* >( &v_ ) = 0;
}
@@ -82,4 +114,7 @@ public:
#define BOOST_DETAIL_SPINLOCK_INIT {0}
+#undef BOOST_SP_ARM_BARRIER
+#undef BOOST_SP_ARM_HAS_LDREX
+
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
diff --git a/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp b/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp
index 84bf69f..8ae09e3 100644
--- a/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp
+++ b/cutl/details/boost/smart_ptr/detail/spinlock_pool.hpp
@@ -41,7 +41,11 @@ public:
static spinlock & spinlock_for( void const * pv )
{
+#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
+ std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41;
+#else
std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41;
+#endif
return pool_[ i ];
}