Commit Graph

214 Commits

Author SHA1 Message Date
Andrey Semashev
e6a188d165 Experimental support for IBM XL C++ compilers for PowerPC. 2015-08-13 23:37:33 +03:00
Andrey Semashev
fcff86225e Added workarounds for nvcc - don't use cc clobber and constraint alternatives in asm statements. Hopefully, should fix #10625. 2014-12-20 16:35:03 +03:00
Andrey Semashev
fe8f1dc4e0 Use #pragma intrinsic only with MSVC. 2014-10-01 13:30:37 +04:00
Andrey Semashev
5f6e9689a3 Silenced MSVC warnings about unused parameters. 2014-10-01 13:02:15 +04:00
Andrey Semashev
415db70547 Added support for extending operations to GCC atomic backend.
Fix for #10446. Some platforms (e.g. Raspberry Pi) only support atomic ops of some particular size but not less. Use extending arithmetic operations for these platforms. Also, make sure bools are always treated as 8-bit values, even if the actual type is larger. This makes its use in atomic<>, atomic_flag and lock pool more consistent.
2014-09-27 20:40:09 +04:00
Andrey Semashev
8f10f20359 Use #pragma intrinsic only with MSVC. 2014-08-30 14:09:18 +04:00
Andrey Semashev
7f17e3b9a3 Use #pragma intrinsic only with MSVC.
Intel compiler doesn't support and doesn't need #pragma intrinsic and
issues warnings about it. Based on changes to boost/detail/
2014-08-24 00:02:16 +04:00
Andrey Semashev
4dee330229 Added support for types with non-trivial default constructors. 2014-07-07 22:40:41 +04:00
Andrey Semashev
6a184d95dd Renamed union_cast.hpp -> casts.hpp. 2014-07-07 21:51:06 +04:00
Andrey Semashev
00c2879066 Made sure that memory_order_consume is equivalent to memory_order_acquire on SPARC. Also make signal fences more strict in case of memory_order_consume since the standard requires them to be equivalent to thread fences except for thread synchronization instructions. 2014-07-07 21:48:53 +04:00
Andrey Semashev
0c9b1b3806 Reworked platform selection, fixed Windows backend.
Platform selection now works in two stages. First compiler is tested for
the supported configuration. If that fails, OS is tested. Lastly, if
nothing succeeded, emulation backend is selected.
2014-06-09 01:07:26 +04:00
Andrey Semashev
b44027a58e Removed dependency on Boost.Detail. Fixed compilation issues with MSVC
7.1
2014-06-09 00:01:12 +04:00
Andrey Semashev
a6ec366f02 Fixed compilation failure due to a missing argument name. 2014-06-04 21:41:06 +04:00
Andrey Semashev
e0f038e92a Fixed compilation failure due to a missing argument name. 2014-06-04 21:38:15 +04:00
Andrey Semashev
21e497c01b Corrected hw memory barriers for memory_order_consume. 2014-06-03 23:57:52 +04:00
Andrey Semashev
d4ee3a3047 Added a comment about the reason why we promote memory_order_consume to memory_order_acquire. 2014-06-03 23:30:21 +04:00
Andrey Semashev
e55bf17309 Changed memory_order_consume handling on ARM and PPC.
memory_order_consume is promoted to memory_order_acquire on these
architectures as they have a weaker memory model than other
architectures. GCC seems to behave the same way. Added nonessential
checks to compiler barriers so that the behavior is closer to thread
fences.
2014-06-01 20:03:53 +04:00
Andrey Semashev
abdce8f1bb Changed memory_order constant values to simplify checks for success/failure orders in compare_exchange methods. Fixed incorrect cas_failure_order_must_not_be_stronger_than_success_order check. 2014-06-01 02:10:44 +04:00
Andrey Semashev
a721aa468f Removed scratch argument for asm block in non-PIC mode. 2014-05-26 23:21:01 +04:00
Andrey Semashev
97ae84a474 Adjusted the workaround for ldrexd/strexd instruction problem with register pairs allocation. The problem only affects ARMv6k in Thumb mode, so enable these instructions for ARM mode. Also don't base the decision on the compiler version, it is probably not relevant. Updated lockfree test to reflect the recent changes related to ARM backends. 2014-05-23 21:02:07 +04:00
Andrey Semashev
deddca6918 Fixed a few bugs with ARM assembler: incorrect comparisons in compare_exchange, compilation failures due to insufficient registers in some optimization modes. Eventually I had to disable 64-bit atomic ops for gcc 4.7 because it is not able to allocate register pairs suitable for ldrexd/strexd instructions. 2014-05-22 01:01:46 +04:00
Andrey Semashev
a71a23694b Fixed typo in a comment. 2014-05-21 00:36:43 +04:00
Andrey Semashev
7197b188ac Another attempt to work around the problem with old binutils not supporting dmb arguments. Changed 64-bit operations so that the generated asm does not contain offsets in ldrexd and strexd instructions. Otherwise ARM assembler chokes. 2014-05-21 00:34:10 +04:00
Andrey Semashev
b8626e355b Moving memory_order.hpp to Boost.Atomic. 2014-05-20 21:59:22 +04:00
Andrey Semashev
7f290018d2 Changed the dmb instruction argument in attempt to fix compilation with old binutils on QNX. 2014-05-18 19:03:55 +04:00
Andrey Semashev
76b78f2491 #9985. Added ebx saves and restores in asm blocks to avoid frame pointer clobbering, when frame pointer omission is disabled. 2014-05-17 21:58:59 +04:00
Andrey Semashev
00c21f9978 Documented new feature test and configuration macros. Fixed disabled gcc atomic backend. 2014-05-17 19:20:51 +04:00
Andrey Semashev
08d30a2320 Added missing include. 2014-05-11 23:14:47 +04:00
Andrey Semashev
890313b8d7 Added missing include. 2014-05-11 23:13:58 +04:00
Andrey Semashev
3a81a36bbe Removed no longer used files. 2014-05-11 20:28:12 +04:00
Andrey Semashev
5c032ccf3a Added gcc Alpha backend. Completely untested. 2014-05-11 20:21:41 +04:00
Andrey Semashev
5cb6e92ed0 Extracted common c86 DCAS code to a separate header. 2014-05-11 17:33:09 +04:00
Andrey Semashev
c319c6efd1 Enabled gcc atomic backend for Intel Compiler on Linux. 2014-05-11 17:00:00 +04:00
Andrey Semashev
c196e6da0c Fixed compilation of ARM backend. Simplified fences implementation. 2014-05-11 14:18:49 +04:00
Andrey Semashev
684917a6fe Implemented gcc ARM backend. Some files renamed. 2014-05-11 02:36:15 +04:00
Andrey Semashev
4e9632a669 Implemented gcc SPARCv9 backend.
The backend also adds support for 64-bit atomics.
2014-05-09 22:24:37 +04:00
Andrey Semashev
f53911de3d Implemented PorwerPC backend. 2014-05-09 20:57:02 +04:00
Andrey Semashev
d3af1bace9 Fixed compilation. 2014-05-09 19:04:41 +04:00
Andrey Semashev
4cb51c6b76 Signed flag is now forwarded to the backends.
Forwarding the "signed" property allows to specialize operations
implementation, which may be desired for some architectures. This also
eliminates the formally implementation-defined result of unsigned-to-
target type.

