]> granicus.if.org Git - libatomic_ops/log
libatomic_ops
5 years agoUpdate ChangeLog file (set v7.6.8 release date)
Ivan Maidanski [Tue, 11 Dec 2018 08:39:27 +0000 (11:39 +0300)]
Update ChangeLog file (set v7.6.8 release date)

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Mon, 10 Dec 2018 22:58:51 +0000 (01:58 +0300)]
Update ChangeLog file (v7.6 changes)

5 years agoUpdate ChangeLog file (set v7.4.12 release date)
Ivan Maidanski [Mon, 10 Dec 2018 22:53:45 +0000 (01:53 +0300)]
Update ChangeLog file (set v7.4.12 release date)

5 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 10 Dec 2018 22:11:58 +0000 (01:11 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

5 years agoUndo incorrect fix of typos regarding 'an' article
Ivan Maidanski [Mon, 10 Dec 2018 21:38:54 +0000 (00:38 +0300)]
Undo incorrect fix of typos regarding 'an' article
(revert part of commit cbde60d)

* src/atomic_ops/sysdeps/icc/ia64.h (AO_char_load_acquire): Fix typo
("an ld.acq") in comment.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
(AO_XSIZE_load_acquire): Likewise.
* src/atomic_ops/sysdeps/icc/ia64.h (AO_short_load_acquire,
AO_int_load_acquire): Add comment (similar to that of
AO_char_load_acquire).
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
(AO_XSIZE_store_release): Fix typo ("an st.rel") in comment.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h:
Regenerate.
* src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h:
Likewise.

5 years agoUndefine AO_ARM_HAVE_* private macros after their usage
Ivan Maidanski [Wed, 5 Dec 2018 21:51:51 +0000 (00:51 +0300)]
Undefine AO_ARM_HAVE_* private macros after their usage
(fix of commit 9b7cecba)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_ARM_HAVE_DMB, AO_ARM_HAVE_LDREX,
AO_ARM_HAVE_LDREXBH, AO_ARM_HAVE_LDREXD, AO_ARM_HAVE_SWP): Undefine at
the end of the file.

5 years agoUse standalone private macro to guard against AO_GCC_BARRIER redefinition
Ivan Maidanski [Wed, 5 Dec 2018 21:43:43 +0000 (00:43 +0300)]
Use standalone private macro to guard against AO_GCC_BARRIER redefinition
(code refactoring)

* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h:
Regenerate.
* src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
(AO_GCC_BARRIER): Define only if AO_HAVE_GCC_BARRIER is undefined.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
[!AO_HAVE_GCC_BARRIER] (AO_HAVE_GCC_BARRIER): Define macro.

5 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 3 Dec 2018 23:04:57 +0000 (02:04 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit 1145982 from 'release-7_4')

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Tue, 27 Nov 2018 08:12:42 +0000 (11:12 +0300)]
Update ChangeLog file (v7.6 changes)

5 years agoEliminate 'casting signed to bigger unsigned int' CSA warning (test_stack)
Ivan Maidanski [Sat, 10 Nov 2018 06:24:16 +0000 (09:24 +0300)]
Eliminate 'casting signed to bigger unsigned int' CSA warning (test_stack)

* tests/test_stack.c (run_one_test): Change type of index, i local
variables from int to unsigned.
* tests/test_stack.c [VERBOSE] (run_one_test): Change type of j local
variable from int to unsigned; update print format specifier
accordingly.
* tests/test_stack.c (main): Change type of i local variable from int
to unsigned.

5 years agoTravis CI: Execute cppcheck without sudo and -U long
Ivan Maidanski [Thu, 8 Nov 2018 09:15:17 +0000 (12:15 +0300)]
Travis CI: Execute cppcheck without sudo and -U long

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Mon, 29 Oct 2018 22:15:50 +0000 (01:15 +0300)]
Update ChangeLog file (v7.6 changes)

5 years agoUse GCC atomic primitives for aarch64-ilp32 double-wide operations
Ivan Maidanski [Fri, 26 Oct 2018 18:33:46 +0000 (21:33 +0300)]
Use GCC atomic primitives for aarch64-ilp32 double-wide operations

Issue #38 (libatomic_ops).

Both gcc and clang have correct support of 64-bit atomic primitives
on AArch64, so need to use inline assembly.

* src/atomic_ops/sysdeps/gcc/aarch64.h [!__clang__] (AO_double_load,
AO_double_load_acquire, AO_double_store, AO_double_store_release,
AO_double_compare_and_swap, AO_double_compare_and_swap_acquire,
AO_double_compare_and_swap_release, AO_double_compare_and_swap_full):
Do not define if __ILP32__ (unless AO_AARCH64_ASM_LOAD_STORE_CAS).
* src/atomic_ops/sysdeps/gcc/aarch64.h [!__clang__
|| AO_CLANG_PREREQ(3,9)] (AO_GCC_HAVE_double_SYNC_CAS): Do not define
if __ILP32__; update gcc version in comment.

5 years agoUpdate AUTHORS file (add Tautvydas Zilys)
Ivan Maidanski [Thu, 25 Oct 2018 22:59:15 +0000 (01:59 +0300)]
Update AUTHORS file (add Tautvydas Zilys)

5 years agoSupport UWP/arm64 target
Tautvydas Zilys [Mon, 10 Sep 2018 18:41:09 +0000 (11:41 -0700)]
Support UWP/arm64 target

* src/atomic_ops.h [_MSC_VER && _M_ARM64]: Include msftc/x86_64.h.

5 years agoTravis CI: Test nios2 architecture with a cross-compiler
Ivan Maidanski [Wed, 24 Oct 2018 23:01:53 +0000 (02:01 +0300)]
Travis CI: Test nios2 architecture with a cross-compiler

