platform/upstream/libatomic_ops.git
5 years agoBump libatomic_ops version to 7.6.6 upstream/7.6.6 v7.6.6
Ivan Maidanski [Tue, 7 Aug 2018 06:44:36 +0000 (09:44 +0300)]
Bump libatomic_ops version to 7.6.6

* ChangeLog (7.6.6): Add release date.
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* src/atomic_ops/ao_version.h (AO_VERSION_MICRO): Likewise.

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 agoTravis CI: Upgrade clang-4.0 to clang-5.0, and gcc-5 to gcc-8
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-8
(cherry-pick of commits c475050, bc42d68 from 'master')

5 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

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 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
(cherry-pick of commit d2864b5 from 'master')

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.

5 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.

5 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 agoBump libatomic_ops version to 7.6.4 v7.6.4
Ivan Maidanski [Tue, 27 Mar 2018 08:09:47 +0000 (11:09 +0300)]
Bump libatomic_ops version to 7.6.4

* ChangeLog (7.6.4): Add release date.
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* src/atomic_ops/ao_version.h (AO_VERSION_MICRO): Likewise.

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 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 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
(back-port of commit a05abf6 from 'master')

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 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
(back-port of commit f40ed03 from 'master')

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 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 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 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 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 ago[7.6.2] v7.6.2
Ivan Maidanski [Sun, 24 Dec 2017 07:52:13 +0000 (10:52 +0300)]
[7.6.2]

Bump libatomic_ops version to 7.6.2

* ChangeLog (7.6.2): Add release date.
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* src/atomic_ops/ao_version.h (AO_VERSION_MICRO): Likewise.
* appveyor.yml (version): Change "7.6.0" to "7.6.x".
* 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 (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 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 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 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 agoTravis CI: Test AO_USE_ALMOST_LOCK_FREE macro
Ivan Maidanski [Tue, 19 Dec 2017 08:57:32 +0000 (11:57 +0300)]
Travis CI: Test AO_USE_ALMOST_LOCK_FREE macro
(Cherry-pick commits e0411c6, 1468661, f15ac85 from 'master' branch.)

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 agoTravis CI: Test mmap-based atomic_ops_malloc with CSA
Ivan Maidanski [Mon, 4 Dec 2017 21:11:27 +0000 (00:11 +0300)]
Travis CI: Test mmap-based atomic_ops_malloc with CSA

6 years agoTravis CI: Test with ASan and -D USE_STANDARD_MALLOC
Ivan Maidanski [Sun, 3 Dec 2017 07:28:23 +0000 (10:28 +0300)]
Travis CI: Test with ASan and -D USE_STANDARD_MALLOC

Test that no memory leak exists in test_malloc.

6 years agoTravis CI: Test with ASan and -march=native with Clang-4.0 (Linux/x64)
Ivan Maidanski [Fri, 1 Dec 2017 17:21:43 +0000 (20:21 +0300)]
Travis CI: Test with ASan and -march=native with Clang-4.0 (Linux/x64)

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
(Cherry-pick commits c058d9d, 110b0dc, 3aefd4e, 441415c from 'master'.)

* src/atomic_ops_malloc.c (AO_malloc, AO_free): Remove TSan workaround
(do not check AO_THREAD_SANITIZER macro).
* 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_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_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).
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Replace *x=next with
store_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 load_before_cas((AO_t*)cptr).
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE
&& AO_HAVE_compare_and_swap_double] (AO_stack_pop_acquire): Reformat
code.

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 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 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 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 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 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)
(Cherry-pick commits 83fca68, baa9851 from 'master' branch.)

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):
Do not define if AO_CLANG_PREREQ(3, 8) (unless __APPLE_CC__).

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 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 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 agoUse __builtin_expect in atomic_ops_malloc
Ivan Maidanski [Mon, 4 Dec 2017 21:21:04 +0000 (00:21 +0300)]
Use __builtin_expect in atomic_ops_malloc

