Commit Graph

361 Commits

Author SHA1 Message Date
Andrey Semashev
6d40529a58 Switch back to Boost.TypeTraits for integral traits because libstdc++ doesn't consider __int128 an integral type. 2017-04-03 15:11:30 +03:00
Andrey Semashev
11c785768c Updated to reflect changes from P0558R1 accepted into C++17.
1. Expose value_type and difference_type (where present) to user's code.

2. Prohibit arithmetic operations on pointers to non-object types. In
   particular, arithmetic operations such as fetch_add/fetch_sub will no longer
   compile for pointers to cv void, pointers to functions and pointers to
   non-static class members.

Also, use C++11 <type_traits> when possible instead of Boost.TypeTraits to
reduce dependencies. Cleaned up value_arg_type internal type usage for more
efficient argument passing.
2017-04-01 18:29:26 +03:00
Andrey Semashev
a67cc1b055 Corrected register usage in x86 DCAS asm blocks.
In some of the asm blocks eax was modified as a result of cmpxchg8b but that
was not reflected in the register constraints. This could cause incorrect code
being generated.
2017-01-08 18:09:12 +03:00
Andrey Semashev
2b6ef06b57 Added preliminary support for MSVC for ARM64 target. 2017-01-07 21:27:09 +03:00
Andrey Semashev
e6e6a04114 Changed taking address of the values involved in bitwise_cast to avoid gcc warnings. 2017-01-06 16:35:57 +03:00
Andrey Semashev
41eac78e25 Merge branch 'develop' 2016-11-08 16:49:21 +03:00
Andrey Semashev
07be21c7e8 Silenced some MSVC warnings. 2016-11-06 21:29:33 +03:00
Andrey Semashev
8e30f37a1f Added workarounds for Oracle Studio 12.5 on x86. 2016-10-13 15:59:22 +03:00
Andrey Semashev
5b30e196a6 Added is_always_lock_free static constant from C++17. 2016-10-13 15:59:22 +03:00
Rene Rivera
019610574b Add, and update, documentation build targets. 2016-10-10 11:39:47 -05:00
Andrey Semashev
836381dcd1 Added workarounds for Oracle Studio 12.5 on x86. 2016-10-09 19:15:42 +03:00
Andrey Semashev
336a349b9f Added is_always_lock_free static constant from C++17. 2016-10-09 17:53:55 +03:00
Rene Rivera
512f1ac409 Add, and update, documentation build targets. 2016-10-07 23:07:32 -05:00
Andrey Semashev
9be3389f06 Updated test to refrect improved support for Oracle Studio and SPARC. 2016-09-17 13:30:26 +03:00
Andrey Semashev
cc9cff37af Documented BOOST_ATOMIC_NO_CMPXCHG8B and BOOST_ATOMIC_NO_MFENCE config macros. 2016-09-15 01:19:52 +03:00
Andrey Semashev
e450653451 Extracted x86 mfence detection to caps headers.
Also, for non-gcc compilers which do not allow to auto-detect mfence availability (e.g. Oracle Studio) the instruction is assumed to be supported (since SSE2 is supported by virtually every x86 CPU now). This can be changed by defining BOOST_ATOMIC_NO_MFENCE.
2016-09-15 01:05:51 +03:00
Andrey Semashev
dce87d3c0a Changes for better compatibility with Oracle Studio 12.5.
1. Although the compiler is supposed to support __atomic and __sync intrinsics like gcc, it does not define any macros allowing to detect that. In particular, it is not possible to deduce what sizes of atomic operands are supported in hardware except to check the arch macros.
2. The compiler does not define any macros that allow to deduce the target x86 CPU, which makes it impossible to know whether the CPU supports cmpxchg8b/cmpxchg16b/mfence.

Because of that this commit changes handling of this compiler the following way:

1. On SPARC the compiler will use the gcc_sparc backend. Also, enabled the backend for the SPARCv8+ architecture as it appears to be almost a 32-bit equivalent to SPARCv9 and does support cas/casx instructions.
2. On x86 the compiler will use the gcc_x86 backend. By default cmpxchg8b/cmpxchg16b are assumed to be supported unless BOOST_ATOMIC_NO_CMPXCHG8B/BOOST_ATOMIC_NO_CMPXCHG16B is defined. The mfence instruction requires SSE2 and although ubiquitous these days, it will still be detected as not supported for now.
2016-09-15 00:46:26 +03:00
Andrey Semashev
4274a78f46 Corrected typos that prevented compilation. 2016-09-14 20:36:12 +03:00
Andrey Semashev
ee4a80f477 Added a delimiter space between the header marker and Boost.Log image.
The space is formally required by the Markdown syntax (http://spec.commonmark.org/0.25/#atx-headings), although GitHub implementation seems to not require it.
2016-08-19 13:39:12 +03:00
Andrey Semashev
ffe7710a90 Added a boostdoc target to unify Boost release docs building. 2016-01-06 21:04:08 +03:00
Tim Blechmann
24586fe2aa Merge pull request #5 from jeremy-murphy/unused_params
Fix some unused parameter warnings.
2015-12-15 11:16:33 +01:00
Jeremy W. Murphy
0abd9bfd73 Fix some unused parameter warnings. 2015-12-15 20:56:58 +11:00
Andrey Semashev
430169a53c Removed union_cast in favor of memcpy-based implementation and renamed the cast to bitwise_cast. Use __builtin_mem* instead of regular function calls when possible. This saves inclusion of <cstring> and possibly generates better code when -fno-builtin is used. The net result of these changes is no UB that union_cast was introducing while hopefully retaining the same performance. 2015-12-02 20:04:10 +03:00
Andrey Semashev
c989d936c5 Renamed casts.hpp to bitwise_cast.hpp. 2015-12-02 18:36:49 +03:00
Andrey Semashev
8bbf5e19db Corrected compiler check for BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS. 2015-11-08 17:24:30 +03:00
Andrey Semashev
6e2d7b28de Restored old versions of DCAS operations that use an extra register for compatibility with old binutils, which apparently are used on OS X with gcc 4.2. 2015-11-04 15:25:12 +03:00
Andrey Semashev
45289e534e Added a few notes to the README.md file. 2015-08-28 21:56:15 +03:00
Andrey Semashev
ec4738a8eb Workaround for MSVC-12 ICE. 2015-08-26 23:27:13 +03:00
Andrey Semashev
e3aac4bc65 Simplified memory references in assembler blocks which should reduce the typical number of used registers by one. 2015-08-23 03:27:37 +03:00
Andrey Semashev
4462c1cdf4 Fixed compilation with gcc 4.4. 2015-08-23 02:05:35 +03:00
Andrey Semashev
18fdcb1747 Fixed compilation errors with MSVC caused by using types with large alignment values as function arguments. Alignment is now explicitly specified for all storage types to avoid surprises. Optimized CAS-based exchange implementation on x86. Relaxed initial loads in CAS-based operations as this load is not required to be accurate. 2015-08-23 01:04:08 +03:00
Andrey Semashev
6bb5b17108 Silenced MSVC warnings about 'this' being used in the constructor initialization list. 2015-08-22 20:47:56 +03:00
Tim Blechmann
f0f1ef228c atomic: fix compilation on msvc 8 / Windows CE / arm 2015-08-22 10:17:02 +02:00
Andrey Semashev
ff91811c1a Fixes #10994. Fixed compilation with gcc 4.4 when cmpxchg16b is used. 2015-08-17 23:27:37 +03:00
Andrey Semashev
b1bb36c5b3 Only use intptr_t when available. Only test integer overflows/underflows for unsigned integers (the behavior is undefined for signed ints anyway). This should silence compiler warnings as well. 2015-08-17 22:25:19 +03:00
Andrey Semashev
a8661d4cc2 Corrected memory barriers in store, load and thread_fence. Added indentation to the generated assembler code. 2015-08-15 00:29:43 +03:00
Andrey Semashev
4162cb109f Corrected memory ordering of loads. Relaxed loads do not synchronize-with seq_cst stores, which allowed the test to fail. Also removed unnecessary loads that did not contribute to the test robustness and could have reduced it by issuing extra memory fences. 2015-08-14 15:03:35 +03:00
Andrey Semashev
e6a188d165 Experimental support for IBM XL C++ compilers for PowerPC. 2015-08-13 23:37:33 +03:00
Andrey Semashev
7b1d722d94 Ported tests to core/lightweight_test.hpp.
Boost.Test was dropped due to instability and long-standing differences between develop and master branches. We don't use most of its features anyway.
2015-01-25 18:50:58 +03:00
Tim Blechmann
427a757bbf Merge pull request #4 from jhunold/test_dependency
Add explicit dependency on Boost.Test
2015-01-14 16:17:50 +01:00
Jürgen Hunold
30f72c8d25 Add explicit dependency on Boost.Test 2015-01-14 16:13:41 +01:00
Andrey Semashev
b8c91efe8f Made spinning on the lock less expensive. 2014-12-20 17:30:35 +03:00
Andrey Semashev
b77b0aff22 Made spinning on the lock less expensive. 2014-12-20 17:26:18 +03:00
Andrey Semashev
d6cc2c93c1 Avoid the lock padding member altogether if padding size is 0. 2014-12-20 17:05:24 +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
6995a64181 Added missing curly braces to the lock pool initializers. This should fix compilation when the compiler does not support brace folding. 2014-12-20 15:51:21 +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