5 years agoFix 'Cannot implement CAS_full on this architecture' build error (nios2)
Ivan Maidanski [Wed, 24 Oct 2018 22:54:57 +0000 (01:54 +0300)]
Fix 'Cannot implement CAS_full on this architecture' build error (nios2)

* src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS
&& !__INTEL_COMPILER && __nios2__] (AO_CAN_EMUL_CAS): Define macro.

5 years agoTravis CI: Test sh2 and s390 targets with cross-compilers
Ivan Maidanski [Wed, 24 Oct 2018 21:52:13 +0000 (00:52 +0300)]
Travis CI: Test sh2 and s390 targets with cross-compilers

5 years agoTravis CI: Test arm, mips, ppc targets without GCC atomic primitives
Ivan Maidanski [Wed, 24 Oct 2018 21:49:31 +0000 (00:49 +0300)]
Travis CI: Test arm, mips, ppc targets without GCC atomic primitives

5 years agoTravis CI: Test aarch64-ilp32 target with a cross-compiler
Ivan Maidanski [Wed, 24 Oct 2018 21:45:41 +0000 (00:45 +0300)]
Travis CI: Test aarch64-ilp32 target with a cross-compiler

5 years agoTravis CI: Test riscv32 and riscv64 linux targets with a cross-compiler
Ivan Maidanski [Wed, 24 Oct 2018 21:40:19 +0000 (00:40 +0300)]
Travis CI: Test riscv32 and riscv64 linux targets with a cross-compiler

Issue #31 (libatomic_ops).

5 years agoTravis CI: Update cross-compiler toolchains to v8.1.0
Ivan Maidanski [Wed, 24 Oct 2018 21:33:26 +0000 (00:33 +0300)]
Travis CI: Update cross-compiler toolchains to v8.1.0
(except for avr32, cris, ppc64le, s390x, tilegx)

5 years agoSupport ILP32 in AArch64 assembly routines (GCC)
Frank Schaefer [Wed, 24 Oct 2018 03:11:02 +0000 (22:11 -0500)]
Support ILP32 in AArch64 assembly routines (GCC)

Issue #38 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/aarch64.h [(!__clang__
|| AO_AARCH64_ASM_LOAD_STORE_CAS) && !AO_PREFER_GENERALIZED
&& __ILP32__] (AO_double_load, AO_double_load_acquire, AO_double_store,
AO_double_store_release): Specify the size ("w") of arguments of the
aarch64 instructions.
* src/atomic_ops/sysdeps/gcc/aarch64.h [(!__clang__
|| AO_AARCH64_ASM_LOAD_STORE_CAS) && __ILP32__]
(AO_double_compare_and_swap, AO_double_compare_and_swap_acquire,
AO_double_compare_and_swap_release, AO_double_compare_and_swap_full):
Likewise.

5 years agoWorkaround 'condition my_chunk_ptr is always false' cppcheck false positive
Ivan Maidanski [Fri, 19 Oct 2018 18:13:19 +0000 (21:13 +0300)]
Workaround 'condition my_chunk_ptr is always false' cppcheck false positive

* src/atomic_ops_malloc.c (get_chunk): Move get_mmaped() call into the
for loop; replace return statement inside the loop with break.

5 years agoFix typos in arm_v6.h, ia64.h, acquire_release_volatile.template
Ivan Maidanski [Thu, 13 Sep 2018 07:50:21 +0000 (10:50 +0300)]
Fix typos in arm_v6.h, ia64.h, acquire_release_volatile.template

* src/atomic_ops/sysdeps/armcc/arm_v6.h [!AO_UNIPROCESSOR]
(AO_nop_full): Fix typo ("a data memory barrier") in comment.
* src/atomic_ops/sysdeps/icc/ia64.h (AO_char_load_acquire): Fix typo
("a ld.acq instruction") in comment.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
(AO_XSIZE_load_acquire): Likewise.
* src/atomic_ops/sysdeps/icc/ia64.h (AO_short_load_acquire,
AO_int_load_acquire): Remove comment duplicating that in
AO_char_load_acquire.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
(AO_XSIZE_store_release): Fix typo ("a st.rel instruction") in comment.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h:
Regenerate.
* src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h:
Likewise.

5 years agoTravis CI: Put GNU S/W download base URL in a dedicated variable
Ivan Maidanski [Wed, 5 Sep 2018 20:38:54 +0000 (23:38 +0300)]
Travis CI: Put GNU S/W download base URL in a dedicated variable

5 years agoEliminate 'redundant blank line at start/end of block' CodeFactor warning
Ivan Maidanski [Mon, 3 Sep 2018 20:21:18 +0000 (23:21 +0300)]
Eliminate 'redundant blank line at start/end of block' CodeFactor warning
(code refactoring)

* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_test_and_set): Remove
redundant blank line at the start of a code block.
* src/atomic_ops/sysdeps/hpc/ia64.h (AO_fetch_compare_and_swap_release,
AO_char_fetch_compare_and_swap_acquire,
AO_char_fetch_compare_and_swap_release,
AO_short_fetch_compare_and_swap_acquire,
AO_short_fetch_compare_and_swap_release): Remove redundant blank line
at the end of a code block.

5 years agoAdd Codecov.io badge to README
Ivan Maidanski [Mon, 3 Sep 2018 20:05:49 +0000 (23:05 +0300)]
Add Codecov.io badge to README

5 years agoTravis CI: Send code coverage reports to Codecov as well
Ivan Maidanski [Mon, 3 Sep 2018 20:03:19 +0000 (23:03 +0300)]
Travis CI: Send code coverage reports to Codecov as well

5 years agoAdd LGTM.com code quality badges to README
Xavier Rene-Corail [Thu, 30 Aug 2018 10:05:30 +0000 (12:05 +0200)]
Add LGTM.com code quality badges to README

