| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
* src/atomic_ops/sysdeps/gcc/tile.h: Move comment that the support is
minimal to AO_DISABLE_GCC_ATOMICS part of code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(fix of commit cbbf8633)
According to the GCC manual, __atomic_test_and_set() result type is
Bool, thus it is not guaranteed to return AO_TS_SET value. (E.g., the
function may return 1 while AO_TS_SET is 255, as observed on sparc64
with gcc-12.)
* src/atomic_ops/sysdeps/gcc/generic.h [!AO_PREFER_GENERALIZED]
(AO_test_and_set, AO_test_and_set_acquire, AO_test_and_set_release,
AO_test_and_set_full): Return AO_TS_SET if __atomic_test_and_set()
result is non-zero, AO_TS_CLEAR otherwise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The GPL terms are copied from COPYING file.
* src/atomic_ops_malloc.c: Refine GPL copyright text in the header
comment by copying it as-is from COPYING file (as recommended in
"Apply These Terms to Your New Programs" section).
* src/atomic_ops_stack.c: Likewise.
* tests/list_atomic.template: Likewise.
* tests/run_parallel.h: Likewise.
* tests/test_atomic.c: Likewise.
* tests/test_atomic_include.template: Likewise.
* tests/test_malloc.c: Likewise.
* tests/test_stack.c: Likewise.
* tests/test_atomic_include.h: Regenerate.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(reformatting)
* LICENSE: Remove an extra space after comma in MIT-like license.
* configure.ac: Remove an extra space after comma in license header
comment.
* src/atomic_ops/sysdeps/armcc/arm_v6.h: Likewise.
* src/atomic_ops/sysdeps/gcc/aarch64.h: Likewise.
* src/atomic_ops/sysdeps/gcc/alpha.h: Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h: Likewise.
* src/atomic_ops/sysdeps/gcc/hexagon.h: Likewise.
* src/atomic_ops/sysdeps/gcc/m68k.h: Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h: Likewise.
* src/atomic_ops/sysdeps/gcc/powerpc.h: Likewise.
* src/atomic_ops/sysdeps/gcc/riscv.h: Likewise.
* src/atomic_ops/sysdeps/gcc/s390.h: Likewise.
* src/atomic_ops/sysdeps/gcc/sh.h: Likewise.
* src/atomic_ops/sysdeps/gcc/sparc.h: Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h: Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h: Likewise.
|
|
|
|
|
| |
* src/atomic_ops.c [__CYGWIN__ && !AO_USE_NO_SIGNALS && !_GNU_SOURCE]
(_GNU_SOURCE): Define macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issue #45 (libatomic_ops).
Enforce proper alignment of AO_stack_t.AO_pa to avoid the structure
value to cross the CPU cache line boundary. A workaround for
almost-lock-free push/pop test failures on aarch64, at least.
* src/atomic_ops_stack.h [!AO_STACK_ATTR_ALLIGNED]
(AO_STACK_ATTR_ALLIGNED): Define.
* src/atomic_ops_stack.h (AO_stack_t.AO_pa): Add AO_STACK_ATTR_ALLIGNED
attribute.
|
|
|
|
|
|
|
|
|
|
|
| |
Also, execute the first read in a loop with an acquire barrier, and
place black list checking as close to CAS as possible.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Use acquire barrier to read list
value (stored to next local variable); read list value and store it to
x element before iterating over AO_stack_bl (and, thus, retry iterating
over AO_stack_bl if CAS failed).
|
|
|
|
|
|
| |
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_pop_explicit_aux_acquire): Remove assertion about i; replace
"First" to "first" in comment.
|
| |
|
|
|
|
|
|
|
| |
(fix of commit cfd0593f3)
* tests/test_stack.c (output_stat): Do not declare exper_n local
variable if NO_TIMES; move exper_n to the inner scope.
|
|
|
|
|
|
|
|
|
|
| |
(refactoring)
* tests/test_stack.c (run_one_experiment, run_all_experiments,
output_stat): New functions (move relevant code from main).
* tests/test_stack.c (main): Call run_all_experiments and output_stat.
* tests/test_stack.c (run_one_experiment): Add assertion that the_list
is empty before add_elements() call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(fix of commit d29c0910d)
* src/atomic_ops_stack.c (AO_real_head_ptr): Rename to
AO_stack_head_ptr.
* src/atomic_ops_stack.h (AO_real_head_ptr): Likewise.
* src/atomic_ops_stack.c (AO_real_next_ptr): Rename to
AO_stack_next_ptr.
* src/atomic_ops_stack.h (AO_real_next_ptr): Likewise.
* src/atomic_ops_stack.h [!AO_REAL_PTR_AS_MACRO] (AO_REAL_NEXT_PTR,
AO_REAL_HEAD_PTR): Rename AO_real_head_ptr and AO_real_next_ptr to
AO_stack_head_ptr and AO_stack_next_ptr, respectively.
|
|
|
|
|
|
|
|
|
|
| |
* README_stack.txt: Document AO_stack_is_lock_free; update
documentation about AO_STACK_IS_LOCK_FREE.
* src/atomic_ops_stack.c (AO_stack_is_lock_free): Implement.
* src/atomic_ops_stack.h (AO_stack_is_lock_free): New API function
declaration.
* tests/test_stack.c (main): Use !AO_stack_is_lock_free() instead of
AO_USE_ALMOST_LOCK_FREE.
|
|
|
|
|
|
|
| |
(fix of commit 037938630)
* tests/test_stack.c [CPPCHECK] (add_elements): Set le->e.next to 0
before AO_stack_push() call; add comment.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/test_stack.c (struct le): Add comment.
* tests/test_stack.c (list_element): Define as union of AO_t and le.
* tests/test_stack.c (add_elements): Update access to le caused by
list_element type change; do not cast le to AO_t*.
* tests/test_stack.c [VERBOSE_STACK] (print_list): Change type of p
local variable from list_element* to AO_t*; update access to le caused
by list_element type change.
* tests/test_stack.c (check_list): Likewise.
* tests/test_stack.c (run_one_test): Change type of t[] and le local
variables from list_element* to AO_t*.
|
|
|
|
|
|
|
| |
(fix of commit dfc5459a6)
* tests/test_stack.c (check_list): Call abort() immediately if a
duplicate element is found (instead of incrementing err_cnt).
|
|
|
|
|
|
| |
* tests/test_malloc.c (cons): Change type of extras local variable from
int* to char*; set every sizeof(int) byte of extras[] to 42 (instead of
setting every int value).
|
|
|
|
|
|
|
|
|
| |
(refactoring)
* 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): Remove
redundant cast of next local variable to AO_t.
|
|
|
|
|
|
|
|
|
|
|
|
| |
(refactoring)
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE && __alpha__
&& __GNUC__==4] (AO_EXPECT_FALSE): Redefine to expr (before
AO_stack_push_explicit_aux_release); move comment from
AO_stack_pop_explicit_aux_acquire.
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE && __alpha__
&& __GNUC__==4] (AO_stack_pop_explicit_aux_acquire): Use
AO_EXPECT_FALSE (in the same way as for non-alpha case).
|
| |
|
| |
|
|
|
|
|
|
| |
This reverts commit e56aa138b8fb8320d12ae22209f5e07c08ecc6c0.
The reason: CPPCHECK is not intended to be used in runnable tests.
|
| |
|
| |
|
|
|
|
|
|
|
| |
(fix of commit e477b79ef)
* src/atomic_ops_stack.c (AO_stack_init): Pass sizeof(AO_stack_t) to
memset() instead of sizeof pointer; remove redundant cast of list.
|
| |
|
|
|
|
|
|
| |
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Use AO_EXPECT_FALSE() in
comparison of entries and x_bits.
|
|
|
|
|
| |
* tests/test_stack.c (main): Adjust indentation for ifdef VERBOSE_STACK
and for "for" statement (for statistic output).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now AO_REAL_HEAD_PTR() and AO_REAL_NEXT_PTR() macros definition does
not depend on whether the implementation is almost or fully lock-free.
These macros just call the relevant implementation-dependent API
function (AO_real_head_ptr or AO_real_next_ptr, respectively).
If needed, the client could define AO_REAL_PTR_AS_MACRO (prior to
include atomic_ops_stack.h) to continue using implementation-dependent
definition of AO_REAL_HEAD_PTR and AO_REAL_NEXT_PTR macros.
* src/atomic_ops_stack.c [!AO_REAL_PTR_AS_MACRO]
(AO_REAL_PTR_AS_MACRO): Define (before include atomic_ops_stack.h).
* src/atomic_ops_stack.c (AO_real_head_ptr, AO_real_next_ptr):
Implement.
* src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Rename argument.
* src/atomic_ops_stack.h [!AO_REAL_PTR_AS_MACRO] (AO_REAL_NEXT_PTR,
AO_REAL_HEAD_PTR): Redirect to AO_real_next_ptr/AO_real_head_ptr().
* src/atomic_ops_stack.h (AO_stack_init): Move declaration down (to be
after AO_stack_pop).
* src/atomic_ops_stack.h (AO_real_head_ptr, AO_real_next_ptr): Declare
AO_API function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now AO_stack_t definition does not depend on whether the implementation
is almost or fully lock-free.
* src/atomic_ops_stack.c [USE_ALMOST_LOCK_FREE] (AO_stack_push_release,
AO_stack_pop_acquire): Update access to list after changing its type to
a union.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (version, ptr,
AO_stack_pop_acquire, AO_stack_push_release): Likewise.
* src/atomic_ops_stack.h (AO_REAL_HEAD_PTR): Likewise.
* 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_push_release): Rename version local variable to cversion.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (ptr, version):
Undefine (after last use).
* src/atomic_ops_stack.h [!AO_HAVE_double_t]: Move include
standard_ao_double_t.h upper to be before ifdef USE_ALMOST_LOCK_FREE.
* src/atomic_ops_stack.h [!AO_BL_SIZE] (AO_BL_SIZE): Refine comment.
* src/atomic_ops_stack.h (AO_BL_SIZE, AO_N_BITS, AO_BIT_MASK): Define
even if not USE_ALMOST_LOCK_FREE.
* src/atomic_ops_stack.h (AO__stack_ptr_aux): New struct type.
* src/atomic_ops_stack.h (AO_stack_t): Change to union; define
identically regardless of USE_ALMOST_LOCK_FREE; improve comment.
* src/atomic_ops_stack.h (AO_STACK_INITIALIZER): Define identically
regardless of USE_ALMOST_LOCK_FREE; add comment.
|
|
|
|
|
|
| |
* src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release): Remove extra "an" (after "the")
in comment.
|
|
|
|
|
|
|
| |
* src/atomic_ops_stack.c (AO_stack_init): Collapse 2 definitions into
single one; move the definition upper (to be outside of ifdef
USE_ALMOST_LOCK_FREE); implement using memset (instead of initializing
each field to 0).
|
|
|
|
|
| |
* tests/test_stack.c [CPPCHECK] (the_list): Define w/o initialization.
* tests/test_stack.c [CPPCHECK] (main): Call AO_stack_init().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously AO_stack_init() was declared as inline, and
AO_stack_push_release() and AO_stack_pop_acquire() were define as
macros in case of USE_ALMOST_LOCK_FREE. Now, these 3 functions are
always defined in atomic_ops_stack.c.
* src/atomic_ops_stack.c [USE_ALMOST_LOCK_FREE] (AO_stack_init,
AO_stack_push_release, AO_stack_pop_acquire): Implement.
* src/atomic_ops_stack.c [!USE_ALMOST_LOCK_FREE] (AO_stack_init):
Likewise.
* src/atomic_ops_stack.h (AO_stack_init): Remove inline function
definition; declare as AO_API function instead.
* src/atomic_ops_stack.h [USE_ALMOST_LOCK_FREE] (AO_stack_push_release,
AO_stack_pop_acquire): Declare as AO_API function instead of macro.
* src/atomic_ops_stack.h (AO_stack_push, AO_HAVE_stack_push,
AO_stack_pop, AO_HAVE_stack_pop): Define macro unconditionally.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* README_stack.txt: Place quotes properly for "popped".
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_push_explicit_aux_release, PRECHECK, AO_load_next,
AO_stack_pop_explicit_aux_acquire): Reformat comments, adjust code
indentation.
* src/atomic_ops_stack.c [!AO_USE_ALMOST_LOCK_FREE] (ptr,
AO_stack_push_release, AO_stack_pop_acquire): Likewise.
* src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE] (AO_BL_SIZE,
AO_stack_push_explicit_aux_release): Likewise.
* src/atomic_ops_stack.h: Move copyright to be the first comment in
the file.
|
|
|
|
|
|
|
|
|
|
| |
Also, add assertion that no overrun of t[] in run_one_test().
* tests/test_stack.c: Include assert.h.
* tests/test_stack.c (add_elements, check_list, run_one_test, main):
Add comments.
* tests/test_stack.c (run_one_test): Add assertion that index is not
greater than MAX_NTHREADS; refine error message when list is empty.
|
|
|
|
|
|
|
| |
(fix of commit f30c76e28)
* src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE && (__LP64__
|| _LP64 || _WIN64)] (AO_N_BITS): Remove outdated comment about Win64.
|
|
|
|
|
|
|
|
| |
* tests/test_stack.c (marks): Remove static variable.
* tests/test_stack.c (check_list): Declare err_cnt and marks local
variables; allocate marks with calloc() and free it at the end of
function; increment err_cnt instead of abort (after fprintf(stderr));
call abort() at the end of function if err_cnt is non-zero.
|
|
|
|
|
|
|
|
|
| |
(refactoring)
* tests/test_stack.c (fetch_and_add): Rename to fetch_then_add; refine
comment.
* tests/test_stack.c (run_one_test): Rename fetch_and_add to
fetch_then_add.
|
| |
|
|
|
|
|
|
| |
(refactoring)
* tests/test_stack.c (VERBOSE): Rename to VERBOSE_STACK.
|
|
|
|
|
| |
* tests/test_stack.c [AO_USE_ALMOST_LOCK_FREE] (main): Print a message
that almost-lock-free implementation is used.
|
|
|
|
|
|
|
|
| |
(refactoring)
* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE && AO_BL_SIZE!=2]
(AO_stack_push_explicit_aux_release): Remove code duplicated with
AO_BL_SIZE==2 case.
|
|
|
|
|
|
|
|
|
|
| |
(fix of commit cd7fd8539)
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(6,0)]: Use "-Wpedantic" (instead of "-pedantic").
|
|
|
|
|
|
| |
* LICENSE: Mention additionally that the low-level (core) part of the
library is covered by MIT license (near the licensing terms); wrap
a long line properly; update copyright year.
|
|
|
|
|
| |
* CMakeLists.txt: Update copyright year.
* src/atomic_ops.h: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
This commit adds support of the clang compiler (in addition to gcc)
for E2K architecture.
* CMakeLists.txt [install_headers] (FILES): Install also gcc/e2k.h.
* src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS
&& !__INTEL_COMPILER && __e2k__]: Include gcc/e2k.h.
* src/atomic_ops/sysdeps/gcc/e2k.h: New file.
|
|
|
|
|
|
|
| |
This reverts commit 3c086a4529c1b8a4be4796179989f034ab02eba1.
Reason: -D_FORTIFY_SOURCE=3 causes '_FORTIFY_SOURCE redefined' warning
by gcc-9 (Linux).
|
| |
|