* src/atomic_ops_malloc.c [HAVE_MMAP] (get_mmaped, SIZET_SAT_ADD,
AO_malloc_large): Use AO_EXPECT_FALSE.
* src/atomic_ops_malloc.c (get_chunk, msb, AO_malloc, AO_free):
Likewise.
* src/atomic_ops_malloc.c (AO_malloc_large): Reformat code.

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 agoTest smallest allocation of large type (test_malloc)
Ivan Maidanski [Mon, 4 Dec 2017 21:08:40 +0000 (00:08 +0300)]
Test smallest allocation of large type (test_malloc)
(Cherry-pick commits 29d91db, 937b173 from 'master' branch.)

* src/atomic_ops_malloc.c (AO_malloc_large): Add assertion that the
stored size is greater than LOG_MAX_SIZE.
* src/atomic_ops_malloc.c (AO_malloc): Add assertions for log_size.
* tests/test_malloc.c (LOG_MAX_SIZE, CHUNK_SIZE): New macro (copied
from atomic_ops_malloc.c).
* tests/test_malloc.c (main): Call AO_free(0), AO_malloc(0); add comment.
* tests/test_malloc.c [HAVE_MMAP] (main): Call
AO_malloc(CHUNK_SIZE-sizeof(AO_t)+1).

6 years agoAnnotate AO_malloc with 'alloc_size' and 'malloc' attributes
Ivan Maidanski [Fri, 1 Dec 2017 17:32:34 +0000 (20:32 +0300)]
Annotate AO_malloc with 'alloc_size' and 'malloc' attributes

* src/atomic_ops_malloc.h [!AO_ATTR_MALLOC] (AO_ATTR_MALLOC): New macro.
* src/atomic_ops_malloc.h [!AO_ATTR_ALLOC_SIZE] (AO_ATTR_ALLOC_SIZE):
Likewise.
* src/atomic_ops_malloc.h (AO_malloc): Add AO_ATTR_MALLOC,
AO_ATTR_ALLOC_SIZE attributes.

6 years agoFix AO_malloc for sizes near CHUNK_SIZE
Ivan Maidanski [Mon, 4 Dec 2017 20:28:01 +0000 (23:28 +0300)]
Fix AO_malloc for sizes near CHUNK_SIZE

Without this patch, e.g an object of CHUNK_SIZE is treated as non-large
in AO_malloc but freed by AO_free_large (incorrectly).

* src/atomic_ops_malloc.c (AO_malloc): Call AO_malloc_large() also for
size values in range CHUNK_SIZE-sizeof(AO_t)+1 .. CHUNK_SIZE.

6 years agoFix memory leak in test_malloc
Ivan Maidanski [Sun, 3 Dec 2017 07:14:33 +0000 (10:14 +0300)]
Fix memory leak in test_malloc