5 years agoUpdate ChangeLog file (add v7.6.6 release date)
Ivan Maidanski [Tue, 7 Aug 2018 07:55:08 +0000 (10:55 +0300)]
Update ChangeLog file (add v7.6.6 release date)

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Mon, 6 Aug 2018 20:59:25 +0000 (23:59 +0300)]
Update ChangeLog file (v7.6 changes)

5 years agoUpdate copyright information in README and some header files
Ivan Maidanski [Thu, 26 Jul 2018 05:56:17 +0000 (08:56 +0300)]
Update copyright information in README and some header files

* README.md (Copyright & Warranty): Add copyrights from the source
code files.
* src/atomic_ops.h: Update header copyright (add Ivan Maidanski).
* src/atomic_ops/ao_version.h: Likewise.
* src/atomic_ops/sysdeps/gcc/aarch64.h: Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h: Likewise.
* src/atomic_ops/sysdeps/gcc/generic.h: Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h: Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h: Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h: Likewise.

5 years agoCOPYING: sync with FSF's gpl-2.0.txt
Pavel Raiskup [Wed, 18 Jul 2018 07:48:58 +0000 (09:48 +0200)]
COPYING: sync with FSF's gpl-2.0.txt

5 years agoTravis CI: Upgrade gcc-7 to gcc-8
Ivan Maidanski [Mon, 4 Jun 2018 19:30:58 +0000 (22:30 +0300)]
Travis CI: Upgrade gcc-7 to gcc-8

6 years agoTravis CI: Upgrade clang-4.0 to clang-5.0, and gcc-5 to gcc-7
Ivan Maidanski [Mon, 4 Jun 2018 08:05:01 +0000 (11:05 +0300)]
Travis CI: Upgrade clang-4.0 to clang-5.0, and gcc-5 to gcc-7

6 years agoFix comments style in configure.ac and Makefile.am
Ivan Maidanski [Fri, 18 May 2018 17:46:38 +0000 (20:46 +0300)]
Fix comments style in configure.ac and Makefile.am
(code refactoring)

Do not allow the comments that are meaningless in the auto-generated
configure and Makefile.in to be put to these files.

* Makefile.am (check-nolink): Change comment style from "#" to "##".
* configure.ac: Add the copyright and disclaimer.
* configure.ac: Change comment style from "#" to "dnl" for the comments
that are meaningless in auto-generated configure file.

6 years agoFix a typo in the overview section of README
Ivan Maidanski [Mon, 2 Apr 2018 19:52:18 +0000 (22:52 +0300)]
Fix a typo in the overview section of README
(fix of commit 147988d9)

* README.md (Overview): Fix typo ("a number of") in documentation.

6 years agoFix 'undefined reference to __atomic_load/store/cas_16' error (gcc-7/x64)
Ivan Maidanski [Wed, 28 Mar 2018 22:42:38 +0000 (01:42 +0300)]
Fix 'undefined reference to __atomic_load/store/cas_16' error (gcc-7/x64)

Issue #34 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [!AO_DISABLE_GCC_ATOMICS
&& !__APPLE_CC__ && !__clang__ && AO_GNUC_PREREQ(7, 0)
&& !AO_PREFER_BUILTIN_ATOMICS && !AO_THREAD_SANITIZER
&& !__MINGW32__] (AO_SKIPATOMIC_double_compare_and_swap_ANY,
AO_SKIPATOMIC_DOUBLE_LOAD_STORE_ANY): Define macro; add comment.

6 years agoTravis CI: Test with gcc-7/x86_64 and -march=native flag on Linux
Ivan Maidanski [Wed, 28 Mar 2018 22:14:48 +0000 (01:14 +0300)]
Travis CI: Test with gcc-7/x86_64 and -march=native flag on Linux

6 years agoUpdate ChangeLog file (add v7.6.4 release date)
Ivan Maidanski [Wed, 28 Mar 2018 22:38:12 +0000 (01:38 +0300)]
Update ChangeLog file (add v7.6.4 release date)

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Tue, 27 Mar 2018 07:38:23 +0000 (10:38 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoUpdate AUTHORS file (add YunQiang Su)
Ivan Maidanski [Fri, 16 Mar 2018 07:05:24 +0000 (10:05 +0300)]
Update AUTHORS file (add YunQiang Su)

6 years agoSupport MIPS rel6
YunQiang Su [Fri, 16 Mar 2018 06:58:22 +0000 (09:58 +0300)]
Support MIPS rel6

Don't set mips2/3 for mips r6.  MIPS release 6 changes the encoding of
some instructions, including ll/sc.  Setting mips2/3 here produces the
binary with the old encoding (not compatible with mips r6).

This patch has no effect if gcc 4.9+ or clang 3.5+ unless
AO_DISABLE_GCC_ATOMICS is defined manually in CFLAGS.

* src/atomic_ops/sysdeps/gcc/mips.h [AO_DISABLE_GCC_ATOMICS
&& __mips_isa_rev>=6] (AO_MIPS_SET_ISA): Define to empty string
(instead of ".set mips2" or ".set mips3").

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Mon, 5 Mar 2018 22:33:22 +0000 (01:33 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoEnable CAS for byte and short on RISC-V
Ivan Maidanski [Wed, 21 Feb 2018 07:58:33 +0000 (10:58 +0300)]
Enable CAS for byte and short on RISC-V

Issue #31 (libatomic_ops).

At least for gcc-7.2.0 does not define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 macros but, nonetheless, all the
provided CAS operations are lock-free (except for double-word).

* src/Makefile.am (nobase_private_HEADERS): Add gcc/riscv.h entry.
* src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS
&& !__INTEL_COMPILER && __riscv]: Include gcc/riscv.h file.
* src/atomic_ops/sysdeps/gcc/riscv.h: New file (include generic.h).
* src/atomic_ops/sysdeps/gcc/riscv.h (AO_GCC_FORCE_HAVE_CAS): Define
before include generic.h (and undefined at the end of file); add
comment about double-word operations.

6 years agoRemove gcc/nios2.h and gcc/riscv.h files, include gcc/generic.h directly
Ivan Maidanski [Mon, 19 Feb 2018 06:45:50 +0000 (09:45 +0300)]
Remove gcc/nios2.h and gcc/riscv.h files, include gcc/generic.h directly
(code refactoring)

* src/Makefile.am (nobase_private_HEADERS): Remove nios2.h, riscv.h
entries.
* src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS
&& !__INTEL_COMPILER]: Use #elif instead of #endif - #if pairs.
* src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS
&& !__INTEL_COMPILER && (__nios2__ || __riscv)]: Do not include
gcc/nios2.h and gcc/riscv.h files; gcc/generic.h is included instead.
* src/atomic_ops/sysdeps/gcc/nios2.h: Delete file.
* src/atomic_ops/sysdeps/gcc/riscv.h: Likewise.

