Ivan Maidanski [Tue, 2 Oct 2012 07:24:16 +0000 (11:24 +0400)]
Add no-barrier double_compare_and_swap to generalization
* src/atomic_ops/generalize.h (AO_double_compare_and_swap):
New function (only if AO_HAVE_compare_double_and_swap_double and
not AO_HAVE_double_compare_and_swap) completing double-CAS family;
reformat comment.
* src/atomic_ops/generalize.h (AO_HAVE_double_compare_and_swap):
Define macro (accompanying AO_double_compare_and_swap).
Ivan Maidanski [Tue, 2 Oct 2012 07:12:24 +0000 (11:12 +0400)]
Fix compare_double_and_swap_double_full definition condition in emul_cas
* src/atomic_ops/sysdeps/emul_cas.h
(AO_compare_double_and_swap_double_full): Test (define if)
AO_HAVE_compare_double_and_swap_double_full macro instead of
AO_HAVE_compare_double_and_swap_double.
Ivan Maidanski [Sat, 29 Sep 2012 18:28:45 +0000 (22:28 +0400)]
Remove unsafe emulation-based implementation of double CAS (SunCC/x86)
* src/atomic_ops/sysdeps/sunc/x86.h
(AO_compare_double_and_swap_double_full): Do not test
AO_WEAK_DOUBLE_CAS_EMULATION and remove emulation-based implementation
since it is unsafe (not atomic with respect to other kinds of updates)
leading to test_stack failure.
* configure.ac (AO_WEAK_DOUBLE_CAS_EMULATION): Update and refine
documentation.
* src/atomic_ops/sysdeps/sunc/x86.h
(AO_compare_double_and_swap_double_full): Likewise.
Ivan Maidanski [Tue, 18 Sep 2012 17:55:36 +0000 (21:55 +0400)]
Remove sunc/x86_64.h to eliminate sunc/x86.h code duplication
* src/Makefile.am (nobase_private_HEADERS): Remove reference to
sunc/x86_64.h.
* src/atomic_ops.h: Include sunc/x86.h both for x86 and x86_64 (if
__sun defined but not GCC).
* src/atomic_ops/sysdeps/sunc/x86.h (AO_USE_PENTIUM4_INSTRS):
Explicitly define for x86_64 chips.
* src/atomic_ops/sysdeps/sunc/x86.h (AO_fetch_and_add_full,
AO_and_full, AO_or_full, AO_xor_full, AO_compare_and_swap_full,
AO_fetch_compare_and_swap_full): Remove "l" suffix (the size is
properly determined by operands).
* src/atomic_ops/sysdeps/sunc/x86.h
(AO_compare_double_and_swap_double_full): Use cmpxchg8b instruction
only in 32-bit mode (if __i386 defined) if avaialble, otherwise use
either cmpxchg16b (if AO_CMPXCHG16B_AVAILABLE) or emulation (if
AO_WEAK_DOUBLE_CAS_EMULATION).
* src/atomic_ops/sysdeps/sunc/x86.h (AO_T_IS_INT): Define only for
32-bit mode.
* src/atomic_ops/sysdeps/sunc/x86.h (AO_int_fetch_and_add_full,
AO_HAVE_int_fetch_and_add_full): Move definition from sunc/x86_64.h;
define only for 64-bit mode.
* src/atomic_ops/sysdeps/sunc/x86_64.h: Delete this file.
Ivan Maidanski [Tue, 18 Sep 2012 15:03:19 +0000 (19:03 +0400)]
Fix cmpxchg16b-based compare_double_and_swap_double for SunCC/x86_64
* src/atomic_ops/sysdeps/sunc/x86_64.h
(AO_compare_double_and_swap_double_full): Fix inline assembly
arguments commenting out "m"(*addr) one (similar to that in
sunc/x86.h) if AO_CMPXCHG16B_AVAILABLE defined.
Ivan Maidanski [Sun, 23 Sep 2012 12:24:08 +0000 (16:24 +0400)]
Remove nested AO_USE_PTHREAD_DEFS macro check in atomic_ops.h (gcc/arm)
* src/atomic_ops.h: Remove redundant (nested) AO_USE_PTHREAD_DEFS
macro test for gcc/arm.
Ivan Maidanski [Wed, 19 Sep 2012 16:29:25 +0000 (20:29 +0400)]
Fix AO_DOUBLE_T_INITIALIZER definition (x86_64)
* src/atomic_ops/sysdeps/standard_ao_double_t.h
(AO_DOUBLE_T_INITIALIZER): Fix definition for x86_64 (remove cast of
zero since __m128 type is a vector).
Ivan Maidanski [Tue, 18 Sep 2012 20:28:36 +0000 (00:28 +0400)]
Eliminate 'missing initializer' warning for AO_stack_t value initializer
* src/atomic_ops/sysdeps/generic_pthread.h (AO_DOUBLE_T_INITIALIZER):
New API macro definition.
* src/atomic_ops/sysdeps/standard_ao_double_t.h
(AO_DOUBLE_T_INITIALIZER): Likewise.
* src/atomic_ops_stack.h (AO_STACK_INITIALIZER): Define using
AO_DOUBLE_T_INITIALIZER (only if not AO_USE_ALMOST_LOCK_FREE).
Ivan Maidanski [Tue, 18 Sep 2012 17:21:47 +0000 (21:21 +0400)]
Fix a typo in comment of compare_double_and_swap_double (x86_64)
* src/atomic_ops/sysdeps/gcc/x86_64.h
(AO_compare_double_and_swap_double_full): Fix a typo in comment.
* src/atomic_ops/sysdeps/sunc/x86_64.h
(AO_compare_double_and_swap_double_full): Likewise.
Ivan Maidanski [Tue, 18 Sep 2012 15:29:46 +0000 (19:29 +0400)]
Align code and comments of gcc/x86.h and sunc/x86.h
* src/atomic_ops/sysdeps/gcc/x86.h (AO_and_full, AO_or_full,
AO_xor_full, AO_test_and_set_full,
AO_compare_double_and_swap_double_full): Align code and comments.
* src/atomic_ops/sysdeps/sunc/x86.h: Likewise.
Ivan Maidanski [Tue, 18 Sep 2012 13:41:18 +0000 (17:41 +0400)]
Add TODO item to gcc/alpha.h
Ivan Maidanski [Tue, 18 Sep 2012 12:20:31 +0000 (16:20 +0400)]
Update ChangeLog file
Ivan Maidanski [Tue, 18 Sep 2012 11:21:16 +0000 (15:21 +0400)]
tests: Log messages to stdout instead of stderr
* tests/run_parallel.h (run_parallel): Print logging (non-error)
messages using printf() instead of fprintf(stderr).
* tests/test_atomic_include.template (MISSING): Likewise.
* tests/test_malloc.c (print_list): Likewise.
* tests/run_parallel.h (run_parallel): Reformat code.
Ivan Maidanski [Tue, 18 Sep 2012 11:10:47 +0000 (15:10 +0400)]
Remove useless 'perror' call in tests run_parallel.h
* tests/run_parallel.h (run_parallel): Remove useless perror() call
(since error code is returned by pthread primitive or GetLastError).
Ivan Maidanski [Tue, 18 Sep 2012 10:54:48 +0000 (14:54 +0400)]
Terminate tests with abort after error reported
* tests/test_atomic.c (acqrel_thr): Call abort() after fprintf(stderr).
* tests/test_malloc.c (run_one_test): Likewise.
* tests/test_stack.c (check_list, main): Likewise.
Ivan Maidanski [Wed, 5 Sep 2012 04:56:37 +0000 (08:56 +0400)]
Update ChangeLog file
Ivan Maidanski [Wed, 5 Sep 2012 04:55:04 +0000 (08:55 +0400)]
Implement compare_double_and_swap_double for SunCC/x86
(Tested only with Sun C 5.11 SunOS_i386.)
* src/atomic_ops/sysdeps/sunc/x86.h
(AO_compare_double_and_swap_double_full): Implement (define only if
AO_NO_CMPXCHG8B unset) using same algorithm as for gcc/x86 non-PIC.
Ivan Maidanski [Wed, 5 Sep 2012 04:53:41 +0000 (08:53 +0400)]
Update ChangeLog and TODO files
Ivan Maidanski [Wed, 5 Sep 2012 04:25:24 +0000 (08:25 +0400)]
Fix compare_double_and_swap_double for clang/x86 in PIC mode
* src/atomic_ops/sysdeps/gcc/x86.h
(AO_compare_double_and_swap_double_full): Re-implement for PIC mode
saving EBX to a local variable (instead of pushing it to stack) and
saving memory operand address to a register (edi which is manually
preserved), so that the whole code could also work even if EBX points
to memory operand (e.g., in Clang); test __PIC__ using ifdef (instead
of "if"); update comments; reformat code.
Ivan Maidanski [Thu, 30 Aug 2012 14:12:23 +0000 (18:12 +0400)]
TODO: Add FIXME item (Ubuntu/x86)
Ivan Maidanski [Wed, 1 Aug 2012 18:38:50 +0000 (22:38 +0400)]
Update ChangeLog file
Ivan Maidanski [Wed, 1 Aug 2012 18:35:17 +0000 (22:35 +0400)]
Fix AO_compiler_barrier missing parentheses
* src/atomic_ops.h (AO_compiler_barrier): Add parentheses and cast to
void.
Ivan Maidanski [Sun, 22 Jul 2012 08:34:35 +0000 (12:34 +0400)]
Update ChangeLog file
Ivan Maidanski [Wed, 18 Jul 2012 11:58:43 +0000 (15:58 +0400)]
TODO file: add FIXME items (regarding Debian)
Ivan Maidanski [Wed, 4 Jul 2012 04:32:03 +0000 (08:32 +0400)]
Fix AO_compare_double_and_swap_double_full for gcc-4.2.1/x86 in PIC mode
* src/atomic_ops/sysdeps/gcc/x86.h
(AO_compare_double_and_swap_double_full): Use EDI register for
"new_val1" argument in PIC mode only for GCC 4.3+ to workaround
a problem with older compiler versions (e.g., GCC 4.2.1 [FreeBSD])
that do not recognize 'D' as a valid register specification; update
comment.
Ivan Maidanski [Mon, 2 Jul 2012 04:37:55 +0000 (08:37 +0400)]
Update ChangeLog file (regarding v7.2d)
Ivan Maidanski [Sun, 1 Jul 2012 08:55:48 +0000 (12:55 +0400)]
Update ChangeLog file
Ivan Maidanski [Sun, 1 Jul 2012 08:45:23 +0000 (12:45 +0400)]
Fix generalized AO_char/short_compare_and_swap/fetch_and_add CTYPE args
* src/atomic_ops/generalize-small.template
(AO_XSIZE_compare_and_swap_full, AO_XSIZE_compare_and_swap_acquire,
AO_XSIZE_compare_and_swap_release, AO_XSIZE_fetch_and_add_full,
AO_XSIZE_fetch_and_add_acquire, AO_XSIZE_fetch_and_add_release):
Fix type of function arguments (or local variables) by adding
'unsigned' to XCTYPE.
* src/atomic_ops/generalize-small.h: Regenerate.
Ivan Maidanski [Tue, 15 May 2012 07:36:37 +0000 (11:36 +0400)]
Bump libatomic_ops version
* README: Bump version to 7.3alpha3.
* configure.ac: Likewise.
* src/atomic_ops/ao_version.h (AO_VERSION_ALPHA): Likewise.
Ivan Maidanski [Fri, 11 May 2012 16:14:23 +0000 (20:14 +0400)]
[7.3alpha2]
Bump libatomic_ops version to 7.3alpha2
* ChangeLog: Set release dates.
* README: Bump version to 7.3alpha2.
* configure.ac: Likewise.
* src/atomic_ops/ao_version.h (AO_VERSION_ALPHA): Likewise.
H.J. Lu [Mon, 16 Apr 2012 16:23:51 +0000 (09:23 -0700)]
Define AO_T_IS_INT for x32
* src/atomic_ops/sysdeps/gcc/x86_64.h (AO_T_IS_INT): Defined
for x32.
Ivan Maidanski [Tue, 1 May 2012 14:37:20 +0000 (18:37 +0400)]
Update ChangeLog file
Ivan Maidanski [Tue, 1 May 2012 10:56:33 +0000 (14:56 +0400)]
Update AUTHORS file
H.J. Lu [Tue, 1 May 2012 10:31:30 +0000 (14:31 +0400)]
Fix for x32 by removing 'q' suffix in x86-64 instructions
We do not need the 'q' suffix on x86_64 atomic instructions for AO_t
which is defined as "unsigned long"; the later is 32-bit for x32
and 64-bit for x86-64; the register operand in x86-64 atomic
instructions is sufficient to properly determine the register size.
* src/atomic_ops/sysdeps/gcc/x86_64.h (AO_fetch_and_add_full,
AO_and_full, AO_or_full, AO_xor_full, AO_compare_and_swap_full,
AO_fetch_compare_and_swap_full): Remove 'q' suffix in asm instruction.
Ivan Maidanski [Wed, 28 Mar 2012 15:14:25 +0000 (19:14 +0400)]
Fix autogen.sh to prevent reporting success if autoreconf failed
* autogen.sh: Add "set -e" command to abort script execution on
autoreconf failure (thus not printing "ready" in that case).
Ivan Maidanski [Wed, 28 Mar 2012 04:51:25 +0000 (08:51 +0400)]
Fix ChangeLog (regarding autoconf)
Ivan Maidanski [Wed, 28 Mar 2012 04:23:03 +0000 (08:23 +0400)]
Update ChangeLog
Ivan Maidanski [Wed, 28 Mar 2012 03:59:09 +0000 (07:59 +0400)]
Fix configure to define __PIC__ macro explicitly only if not done by GCC
* configure.ac (PICFLAG): Adjust AC_MSG_CHECKING message; report
"none" result if no -fPIC is needed (for Cygwin/MinGW); determine
whether GCC -fPIC option causes __PIC__ macro definition; pass
-D __PIC__ to PICFLAG (instead of CFLAGS) only if not defined
automatically in case -fPIC specified; update comment.
Ivan Maidanski [Mon, 26 Mar 2012 04:52:17 +0000 (08:52 +0400)]
Update ChangeLog
Ivan Maidanski [Mon, 26 Mar 2012 04:34:27 +0000 (08:34 +0400)]
Fix double_ptr_storage definition for GCC pre-v4 (x86_64)
* src/atomic_ops/sysdeps/standard_ao_double_t.h: Do not use __m128
if GCC pre-v4 (at least, xmmintrin.h is missing in gcc-3.4.3-x86_64
included in Solaris 10 distribution).
Ivan Maidanski [Mon, 26 Mar 2012 04:29:38 +0000 (08:29 +0400)]
Fix a typo in comment in standard_ao_double_t.h
Ivan Maidanski [Mon, 26 Mar 2012 04:21:47 +0000 (08:21 +0400)]
Update ChangeLog
Ivan Maidanski [Mon, 26 Mar 2012 04:06:19 +0000 (08:06 +0400)]
Use __builtin_expect in CAS failure loop condition checks (GCC only)
* src/atomic_ops.c (lock, block_all_signals): Use AO_EXPECT_FALSE.
* src/atomic_ops.h (AO_EXPECT_FALSE): New macro.
* src/atomic_ops/generalize-small.template
(AO_XSIZE_fetch_and_add_full, AO_XSIZE_fetch_and_add_acquire,
AO_XSIZE_fetch_and_add_release): Use AO_EXPECT_FALSE for CAS failure
check.
* src/atomic_ops/generalize.h (AO_fetch_and_add_full,
AO_fetch_and_add_acquire, AO_fetch_and_add_release, AO_fetch_and_add,
AO_and_full, AO_or_full, AO_xor_full): Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h
(AO_compare_double_and_swap_double): Likewise.
* src/atomic_ops_stack.c (AO_stack_push_explicit_aux_release,
AO_stack_pop_explicit_aux_acquire, AO_stack_push_release,
AO_stack_pop_acquire): Likewise.
* src/atomic_ops/generalize-small.h: Regenerate.
Ivan Maidanski [Mon, 19 Mar 2012 16:01:51 +0000 (20:01 +0400)]
Update ChangeLog
Ivan Maidanski [Wed, 7 Mar 2012 15:45:25 +0000 (19:45 +0400)]
Update ChangeLog
Ivan Maidanski [Wed, 7 Mar 2012 15:12:49 +0000 (19:12 +0400)]
Fix AO_compare_double_and_swap_double_full for gcc/x86 (PIC mode)
* src/atomic_ops/sysdeps/gcc/x86.h
(AO_compare_double_and_swap_double_full): Use EDI register for
"new_val1" argument instead of a memory operand and use XCHG assembler
instruction instead of push/pop in case of PIC mode (to workaround
a bug in GCC 4.6.1); update the comment.
Ivan Maidanski [Wed, 7 Mar 2012 03:43:07 +0000 (07:43 +0400)]
Update TODO file (remove fixed item for clang/x86)
Ivan Maidanski [Wed, 7 Mar 2012 03:41:23 +0000 (07:41 +0400)]
Fix AO_stack_push_release to workaround bug in clang-1.1/x86
* src/atomic_ops_stack.c (AO_stack_push_release): Make "cptr" local
variable volatile to workaround a bug in clang-1.1/x86 compiler; add
comment.
Ivan Maidanski [Wed, 7 Mar 2012 03:31:55 +0000 (07:31 +0400)]
Fix a typo in comment
* src/atomic_ops/sysdeps/gcc/x86.h
(AO_compare_double_and_swap_double_full): Fix argument name in the
comment.
* src/atomic_ops/sysdeps/sunc/x86.h
(AO_compare_double_and_swap_double_full): Likewise.
Ivan Maidanski [Mon, 5 Mar 2012 16:51:28 +0000 (20:51 +0400)]
Update ChangeLog
Ivan Maidanski [Mon, 5 Mar 2012 16:15:14 +0000 (20:15 +0400)]
configure: Require automake 2.61 instead of 2.63
* configure.ac (AC_PREREQ): Use value of 2.63 (relax requirement to
enable autoreconf on current Mac OS X).
Ivan Maidanski [Sun, 4 Mar 2012 18:43:18 +0000 (22:43 +0400)]
Update ChangeLog
Ivan Maidanski [Sun, 4 Mar 2012 18:21:40 +0000 (22:21 +0400)]
Replace pointer relational comparisons with non-pointer ones
* src/atomic_ops_malloc.c (initial_heap_lim): Remove static variable
(which holds a constant).
* src/atomic_ops_malloc.c (get_chunk): Replace "goto" with for/break;
remove "my_lim" local variable; cast AO_compare_and_swap_acquire()
unused result to void; replace less-or-equal comparison of pointers
with comparison of ptrdiff_t value.
* src/atomic_ops_malloc.c (add_chunk_as): Update comment; remove "sz"
argument; replace "first", "limit", "p", "next" pointer local variable
with "ofs", "limit" and "sz" variables of size_t; add assertion on
"sz" value; replace less-or-equal comparison of pointers with
comparison of size_t values.
* src/atomic_ops_malloc.c (AO_malloc): Remove "adj_sz" local variable;
do not pass adj_sz argument to add_chunk_as.
Ivan Maidanski [Sun, 4 Mar 2012 16:20:22 +0000 (20:20 +0400)]
Fix a typo in comment
* src/atomic_ops_malloc.h (AO_malloc_enable_mmap): Fix a typo in the
comment.
Ivan Maidanski [Fri, 17 Feb 2012 15:15:41 +0000 (19:15 +0400)]
configure: Require automake 2.63 (widely spread) instead of 2.64
* configure.ac (AC_PREREQ): Use value of 2.63 (instead of 2.64).
Ivan Maidanski [Tue, 7 Feb 2012 04:18:19 +0000 (08:18 +0400)]
Update TODO file (add FIXME note for clang)
Ivan Maidanski [Mon, 6 Feb 2012 04:56:45 +0000 (08:56 +0400)]
Remove unused and hide some inner symbols in atomic_ops_malloc
* src/atomic_ops_malloc.c (AO_chunk_free_list): Remove unused global
variable.
* src/atomic_ops_malloc.c (msbs): Add 'const' keyword.
* src/atomic_ops_malloc.c (msb): Add 'static' keyword to inner
function declaration.
Ivan Maidanski [Mon, 6 Feb 2012 04:44:33 +0000 (08:44 +0400)]
Suppress compiler warning in atomic_ops_malloc
* src/atomic_ops_malloc.c (msb): Change shift-by-32 expression to
work around a warning issued by clang compiler.
Ivan Maidanski [Fri, 20 Jan 2012 18:36:39 +0000 (22:36 +0400)]
configure: Specify bug reports email in AC_INIT
Ivan Maidanski [Fri, 20 Jan 2012 18:10:29 +0000 (22:10 +0400)]
README: Add bug reports address
Ivan Maidanski [Thu, 19 Jan 2012 04:35:21 +0000 (08:35 +0400)]
test_stack: check_list() code refactoring and 'marks' size optimization
* tests/test_stack.c (marks): Set smaller size (according to the
maximum index passed to check_list).
* tests/test_stack.c (check_list): Store p->data to "i" local variable
(in the loop body) replacing multiple occurrences of p->data.
Ivan Maidanski [Thu, 19 Jan 2012 04:33:50 +0000 (08:33 +0400)]
Change function prototype specifications to follow strict ANSI C style
* tests/test_atomic.c (main): Put "void" keyword into the arguments
specification of the function prototype.
* tests/test_stack.c (main): Likewise.
Bruno Haible [Thu, 19 Jan 2012 07:07:19 +0000 (11:07 +0400)]
Add autogen.sh file
Ivan Maidanski [Wed, 11 Jan 2012 17:41:51 +0000 (21:41 +0400)]
Replace repeating '==' in documentation with a single one
* README: Replace sequences of repeating '==' identifying section
titles (which is also used by git-apply) with two '=' symbols at the
beginning and at the end of each title.
* TODO: Likewise.
* ChangeLog: Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h: Break a sequence of repeating '=='
(in a comment) with a space.
Ivan Maidanski [Sat, 31 Dec 2011 13:13:28 +0000 (17:13 +0400)]
Update TODO file (remove FIXME - problem caused by target mismatch)
Ivan Maidanski [Sat, 31 Dec 2011 12:59:21 +0000 (16:59 +0400)]
Update TODO file (remove FIXME - problem fixed in GCC v4.6.2)
Ivan Maidanski [Thu, 22 Dec 2011 07:19:00 +0000 (11:19 +0400)]
.gitignore: Ignore config.cache
Ivan Maidanski [Mon, 19 Dec 2011 11:26:42 +0000 (15:26 +0400)]
Code refactoring of gcc/arm.h by introducing AO_ARM_HAVE_x macros
* src/atomic_ops/sysdeps/gcc/arm.h (AO_ARM_HAVE_LDREX,
AO_ARM_HAVE_LDREXD, AO_ARM_HAVE_SWP): New macro.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_full, AO_load, AO_store,
AO_test_and_set, AO_fetch_and_add, AO_fetch_and_add1,
AO_fetch_and_sub1, AO_compare_and_swap, AO_fetch_compare_and_swap,
AO_compare_double_and_swap_double, AO_test_and_set_full): Test
AO_ARM_HAVE_LDREX, AO_ARM_HAVE_LDREXD and AO_ARM_HAVE_SWP instead of
__ARM_ARCH_x__ directly.
Ivan Maidanski [Fri, 16 Dec 2011 14:17:37 +0000 (18:17 +0400)]
Update ChangeLog
Ivan Maidanski [Fri, 16 Dec 2011 14:07:30 +0000 (18:07 +0400)]
Fix __ARM_ARCH_5__ macro handling for Android NDK (ARMv7)
* src/atomic_ops/sysdeps/gcc/arm.h (__ARM_ARCH_7__, __ARM_ARCH_7A__):
Recognize to override __ARM_ARCH_5xx__ macros (since Android NDK GCC
defines both for armv7); update comment.
Ivan Maidanski [Wed, 14 Dec 2011 07:13:46 +0000 (11:13 +0400)]
Merge branch 'ao_val_cas'
Ivan Maidanski [Tue, 13 Dec 2011 14:52:37 +0000 (18:52 +0400)]
.gitignore: Ignore Gcov files (.gcda, .gcno)
Ivan Maidanski [Tue, 13 Dec 2011 14:50:32 +0000 (18:50 +0400)]
.gitignore: Ignore binary files (.a, .exe, .o, etc.) in all folders
Ivan Maidanski [Tue, 13 Dec 2011 10:45:26 +0000 (14:45 +0400)]
Update ChangeLog
Ivan Maidanski [Tue, 13 Dec 2011 06:36:24 +0000 (10:36 +0400)]
configure: Do not pass '-Wextra' option to GCC if unsupported
* configure.ac (WEXTRA): New variable (set to "-Wextra" if the latter
is supported by GCC, otherwise to "-W").
* configure.ac (CFLAGS): Use WEXTRA variable.
Ivan Maidanski [Mon, 12 Dec 2011 14:57:23 +0000 (18:57 +0400)]
Define NDEBUG via config.h instead of CFLAGS;
do not define NDEBUG if '--enable-assertions' passed to configure
* configure.ac (CFLAGS): Do not add "-DNDEBUG".
* configure.ac (assertions): New AC argument.
* configure.ac (NDEBUG): New AC macro (defined only if "assertions"
AC argument is not set to "yes").
Ivan Maidanski [Thu, 8 Dec 2011 13:17:21 +0000 (17:17 +0400)]
Recognize AO_PREFER_GENERALIZED to favor generalization over asm (MIPS)
* src/atomic_ops/sysdeps/gcc/mips.h (AO_fetch_and_add,
AO_HAVE_fetch_and_add, AO_test_and_set, AO_HAVE_test_and_set): Do not
define if AO_PREFER_GENERALIZED.
Ivan Maidanski [Thu, 8 Dec 2011 13:30:07 +0000 (17:30 +0400)]
Update ChangeLog
Ivan Maidanski [Thu, 8 Dec 2011 12:39:56 +0000 (16:39 +0400)]
Add new macro (AO_PREFER_GENERALIZED) to favor generalized primitives
over direct assembly-based ones
* configure.ac (AO_PREFER_GENERALIZED): New AC template.
* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_test_and_set,
AO_HAVE_test_and_set, AO_fetch_and_add, AO_HAVE_fetch_and_add,
AO_fetch_and_add1, AO_HAVE_fetch_and_add1, AO_fetch_and_sub1,
AO_HAVE_fetch_and_sub1): Do not define if AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set,
AO_HAVE_test_and_set, AO_fetch_and_add, AO_HAVE_fetch_and_add,
AO_fetch_and_add1, AO_HAVE_fetch_and_add1, AO_fetch_and_sub1,
AO_HAVE_fetch_and_sub1): Likewise.
* src/atomic_ops/sysdeps/gcc/avr32.h (AO_test_and_set_full,
AO_HAVE_test_and_set_full): Likewise.
* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_fetch_and_add,
AO_HAVE_fetch_and_add, AO_test_and_set, AO_HAVE_test_and_set):
Likewise.
* src/atomic_ops/sysdeps/gcc/ia64.h (AO_fetch_and_add1_acquire,
AO_HAVE_fetch_and_add1_acquire, AO_fetch_and_add1_release,
AO_HAVE_fetch_and_add1_release, AO_fetch_and_sub1_acquire,
AO_HAVE_fetch_and_sub1_acquire, AO_fetch_and_sub1_release,
AO_HAVE_fetch_and_sub1_release, AO_int_fetch_and_add1_acquire,
AO_HAVE_int_fetch_and_add1_acquire, AO_int_fetch_and_add1_release,
AO_HAVE_int_fetch_and_add1_release, AO_int_fetch_and_sub1_acquire,
AO_HAVE_int_fetch_and_sub1_acquire, AO_int_fetch_and_sub1_release,
AO_HAVE_int_fetch_and_sub1_release): Likewise.
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_test_and_set,
AO_HAVE_test_and_set, AO_test_and_set_acquire,
AO_HAVE_test_and_set_acquire, AO_test_and_set_release,
AO_HAVE_test_and_set_release, AO_test_and_set_full,
AO_HAVE_test_and_set_full): Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_fetch_and_add_full,
AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full,
AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise.
* src/atomic_ops/sysdeps/gcc/x86_64.h (AO_fetch_and_add_full,
AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full, AO_or_full,
AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise.
* src/atomic_ops/sysdeps/hpc/ia64.h (AO_fetch_and_add1_acquire,
AO_HAVE_fetch_and_add1_acquire, AO_fetch_and_add1_release,
AO_HAVE_fetch_and_add1_release, AO_fetch_and_sub1_acquire,
AO_HAVE_fetch_and_sub1_acquire, AO_fetch_and_sub1_release,
AO_HAVE_fetch_and_sub1_release): Likewise.
* src/atomic_ops/sysdeps/ibmc/powerpc.h (AO_test_and_set_acquire,
AO_HAVE_test_and_set_acquire, AO_test_and_set_release,
AO_HAVE_test_and_set_release, AO_test_and_set_full,
AO_HAVE_test_and_set_full): Likewise.
* src/atomic_ops/sysdeps/icc/ia64.h (AO_fetch_and_add1_acquire,
AO_HAVE_fetch_and_add1_acquire, AO_fetch_and_add1_release,
AO_HAVE_fetch_and_add1_release, AO_fetch_and_sub1_acquire,
AO_HAVE_fetch_and_sub1_acquire, AO_fetch_and_sub1_release,
AO_HAVE_fetch_and_sub1_release): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h (AO_fetch_and_add_full,
AO_HAVE_fetch_and_add_full, AO_fetch_and_add1_full,
AO_HAVE_fetch_and_add1_full, AO_fetch_and_sub1_full,
AO_HAVE_fetch_and_sub1_full): Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h (AO_fetch_and_add_full,
AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full,
AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise.
* src/atomic_ops/sysdeps/sunc/x86_64.h (AO_fetch_and_add_full,
AO_HAVE_fetch_and_add_full, AO_and_full, AO_HAVE_and_full,
AO_or_full, AO_HAVE_or_full, AO_xor_full, AO_HAVE_xor_full): Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set_full,
AO_HAVE_test_and_set_full): Do not define if AO_PREFER_GENERALIZED
(but only in case of ARMv6+).
* src/atomic_ops/sysdeps/msftc/common32_defs.h (_InterlockedIncrement,
_InterlockedDecrement, _InterlockedExchangeAdd): Do not declare
intrinsic if both AO_PREFER_GENERALIZED and AO_ASSUME_WINDOWS98.
* src/atomic_ops/sysdeps/msftc/common32_defs.h (AO_fetch_and_add_full,
AO_HAVE_fetch_and_add_full, AO_fetch_and_add1_full,
AO_HAVE_fetch_and_add1_full, AO_fetch_and_sub1_full,
AO_HAVE_fetch_and_sub1_full): Do not define if both
AO_PREFER_GENERALIZED and AO_ASSUME_WINDOWS98.
* src/atomic_ops/sysdeps/msftc/x86_64.h (_InterlockedIncrement64,
_InterlockedDecrement64, _InterlockedExchangeAdd64): Do not declare
intrinsic if AO_PREFER_GENERALIZED.
Ivan Maidanski [Wed, 7 Dec 2011 09:25:14 +0000 (13:25 +0400)]
Remove unused InterlockedExchange/ReadWriteBarrier declarations (VC/x86)
* src/atomic_ops/sysdeps/msftc/common32_defs.h (_InterlockedExchange,
_ReadWriteBarrier): Remove pragma for unused intrinsic.
* src/atomic_ops/sysdeps/msftc/x86_64.h (_ReadWriteBarrier,
_InterlockedExchange64): Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h (_InterlockedExchange):
Remove unused macro and prototype.
Ivan Maidanski [Thu, 1 Dec 2011 16:37:54 +0000 (20:37 +0400)]
Add all AO control macros to configure (as templates)
* configure.ac (AO_USE_NANOSLEEP, AO_USE_NO_SIGNALS,
AO_USE_WIN32_PTHREADS, AO_TRACE_MALLOC, AO_GENERALIZE_ASM_BOOL_CAS,
AO_USE_PTHREAD_DEFS, AO_ASM_X64_AVAILABLE, AO_ASSUME_VISTA,
AO_ASSUME_WINDOWS98, AO_CMPXCHG16B_AVAILABLE, AO_FORCE_USE_SWP,
AO_NO_SPARC_V9, AO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE,
AO_UNIPROCESSOR, AO_USE_INTERLOCKED_INTRINSICS,
AO_USE_PENTIUM4_INSTRS, AO_USE_SYNC_CAS_BUILTIN,
AO_WEAK_DOUBLE_CAS_EMULATION): New AC template.
Ivan Maidanski [Thu, 1 Dec 2011 10:41:39 +0000 (14:41 +0400)]
Prevent AO_USE_SYNC_CAS_BUILTIN redefinition in atomic_ops.h
* src/atomic_ops.h (AO_USE_SYNC_CAS_BUILTIN): Do not redefine if it
is already defined.
Ivan Maidanski [Thu, 1 Dec 2011 10:35:21 +0000 (14:35 +0400)]
On altering CFLAGS value in configure place client flags at end
* configure.ac (CFLAGS): Always append old CFLAGS value (instead of
placing it at start).
Ivan Maidanski [Wed, 30 Nov 2011 12:21:00 +0000 (16:21 +0400)]
Update ChangeLog
Ivan Maidanski [Wed, 30 Nov 2011 11:37:53 +0000 (15:37 +0400)]
Workaround ICE9 A1 chip LL bug (MIPS)
* src/atomic_ops/sysdeps/gcc/mips.h (AO_MIPS_LL_FIX): New macro (used
to workaround LL bug in some chips); test AO_ICE9A1_LLSC_WAR new macro.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_fetch_and_add,
AO_test_and_set, AO_compare_and_swap, AO_fetch_compare_and_swap):
Insert AO_MIPS_LL_FIX after every "ll" operation.
Ivan Maidanski [Wed, 30 Nov 2011 10:18:27 +0000 (14:18 +0400)]
Implement fetch_and_add, test_and_set primitives for MIPS
* src/atomic_ops/sysdeps/gcc/mips.h (AO_fetch_and_add,
AO_HAVE_fetch_and_add, AO_test_and_set, AO_HAVE_test_and_set):
Implement (assuming 32-bit ABI); update FIXME.
Ivan Maidanski [Wed, 30 Nov 2011 08:30:29 +0000 (12:30 +0400)]
Implement AO_fetch_compare_and_swap for MIPS
* src/atomic_ops/sysdeps/gcc/mips.h (AO_compare_and_swap,
AO_HAVE_compare_and_swap): Do not define if AO_GENERALIZE_ASM_BOOL_CAS.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_fetch_compare_and_swap,
AO_HAVE_fetch_compare_and_swap): Implement (assuming 32-bit ABI);
remove FIXME.
Ivan Maidanski [Tue, 29 Nov 2011 19:11:49 +0000 (23:11 +0400)]
Reformat gcc/ia64.h code
* src/atomic_ops/sysdeps/gcc/ia64.h (AO_int_fetch_and_add1_acquire,
AO_int_fetch_and_add1_release, AO_int_fetch_and_sub1_acquire,
AO_int_fetch_and_sub1_release, AO_int_fetch_compare_and_swap_acquire,
AO_int_fetch_compare_and_swap_release): Reformat code.
Ivan Maidanski [Tue, 29 Nov 2011 18:09:00 +0000 (22:09 +0400)]
Update ChangeLog
Ivan Maidanski [Tue, 29 Nov 2011 18:41:13 +0000 (22:41 +0400)]
Merge branch 'ao_t_is_int-fix' into master
Ivan Maidanski [Tue, 29 Nov 2011 17:46:44 +0000 (21:46 +0400)]
Generalize acquire/release/full CAS primitives for MIPS
* src/atomic_ops/sysdeps/gcc/mips.h (AO_compare_and_swap_acquire,
AO_compare_and_swap_release, AO_compare_and_swap_full): Remove as
generalized; add comment.
Ivan Maidanski [Tue, 29 Nov 2011 17:11:06 +0000 (21:11 +0400)]
Include ao_t_is_int.h from atomic_ops.h after first generalization if
AO_T_IS_INT (new macro) is defined in 'sysdeps' file
* src/atomic_ops.h (AO_T_IS_INT): Test macro after first
generalization, if set then include ao_t_is_int.h file and force
AO_GENERALIZE_TWICE.
* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_T_IS_INT): Define new macro
instead of ao_t_is_int.h inclusion.
* src/atomic_ops/sysdeps/gcc/ia64.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/gcc/m68k.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/hpc/ia64.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/msftc/x86.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/gcc/powerpc.h: Add place-holder comment (in
case of ppc64).
* src/atomic_ops/sysdeps/gcc/hexagon.h: Do not include generalize.h
any longer (since ao_t_is_int.h is included from atomic_ops.h now).
* src/atomic_ops/sysdeps/gcc/ia64.h: Likewise.
* src/atomic_ops/sysdeps/hpc/ia64.h: Likewise.
Ivan Maidanski [Tue, 29 Nov 2011 16:36:56 +0000 (20:36 +0400)]
Fix generalization for IA-64, Hexagon (include generalize.h before
ao_t_is_int.h to have AO_or, AO_..._read/write and some other
int-derived primitives got defined)
* src/atomic_ops/sysdeps/gcc/hexagon.h: Include generalize.h file
before ao_t_is_int.h one.
* src/atomic_ops/sysdeps/gcc/ia64.h: Likewise.
* src/atomic_ops/sysdeps/hpc/ia64.h: Likewise.
Ivan Maidanski [Mon, 28 Nov 2011 15:28:00 +0000 (19:28 +0400)]
Merge branch 'ao_val_cas'
Ivan Maidanski [Fri, 18 Nov 2011 08:36:56 +0000 (12:36 +0400)]
Remove "function untested" notes in code for PowerPC
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_compare_and_swap,
AO_fetch_compare_and_swap, AO_fetch_and_add): Remove FIXME.
Andreas Tobler [Fri, 18 Nov 2011 08:29:06 +0000 (12:29 +0400)]
Fix AO_fetch_compare_and_swap (PowerPC) inline asm syntax
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_fetch_compare_and_swap):
Remove commas after "fetched_val" inline asm parameter.
Ivan Maidanski [Mon, 14 Nov 2011 13:21:03 +0000 (17:21 +0400)]
Merge branch 'master' into ao_val_cas
Ivan Maidanski [Mon, 14 Nov 2011 13:19:50 +0000 (17:19 +0400)]
Define 'w' local variable in test_atomic_include.h only if used
* tests/test_atomic_include.template (test_atomicXX): Define "w" local
variable only if AO_HAVE_compare_[double_]and_swap_double.
Ivan Maidanski [Wed, 9 Nov 2011 17:04:37 +0000 (21:04 +0400)]
Add AO_GENERALIZE_ASM_BOOL_CAS new macro to allow AO_compare_and_swap
definition via AO_fetch_compare_and_swap instead of own ASM-based one
* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_compare_and_swap): Do not
define if AO_GENERALIZE_ASM_BOOL_CAS.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_compare_and_swap): Likewise.
* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_compare_and_swap):
Likewise.
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_compare_and_swap,
AO_compare_and_swap_acquire, AO_compare_and_swap_release,
AO_compare_and_swap_full): Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_compare_and_swap_full):
Likewise.
* src/atomic_ops/sysdeps/gcc/x86_64.h (AO_compare_and_swap_full):
Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h (AO_compare_and_swap_full):
Likewise.
* src/atomic_ops/sysdeps/sunc/x86_64.h (AO_compare_and_swap_full):
Likewise.
Ivan Maidanski [Wed, 9 Nov 2011 15:55:03 +0000 (19:55 +0400)]
Update ChangeLog file