Also for x86 implementations removed compiler barriers since the
compilers already treat intrinsics/asm blocks as ones.
2014-05-09 18:53:06 +04:00
Andrey Semashev
652e87b7e7 Added Linux ARM backend. 2014-05-07 22:21:04 +04:00
Andrey Semashev
20dd8bd827 Implemented MSVC and Windows backends. 2014-05-04 23:41:16 +04:00
Andrey Semashev
931a5dc2aa Improved assertion messages. 2014-05-04 05:22:59 +04:00
Andrey Semashev
17cf91d8c9 Working on the library rewrite. Implemented gcc-x86 and gcc-sync
backends.
2014-05-04 00:14:24 +04:00
Andrey Semashev
0e5b641e0a Added workarounds for clang. 2014-04-20 19:03:56 +04:00
Andrey Semashev
625c3c3a2e Compilation fixes. Added public headers for atomic_flag and atomic. 2014-04-20 17:26:42 +04:00
Andrey Semashev
f3d59ec1c1 Working on the new library design.
Added implementation of atomic ops with gcc __atomic intrinsics.
Implemented the unified atomic interface. Extracted atomic_flag to a
separate header. atomic_flag now follows standard requirements for
static initialization, if possible.
2014-04-19 22:25:02 +04:00
Andrey Semashev
928bdea4f6 Merge branch 'develop' into decouple_interface_impl_rewrite 2014-03-23 16:07:37 +04:00
Andrey Semashev
e3536bec75 Hopefully, fixes #9447.
Cleanup of the success flag in CAS operations has been reworked. The
flag is automatically cleared by default and only set when the operation
succeeds. Also minor code reformatting and __volatile__ specifications
to prohibit the assembler code moving around.
2014-03-23 15:15:56 +04:00
Andrey Semashev
c56a76c084 Further attempts to work around clang bugs. 2014-03-19 19:07:30 +04:00
Andrey Semashev
8a3e5b1466 Further attempts to work around clang compilation failures. 2014-03-18 21:25:33 +04:00
Andrey Semashev
9e15e02528 Attempt to make Darwin clang compile the asm statement. 2014-03-17 19:36:39 +04:00
Andrey Semashev
522279d1e7 Added missing fence functions for the clang 3.4 workaround. Also made atomic_flag copy and assignment to be deleted on C++11 compilers. 2014-03-16 21:19:42 +04:00
Andrey Semashev
b277b46c5f Removed incorrect constexpr qualifications from constructors with non-empty bodies. 2014-03-15 16:25:10 +04:00
Andrey Semashev
bf1898e2e6 Added a workaround for clang 3.4 bug: the compiler does not implement __atomic intrinsics even though it defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 macro. 2014-03-15 16:11:03 +04:00
Andrey Semashev
e4bde20f2e More compilation fixes for the case when 128-bit integers are not supported. 2014-02-28 12:43:11 +04:00
Andrey Semashev
7b13e9cd24 Reworked capabilities definition. For all platforms, added BOOST_ATOMIC_INTn_LOCK_FREE macros that define the support for fixed sized integers. Other macros are deduced from the new ones, according to the native type sizes. 2014-02-09 16:12:00 +04:00
Andrey Semashev
4efb93ba4d Ranamed header. 2014-02-09 13:38:52 +04:00
Andrey Semashev
28f0c4c408 Merge branch 'develop' into decouple_interface_impl_rewrite 2014-01-27 01:03:31 +04:00
Andrey Semashev
173eb4a64f Fixed compilation with MSVC. 2014-01-26 21:24:34 +04:00
Andrey Semashev
7d768ca2e1 Extracted all capability macros to separate headers. 2014-01-26 19:39:38 +04:00
Andrey Semashev
6f6614717e Added experimental support for ARM architecture on Windows. Completely untested. 2014-01-26 17:05:54 +04:00
Andrey Semashev
6bb71fdd8f Fixed incorrect initialization of 128-bit values, when no native support for 128-bit integers is available. 2014-01-26 13:58:48 +04:00
Agustín Bergé
1ee6311ea4 Silence GCC -Wcast-qual warning
Use C++ casts instead of C-style casts in order to silence warning about casting away qualifiers.