6 years agoUpdate AUTHORS file (add Shea Levy)
Ivan Maidanski [Mon, 19 Feb 2018 06:07:11 +0000 (09:07 +0300)]
Update AUTHORS file (add Shea Levy)

6 years agoAdd RISC-V support
Shea Levy [Sun, 18 Feb 2018 05:47:44 +0000 (00:47 -0500)]
Add RISC-V support

Issue #31 (libatomic_ops).

* src/Makefile.am (nobase_private_HEADERS): Add riscv.h entry.
* src/atomic_ops.h [__riscv]: Include riscv.h file.
* src/atomic_ops/sysdeps/gcc/riscv.h: New file (just include generic.h).

6 years agoTravis CI: Test compilation of 'src' files as C++ ones (Clang)
Ivan Maidanski [Wed, 14 Feb 2018 07:06:28 +0000 (10:06 +0300)]
Travis CI: Test compilation of 'src' files as C++ ones (Clang)

6 years agoConvert atomic_ops_malloc.c to valid C++ code
Ivan Maidanski [Wed, 14 Feb 2018 06:54:29 +0000 (09:54 +0300)]
Convert atomic_ops_malloc.c to valid C++ code

Explicit pointer casts are added where necessary.

* src/atomic_ops_malloc.c [HAVE_MMAP] (get_mmaped): Cast result of
mmap() to char* (when assigned to "result" local variable).
* src/atomic_ops_malloc.c (AO_free): Cast AO_free_large() argument
to char*.

6 years agoTravis CI: Test compilation of C tests as C++ ones
Ivan Maidanski [Thu, 8 Feb 2018 22:14:51 +0000 (01:14 +0300)]
Travis CI: Test compilation of C tests as C++ ones

6 years agoConvert tests to valid C++ code
Ivan Maidanski [Thu, 8 Feb 2018 22:12:27 +0000 (01:12 +0300)]
Convert tests to valid C++ code

* tests/test_malloc.c (cons, dummy_test, run_one_test): Add explicit
cast of void* pointer (returned by malloc) to the type of the variable
the pointer is assigned to.
* tests/test_stack.c (add_elements): Likewise.

6 years agoFix public headers inclusion from clients C++ code
Ivan Maidanski [Thu, 8 Feb 2018 21:42:25 +0000 (00:42 +0300)]
Fix public headers inclusion from clients C++ code

Put declarations of exported variables and non-inline functions into
extern "C" blocks.

* src/atomic_ops/sysdeps/emul_cas.h [__cplusplus]
(AO_fetch_compare_and_swap_emulation,
AO_compare_double_and_swap_double_emulation, AO_store_full_emulation):
Wrap the prototypes (but not included headers).
* src/atomic_ops/sysdeps/gcc/x86.h [AO_WEAK_DOUBLE_CAS_EMULATION
&& __cplusplus] (AO_compare_double_and_swap_double_emulation): Likewise.
* src/atomic_ops/sysdeps/generic_pthread.h [__cplusplus] (AO_pt_lock):
Likewise.
* src/atomic_ops/sysdeps/sunc/sparc.h [__cplusplus]
(AO_test_and_set_full): Likewise.
* src/atomic_ops_malloc.h [__cplusplus] (AO_free, AO_malloc,
AO_malloc_enable_mmap): Likewise.
* src/atomic_ops_stack.h [__cplusplus]
(AO_stack_push_explicit_aux_release,
AO_stack_pop_explicit_aux_acquire, AO_stack_init,
AO_stack_push_release, AO_stack_pop_acquire): Likewise.
* tests/test_atomic.c [AO_TEST_EMULATION && __cplusplus]
(AO_store_full_emulation, AO_fetch_compare_and_swap_emulation,
AO_compare_double_and_swap_double_emulation): Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER<1400
&& __cplusplus]: Adjust comment for the end of extern "C" block.

6 years agoEliminate 'using argument that points at uninitialized var' cppcheck error
Ivan Maidanski [Tue, 30 Jan 2018 21:40:23 +0000 (00:40 +0300)]
Eliminate 'using argument that points at uninitialized var' cppcheck error

* tests/list_atomic.template [AO_HAVE_test_and_setXX]
(XSIZE_list_atomicXX): Initialize ts local variable (to
AO_TS_INITIALIZER).

6 years agoFix 'AO_pt_lock undefined' error if cross-compiling manually (MinGW)
Ivan Maidanski [Tue, 16 Jan 2018 08:50:35 +0000 (11:50 +0300)]
Fix 'AO_pt_lock undefined' error if cross-compiling manually (MinGW)

* tests/test_atomic.c [AO_USE_PTHREAD_DEFS] (main): Skip the test if
__MINGW32__ (even if AO_NO_PTHREADS is not defined).

6 years agoTravis CI: Test also with mingw-w64 cross-compiler for 32-bit target (x86)
Ivan Maidanski [Tue, 16 Jan 2018 08:43:10 +0000 (11:43 +0300)]
Travis CI: Test also with mingw-w64 cross-compiler for 32-bit target (x86)