* tests/test_malloc.c (free_list): New function definition.
* tests/test_malloc.c (run_one_test): Call free_list(x) on return.

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 1 Dec 2017 17:00:15 +0000 (20:00 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoTravis CI: Test with TSan when a 16-byte CAS is available
Ivan Maidanski [Tue, 28 Nov 2017 08:12:04 +0000 (11:12 +0300)]
Travis CI: Test with TSan when a 16-byte CAS is available

6 years agoTravis CI: Test also with GCC with ASan enabled
Ivan Maidanski [Mon, 20 Nov 2017 07:53:34 +0000 (10:53 +0300)]
Travis CI: Test also with GCC with ASan enabled
(Cherry-pick commits cb7cab3, 30d68cc, 40a49c9 from 'master' branch.)

6 years agoDefine AO_TS_SET to true (1) if GCC atomic_test_and_set is used
Ivan Maidanski [Tue, 28 Nov 2017 19:11:15 +0000 (22:11 +0300)]
Define AO_TS_SET to true (1) if GCC atomic_test_and_set is used
(fix commit 3315a03)

According to GCC manual about the built-in functions for memory model
aware atomic operations, __atomic_test_and_set returns bool value;
bool true is encoded as 1.

* src/atomic_ops/sysdeps/test_and_set_t_is_char.h [AO_PREFER_GENERALIZED
|| !__GCC_ATOMIC_TEST_AND_SET_TRUEVAL] (AO_TS_SET_TRUEVAL): Define to 1
(instead of 0xff).

6 years agoDo not use asm-based 16-byte CAS if compiled with TSan (Linux/x64)
Ivan Maidanski [Tue, 28 Nov 2017 08:28:32 +0000 (11:28 +0300)]
Do not use asm-based 16-byte CAS if compiled with TSan (Linux/x64)
(fix commit c058d9d)

Thread Sanitizer does not know the semantic of the asm synchronization
instructions.

* src/atomic_ops/sysdeps/gcc/x86.h [x86_64 && !ILP32
&& __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 && AO_THREAD_SANITIZER]
(AO_compare_double_and_swap_double_full): Do not define.

6 years agoEliminate data race in cons() of test_malloc
Ivan Maidanski [Tue, 28 Nov 2017 08:06:36 +0000 (11:06 +0300)]
Eliminate data race in cons() of test_malloc
(fix commit c058d9d)

The data race has not affected the functionality of the test but this
commit allows to avoid no_sanitize attribute for the function.

* tests/test_malloc.c (cons): Remove AO_ATTR_NO_SANITIZE_THREAD
attribute; Do not reset extra (use "%" operator to get my_extra value).
* tests/test_malloc.c [AO_HAVE_fetch_and_add1] (cons): Change type of
extra to AO_t, add volatile qualifier; use AO_fetch_and_add1 instead of
"++" operator to update extra.

6 years agoFix 'unknown attribute no_sanitize' compiler warning for GCC
Ivan Maidanski [Mon, 20 Nov 2017 06:56:25 +0000 (09:56 +0300)]
Fix 'unknown attribute no_sanitize' compiler warning for GCC
(fix commits 9020c5db6a3eee47c058d9dc637f7fe1)

* src/atomic_ops.h [!__has_feature && __SANITIZE_ADDRESS__]
(AO_ADDRESS_SANITIZER): Define.
* src/atomic_ops.h [!AO_ATTR_NO_SANITIZE_MEMORY && AO_MEMORY_SANITIZER
&& !AO_CLANG_PREREQ(3,8)] (AO_ATTR_NO_SANITIZE_MEMORY): Define to
__attribute__((no_sanitize_memory)).
* src/atomic_ops.h [!AO_ATTR_NO_SANITIZE_THREAD && AO_THREAD_SANITIZER
&& !AO_CLANG_PREREQ(3,8)] (AO_ATTR_NO_SANITIZE_THREAD): Define to
__attribute__((no_sanitize_thread)).

6 years agoPlace no_sanitize attributes in a GCC-compliant way
Ivan Maidanski [Sun, 19 Nov 2017 07:41:30 +0000 (10:41 +0300)]
Place no_sanitize attributes in a GCC-compliant way
(fix commits 9020c5dbc058d9dc)

Now the attributes precede the function prototypes (the format is:
<attribute> void f(void) <body>).

* src/atomic_ops/generalize-arithm.template
(AO_XSIZE_fetch_and_add_full, AO_XSIZE_fetch_and_add_acquire,
AO_XSIZE_fetch_and_add_release, AO_XSIZE_fetch_and_add,
AO_XSIZE_and_full, AO_XSIZE_or_full, AO_XSIZE_xor_full): Move
AO_ATTR_NO_SANITIZE_THREAD attribute to the beginning of the function
prototype (to be right before AO_INLINE).
* src/atomic_ops/generalize-small.template (AO_XSIZE_load_read,
AO_XSIZE_load_full, AO_XSIZE_load_acquire, AO_XSIZE_load,
AO_XSIZE_store_write, AO_XSIZE_store, AO_XSIZE_store_release,
AO_XSIZE_store_full): Likewise.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Likewise.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE]
(AO_stack_push_release, AO_stack_pop_acquire): Likewise.
* tests/test_atomic.c [AO_HAVE_test_and_set_acquire] (do_junk):
Likewise.
* tests/test_malloc.c (cons): Likewise.
* src/atomic_ops/generalize-small.template (AO_XSIZE_store_write,
AO_XSIZE_store, AO_XSIZE_store_release, AO_XSIZE_store_full): Move
AO_ATTR_NO_SANITIZE_MEMORY attribute to the beginning of the function
prototype.
* src/atomic_ops/generalize-arithm.h: Regenerate.
* src/atomic_ops/generalize-small.h: Likewise.