warning: cast from type 'volatile bool*' to type 'bool*' casts away qualifiers [-Wcast-qual]
2014-01-13 12:31:22 -06:00
Andrey Semashev
9ded906200 The lock pool mutexes are now statically initialized. Fixes #9466. 2013-12-14 19:44:23 +04:00
Tim Blechmann
6ef10a2d40 atomic: fix compilation and make use of gcc's cas-based implementation 2013-12-07 10:48:24 +01:00
Andrey Semashev
94359f6aea Reverted commit 86144, which was misapplied and not required. The support for 64-bit atomic ops on 32-bit x86 was already present before.
[SVN r86320]
2013-10-15 11:08:22 +00:00
Tim Blechmann
9606e3f321 atomic: 64bit cas support for 32bit windows
fixes #9193

[SVN r86144]
2013-10-03 09:17:42 +00:00
Stephen Kelly
21fc47f109 Atomic: Remove obsolete MSVC version check.
[SVN r85910]
2013-09-25 21:11:49 +00:00
Andrey Semashev
799b822bab Fixed duplicate BOOST_ATOMIC_COMPILER_BARRIER macro definition. Extracted linking setup to a separate header so that including interlocked.hpp doesn't require linking with the library.
[SVN r85793]
2013-09-19 20:04:47 +00:00
Andrey Semashev
dd3267bc43 Added macro checks for more ARM targets. The macros were taken from smart_ptr/detail/spinlock_gcc_arm.hpp.
[SVN r85586]
2013-09-06 17:37:29 +00:00
Andrey Semashev
a629bd6308 Corrected macro name.
[SVN r85578]
2013-09-05 18:28:42 +00:00
Andrey Semashev
b8cd09c50b Switched to boost::detail::lightweight_mutex instead of boost::mutex from Boost.Thread to avoid false dependencies on Boost.DateTime, Boost.Chrono and Boost.System. This should hopefully resolve linking problems on MinGW.
[SVN r85531]
2013-08-31 11:21:50 +00:00
Andrey Semashev
2dc386ae88 Added missing includes and std:: qualification for ptrdiff_t.
[SVN r85090]
2013-07-20 17:46:48 +00:00
Tim Blechmann
ffae0dc7a0 atomic: qnx/qcc compile fix
[SVN r85015]
2013-07-12 17:49:20 +00:00
Andrey Semashev
2327494330 Mentioned Intel compiler version in the comment.
[SVN r84857]
2013-06-21 08:29:19 +00:00
Andrey Semashev
1837dbe879 Disabled __atomic* intrinsics for Intel compiler.
[SVN r84856]
2013-06-21 08:25:35 +00:00
Andrey Semashev
adefa136d0 Minor performance optimization and fixes of register constraints alternatives.
[SVN r84816]
2013-06-17 20:07:13 +00:00
Andrey Semashev
64dfb109b8 Resolved MSVC warnings about multiple operator= overloads.
[SVN r84806]
2013-06-16 17:23:26 +00:00
Andrey Semashev
5c4c16f436 Extracted intptr_t and uintptr_t types to cstdint.hpp. Refs #7823.
[SVN r84805]
2013-06-16 15:02:27 +00:00
Andrey Semashev
55e8b16a12 Fixed compilation with gcc 4.4. Optimized code for gcc older than 4.7 and also added support for 128-bit atomic ops. Completed transition to defaulted and deleted functions.
[SVN r84801]
2013-06-16 13:40:11 +00:00
Andrey Semashev
9cab8a9ebf Added a generic atomic<> implementation based on the new __atomic intrinsics available in gcc 4.7 and clang 3.2. The new implementation adds support for 128-bit atomic. Other implementations updated to employ new macros in Boost.Config for defaulted and deleted functions (this is not complete yet). Fixed padding for the lock pool. Initializing constructor for atomic<> made explicit to avoid ambiguities of different overloads of operator=.
[SVN r84800]
2013-06-15 20:43:48 +00:00
Andrey Semashev
dcab6171fa Code cleanup.
[SVN r84699]
2013-06-08 18:10:21 +00:00
Andrey Semashev
5b0186dc7d Added implementation of 64-bit atomic operations on 32-bit Windows. Pointer specializations of 64-bit CAS-based atomic implementation extracted to a separate header, since these specializations are not needed on 32-bit platforms.
[SVN r84695]
2013-06-08 17:36:38 +00:00
Tim Blechmann
8e69b6ffba atomic: pad spin-locks to avoid false sharing
[SVN r84386]
2013-05-20 09:07:22 +00:00
Tim Blechmann
18b97cbe7a atomic: Optimization for 64 bit loads and stores for 32 bit x86 on gcc
fixes #8574