6 years agoTravis CI: Fix ASan builds with Clang-4.0 and GCC-5 (add sudo)
Ivan Maidanski [Tue, 16 Jan 2018 08:27:39 +0000 (11:27 +0300)]
Travis CI: Fix ASan builds with Clang-4.0 and GCC-5 (add sudo)

6 years agoEliminate 'function is never used' cppcheck warning for load_before_cas
Ivan Maidanski [Thu, 28 Dec 2017 18:09:25 +0000 (21:09 +0300)]
Eliminate 'function is never used' cppcheck warning for load_before_cas
(fix commit 441415c8)

* src/atomic_ops_stack.c [!AO_USE_ALMOST_LOCK_FREE
&& AO_THREAD_SANITIZER && !AO_HAVE_compare_and_swap_double &&
!AO_HAVE_compare_double_and_swap_double] (load_before_cas): Define as
macro (not as a static function).

6 years agoTravis CI: Do not use 'trusty' build environment
Ivan Maidanski [Mon, 25 Dec 2017 06:37:41 +0000 (09:37 +0300)]
Travis CI: Do not use 'trusty' build environment

6 years agoUpdate version info of libatomic_ops_gpl.so to match that of v7.6.2
Ivan Maidanski [Mon, 25 Dec 2017 06:13:41 +0000 (09:13 +0300)]
Update version info of libatomic_ops_gpl.so to match that of v7.6.2

* src/Makefile.am (LIBATOMIC_OPS_GPL_VER_INFO): Increment revision
(bump version info of libatomic_ops_gpl.so to 2:2:1).

6 years agoUpdate ChangeLog file (add gc-7.6.2 release date)
Ivan Maidanski [Mon, 25 Dec 2017 06:05:40 +0000 (09:05 +0300)]
Update ChangeLog file (add gc-7.6.2 release date)

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Sun, 24 Dec 2017 07:36:55 +0000 (10:36 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Fri, 22 Dec 2017 16:30:29 +0000 (19:30 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

6 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Tue, 12 Dec 2017 14:54:03 +0000 (17:54 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(Cherry-pick commit e3fdda6 from 'release-7_4' branch.)

6 years agoUse dedicated no_sanitize_thread load/store instead of copy_before_cas
Ivan Maidanski [Thu, 21 Dec 2017 07:49:27 +0000 (10:49 +0300)]
Use dedicated no_sanitize_thread load/store instead of copy_before_cas
(fix commits 6ffda1db110b0dcc)

This is also a workaround for a TSan false positive reported
in AO_stack_pop_acquire.

* src/atomic_ops_stack.c (AO_copy_before_cas): Remove.
* src/atomic_ops_stack.c (store_before_cas): New static function (or
defined as a macro).
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (load_before_cas):
Likewiese.
* src/atomic_ops_stack.c (AO_stack_push_explicit_aux_release,
AO_stack_push_release): Use store_before_cas instead of
AO_copy_before_cas.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (load_before_cas):
Add volatile to addr argument if Clang.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (AO_stack_pop_acquire):
Use load_before_cas instead of AO_copy_before_cas.

6 years agoWorkaround TSan false positive in AO_stack_pop_explicit_aux_acquire
Ivan Maidanski [Wed, 20 Dec 2017 23:25:48 +0000 (02:25 +0300)]
Workaround TSan false positive in AO_stack_pop_explicit_aux_acquire
(fix commits c058d9d6ffda1db)

The TSan-related workaround in AO_malloc is no longer needed.

* src/atomic_ops_malloc.c [AO_THREAD_SANITIZER
&& AO_USE_ALMOST_LOCK_FREE] (AO_malloc): Do not use AO_store (always
use *result=log_sz); remove comment.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE
&& AO_THREAD_SANITIZER] (AO_load_next): New static function (with
AO_ATTR_NO_SANITIZE_THREAD attribute); add comments.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE
&& !AO_THREAD_SANITIZER] (AO_load_next): Define to AO_load.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_pop_explicit_aux_acquire): Replace AO_load(first_ptr) with
AO_load_next(first_ptr).

6 years agoTravis CI: Test DONT_USE_MMAP (Linux)
Ivan Maidanski [Wed, 20 Dec 2017 22:54:59 +0000 (01:54 +0300)]
Travis CI: Test DONT_USE_MMAP (Linux)

6 years agoTravis CI: Test AO_USE_ALMOST_LOCK_FREE in more configurations
Ivan Maidanski [Wed, 20 Dec 2017 22:46:27 +0000 (01:46 +0300)]
Travis CI: Test AO_USE_ALMOST_LOCK_FREE in more configurations
(fix commits e0411c61468661)

6 years agoTravis CI: Test with AO_STACK_PREFER_CAS_DOUBLE
Ivan Maidanski [Wed, 20 Dec 2017 22:04:31 +0000 (01:04 +0300)]
Travis CI: Test with AO_STACK_PREFER_CAS_DOUBLE

6 years agoTravis CI: Test malloc/stack with AO_USE_PTHREAD_DEFS
Ivan Maidanski [Wed, 20 Dec 2017 21:57:53 +0000 (00:57 +0300)]
Travis CI: Test malloc/stack with AO_USE_PTHREAD_DEFS

6 years agoNew macro to select stack implementation based on CAS-double
Ivan Maidanski [Wed, 20 Dec 2017 21:52:57 +0000 (00:52 +0300)]
New macro to select stack implementation based on CAS-double

The macro is AO_STACK_PREFER_CAS_DOUBLE.  This is only for testing.

* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE
&& AO_HAVE_compare_double_and_swap_double && AO_STACK_PREFER_CAS_DOUBLE
&& AO_HAVE_compare_and_swap_double] (AO_stack_pop_acquire,
AO_stack_pop_acquire): Use implementation based compare_and_swap_double
instead of compare_double_and_swap_double); remove #error directive.