6 years agoUpdate ChangeLog file (set v7.4.8 release date)
Ivan Maidanski [Thu, 26 Oct 2017 07:17:12 +0000 (10:17 +0300)]
Update ChangeLog file (set v7.4.8 release date)

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 13 Oct 2017 16:31:34 +0000 (19:31 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoTravis CI: Test also 32-bit builds with --disable-atomic-intrinsics
Ivan Maidanski [Thu, 5 Oct 2017 22:59:55 +0000 (01:59 +0300)]
Travis CI: Test also 32-bit builds with --disable-atomic-intrinsics

6 years agoTravis CI: Test also 32-bit code with ASan (on OS X)
Ivan Maidanski [Thu, 5 Oct 2017 22:52:08 +0000 (01:52 +0300)]
Travis CI: Test also 32-bit code with ASan (on OS X)

6 years agoTravis CI: Test AO_GENERALIZE_ASM_BOOL_CAS, AO_USE_NANOSLEEP/NO_SIGNALS
Ivan Maidanski [Thu, 5 Oct 2017 22:48:28 +0000 (01:48 +0300)]
Travis CI: Test AO_GENERALIZE_ASM_BOOL_CAS, AO_USE_NANOSLEEP/NO_SIGNALS

6 years agoTravis CI: Test also with Leak Sanitizer (LSan)
Ivan Maidanski [Thu, 5 Oct 2017 22:39:01 +0000 (01:39 +0300)]
Travis CI: Test also with Leak Sanitizer (LSan)

6 years agoTravis CI: Add a test build with Thread sanitizer (TSan)
Ivan Maidanski [Thu, 21 Sep 2017 22:06:22 +0000 (01:06 +0300)]
Travis CI: Add a test build with Thread sanitizer (TSan)

6 years agoWorkaround TSan false positive warnings in stack_pop assertions
Ivan Maidanski [Thu, 5 Oct 2017 22:16:40 +0000 (01:16 +0300)]
Workaround TSan false positive warnings in stack_pop assertions

* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_pop_explicit_aux_acquire): Skip
assert(a->AO_stack_bl[i]==first) and assert(*list!=first)
if AO_THREAD_SANITIZER; add comment.

6 years agoWorkaround Thread Sanitizer (TSan) false positive warnings
Ivan Maidanski [Thu, 21 Sep 2017 08:36:30 +0000 (11:36 +0300)]
Workaround Thread Sanitizer (TSan) false positive warnings

* src/atomic_ops.h [__has_feature && __has_feature(thread_sanitizer)]
(AO_THREAD_SANITIZER): New internal macro.
* src/atomic_ops.h [!AO_ATTR_NO_SANITIZE_THREAD]
(AO_ATTR_NO_SANITIZE_THREAD): Likewise.
* src/atomic_ops/generalize-arithm.h: Regenerate.
* src/atomic_ops/generalize-small.h: Likewise.
* src/atomic_ops/generalize-arithm.template
(AO_XSIZE_fetch_and_add_full, AO_XSIZE_fetch_and_add_acquire,
AO_XSIZE_fetch_and_add_release, AO_XSIZE_fetch_and_add,
AO_XSIZE_and_full, AO_XSIZE_or_full, AO_XSIZE_xor_full): Add
AO_ATTR_NO_SANITIZE_THREAD attribute.
* src/atomic_ops/generalize-small.template (AO_XSIZE_load_read,
AO_XSIZE_load_full, AO_XSIZE_load_acquire, AO_XSIZE_load,
AO_XSIZE_store_write, AO_XSIZE_store, AO_XSIZE_store_release,
AO_XSIZE_store_full: Likewise.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Likewise.
* src/atomic_ops_stack.c [AO_HAVE_compare_double_and_swap_double]
(AO_stack_push_release, AO_stack_pop_acquire): Likewise.
* tests/test_malloc.c (cons): Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __clang__ && __x86_64__ && !__ILP32__ && AO_THREAD_SANITIZER]
(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): Define; update comment.
* src/atomic_ops_malloc.c [AO_THREAD_SANITIZER] (AO_malloc, AO_free):
Use AO_store/load to write/read log_sz value in object header.
* tests/test_atomic.c (do_junk): New function (declared with
AO_ATTR_NO_SANITIZE_THREAD attribute); multiply junk value by two
different constant values.
* tests/test_atomic.c (test_and_set_thr): Call do_junk() instead of
operating on junk global variable directly.