[SVN r84288]
2013-05-15 06:12:46 +00:00
Tim Blechmann
96b44933f0 atomic: provide additive functionality for atomic<void*>
fixes #8501

[SVN r84190]
2013-05-08 04:45:38 +00:00
Andrey Semashev
82064eecd6 Added missing constexpr/noexcept.
[SVN r83099]
2013-02-23 15:24:58 +00:00
Andrey Semashev
888095208d Fixed typo.
[SVN r83098]
2013-02-23 14:57:49 +00:00
Andrey Semashev
ca1f5e95d4 Fixed typo in the comment.
[SVN r83097]
2013-02-23 14:22:15 +00:00
Andrey Semashev
f9c4249c8e 1. Fixed compilation with MSVC 2003.
2. Fixed incorrect reinterpret_casts in constexpr constructors that could result in buffer overruns. The initializing constructors for non-integral atomics are not constexpr yet because memcpy must be used inside.
3. Made atomic_flag default constructors constexpr. This is not by the standard but we do not implement ATOMIC_FLAG_INIT yet, so the default constructor is needed and it should be constexpr when possible.
4. Fixed a few syntax errors and cleaned up the code a bit.
5. Moved operator value_type() to the interface class in order not to duplicate it in base_atomic specializations.
6. The return type of operator=() changed to follow the standard.

[SVN r83096]
2013-02-23 14:21:19 +00:00
Vicente J. Botet Escriba
546ff8d616 Atomic: fix some minor issues.
[SVN r82947]
2013-02-17 13:16:23 +00:00
Hartmut Kaiser
a6cd5bb9a7 Atomic: fixing Windows compilation problem
[SVN r82942]
2013-02-17 04:43:17 +00:00
Tim Blechmann
764db51b6d atomic: adapt for constexpr and noexcept
Signed-off-by: Tim Blechmann <tim@klingt.org>