6 years agoPrevent too long run of test_atomic_generalized (especially with TSan)
Ivan Maidanski [Wed, 20 Dec 2017 21:37:54 +0000 (00:37 +0300)]
Prevent too long run of test_atomic_generalized (especially with TSan)

* tests/test_atomic.c [AO_PREFER_GENERALIZED] (NITERS): Set to a smaller
value (the same one as for AO_USE_PTHREAD_DEFS).

6 years agoFill in allocated memory with values depending on thread id (test_malloc)
Ivan Maidanski [Wed, 20 Dec 2017 07:31:07 +0000 (10:31 +0300)]
Fill in allocated memory with values depending on thread id (test_malloc)

* tests/test_malloc.c (run_one_test): Define new local variables a, b
(with the values depending on arg); replace 'a' and 'b' with a and b,
respectively; reformat the code; return NULL instead of arg; remove
the comment (the workaround is no longer needed).

6 years agoEliminate GCC-5 ASan global-buffer-overflow false positive for AO_stack_bl
Ivan Maidanski [Wed, 20 Dec 2017 07:22:20 +0000 (10:22 +0300)]
Eliminate GCC-5 ASan global-buffer-overflow false positive for AO_stack_bl

* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Replace a->AO_stack_bl+i with
&a->AO_stack_bl[i] (including the case of i==0).

6 years agoMark unallocated/freed memory as inaccessible using ASan functionality
Ivan Maidanski [Wed, 20 Dec 2017 07:11:54 +0000 (10:11 +0300)]
Mark unallocated/freed memory as inaccessible using ASan functionality

Note: to disable it, AO_NO_MALLOC_POISON should be defined by client.

* src/atomic_ops_malloc.c [AO_ADDRESS_SANITIZER && !AO_NO_MALLOC_POISON]
(__asan_poison_memory_region, __asan_unpoison_memory_region): Prototype.
* src/atomic_ops_malloc.c (ASAN_POISON_MEMORY_REGION,
ASAN_UNPOISON_MEMORY_REGION): New macro.
* src/atomic_ops_malloc.c (add_chunk_as): Call
ASAN_POISON_MEMORY_REGION() for each pushed region.
* src/atomic_ops_malloc.c (AO_malloc): Call
ASAN_UNPOISON_MEMORY_REGION() for the returned memory region.
* src/atomic_ops_malloc.c (AO_free): Call ASAN_POISON_MEMORY_REGION()
before pushing the freed region to AO_free_list.

6 years agoTravis CI: Test AO_USE_ALMOST_LOCK_FREE macro also with ASan
Ivan Maidanski [Wed, 20 Dec 2017 07:00:28 +0000 (10:00 +0300)]
Travis CI: Test AO_USE_ALMOST_LOCK_FREE macro also with ASan
(fix commit e0411c6)

6 years agoTravis CI: Test with a custom AO_BL_SIZE value
Ivan Maidanski [Tue, 19 Dec 2017 22:22:19 +0000 (01:22 +0300)]
Travis CI: Test with a custom AO_BL_SIZE value

6 years agoDo not test CHUNK_SIZE allocation if no mmap() available (test_malloc)
Ivan Maidanski [Tue, 19 Dec 2017 09:05:01 +0000 (12:05 +0300)]
Do not test CHUNK_SIZE allocation if no mmap() available (test_malloc)
(fix commit 29d91db)

* tests/test_malloc.c (main): Do not call AO_malloc(CHUNK_SIZE) unless
HAVE_MMAP.

6 years agoTravis CI: Test AO_USE_ALMOST_LOCK_FREE macro (Linux/x64)
Ivan Maidanski [Tue, 19 Dec 2017 08:57:32 +0000 (11:57 +0300)]
Travis CI: Test AO_USE_ALMOST_LOCK_FREE macro (Linux/x64)

6 years agoAllow to select almost-non-blocking stack implementation explicitly
Ivan Maidanski [Tue, 19 Dec 2017 08:46:06 +0000 (11:46 +0300)]
Allow to select almost-non-blocking stack implementation explicitly

This could be used e.g. if built-in double-word CAS has some bug.

* src/atomic_ops_stack.h (AO_STACK_IS_LOCK_FREE): Do not define if
AO_USE_ALMOST_LOCK_FREE is explicitly defined (outside).

6 years agoFix typo in AO_REAL_NEXT_PTR comment (atomic_ops_stack.h)
Ivan Maidanski [Tue, 19 Dec 2017 08:26:10 +0000 (11:26 +0300)]
Fix typo in AO_REAL_NEXT_PTR comment (atomic_ops_stack.h)

* src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE] (AO_REAL_NEXT_PTR):
Fix typo ("either NULL") in the comment.

6 years agoNew macro (DONT_USE_MMAP) to support testing as if mmap() is unavailable
Ivan Maidanski [Tue, 19 Dec 2017 08:19:44 +0000 (11:19 +0300)]
New macro (DONT_USE_MMAP) to support testing as if mmap() is unavailable

* src/atomic_ops_malloc.c [DONT_USE_MMAP] (HAVE_MMAP): Undefine (after
including config.h).
* tests/test_malloc.c [DONT_USE_MMAP] (HAVE_MMAP): Likewise.

6 years agoUse double-word atomic intrinsics for recent Clang versions (gcc/x86.h)
Ivan Maidanski [Fri, 8 Dec 2017 17:02:48 +0000 (20:02 +0300)]
Use double-word atomic intrinsics for recent Clang versions (gcc/x86.h)

Older clang versions have some bugs or limitations that prevent from
using double-word built-in atomic operations.