6 years agoEliminate '-pedantic is not option that controls warnings' GCC-6.4 message
Ivan Maidanski [Wed, 27 Sep 2017 08:50:11 +0000 (11:50 +0300)]
Eliminate '-pedantic is not option that controls warnings' GCC-6.4 message
(fix commits 7633154, 7fad46e)

Issue #27 (libatomic_ops).

* src/atomic_ops/sysdeps/standard_ao_double_t.h
[(__x86_64__ && AO_GCC_ATOMIC_TEST_AND_SET || __aarch64__)
&& !__ILP32__ && AO_GNUC_PREREQ(4, 7)] (pragma GCC diagnostic):
Use "-Wpedantic" (instead of "-pedantic") if GCC v6.4+.

6 years agoFix 'bad register name %sil' assembler error (GCC-4.4/x86)
Ivan Maidanski [Thu, 5 Oct 2017 08:40:31 +0000 (11:40 +0300)]
Fix 'bad register name %sil' assembler error (GCC-4.4/x86)
(fix commit 7708b76)

* src/atomic_ops/sysdeps/gcc/x86.h [!AO_USE_SYNC_CAS_BUILTIN]
(AO_char_fetch_compare_and_swap_full): Replace "r"(new_val) to
"q"(new_val) in __asm__("cmpxchgb").