[SVN r82870]
2013-02-14 12:32:41 +00:00
Tim Blechmann
848f7530b5 atomic: uclibc doesn't seem to have intptr_t
fixes #7979

[SVN r82754]
2013-02-05 21:43:04 +00:00
Andrey Semashev
e5eb08c4b8 Attempt to fix compilation in Windows CE.
[SVN r82203]
2012-12-25 03:35:12 +00:00
Andrey Semashev
3c1e036002 Fixed compilation on PGI.
[SVN r82183]
2012-12-23 12:19:45 +00:00
Andrey Semashev
f1edf108b2 Added missing atomic typedefs.
[SVN r82161]
2012-12-21 22:39:16 +00:00
Andrey Semashev
12997b05f9 Restored full fence in the platform_fence_after_load function on architectures other than x86 and x86_64. The fence is not required only on those architectures.
[SVN r82156]
2012-12-21 21:01:19 +00:00
Andrey Semashev
bd0ef80622 Attempt to fix compilation on Windows CE.
[SVN r82155]
2012-12-21 20:36:26 +00:00
Andrey Semashev
33343de82e Removed unnecessary fences, added pause operations to tight spin loops to optimize power consumption and performance on HT-enabled systems.
[SVN r82106]
2012-12-19 22:00:25 +00:00
Tim Blechmann
982dc948e3 atomic: fix typos
fixes #7804

[SVN r82072]
2012-12-18 09:43:23 +00:00
Andrey Semashev
55f3aaadaf Code cleanup. Implemented optimized atomic operations for Windows.
[SVN r81969]
2012-12-15 13:24:01 +00:00
Andrey Semashev
bf8270ebf9 Rearranged public headers and added #pragma once for compilers that support it.
[SVN r81932]
2012-12-14 11:13:30 +00:00
Andrey Semashev
4c200d702b Corrected BOOST_ATOMIC_LLONG_LOCK_FREE macro definition on Windows x64 platform.
[SVN r81831]
2012-12-10 18:56:34 +00:00
Tim Blechmann
3c288331b0 atomic: make use of gcc's __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
__i686__ is not enabled for every platform supporting cmpxchg8b. to work
around this, we provide a separate implementation via gcc's atomic builtins

[SVN r81736]
2012-12-06 12:35:32 +00:00
Hartmut Kaiser
d0d71e81d8 Boost.Atomic: committing MSVC visibility patch, auto-linking and long long fix
[SVN r80530]
2012-09-15 12:44:39 +00:00
Helge Bahmann
71564c97cf Add missing copyright and licence notices
Add missing notices to various files to make clear they are distributable
under the boost licence.


[SVN r80527]
2012-09-14 19:12:13 +00:00
Helge Bahmann
b53b1d4bdc Add missing newline at end of file
[SVN r80526]
2012-09-14 19:06:38 +00:00
Helge Bahmann
40c05b4274 Rename armv6+ to armv6plus
Avoid forbidden character in file name.


[SVN r80525]
2012-09-14 19:05:52 +00:00
Tim Blechmann
94f7a5bd30 atomic: fix const-correctnes of double-width load
[SVN r80454]
2012-09-08 16:36:11 +00:00
Helge Bahmann
3870d2bf30 Catch conflicting macro definitions
Compilation reportedly fails on icc, conflicting macro definitions (both
__i686__ and __x86_64__ defined) is under suspicion. This patch tentatively
fixes the issue.

Reported-by: Tim Blechmann <tim@klingt.org>


[SVN r79617]
2012-07-20 10:51:45 +00:00
Helge Bahmann
3d15020971 Delete arithmetic methods for atomic<void *>
Delete definitions for fetch_add and fetch_sub on void * pointers -- clang
already treats their definition as erroneous.

Reported-by: Anand TM <anand_tm@yahoo.com>



[SVN r79616]
2012-07-20 08:17:47 +00:00
Helge Bahmann
49f913ae58 Fix compilation of interlocked.hpp
Fix two compilation errors I missed due to sloppy testing :/
Reported-by: <lukester_null@yahoo.co.uk>


[SVN r79615]
2012-07-20 08:11:39 +00:00
Helge Bahmann
131b70c1fa atomic: initial import
[SVN r79348]
2012-07-08 11:21:45 +00:00