Note: even as of clang-4.0, there seems to be a bug in some
double-word built-in operation if Thread Sanitizer is used.

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __APPLE_CC__ && __x86_64__]
(AO_SKIPATOMIC_double_compare_and_swap_ANY): Do not define if
AO_CLANG_PREREQ(9, 0); update comment.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__APPLE_CC__ && __clang__ && !__x86_64__
&& !AO_PREFER_BUILTIN_ATOMICS && !__CYGWIN__]
(AO_SKIPATOMIC_double_compare_and_swap_ANY,
AO_SKIPATOMIC_DOUBLE_LOAD_STORE_ANY): Do not define if
AO_CLANG_PREREQ(5, 0); update comment.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__APPLE_CC__ && __clang__ && __x86_64__ && !__ILP32__
&& AO_ADDRESS_SANITIZER] (AO_SKIPATOMIC_double_compare_and_swap_ANY
AO_SKIPATOMIC_DOUBLE_LOAD_STORE_ANY): Do not define if
AO_CLANG_PREREQ(4, 0); update comment.

6 years agoDo not define copy_before_cas() as inline
Ivan Maidanski [Fri, 8 Dec 2017 16:04:50 +0000 (19:04 +0300)]
Do not define copy_before_cas() as inline
(fix commit 6ffda1d)

* src/atomic_ops_stack.c (AO_copy_before_cas): Replace AO_INLINE with
static.

6 years agoSimplify '#if' expressions in gcc/x86.h
Ivan Maidanski [Fri, 8 Dec 2017 08:30:40 +0000 (11:30 +0300)]
Simplify '#if' expressions in gcc/x86.h
(code refactoring)

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET]
(AO_SKIPATOMIC_double_compare_and_swap_ANY, AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Simplify "#if" condition
expressions.

6 years agoDisable workaround in stack_pop_acquire that was needed for ancient Clang
Ivan Maidanski [Fri, 8 Dec 2017 06:58:05 +0000 (09:58 +0300)]
Disable workaround in stack_pop_acquire that was needed for ancient Clang

* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE
&& AO_HAVE_compare_double_and_swap_double && __clang__]
(AO_stack_pop_acquire): Do not declare cptr local variable as volatile
if AO_CLANG_PREREQ(3, 5).

6 years agoMinimize use of AO_ATTR_NO_SANITIZE_THREAD in atomic_ops_malloc/stack
Ivan Maidanski [Thu, 7 Dec 2017 08:14:46 +0000 (11:14 +0300)]
Minimize use of AO_ATTR_NO_SANITIZE_THREAD in atomic_ops_malloc/stack
(fix commit c058d9d)

* src/atomic_ops_malloc.c [AO_THREAD_SANITIZER] (AO_malloc):
Use AO_store() only if AO_USE_ALMOST_LOCK_FREE; add comment.
* src/atomic_ops_malloc.c (AO_free): Remove TSan workaround (do not
check AO_THREAD_SANITIZER macro).
* src/atomic_ops_stack.c (AO_copy_before_cas): New inline function.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Remove AO_ATTR_NO_SANITIZE_THREAD.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE
&& AO_HAVE_compare_double_and_swap_double] (AO_stack_push_release,
AO_stack_pop_acquire): Likewise.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Replace *x=next with
AO_copy_before_cas(x,&next).
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE]
(AO_stack_push_release): Likewise.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (AO_stack_pop_acquire):
Replace next=*cptr with AO_copy_before_cas(&next,cptr).
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE
&& AO_HAVE_compare_and_swap_double] (AO_stack_pop_acquire): Reformat
code.

6 years agoTravis CI: Test with a bigger number of threads (32)
Ivan Maidanski [Thu, 7 Dec 2017 07:06:19 +0000 (10:06 +0300)]
Travis CI: Test with a bigger number of threads (32)

6 years agoIncrease the default number of threads to 16 in test_malloc/stack
Ivan Maidanski [Wed, 6 Dec 2017 21:39:04 +0000 (00:39 +0300)]
Increase the default number of threads to 16 in test_malloc/stack

* tests/test_malloc.c [!DEFAULT_NTHREADS && HAVE_MMAP]
(DEFAULT_NTHREADS): Change the value from 10 to 16.
* tests/test_stack.c [!DEFAULT_NTHREADS] (DEFAULT_NTHREADS): Change
the value from 4 to 16.

6 years agoAllow to alter DEFAULT/MAX_NTHREADS values in test_malloc/stack
Ivan Maidanski [Wed, 6 Dec 2017 21:22:41 +0000 (00:22 +0300)]
Allow to alter DEFAULT/MAX_NTHREADS values in test_malloc/stack
(code refactoring)

* tests/run_parallel.h [!MAX_NTHREADS] (MAX_NTHREADS): Define (move
from test_malloc.c).
* tests/run_parallel.h [USE_PTHREADS || USE_VXTHREADS
|| USE_WINTHREADS] (run_parallel): Replace 100 with MAX_NTHREADS.
* tests/test_malloc.c (main): Add assertion that DEFAULT_NTHREADS
is not greater than MAX_NTHREADS.
* tests/test_stack.c (main): Likewise.
* tests/test_stack.c [!DEFAULT_NTHREADS] (DEFAULT_NTHREADS): Define
(to 4).
* tests/test_stack.c (main): Use DEFAULT_NTHREADS (instead of 4).

6 years agoFix test_stack failure if AO_PREFER_BUILTIN_ATOMICS (GCC/Aarch64)
Ivan Maidanski [Wed, 6 Dec 2017 21:00:18 +0000 (00:00 +0300)]
Fix test_stack failure if AO_PREFER_BUILTIN_ATOMICS (GCC/Aarch64)

As of gcc-5.4/aarch64, not all of the built-in double-word atomics
are implemented correctly.

* src/atomic_ops/sysdeps/gcc/aarch64.h [!__clang__
|| AO_AARCH64_ASM_LOAD_STORE_CAS] (AO_double_load,
AO_double_load_acquire, AO_double_store, AO_double_store_release,
AO_double_compare_and_swap, AO_double_compare_and_swap_acquire,
AO_double_compare_and_swap_release, AO_double_compare_and_swap_full):
Define (asm-based implementation) even if AO_PREFER_BUILTIN_ATOMICS
or AO_THREAD_SANITIZER; update comment.