6 years agoTravis CI: Fix builds for avr32, cris, sh4, tilegx after OS image update
Ivan Maidanski [Thu, 21 Sep 2017 21:19:27 +0000 (00:19 +0300)]
Travis CI: Fix builds for avr32, cris, sh4, tilegx after OS image update

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Wed, 20 Sep 2017 21:35:15 +0000 (00:35 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoUpdate ChangeLog file (v7.4 changes only)
Ivan Maidanski [Wed, 20 Sep 2017 08:31:29 +0000 (11:31 +0300)]
Update ChangeLog file (v7.4 changes only)
(Cherry-pick commit 1b48276 from 'release-7_4' branch.)

6 years agoTravis CI: Test configure --disable-docs
Ivan Maidanski [Thu, 3 Aug 2017 21:34:31 +0000 (00:34 +0300)]
Travis CI: Test configure --disable-docs

6 years agoDo not install documentation if configure --disable-docs (new option)
Ivan Maidanski [Thu, 3 Aug 2017 21:18:34 +0000 (00:18 +0300)]
Do not install documentation if configure --disable-docs (new option)

Issue #28 (libatomic_ops).

* Makefile.am (dist_doc_DATA): Define only if ENABLE_DOCS.
* doc/Makefile.am (dist_doc_DATA): Likewise.
* configure.ac (docs): New AC_ARG_ENABLE.
* configure.ac (ENABLE_DOCS): New AM_CONDITIONAL.

6 years agoEliminate '-pedantic is not an option that controls warnings' GCC message
Ivan Maidanski [Mon, 31 Jul 2017 06:41:23 +0000 (09:41 +0300)]
Eliminate '-pedantic is not an option that controls warnings' GCC message
(fix commit 7633154)

Issue #27 (libatomic_ops).

* src/atomic_ops/sysdeps/standard_ao_double_t.h
[(__x86_64__ && AO_GCC_ATOMIC_TEST_AND_SET || __aarch64__)
&& !__ILP32__ && AO_GNUC_PREREQ(4, 7)] (pragma GCC diagnostic):
Use "-Wpedantic" (instead of "-pedantic") if GCC v7+.

6 years agoWorkaround 'unused result' code defects in list_atomic.template
Ivan Maidanski [Mon, 24 Jul 2017 09:56:47 +0000 (12:56 +0300)]
Workaround 'unused result' code defects in list_atomic.template

* tests/list_atomic.template: Include stdlib.h (needed for exit()
prototype).
* tests/list_atomic.template [AO_HAVE_XSIZE_loadXX]
(XSIZE_list_atomicXX): Cast AO_XSIZE_loadXX() result to void.
* tests/list_atomic.template [AO_HAVE_XSIZE_fetch_and_addXX]: Cast
AO_XSIZE_fetch_and_addXX() result to void.
* tests/list_atomic.template [AO_HAVE_XSIZE_fetch_and_add1XX]
(XSIZE_list_atomicXX): Cast AO_XSIZE_fetch_and_add1XX() result to void.
* tests/list_atomic.template [AO_HAVE_XSIZE_fetch_and_sub1XX]
(XSIZE_list_atomicXX): Cast AO_XSIZE_fetch_and_sub1XX() result to void.
* tests/list_atomic.template [AO_HAVE_test_and_setXX]
(XSIZE_list_atomicXX): Cast AO_test_and_setXX() result to void.
* tests/list_atomic.template [AO_HAVE_XSIZE_compare_and_swapXX]
(XSIZE_list_atomicXX): Call exit(1) if AO_XSIZE_compare_and_swapXX
failed.
* tests/list_atomic.template [AO_HAVE_XSIZE_fetch_compare_and_swapXX]
(XSIZE_list_atomicXX): Call exit(1) if AO_XSIZE_fetch_compare_and_swapXX
failed.

6 years agoWorkaround 'unused result' code defect in atomic_ops.c
Ivan Maidanski [Mon, 24 Jul 2017 09:28:42 +0000 (12:28 +0300)]
Workaround 'unused result' code defect in atomic_ops.c

* src/atomic_ops.c [!AO_USE_NANOSLEEP && !AO_USE_WIN32_PTHREADS]
(AO_pause): Cast select() result to void.

6 years agoUpdate AUTHORS file (add Mikael Urankar)
Ivan Maidanski [Tue, 20 Jun 2017 09:23:15 +0000 (12:23 +0300)]
Update AUTHORS file (add Mikael Urankar)

6 years agoWorkaround misspelling in GCC to detect ARMv6KZ platform
Mikael Urankar [Mon, 19 Jun 2017 08:13:14 +0000 (10:13 +0200)]
Workaround misspelling in GCC to detect ARMv6KZ platform

Issue #26 (libatomic_ops).

Due to a misspelling in GCC, the check for the ARMv6KZ platform
uses ARM_ARCH_6ZK macro instead of ARM_ARCH_6KZ.

* src/atomic_ops/sysdeps/gcc/arm.h (AO_ARM_HAVE_DMB): Do not define
if __ARM_ARCH_6KZ__.

6 years agoAdd bdwgc mailing list online archive link to README
Ivan Maidanski [Thu, 15 Jun 2017 22:14:13 +0000 (01:14 +0300)]
Add bdwgc mailing list online archive link to README

* README.md (Feedback, Contribution, Questions and Notifications):
Update information about accessing the mailing list archive (add link
to that at Narkive site).

6 years agoUse GCC atomic intrinsics for Hexagon (clang 3.9+)
Ivan Maidanski [Fri, 9 Jun 2017 07:59:55 +0000 (10:59 +0300)]
Use GCC atomic intrinsics for Hexagon (clang 3.9+)

* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS] (AO_GCC_FORCE_HAVE_CAS,
AO_GCC_HAVE_double_SYNC_CAS): Define.
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS]: Include standard_ao_double_t.h, generic.h.
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS]: Do not include test_and_set_t_is_ao_t.h,
all_aligned_atomic_load_store.h.
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS]: Do not define AO_nop_full,
AO_fetch_and_add, AO_test_and_set, AO_compare_and_swap,
AO_fetch_compare_and_swap, AO_T_IS_INT.