6 years agoFix test failures for Clang-3.8 and older (Aarch64)
Ivan Maidanski [Wed, 6 Dec 2017 08:42:35 +0000 (11:42 +0300)]
Fix test failures for Clang-3.8 and older (Aarch64)

For older Clang/aarch64 releases, double-wide atomics are no longer
supported.

* src/atomic_ops/sysdeps/gcc/aarch64.h [__clang__
&& !AO_CLANG_PREREQ(3, 9)]: Do not include standard_ao_double_t.h file;
add comment.
* src/atomic_ops/sysdeps/gcc/aarch64.h [__clang__
&& !AO_CLANG_PREREQ(3, 8)] (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire): Do not define and do not undefine
(since generic.h is included only for GCC and for Clang v3.9+).
* src/atomic_ops/sysdeps/gcc/aarch64.h [AO_AARCH64_ASM_LOAD_STORE_CAS]
(AO_double_load, AO_double_load_acquire, AO_double_store,
AO_double_store_release, AO_double_compare_and_swap,
AO_double_compare_and_swap_acquire, AO_double_compare_and_swap_release,
AO_double_compare_and_swap_full): Do not define if __clang__
&& !AO_CLANG_PREREQ(3, 9).
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_HAVE_double_SYNC_CAS):
Likewise.

6 years agoUse generalized double-wide load/store if AO_PREFER_GENERALIZED (Aarch64)
Ivan Maidanski [Wed, 6 Dec 2017 08:17:49 +0000 (11:17 +0300)]
Use generalized double-wide load/store if AO_PREFER_GENERALIZED (Aarch64)

* src/atomic_ops/sysdeps/gcc/aarch64.h [!__clang__
|| AO_AARCH64_ASM_LOAD_STORE_CAS] (AO_double_load,
AO_double_load_acquire, AO_double_store, AO_double_store_release):
Do not define (using asm) if AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_HAVE_double_SYNC_CAS):
Define also for GCC; update comment.

6 years agoDefine double-word CAS for all clang/aarch64 versions
Ivan Maidanski [Wed, 6 Dec 2017 08:05:38 +0000 (11:05 +0300)]
Define double-word CAS for all clang/aarch64 versions
(fix commit 46d43dc)

* src/atomic_ops/sysdeps/gcc/aarch64.h [__clang__]
(AO_GCC_HAVE_double_SYNC_CAS): Define for all Clang versions.

6 years agoDo not expose AO_GCC_FORCE_HAVE_CAS macro to client code
Ivan Maidanski [Tue, 5 Dec 2017 21:28:33 +0000 (00:28 +0300)]
Do not expose AO_GCC_FORCE_HAVE_CAS macro to client code
(code refactoring)

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_FORCE_HAVE_CAS,
AO_GCC_HAVE_double_SYNC_CAS): Undefine at the end of file.
* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_GCC_FORCE_HAVE_CAS,
AO_GCC_HAVE_double_SYNC_CAS): Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_GCC_FORCE_HAVE_CAS): Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_GCC_FORCE_HAVE_CAS): Likewise.

6 years agoUse built-in atomics for load/store/CAS for Clang by default (Aarch64)
Ivan Maidanski [Tue, 5 Dec 2017 09:03:51 +0000 (12:03 +0300)]
Use built-in atomics for load/store/CAS for Clang by default (Aarch64)

* src/atomic_ops/sysdeps/gcc/aarch64.h [!AO_PREFER_BUILTIN_ATOMICS]
(AO_double_load, AO_double_load_acquire, AO_double_store,
AO_double_store_release, AO_double_compare_and_swap,
AO_double_compare_and_swap_acquire, AO_double_compare_and_swap_release,
AO_double_compare_and_swap_full): Do not define (using asm) if
AO_THREAD_SANITIZER or if Clang (unless AO_AARCH64_ASM_LOAD_STORE_CAS).

6 years agoDo not disallow to define double_load using built-in atomics (Aarch64)
Ivan Maidanski [Tue, 5 Dec 2017 08:27:47 +0000 (11:27 +0300)]
Do not disallow to define double_load using built-in atomics (Aarch64)
(fix commit 03a0465)

Clang 3.8 (and later) and GCC have the correct implementation of
double-word atomic load (containing STXP instruction) for Aarch64.

* src/atomic_ops/sysdeps/gcc/aarch64.h [AO_PREFER_BUILTIN_ATOMICS]
(AO_SKIPATOMIC_double_load, AO_SKIPATOMIC_double_load_acquire): Do not
define for GCC and if AO_CLANG_PREREQ(3, 8).

6 years agoUse GCC built-in atomic to define nop_write in case of TSan (Aarch64)
Ivan Maidanski [Tue, 5 Dec 2017 07:51:45 +0000 (10:51 +0300)]
Use GCC built-in atomic to define nop_write in case of TSan (Aarch64)

* src/atomic_ops/sysdeps/gcc/aarch64.h [!AO_PREFER_BUILTIN_ATOMICS
&& !AO_UNIPROCESSOR] (AO_nop_write): Do not define (using asm DMB)
if AO_THREAD_SANITIZER; update comment.

6 years agoDo not define AO_GCC_FORCE_HAVE_CAS for Clang 3.8+ (Aarch64)
Ivan Maidanski [Tue, 5 Dec 2017 07:41:39 +0000 (10:41 +0300)]
Do not define AO_GCC_FORCE_HAVE_CAS for Clang 3.8+ (Aarch64)
(fix commit 83fca68)

Clang now defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros (so,
the workaround is not needed anymore).

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_FORCE_HAVE_CAS,
AO_GCC_HAVE_double_SYNC_CAS): Do not define if AO_CLANG_PREREQ(3, 8)
(unless __APPLE_CC__).