diff options
author | Tobias Rapp <tobias.rapp@student.kit.edu> | 2013-09-09 14:41:05 +0200 |
---|---|---|
committer | Tobias Rapp <tobias.rapp@student.kit.edu> | 2013-09-09 14:41:05 +0200 |
commit | bfc267952aab24e9fb08954d38c4b889abaa2f11 (patch) | |
tree | 9d248fb3862d409be142da651a2b43d76d11d27f | |
parent | 860c1d90ca4aeb4083b05783f67313f94e7623fe (diff) |
Replaced libatomic_ops with source only version
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | libatomic_ops-install/lib/libatomic_ops.a | bin | 18392 -> 0 bytes | |||
-rw-r--r-- | libatomic_ops-install/lib/libatomic_ops_gpl.a | bin | 16002 -> 0 bytes | |||
-rw-r--r-- | libatomic_ops-install/lib/pkgconfig/atomic_ops.pc | 10 | ||||
-rw-r--r-- | libatomic_ops-install/share/libatomic_ops/LICENSING.txt | 63 | ||||
-rw-r--r-- | libatomic_ops-install/share/libatomic_ops/README.txt | 246 | ||||
-rw-r--r-- | libatomic_ops-install/share/libatomic_ops/README_malloc.txt | 57 | ||||
-rw-r--r-- | libatomic_ops-install/share/libatomic_ops/README_stack.txt | 78 | ||||
-rw-r--r-- | libatomic_ops-install/share/libatomic_ops/README_win32.txt | 31 | ||||
-rw-r--r-- | libatomic_ops/AUTHORS | 40 | ||||
-rw-r--r-- | libatomic_ops/COPYING (renamed from libatomic_ops-install/share/libatomic_ops/COPYING) | 0 | ||||
-rw-r--r-- | libatomic_ops/ChangeLog | 309 | ||||
-rw-r--r-- | libatomic_ops/Makefile | 13 | ||||
-rw-r--r-- | libatomic_ops/README | 55 | ||||
-rw-r--r-- | libatomic_ops/TODO | 13 | ||||
-rw-r--r-- | libatomic_ops/libatomic_ops.a | bin | 0 -> 5514 bytes | |||
-rw-r--r-- | libatomic_ops/src/.deps/atomic_ops.Plo | 171 | ||||
-rw-r--r-- | libatomic_ops/src/.deps/atomic_ops_malloc.Plo | 161 | ||||
-rw-r--r-- | libatomic_ops/src/.deps/atomic_ops_stack.Plo | 140 | ||||
-rw-r--r-- | libatomic_ops/src/.deps/atomic_ops_sysdeps.Plo | 1 | ||||
-rw-r--r-- | libatomic_ops/src/.libs/libatomic_ops.a | bin | 0 -> 21802 bytes | |||
-rw-r--r-- | libatomic_ops/src/.libs/libatomic_ops.lai | 41 | ||||
-rw-r--r-- | libatomic_ops/src/.libs/libatomic_ops_gpl.a | bin | 0 -> 21012 bytes | |||
-rw-r--r-- | libatomic_ops/src/.libs/libatomic_ops_gpl.lai | 41 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops.c | 253 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops.h (renamed from libatomic_ops-install/include/atomic_ops.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/ao_version.h (renamed from libatomic_ops-install/include/atomic_ops/ao_version.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/generalize-arithm.h (renamed from libatomic_ops-install/include/atomic_ops/generalize-arithm.h) | 8 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/generalize-arithm.template | 845 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/generalize-small.h (renamed from libatomic_ops-install/include/atomic_ops/generalize-small.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/generalize-small.template | 520 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/generalize.h (renamed from libatomic_ops-install/include/atomic_ops/generalize.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/README | 7 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/all_acquire_release_volatile.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/all_aligned_atomic_load_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/all_atomic_load_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/all_atomic_only_load.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/all_atomic_only_load.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/ao_t_is_int.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.template | 92 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/armcc/arm_v6.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/armcc/arm_v6.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/emul_cas.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/aarch64.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/aarch64.h) | 25 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/alpha.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/arm.h) | 44 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/avr32.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/cris.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic-arithm.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.template | 44 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic-small.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.template | 70 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/generic.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/hexagon.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/hexagon.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/hppa.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/ia64.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/m68k.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/mips.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/mips.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/powerpc.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/s390.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/sh.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/sh.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/sparc.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/gcc/x86.h) | 4 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/generic_pthread.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/hpc/hppa.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/hpc/ia64.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/ibmc/powerpc.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/icc/ia64.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template | 61 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/atomic_load.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.template | 37 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/atomic_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.template | 35 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_atomic_load.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_atomic_load.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_atomic_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_atomic_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_atomic_load.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_atomic_load.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_atomic_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_atomic_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/ordered_loads_only.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template | 27 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/ordered_stores_only.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template | 27 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_atomic_load.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_atomic_load.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_atomic_store.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_atomic_store.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/msftc/arm.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/msftc/arm.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/msftc/common32_defs.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/msftc/common32_defs.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/msftc/x86.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/msftc/x86_64.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/msftc/x86_64.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/ordered.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/ordered.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/ordered_except_wr.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/read_ordered.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/read_ordered.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/standard_ao_double_t.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S | 5 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/sunc/sparc.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/sunc/x86.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/sunc/x86.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h (renamed from libatomic_ops-install/include/atomic_ops/sysdeps/test_and_set_t_is_char.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops_malloc.c | 305 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops_malloc.h (renamed from libatomic_ops-install/include/atomic_ops_malloc.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops_stack.c | 281 | ||||
-rw-r--r-- | libatomic_ops/src/atomic_ops_stack.h (renamed from libatomic_ops-install/include/atomic_ops_stack.h) | 0 | ||||
-rw-r--r-- | libatomic_ops/src/config.h.in | 149 |
104 files changed, 3803 insertions, 509 deletions
@@ -12,6 +12,8 @@ *.o *.obj +build/* + /*.gc.log /.deps/ /.libs/ @@ -61,7 +63,6 @@ config.h.in~ stamp-h1 # External library (without trailing slash to allow symlinks): -/libatomic_ops* /pthreads-w32* # These files are generated by autoreconf: diff --git a/libatomic_ops-install/lib/libatomic_ops.a b/libatomic_ops-install/lib/libatomic_ops.a Binary files differdeleted file mode 100644 index 4a63f4d..0000000 --- a/libatomic_ops-install/lib/libatomic_ops.a +++ /dev/null diff --git a/libatomic_ops-install/lib/libatomic_ops_gpl.a b/libatomic_ops-install/lib/libatomic_ops_gpl.a Binary files differdeleted file mode 100644 index 3c68afa..0000000 --- a/libatomic_ops-install/lib/libatomic_ops_gpl.a +++ /dev/null diff --git a/libatomic_ops-install/lib/pkgconfig/atomic_ops.pc b/libatomic_ops-install/lib/pkgconfig/atomic_ops.pc deleted file mode 100644 index 853cc04..0000000 --- a/libatomic_ops-install/lib/pkgconfig/atomic_ops.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/tobias/bdwgc/libatomic_ops-install -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: The atomic_ops library -Description: Atomic memory update operations portable implementation -Version: 7.3alpha3 -Libs: -L${libdir} -latomic_ops -Cflags: -I${includedir} diff --git a/libatomic_ops-install/share/libatomic_ops/LICENSING.txt b/libatomic_ops-install/share/libatomic_ops/LICENSING.txt deleted file mode 100644 index c6e1640..0000000 --- a/libatomic_ops-install/share/libatomic_ops/LICENSING.txt +++ /dev/null @@ -1,63 +0,0 @@ -Our intent is to make it easy to use libatomic_ops, in -both free and proprietary software. Hence most code that we expect to be -linked into a client application is covered by an MIT-style license. - -A few library routines are covered by the GNU General Public License. -These are put into a separate library, libatomic_ops_gpl.a . - -The low-level part of the library is mostly covered by the following -license: - ----------------------------------------- - -Copyright (c) ... - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - --------------------------------- - -A few files in the sysdeps directory were inherited in part from the -Boehm-Demers-Weiser conservative garbage collector, and are covered by -its license, which is similar in spirit: - --------------------------------- - -Copyright (c) ... - -THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - -Permission is hereby granted to use or copy this program -for any purpose, provided the above notices are retained on all copies. -Permission to modify the code and to distribute modified code is granted, -provided the above notices are retained, and a notice that the code was -modified is included with the above copyright notice. - ----------------------------------- - -A few files are covered by the GNU General Public License. (See file -"COPYING".) This applies only to test code, sample applications, -and the libatomic_ops_gpl portion of the library. -Thus libatomic_ops_gpl should generally not be linked into proprietary code. -(This distinction was motivated by patent considerations.) - -It is possible that the license of the GPL pieces may be changed for -future versions to make them more consistent with the rest of the package. -If you submit patches, and have strong preferences about licensing, please -express them. diff --git a/libatomic_ops-install/share/libatomic_ops/README.txt b/libatomic_ops-install/share/libatomic_ops/README.txt deleted file mode 100644 index 0047092..0000000 --- a/libatomic_ops-install/share/libatomic_ops/README.txt +++ /dev/null @@ -1,246 +0,0 @@ -Usage: - -0) If possible, do this on a multiprocessor, especially if you are planning -on modifying or enhancing the package. It will work on a uniprocessor, -but the tests are much more likely to pass in the presence of serious problems. - -1) Type ./configure --prefix=<install dir>; make; make check -in the directory containing unpacked source. The usual GNU build machinery -is used, except that only static, but position-independent, libraries -are normally built. On Windows, read README_win32.txt instead. - -2) Applications should include atomic_ops.h. Nearly all operations -are implemented by header files included from it. It is sometimes -necessary, and always recommended to also link against libatomic_ops.a. -To use the almost non-blocking stack or malloc implementations, -see the corresponding README files, and also link against libatomic_gpl.a -before linking against libatomic_ops.a. - -OVERVIEW: -Atomic_ops.h defines a large collection of operations, each one of which is -a combination of an (optional) atomic memory operation, and a memory barrier. -Also defines associated feature-test macros to determine whether a particular -operation is available on the current target hardware (either directly or -by synthesis). This is an attempt to replace various existing files with -similar goals, since they usually do not handle differences in memory -barrier styles with sufficient generality. - -If this is included after defining AO_REQUIRE_CAS, then the package -will make an attempt to emulate compare-and-swap in a way that (at least -on Linux) should still be async-signal-safe. As a result, most other -atomic operations will then be defined using the compare-and-swap -emulation. This emulation is slow, since it needs to disable signals. -And it needs to block in case of contention. If you care about performance -on a platform that can't directly provide compare-and-swap, there are -probably better alternatives. But this allows easy ports to some such -platforms (e.g. PA_RISC). The option is ignored if compare-and-swap -can be implemented directly. - -If atomic_ops.h is included after defining AO_USE_PTHREAD_DEFS, then all -atomic operations will be emulated with pthread locking. This is NOT -async-signal-safe. And it is slow. It is intended primarily for debugging -of the atomic_ops package itself. - -Note that the implementation reflects our understanding of real processor -behavior. This occasionally diverges from the documented behavior. (E.g. -the documented X86 behavior seems to be weak enough that it is impractical -to use. Current real implementations appear to be much better behaved.) -We of course are in no position to guarantee that future processors -(even HPs) will continue to behave this way, though we hope they will. - -This is a work in progress. Corrections/additions for other platforms are -greatly appreciated. It passes rudimentary tests on X86, Itanium, and -Alpha. - -OPERATIONS: - -Most operations operate on values of type AO_t, which are unsigned integers -whose size matches that of pointers on the given architecture. Exceptions -are: - -- AO_test_and_set operates on AO_TS_t, which is whatever size the hardware -supports with good performance. In some cases this is the length of a cache -line. In some cases it is a byte. In many cases it is equivalent to AO_t. - -- A few operations are implemented on smaller or larger size integers. -Such operations are indicated by the appropriate prefix: - -AO_char_... Operates on unsigned char values. -AO_short_... Operates on unsigned short values. -AO_int_... Operates on unsigned int values. - -(Currently a very limited selection of these is implemented. We're -working on it.) - -The defined operations are all of the form AO_[<size>_]<op><barrier>(<args>). - -The <op> component specifies an atomic memory operation. It may be -one of the following, where the corresponding argument and result types -are also specified: - -void nop() - No atomic operation. The barrier may still be useful. -AO_t load(const volatile AO_t * addr) - Atomic load of *addr. -void store(volatile AO_t * addr, AO_t new_val) - Atomically store new_val to *addr. -AO_t fetch_and_add(volatile AO_t *addr, AO_t incr) - Atomically add incr to *addr, and return the original value of *addr. -AO_t fetch_and_add1(volatile AO_t *addr) - Equivalent to AO_fetch_and_add(addr, 1). -AO_t fetch_and_sub1(volatile AO_t *addr) - Equivalent to AO_fetch_and_add(addr, (AO_t)(-1)). -void and(volatile AO_t *addr, AO_t value) - Atomically 'and' value into *addr. -void or(volatile AO_t *addr, AO_t value) - Atomically 'or' value into *addr. -void xor(volatile AO_t *addr, AO_t value) - Atomically 'xor' value into *addr. -int compare_and_swap(volatile AO_t * addr, AO_t old_val, AO_t new_val) - Atomically compare *addr to old_val, and replace *addr by new_val - if the first comparison succeeds. Returns nonzero if the comparison - succeeded and *addr was updated. -AO_t fetch_compare_and_swap(volatile AO_t * addr, AO_t old_val, AO_t new_val) - Atomically compare *addr to old_val, and replace *addr by new_val - if the first comparison succeeds; returns the original value of *addr. -AO_TS_VAL_t test_and_set(volatile AO_TS_t * addr) - Atomically read the binary value at *addr, and set it. AO_TS_VAL_t - is an enumeration type which includes two values AO_TS_SET and - AO_TS_CLEAR. An AO_TS_t location is capable of holding an - AO_TS_VAL_t, but may be much larger, as dictated by hardware - constraints. Test_and_set logically sets the value to AO_TS_SET. - It may be reset to AO_TS_CLEAR with the AO_CLEAR(AO_TS_t *) macro. - AO_TS_t locations should be initialized to AO_TS_INITIALIZER. - The values of AO_TS_SET and AO_TS_CLEAR are hardware dependent. - (On PA-RISC, AO_TS_SET is zero!) - -Test_and_set is a more limited version of compare_and_swap. Its only -advantage is that it is more easily implementable on some hardware. It -should thus be used if only binary test-and-set functionality is needed. - -If available, we also provide compare_and_swap operations that operate -on wider values. Since standard data types for double width values -may not be available, these explicitly take pairs of arguments for the -new and/or old value. Unfortunately, there are two common variants, -neither of which can easily and efficiently emulate the other. -The first performs a comparison against the entire value being replaced, -where the second replaces a double-width replacement, but performs -a single-width comparison: - -int compare_double_and_swap_double(volatile AO_double_t * addr, - AO_t old_val1, AO_t old_val2, - AO_t new_val1, AO_t new_val2); - -int compare_and_swap_double(volatile AO_double_t * addr, - AO_t old_val1, - AO_t new_val1, AO_t new_val2); - -where AO_double_t is a structure containing AO_val1 and AO_val2 fields, -both of type AO_t. For compare_and_swap_double, we compare against -the val1 field. AO_double_t exists only if AO_HAVE_double_t -is defined. - -ORDERING CONSTRAINTS: - -Each operation name also includes a suffix that specifies the associated -ordering semantics. The ordering constraint limits reordering of this -operation with respect to other atomic operations and ordinary memory -references. The current implementation assumes that all memory references -are to ordinary cacheable memory; the ordering guarantee is with respect -to other threads or processes, not I/O devices. (Whether or not this -distinction is important is platform-dependent.) - -Ordering suffixes are one of the following: - -<none>: No memory barrier. A plain AO_nop() really does nothing. -_release: Earlier operations must become visible to other threads - before the atomic operation. -_acquire: Later operations must become visible after this operation. -_read: Subsequent reads must become visible after reads included in - the atomic operation or preceding it. Rarely useful for clients? -_write: Earlier writes become visible before writes during or after - the atomic operation. Rarely useful for clients? -_full: Ordered with respect to both earlier and later memory ops. - AO_store_full or AO_nop_full are the normal ways to force a store - to be ordered with respect to a later load. -_release_write: Ordered with respect to earlier writes. This is - normally implemented as either a _write or _release - barrier. -_acquire_read: Ordered with respect to later reads. This is - normally implemented as either a _read or _acquire barrier. -_dd_acquire_read: Ordered with respect to later reads that are data - dependent on this one. This is needed on - a pointer read, which is later dereferenced to read a - second value, with the expectation that the second - read is ordered after the first one. On most architectures, - this is equivalent to no barrier. (This is very - hard to define precisely. It should probably be avoided. - A major problem is that optimizers tend to try to - eliminate dependencies from the generated code, since - dependencies force the hardware to execute the code - serially.) - -We assume that if a store is data-dependent on an a previous load, then -the two are always implicitly ordered. - -It is possible to test whether AO_<op><barrier> is available on the -current platform by checking whether AO_HAVE_<op>_<barrier> is defined -as a macro. - -Note that we generally don't implement operations that are either -meaningless (e.g. AO_nop_acquire, AO_nop_release) or which appear to -have no clear use (e.g. AO_load_release, AO_store_acquire, AO_load_write, -AO_store_read). On some platforms (e.g. PA-RISC) many operations -will remain undefined unless AO_REQUIRE_CAS is defined before including -the package. - -When typed in the package build directory, the following command -will print operations that are unimplemented on the platform: - -make test_atomic; ./test_atomic - -The following command generates a file "list_atomic.i" containing the -macro expansions of all implemented operations on the platform: - -make list_atomic.i - -Future directions: - -It currently appears that something roughly analogous to this is very likely -to become part of the C++0x standard. That effort has pointed out a number -of issues that we expect to address there. Since some of the solutions -really require compiler support, they may not be completely addressed here. - -Known issues include: - -We should be more precise in defining the semantics of the ordering -constraints, and if and how we can guarantee sequential consistency. - -Dd_acquire_read is very hard or impossible to define in a way that cannot -be invalidated by reasonably standard compiler transformations. - -There is probably no good reason to provide operations on standard -integer types, since those may have the wrong alignment constraints. - - -Example: - -If you want to initialize an object, and then "publish" a pointer to it -in a global location p, such that other threads reading the new value of -p are guaranteed to see an initialized object, it suffices to use -AO_release_write(p, ...) to write the pointer to the object, and to -retrieve it in other threads with AO_acquire_read(p). - -Platform notes: - -All X86: We quietly assume 486 or better. - -Microsoft compilers: -Define AO_ASSUME_WINDOWS98 to get access to hardware compare-and-swap -functionality. This relies on the InterlockedCompareExchange() function -which was apparently not supported in Windows95. (There may be a better -way to get access to this.) - -Gcc on x86: -Define AO_USE_PENTIUM4_INSTRS to use the Pentium 4 mfence instruction. -Currently this is appears to be of marginal benefit. diff --git a/libatomic_ops-install/share/libatomic_ops/README_malloc.txt b/libatomic_ops-install/share/libatomic_ops/README_malloc.txt deleted file mode 100644 index ec4ed89..0000000 --- a/libatomic_ops-install/share/libatomic_ops/README_malloc.txt +++ /dev/null @@ -1,57 +0,0 @@ -The libatomic_ops_gpl includes a simple almost-lock-free malloc implementation. - -This is intended as a safe way to allocate memory from a signal handler, -or to allocate memory in the context of a library that does not know what -thread library it will be used with. In either case locking is impossible. - -Note that the operations are only guaranteed to be 1-lock-free, i.e. a -single blocked thread will not prevent progress, but multiple blocked -threads may. To safely use these operations in a signal handler, -the handler should be non-reentrant, i.e. it should not be interruptable -by another handler using these operations. Furthermore use outside -of signal handlers in a multithreaded application should be protected -by a lock, so that at most one invocation may be interrupted by a signal. -The header will define the macro "AO_MALLOC_IS_LOCK_FREE" on platforms -on which malloc is completely lock-free, and hence these restrictions -do not apply. - -In the presence of threads, but absence of contention, the time performance -of this package should be as good, or slightly better than, most system -malloc implementations. Its space performance -is theoretically optimal (to within a constant factor), but probably -quite poor in practice. In particular, no attempt is made to -coalesce free small memory blocks. Something like Doug Lea's malloc is -likely to use significantly less memory for complex applications. - -Performance on platforms without an efficient compare-and-swap implementation -will be poor. - -This package was not designed for processor-scalability in the face of -high allocation rates. If all threads happen to allocate different-sized -objects, you might get lucky. Otherwise expect contention and false-sharing -problems. If this is an issue, something like Maged Michael's algorithm -(PLDI 2004) would be technically a far better choice. If you are concerned -only with scalability, and not signal-safety, you might also consider -using Hoard instead. We have seen a factor of 3 to 4 slowdown from the -standard glibc malloc implementation with contention, even when the -performance without contention was faster. (To make the implementation -more scalable, one would need to replicate at least the free list headers, -so that concurrent access is possible without cache conflicts.) - -Unfortunately there is no portable async-signal-safe way to obtain large -chunks of memory from the OS. Based on reading of the source code, -mmap-based allocation appears safe under Linux, and probably BSD variants. -It is probably unsafe for operating systems built on Mach, such as -Apple's Darwin. Without use of mmap, the allocator is -limited to a fixed size, statically preallocated heap (2MB by default), -and will fail to allocate objects above a certain size (just under 64K -by default). Use of mmap to circumvent these limitations requires an -explicit call. - -The entire interface to the AO_malloc package currently consists of: - -#include <atomic_ops_malloc.h> /* includes atomic_ops.h */ - -void *AO_malloc(size_t sz); -void AO_free(void *p); -void AO_malloc_enable_mmap(void); diff --git a/libatomic_ops-install/share/libatomic_ops/README_stack.txt b/libatomic_ops-install/share/libatomic_ops/README_stack.txt deleted file mode 100644 index 52edbb5..0000000 --- a/libatomic_ops-install/share/libatomic_ops/README_stack.txt +++ /dev/null @@ -1,78 +0,0 @@ -Note that the AO_stack implementation is licensed under the GPL, -unlike the lower level routines. - -The header file atomic_ops_stack.h defines a linked stack abstraction. -Stacks may be accessed by multiple concurrent threads. The implementation -is 1-lock-free, i.e. it will continue to make progress if at most one -thread becomes inactive while operating on the data structure. - -(The implementation can be built to be N-lock-free for any given N. But that -seems to rarely be useful, especially since larger N involve some slowdown.) - -This makes it safe to access these data structures from non-reentrant -signal handlers, provided at most one non-signal-handler thread is -accessing the data structure at once. This latter condition can be -ensured by acquiring an ordinary lock around the non-handler accesses -to the data structure. - -For details see: - -Hans-J. Boehm, "An Almost Non-Blocking Stack", PODC 2004, -http://portal.acm.org/citation.cfm?doid=1011767.1011774, or -http://www.hpl.hp.com/techreports/2004/HPL-2004-105.html -(This is not exactly the implementation described there, since the -interface was cleaned up in the interim. But it should perform -very similarly.) - -We use a fully lock-free implementation when the underlying hardware -makes that less expensive, i.e. when we have a double-wide compare-and-swap -operation available. (The fully lock-free implementation uses an AO_t- -sized version count, and assumes it does not wrap during the time any -given operation is active. This seems reasonably safe on 32-bit hardware, -and very safe on 64-bit hardware.) If a fully lock-free implementation -is used, the macro AO_STACK_IS_LOCK_FREE will be defined. - -The implementation is interesting only because it allows reuse of -existing nodes. This is necessary, for example, to implement a memory -allocator. - -Since we want to leave the precise stack node type up to the client, -we insist only that each stack node contains a link field of type AO_t. -When a new node is pushed on the stack, the push operation expects to be -passed the pointer to this link field, which will then be overwritten by -this link field. Similarly, the pop operation returns a pointer to the -link field of the object that previously was on the top of the stack. - -The cleanest way to use these routines is probably to define the stack node -type with an initial AO_t link field, so that the conversion between the -link-field pointer and the stack element pointer is just a compile-time -cast. But other possibilities exist. (This would be cleaner in C++ with -templates.) - -A stack is represented by an AO_stack_t structure. (This is normally -2 or 3 times the size of a pointer.) It may be statically initialized -by setting it to AO_STACK_INITIALIZER, or dynamically initialized to -an empty stack with AO_stack_init. There are only three operations for -accessing stacks: - -void AO_stack_init(AO_stack_t *list); -void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); -AO_t * AO_stack_pop_acquire(volatile AO_stack_t *list); - -We require that the objects pushed as list elements remain addressable -as long as any push or pop operation are in progress. (It is OK for an object -to be "pop"ped off a stack and "deallocated" with a concurrent "pop" on -the same stack still in progress, but only if "deallocation" leaves the -object addressable. The second "pop" may still read the object, but -the value it reads will not matter.) - -We require that the headers (AO_stack objects) remain allocated and -valid as long as any operations on them are still in-flight. - -We also provide macros AO_REAL_HEAD_PTR that converts an AO_stack_t -to a pointer to the link field in the next element, and AO_REAL_NEXT_PTR -that converts a link field to a real, dereferencable, pointer to the link field -in the next element. This is intended only for debugging, or to traverse -the list after modification has ceased. There is otherwise no guarantee that -walking a stack using this macro will produce any kind of consistent -picture of the data structure. diff --git a/libatomic_ops-install/share/libatomic_ops/README_win32.txt b/libatomic_ops-install/share/libatomic_ops/README_win32.txt deleted file mode 100644 index e2b87ad..0000000 --- a/libatomic_ops-install/share/libatomic_ops/README_win32.txt +++ /dev/null @@ -1,31 +0,0 @@ -Most of the atomic_ops functionality is available under Win32 with -the Microsoft tools, but the build process currently is considerably more -primitive than on Linux/Unix platforms. - -To build: - -1) Go to the src directory in the distribution. -2) Make sure the Microsoft command-line tools (e.g. nmake) are available. -3) Run "nmake -f Makefile.msft". This should run some tests, which -may print warnings about the types of the "Interlocked" functions. -I haven't been able to make all versions of VC++ happy. If you know -how to, please send a patch. -4) To compile applications, you will need to retain or copy the following -pieces from the resulting src directory contents: - "atomic_ops.h" - Header file defining low-level primitives. This - includes files from: - "atomic_ops"- Subdirectory containing implementation header files. - "atomic_ops_stack.h" - Header file describing almost lock-free stack. - "atomic_ops_malloc.h" - Header file describing almost lock-free malloc. - "libatomic_ops_gpl.lib" - Library containing implementation of the - above two (plus AO_pause() defined in atomic_ops.c). - The atomic_ops.h implementation is entirely in the - header files in Win32. - -Most clients of atomic_ops.h will need to define AO_ASSUME_WINDOWS98 before -including it. Compare_and_swap is otherwise not available. -Defining AO_ASSUME_VISTA will make compare_double_and_swap_double available -as well. - -Note that the library is covered by the GNU General Public License, while -the top 2 of these pieces allow use in proprietary code. diff --git a/libatomic_ops/AUTHORS b/libatomic_ops/AUTHORS new file mode 100644 index 0000000..0186eaa --- /dev/null +++ b/libatomic_ops/AUTHORS @@ -0,0 +1,40 @@ +Originally written by Hans Boehm, with some platform-dependent code +imported from the Boehm-Demers-Weiser GC, where it was contributed +by many others. +Currently maintained by Ivan Maidanski. + +Andreas Tobler <a.tobler@schweiz.org> +Andrew Agno <agno+boehmgc@agno.net> +Bradley Smith <brad@brad-smith.co.uk> +Bruce Mitchener <bruce.mitchener@gmail.com> +Carlos O'Donell <carlos@baldric.uwo.ca> +Daniel Grayson <dan@math.uiuc.edu> +Doug Lea <dl@cs.oswego.edu> +Earl Chew <earl_chew@agilent.com> +Emmanuel Stapf <manus@eiffel.com> +Gilles Talis <gilles.talis@gmail.com> +Gregory Farnum <gregory.farnum@dreamhost.com> +H.J. Lu <hjl.tools@gmail.com> +Hans Boehm <Hans.Boehm@hp.com> +Hans-Peter Nilsson <hp@gcc.gnu.org> +Ian Wienand <ianw@gelato.unsw.edu.au> +Ivan Maidanski <ivmai@mail.ru> +Jeremy Huddleston <jeremyhu@apple.com> +Jim Marshall <jim.marshall@wbemsolutions.com> +Joerg Wagner <wagner@it.neclab.eu> +Linas Vepstas <linasvepstas@gmail.com> +Luca Barbato <lu_zero@gentoo.org> +Maged Michael <michael@cs.rochester.edu> +Manuel Serrano <Manuel.Serrano@inria.fr> +Michael Hope <michael.hope@linaro.org> +Patrick Marlier <patrick.marlier@unine.ch> +Petter Urkedal <urkedal@nbi.dk> +Philipp Zambelli <pzamb@iicm.edu> +Ranko Zivojnovic <ranko@spidernet.net> +Roger Hoover <roger.hoover@gmail.com> +Sebastian Siewior <sebastian@breakpoint.cc> +Takashi Yoshii <takashi.yoshii.zj@renesas.com> +Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> +Thorsten Glaser <tg@debian.org> +Tony Mantler <nicoya@ubb.ca> +Yvan Roux <yvan.roux@linaro.org> diff --git a/libatomic_ops-install/share/libatomic_ops/COPYING b/libatomic_ops/COPYING index d60c31a..d60c31a 100644 --- a/libatomic_ops-install/share/libatomic_ops/COPYING +++ b/libatomic_ops/COPYING diff --git a/libatomic_ops/ChangeLog b/libatomic_ops/ChangeLog new file mode 100644 index 0000000..ff23294 --- /dev/null +++ b/libatomic_ops/ChangeLog @@ -0,0 +1,309 @@ + +== [7.3alpha4] (development) == + +* Add and/or/xor entries to list_atomic (tests). +* Add char/short/int/AO_double_t and dd_acquire cases to list_atomic (tests). +* Add compile-time assertion for size of 'standard' AO_double_t. +* Add double_store pthread-based implementation and tests. +* Add generalized CAS primitives of char/short/int size. +* Add generalized atomic and/or/xor operations for char/short/int types. +* Add generalized fetch_and_add_acquire/release (for ARMv6+). +* Add generic implementation of double_load primitives. +* Add information about AO_ASSUME_VISTA to README_win32. +* Add internal header containing only char/short/int/AO_t atomic loads. +* Add load/store primitives generalization based on CAS. +* Add lock-based implementation of char/short/int_fetch_compare_and_swap. +* Add makefile rule to test list_atomic.template syntax (tests). +* Add missing 'const' in aligned-atomic XSIZE_load implementation. +* Add missing double_compare_and_swap to generalization. +* Add missing generalization of no-barrier CAS in template. +* Add negative double-CAS test cases to test_atomic_include (tests). +* Add test_stack to Makefile.msft (tests). +* Adjust fprintf arguments type matching specifier in test_stack (tests). +* Adjust included filenames in atomic_ops_malloc and test_stack. +* Adjust quotes in echo command of Makefile.msft (Win32). +* Always use 'mfence' for nop_full if target CPU supports SSE2 (gcc/x86). +* Better document configure THREADDLLIBS variable. +* Cast away volatile on dereference in CAS-based generalization primitives. +* Define AO_NO_PTHREADS in configure if no pthreads (Win32 and VxWorks). +* Define AO_int_X operations for ARM and avr32. +* Define double-wide ordered loads/stores for x86. +* Define int_and/or/xor primitives in ao_t_is_int header. +* Define nop_full as compiler barrier for pre-ARMv6 single-core case. +* Do not duplicate BUILT_SOURCES entries in nobase_private_HEADERS (Makefile). +* Do not include standard_ao_double_t.h where double-CAS is unimplemented. +* Do not report absence of meaningless nop, load and store in test_atomic. +* Do not use deprecated AO_T and AO_TS_T (tests). +* Eliminate 'missing initializer' warning for AO_stack_t value initializer. +* Eliminate 64-bit compiler warnings in atomic_ops_malloc. +* Eliminate arithmetic shifts in double-CAS (gcc/arm, msftc/x86). +* Eliminate warning for fetch_and_add argument in test_atomic_include (tests). +* Enable Makefile.msft for Win64. +* Enable build using toolchain without pthreads. +* Enable double_compare_and_swap for non-cpp code (msftc/x86.h). +* Enable generalization of all variants of CAS via fetch_compare_and_swap. +* Enable test_stack for pthreads-w32 and Win32 with native threads. +* Fix generalized AO_char/short_compare_and_swap args (missing 'unsigned'). +* Fix makefile sed rule for list_atomic (tests). +* Fix missing abort() usage in atomic_ops_malloc and tests on WinCE. +* Generalize compare_double_and_swap_double using double_compare_and_swap. +* Generalize double_load/store for x86_64 (GCC). +* Generate ao_t_is_int, 'loadstore' headers from templates. +* Generate generalized AO_t load/store/fetch_and_add primitives from template. +* Generate ordered_loads/stores_only headers from templates. +* Group all X_acquire_release_volatile.h and X_[aligned_]atomic_load_store.h. +* Implement and/or/xor, AO_double_load for ARM. +* Implement atomic store using direct write by default on ARMv6+. +* Implement char/short/int-wide primitives using GCC built-in atomic/sync. +* Implement char/short/int_fetch_and_add for msftc/x86[_64] (Win32). +* Implement char/short_fetch_and_add, char/short_load for ARMv6+ (GCC). +* Implement char/short_store primitives at aligned addresses for ARM. +* Implement compare_double_and_swap_double for SunCC/x86. +* Implement double_load/store based on guaranteed x86 access atomicity. +* Implement double_store for ARMv7 using LDREXD/STREXD. +* Implement load/store via simple LDR/STR for ARMv6+ (msftc). +* Implement nop_full/write using 'dmb' instruction if available (gcc/arm). +* Improve debug printing in test_stack (tests). +* Log messages to stdout instead of stderr (tests). +* Make AO_ASSUME_VISTA also enables Win98 code in msftc/x86.h (Win32). +* Minimize gcc/generic-arithm template by factoring out barriers. +* Move 'unsigned' keyword to XCTYPE in generalize-small template. +* Move default compiler options to CFLAGS in Makefile.msft (Win32). +* Move definitions of ordered loads/stores to inner separate headers. +* Move gcc-generic AO_t-wide primitives to generic-small/arithm headers. +* Move generalized arithmetical primitives to 'generalize-arithm' template. +* Optimize AO_spin manually to minimize compiler influence on its duration. +* Parameterize list_atomic template with XSIZE (tests). +* Perform only few list reversals in test_malloc if AO based on pthreads. +* Remote duplicate definition of test_and_set_acquire in generalize.h. +* Remove X_aligned_atomic_load_store headers and template. +* Remove duplicate AO_spin and AO_pause definition in atomic_ops_stack. +* Remove gcc/x86_64.h eliminating code duplication of gcc/x86.h. +* Remove nested AO_USE_PTHREAD_DEFS macro check in atomic_ops.h (gcc/arm). +* Remove redundant 'cc' clobber for LDREXD instruction (gcc/arm). +* Remove store_full from msftc/arm.h in favor of generalized primitive. +* Remove sunc/x86_64.h eliminating code duplication of sunc/x86.h. +* Remove unsafe emulation-based implementation of double CAS (SunCC/x86_64). +* Remove useless 'perror' call in run_parallel.h (tests). +* Reorder AO_double_t union elements for AO_DOUBLE_T_INITIALIZER portability. +* Replace atomic_load_store.template with atomic_load and atomic_store ones. +* Replace some FIXME items with TODO in atomic_ops.c and sysdeps headers. +* Specify fetch_and_add/sub1 result as unused in test_atomic (tests). +* Support AArch64 (64-bit ARM) target (GCC). +* Support ARMv8 target (gcc/arm). +* Test double_compare_and_swap in test_atomic (tests). +* Use AO_ prefix for internal functions in arm_v6.h, hppa.h. +* Use __atomic GCC built-in to implement generic double-wide CAS. +* Use built-in __sync CAS for double-CAS if AO_USE_SYNC_CAS_BUILTIN for x86. +* Workaround GCC 4.4.3 warning reported for 'val' of list_atomic.c (tests). + + +== [7.3alpha2] 2012-05-11 == + +* Add '-no-undefined' to LDFLAGS in src/Makefile.am. +* Add AO_and, AO_xor atomic operations. +* Add AO_fetch_compare_and_swap primitives. +* Add and fill in AUTHORS, TODO files. +* Add autogen.sh file. +* Adjust AO_..._H macros in public headers. +* Code refactoring of gcc/arm.h by introducing AO_ARM_HAVE_x macros. +* Define AO macros for libatomic_ops version identification. +* Do not define NDEBUG if '--enable-assertions' passed to configure. +* Eliminate compiler warnings in various functions and macros. +* Generalize AO_compare_and_swap primitives via AO_fetch_compare_and_swap. +* Generalize acquire/release/full CAS primitives for MIPS +* Implement fetch_and_add, test_and_set primitives for MIPS. +* Improve Makefile for MS VC++; pass '-W3' option to MS compiler. +* Include ao_t_is_int.h from atomic_ops.h after first generalization pass +* Merge all Makefile.am files in src tree. +* Minor code refactoring of atomic_ops.c, generic_pthread.h. +* Minor configure build improvements (e.g., ensure proper autoconf version). +* Place only major per-release changes description to ChangeLog (this file). +* Recognize AO_PREFER_GENERALIZED macro to favor generalization over assembly. +* Remove all auto-generated files except for generalize-small.h from the repo. +* Remove duplicate doc/COPYING and empty NEWS files. +* Replace atomic_ops_malloc static mmap-related empty functions with macros. +* Replace pointer relational comparisons with non-pointer ones. +* Require autoconf 2.61 instead of v2.64. +* Show extra compiler warnings (GCC only). +* Turn off AO primitives inlining if AO_NO_INLINE defined. +* Use __builtin_expect in CAS failure loop condition checks (GCC only). + + +== [7.2e] (candidate) == + +* Fix (remove) invalid include of read_ordered.h for ARM. +* Fix AM_CONFIG_HEADER in configure for autoconf-2.69-1. +* Fix AO_pause sleep delay for particular argument values (Win32). +* Fix ARMv7 LDREXD/STREXD double-wide operand specification (GCC/Clang). +* Fix LDREXD/STREXD use for pre-Clang3.3/arm. +* Fix README regarding _acquire_read barrier. +* Fix XSIZE_load/store definition order in generalize-small template. +* Fix asm constraint of CAS memory operand for gcc/alpha, clang-3.1/mips. +* Fix asm constraints of primitives in sunc/x86.h. +* Fix cmpxchg16b-based compare_double_and_swap_double for SunCC/x86_64. +* Fix compare_double_and_swap_double and double_ptr_storage for gcc/x32. +* Fix compare_double_and_swap_double for clang3.0/x86 in PIC mode. +* Fix compare_double_and_swap_double_full definition condition in emul_cas. +* Fix generalize-small template adding missed CAS-based fetch_and_add. +* Fix generalized fetch_and_add function. +* Fix missing compiler barrier in nop_full for uniprocessor ARM. +* Fix ordered_except_wr header inclusion for s390. +* Fix return type of AO_int_X primitives defined in ao_t_is_int header. +* Fix return type of char/short/int_load_read() in read_ordered.h. +* Fix template-based headers regeneration order in src/Makefile. +* Fix typos in ao_t_is_int, atomic_ops.h, generalize.h, msftc/arm.h comments. +* Fix variable type to match printf format specifier in test_stack. +* Fix visibility and initial value of 'dummy' variable in atomic_ops_stack. +* Terminate tests with abort after error reported. + + +== [7.2d] 2012-08-09 == + +* Fix AO_compare_double_and_swap_double_full for gcc-4.2.1/x86 in PIC mode. +* Fix AO_compiler_barrier missing parentheses. +* Fix missing 'unsigned' for generalized AO_char/short_fetch_and_add result. + + +== [7.2] 2012-05-11 == + +* Add atomic_ops.pc.in and atomic_ops-uninstalled.pc.in to pkgconfig folder. +* Define and use AO_PTRDIFF_T in tests for casts between pointer and integer. +* Fix AO_compare_and_swap return type for s390 and PowerPC. +* Fix AO_compare_double_and_swap_double_full for gcc/x86 (PIC mode). +* Fix AO_stack_push_release to workaround bug in clang-1.1/x86 compiler. +* Fix AO_test_and_setXX in tests/list_atomic.template. +* Fix AO_test_and_set_full (gcc/x86[_64].h) to work-around a bug in LLVM v2.7. +* Fix AO_test_and_set_full on m68k. +* Fix __ARM_ARCH_5__ macro handling for Android NDK (ARMv7). +* Fix configure for Cygwin, mingw-w64/32. +* Fix configure to define __PIC__ macro explicitly if needed (GCC). +* Fix double_ptr_storage definition for GCC pre-v4 (x86_64). +* Fix for x32 by removing 'q' suffix in x86-64 instructions. +* Fix generalization for IA-64 (regarding AO_or, AO_..._read/write primitives) +* Fix generalized AO_<type>_fetch_and_add() return type. +* Fix test_atomic_include for the case of missing CAS primitive. +* Fix test_malloc - allocate less memory in case of missing mmap. +* Implement the basic atomic primitives for the hexagon CPU. + + +== [7.2alpha6] 2011-06-14 == + +* Add missing AO_HAVE_ macros. +* Add support of avr32 CPU. +* Better support of various models of ARM. +* Disable AO_compare_double_and_swap_double_full for SunCC x86 as not working. +* Enable ARM Thumb-2 mode. +* Fix AO_test_and_set_full for SunCC (x86). +* Fix bugs in tests. +* Fix clobbers in AO_compare_and_swap_full (x86.h). +* Fix typos in identifiers and comments. +* Improve AO_sync for PowerPC. +* Improve make scripts (configure.ac). +* Make get_mmaped() in atomic_ops_malloc.c more portable. +* Support Intel compiler. +* Support NaCl target. +* Suppress compiler warnings in various places. +* Test more predefined macros (ARM, PowerPC). +* Use assembly code only for MS VC if available (x86_64). +* Use built-in __sync_bool_compare_and_swap if available (x86_64). +* Workaround bugs in LLVM GCC and SunCC regarding XCHG (x86, x86_64). + + +== [7.2alpha4] 2009-12-02 == + +* Fix typos in comments, identifiers and documentation. +* Implement AO_compare_and_swap_full for SPARC. +* Refine ARM-specific code. +* Refine code and comments for MS VC. +* Regenerate make scripts. +* Share common code for all 32-bit CPUs (MS VC). +* Support DigitalMars and Watcom compilers. +* Support MS VC for ARM (WinCE). +* Support SH CPU. +* Support win32-pthreads. +* Support x86 and x86_64 for SunCC compiler. + + +== [7.2alpha2] 2009-05-27 == + +* Add MIPS support. +* Add better support for m68k. +* Add "const" to first parameter of load calls. +* Add parentheses around address argument for various macros. +* Add some platform-specific documentation to INSTALL. +* Add untested 64-bit support for PowerPC. +* Fix AO_compare_and_swap_double_acquire. +* Fix AO_int_fetch_and_add_full (x86_64). +* Fix comments. +* Fix s390 include paths. +* Fix use of lwz instruction (PowerPC). +* Refine clobbers (PowerPC). +* Remove outdated info about Windows support in README. +* Replace K&R-style function definition with ANSI C one. +* add AO_compare_double_and_swap_double for ARMv6. +* gcc/powerpc.h: Consider __NO_LWSYNC__. + + +== [7.1] 2008-02-11 == + +* Add test_and_set, AO_double_compare_and_swap generalizations. +* Conditionally add compare_double_and_swap_double (x86). +* Conditionally add compare_double_and_swap_double (x86). +* Fix AO_compare_double_and_swap_double_full (x86) for PIC mode. +* Fix AO_load_acquire for PowerPC. +* Fix double-width CAS (x86). +* Refine README (add more warnings about data dependencies). +* Refine double_ptr_storage type definition. +* Support ARMv6+ in GCC. +* Support ArmCC compiler. +* Use _InterlockedExchangeAdd for MS VC (x86). + + +== [7.0] 2007-06-28 == + +* Add 64-bit version of AO_load_acquire for PowerPC. +* Add support of x86 and x86_64 for MS VC. +* Do not assume that "mfence" is always present (x86.h). +* Fix ARM AO_test_and_set_full. +* Include windows.h (MS VC). +* Update README to reflect C++0x effort. + + +== [1.2] 2006-07-11 == + +* Add prototypes to suppress compiler warnings. +* Add simple VxWorks support. +* Fix InterlockedCompareExchange proto usage. +* Fix typos (ia64). +* Include all_acquire_release_volatile.h and all_atomic_load_store.h (ia64). +* Initial support for 64-bit targets. +* Use "=q" for AO_test_and_set_full (x86). +* Use inline assembler to generate "mfence" and byte sized XCHG. +* Use new intrinsics available in MSVC 2003 and MSVC 2005. + + +== [1.1] 2005-09-27 == + +* Add and use read_ordered.h. +* Change function naming from "byte" to "char". +* Fix AO_test_and_set for ARM; define AO_CAN_EMUL_CAS. + + +== [1.0] 2005-03-21 == + +* Fix various bugs. +* Add atomic_ops primitives for different sized data. +* Add compare_double_and_swap_double and compare_and_swap_double. +* Add initial support for atomic_ops for VC++/Windows/X86 and HP/UX. +* Add minimal support for the Sun SPARC compiler. +* Add support for platforms that require out-of-line assembly code. +* Add support of int-wide operations on platforms with int-sized pointers. +* Added libatomic_ops_gpl library with support for lock-free stack and malloc. +* Attempt to support PowerPC. +* Change atomic_ops include file structure. +* Change most platforms to use byte-wide test-and-set locations. +* Install under "atomic_ops" instead of "ao". +* Remove compiler_barrier workaround for gcc 3.4+. +* Renamed various types to end in _t. +* Use autoconf, automake. diff --git a/libatomic_ops/Makefile b/libatomic_ops/Makefile new file mode 100644 index 0000000..dd17bd1 --- /dev/null +++ b/libatomic_ops/Makefile @@ -0,0 +1,13 @@ +PROJECT=libatomic_ops +CC=gcc +AR=ar + +$(PROJECT): atomic_ops + $(AR) ru libatomic_ops.a src/atomic_ops.o + +atomic_ops: src/atomic_ops.c + $(CC) -c src/atomic_ops.c -o src/atomic_ops.o + +clean: + rm src/atomic_ops.o + rm libatomic_ops.a diff --git a/libatomic_ops/README b/libatomic_ops/README new file mode 100644 index 0000000..9c7678a --- /dev/null +++ b/libatomic_ops/README @@ -0,0 +1,55 @@ +== Synopsis == + +This package provides semi-portable access to hardware provided +atomic memory operations. These might allow you to write code: + +- That does more interesting things in signal handlers. +- Makes more effective use of multiprocessors by allowing you to write + clever lock-free code. Note that such code is very difficult to get + right, and will unavoidably be less portable than lock-based code. It + is also not always faster than lock-based code. But it may occasionally + be a large performance win. +- To experiment with new and much better thread programming paradigms, etc. + +For details and licensing restrictions see the files in the doc +subdirectory. + +This is version 7.3alpha3 of libatomic_ops. + +You might find a more recent version of this at + +http://www.hpl.hp.com/personal/Hans_Boehm/gc + +or + +http://www.hpl.hp.com/research/linux/atomic_ops/ + +Please address bug reports to gc@linux.hpl.hp.com + + +== Installation and Usage == + +The configuration and build scripts for this package were generated by +Automake/Autoconf. "./configure --prefix=<install dir>; make; make install" +in this directory should work. For a more customized build, see the output of +"./configure --help". + +Note that much of the content of this library is in the header files. +However, two small libraries are built and installed: + +- libatomic_ops.a is a support library, which is not needed on some platforms. + This is intended to be usable, under some mild restrictions, in free or + proprietary code, as are all the header files. See doc/LICENSING.txt. +- libatomic_ops_gpl.a contains some higher level facilities. This code is + currently covered by the GPL. The contents currently correspond to + the headers atomic_ops_stack.h and atomic_ops_malloc.h. + + +== Platform Specific Notes == + +Win32/64: src/Makefile.msft contains a very simple Makefile for building +and running tests and building the gpl library. The core atomic_ops +implementation is entirely in header files. + +HP-UX/PA-RISC: aCC -Ae won't work as a C compiler, since it doesn't support +inline assembly code. Use cc. diff --git a/libatomic_ops/TODO b/libatomic_ops/TODO new file mode 100644 index 0000000..8a95ddb --- /dev/null +++ b/libatomic_ops/TODO @@ -0,0 +1,13 @@ +== TODO tasks == + +Add C++0x ATM (atomic memory operations) layer. + + +== FIXME tasks == + +RHELinux6/POWER7 (gcc-4.4.7-3/ppc64), Fedora16/POWER7 (gcc-4.6.2-1/ppc64), +Debian/powerpc (gcc 4.6.3-7): +test_stack failed (Debian Bug #680100). + +Debian/m68k (Linux 3.2.0-2-atari): +test_stack failed (Bus error), regression (Debian Bug #680066). diff --git a/libatomic_ops/libatomic_ops.a b/libatomic_ops/libatomic_ops.a Binary files differnew file mode 100644 index 0000000..0a05f96 --- /dev/null +++ b/libatomic_ops/libatomic_ops.a diff --git a/libatomic_ops/src/.deps/atomic_ops.Plo b/libatomic_ops/src/.deps/atomic_ops.Plo new file mode 100644 index 0000000..23f0b5d --- /dev/null +++ b/libatomic_ops/src/.deps/atomic_ops.Plo @@ -0,0 +1,171 @@ +atomic_ops.lo: atomic_ops.c config.h atomic_ops.h atomic_ops/ao_version.h \ + /usr/include/assert.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h \ + atomic_ops/sysdeps/gcc/x86.h \ + atomic_ops/sysdeps/gcc/../all_aligned_atomic_load_store.h \ + atomic_ops/sysdeps/gcc/../all_atomic_load_store.h \ + atomic_ops/sysdeps/gcc/../all_atomic_only_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/char_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/short_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/int_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/char_atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/short_atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/int_atomic_store.h \ + atomic_ops/sysdeps/gcc/../test_and_set_t_is_char.h \ + atomic_ops/sysdeps/gcc/../ordered_except_wr.h \ + atomic_ops/sysdeps/gcc/../read_ordered.h \ + atomic_ops/sysdeps/gcc/../loadstore/ordered_loads_only.h \ + atomic_ops/sysdeps/gcc/../loadstore/ordered_stores_only.h \ + atomic_ops/generalize.h atomic_ops/generalize-small.h \ + atomic_ops/generalize-arithm.h /usr/include/pthread.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/byteswap.h /usr/include/sched.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h /usr/include/bits/sched.h /usr/include/bits/time.h \ + /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/sigset.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + atomic_ops/sysdeps/standard_ao_double_t.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/xmmintrin.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/mmintrin.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/mm_malloc.h \ + /usr/include/stdlib.h /usr/include/sys/types.h \ + /usr/include/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/bits/stdlib.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/emmintrin.h + +config.h: + +atomic_ops.h: + +atomic_ops/ao_version.h: + +/usr/include/assert.h: + +/usr/include/features.h: + +/usr/include/bits/predefs.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h: + +atomic_ops/sysdeps/gcc/x86.h: + +atomic_ops/sysdeps/gcc/../all_aligned_atomic_load_store.h: + +atomic_ops/sysdeps/gcc/../all_atomic_load_store.h: + +atomic_ops/sysdeps/gcc/../all_atomic_only_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/char_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/short_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/int_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/char_atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/short_atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/int_atomic_store.h: + +atomic_ops/sysdeps/gcc/../test_and_set_t_is_char.h: + +atomic_ops/sysdeps/gcc/../ordered_except_wr.h: + +atomic_ops/sysdeps/gcc/../read_ordered.h: + +atomic_ops/sysdeps/gcc/../loadstore/ordered_loads_only.h: + +atomic_ops/sysdeps/gcc/../loadstore/ordered_stores_only.h: + +atomic_ops/generalize.h: + +atomic_ops/generalize-small.h: + +atomic_ops/generalize-arithm.h: + +/usr/include/pthread.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/bits/byteswap.h: + +/usr/include/sched.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/bits/sched.h: + +/usr/include/bits/time.h: + +/usr/include/xlocale.h: + +/usr/include/signal.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/bits/setjmp.h: + +/usr/include/bits/signum.h: + +/usr/include/bits/siginfo.h: + +/usr/include/bits/sigaction.h: + +/usr/include/bits/sigcontext.h: + +/usr/include/bits/sigstack.h: + +/usr/include/bits/sigthread.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +atomic_ops/sysdeps/standard_ao_double_t.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/xmmintrin.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/mmintrin.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/mm_malloc.h: + +/usr/include/stdlib.h: + +/usr/include/sys/types.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/include/bits/stdlib.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/emmintrin.h: diff --git a/libatomic_ops/src/.deps/atomic_ops_malloc.Plo b/libatomic_ops/src/.deps/atomic_ops_malloc.Plo new file mode 100644 index 0000000..0a04643 --- /dev/null +++ b/libatomic_ops/src/.deps/atomic_ops_malloc.Plo @@ -0,0 +1,161 @@ +atomic_ops_malloc.lo: atomic_ops_malloc.c config.h atomic_ops_malloc.h \ + atomic_ops_stack.h atomic_ops.h atomic_ops/ao_version.h \ + /usr/include/assert.h /usr/include/features.h \ + /usr/include/bits/predefs.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h \ + atomic_ops/sysdeps/gcc/x86.h \ + atomic_ops/sysdeps/gcc/../all_aligned_atomic_load_store.h \ + atomic_ops/sysdeps/gcc/../all_atomic_load_store.h \ + atomic_ops/sysdeps/gcc/../all_atomic_only_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/char_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/short_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/int_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/char_atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/short_atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/int_atomic_store.h \ + atomic_ops/sysdeps/gcc/../test_and_set_t_is_char.h \ + atomic_ops/sysdeps/gcc/../ordered_except_wr.h \ + atomic_ops/sysdeps/gcc/../read_ordered.h \ + atomic_ops/sysdeps/gcc/../loadstore/ordered_loads_only.h \ + atomic_ops/sysdeps/gcc/../loadstore/ordered_stores_only.h \ + atomic_ops/generalize.h atomic_ops/generalize-small.h \ + atomic_ops/generalize-arithm.h /usr/include/string.h \ + /usr/include/xlocale.h /usr/include/bits/string.h \ + /usr/include/bits/string2.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/stdlib.h /usr/include/bits/string3.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/bits/stdlib.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \ + /usr/include/bits/fcntl2.h /usr/include/sys/mman.h \ + /usr/include/bits/mman.h + +config.h: + +atomic_ops_malloc.h: + +atomic_ops_stack.h: + +atomic_ops.h: + +atomic_ops/ao_version.h: + +/usr/include/assert.h: + +/usr/include/features.h: + +/usr/include/bits/predefs.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h: + +atomic_ops/sysdeps/gcc/x86.h: + +atomic_ops/sysdeps/gcc/../all_aligned_atomic_load_store.h: + +atomic_ops/sysdeps/gcc/../all_atomic_load_store.h: + +atomic_ops/sysdeps/gcc/../all_atomic_only_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/char_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/short_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/int_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/char_atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/short_atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/int_atomic_store.h: + +atomic_ops/sysdeps/gcc/../test_and_set_t_is_char.h: + +atomic_ops/sysdeps/gcc/../ordered_except_wr.h: + +atomic_ops/sysdeps/gcc/../read_ordered.h: + +atomic_ops/sysdeps/gcc/../loadstore/ordered_loads_only.h: + +atomic_ops/sysdeps/gcc/../loadstore/ordered_stores_only.h: + +atomic_ops/generalize.h: + +atomic_ops/generalize-small.h: + +atomic_ops/generalize-arithm.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/bits/byteswap.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/stdlib.h: + +/usr/include/bits/string3.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/bits/stdlib.h: + +/usr/include/sys/stat.h: + +/usr/include/bits/stat.h: + +/usr/include/fcntl.h: + +/usr/include/bits/fcntl.h: + +/usr/include/bits/fcntl2.h: + +/usr/include/sys/mman.h: + +/usr/include/bits/mman.h: diff --git a/libatomic_ops/src/.deps/atomic_ops_stack.Plo b/libatomic_ops/src/.deps/atomic_ops_stack.Plo new file mode 100644 index 0000000..0b79a16 --- /dev/null +++ b/libatomic_ops/src/.deps/atomic_ops_stack.Plo @@ -0,0 +1,140 @@ +atomic_ops_stack.lo: atomic_ops_stack.c config.h /usr/include/string.h \ + /usr/include/features.h /usr/include/bits/predefs.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h \ + /usr/include/xlocale.h /usr/include/bits/string.h \ + /usr/include/bits/string2.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/stdlib.h /usr/include/bits/string3.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/bits/stdlib.h /usr/include/assert.h atomic_ops_stack.h \ + atomic_ops.h atomic_ops/ao_version.h atomic_ops/sysdeps/gcc/x86.h \ + atomic_ops/sysdeps/gcc/../all_aligned_atomic_load_store.h \ + atomic_ops/sysdeps/gcc/../all_atomic_load_store.h \ + atomic_ops/sysdeps/gcc/../all_atomic_only_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/char_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/short_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/int_atomic_load.h \ + atomic_ops/sysdeps/gcc/../loadstore/atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/char_atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/short_atomic_store.h \ + atomic_ops/sysdeps/gcc/../loadstore/int_atomic_store.h \ + atomic_ops/sysdeps/gcc/../test_and_set_t_is_char.h \ + atomic_ops/sysdeps/gcc/../ordered_except_wr.h \ + atomic_ops/sysdeps/gcc/../read_ordered.h \ + atomic_ops/sysdeps/gcc/../loadstore/ordered_loads_only.h \ + atomic_ops/sysdeps/gcc/../loadstore/ordered_stores_only.h \ + atomic_ops/generalize.h atomic_ops/generalize-small.h \ + atomic_ops/generalize-arithm.h + +config.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/bits/predefs.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/bits/byteswap.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/stdlib.h: + +/usr/include/bits/string3.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/bits/stdlib.h: + +/usr/include/assert.h: + +atomic_ops_stack.h: + +atomic_ops.h: + +atomic_ops/ao_version.h: + +atomic_ops/sysdeps/gcc/x86.h: + +atomic_ops/sysdeps/gcc/../all_aligned_atomic_load_store.h: + +atomic_ops/sysdeps/gcc/../all_atomic_load_store.h: + +atomic_ops/sysdeps/gcc/../all_atomic_only_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/char_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/short_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/int_atomic_load.h: + +atomic_ops/sysdeps/gcc/../loadstore/atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/char_atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/short_atomic_store.h: + +atomic_ops/sysdeps/gcc/../loadstore/int_atomic_store.h: + +atomic_ops/sysdeps/gcc/../test_and_set_t_is_char.h: + +atomic_ops/sysdeps/gcc/../ordered_except_wr.h: + +atomic_ops/sysdeps/gcc/../read_ordered.h: + +atomic_ops/sysdeps/gcc/../loadstore/ordered_loads_only.h: + +atomic_ops/sysdeps/gcc/../loadstore/ordered_stores_only.h: + +atomic_ops/generalize.h: + +atomic_ops/generalize-small.h: + +atomic_ops/generalize-arithm.h: diff --git a/libatomic_ops/src/.deps/atomic_ops_sysdeps.Plo b/libatomic_ops/src/.deps/atomic_ops_sysdeps.Plo new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/libatomic_ops/src/.deps/atomic_ops_sysdeps.Plo @@ -0,0 +1 @@ +# dummy diff --git a/libatomic_ops/src/.libs/libatomic_ops.a b/libatomic_ops/src/.libs/libatomic_ops.a Binary files differnew file mode 100644 index 0000000..413e9aa --- /dev/null +++ b/libatomic_ops/src/.libs/libatomic_ops.a diff --git a/libatomic_ops/src/.libs/libatomic_ops.lai b/libatomic_ops/src/.libs/libatomic_ops.lai new file mode 100644 index 0000000..ec124b3 --- /dev/null +++ b/libatomic_ops/src/.libs/libatomic_ops.lai @@ -0,0 +1,41 @@ +# libatomic_ops.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libatomic_ops.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libatomic_ops. +current=1 +age=0 +revision=3 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/afs/info.uni-karlsruhe.de/user/tobias/octopos-app/apps/bdwgc/libatomic_ops-install/lib' diff --git a/libatomic_ops/src/.libs/libatomic_ops_gpl.a b/libatomic_ops/src/.libs/libatomic_ops_gpl.a Binary files differnew file mode 100644 index 0000000..09ec61c --- /dev/null +++ b/libatomic_ops/src/.libs/libatomic_ops_gpl.a diff --git a/libatomic_ops/src/.libs/libatomic_ops_gpl.lai b/libatomic_ops/src/.libs/libatomic_ops_gpl.lai new file mode 100644 index 0000000..eed5fd0 --- /dev/null +++ b/libatomic_ops/src/.libs/libatomic_ops_gpl.lai @@ -0,0 +1,41 @@ +# libatomic_ops_gpl.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libatomic_ops_gpl.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libatomic_ops_gpl. +current=1 +age=0 +revision=3 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/afs/info.uni-karlsruhe.de/user/tobias/octopos-app/apps/bdwgc/libatomic_ops-install/lib' diff --git a/libatomic_ops/src/atomic_ops.c b/libatomic_ops/src/atomic_ops.c new file mode 100644 index 0000000..30dd21c --- /dev/null +++ b/libatomic_ops/src/atomic_ops.c @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Initialized data and out-of-line functions to support atomic_ops.h + * go here. Currently this is needed only for pthread-based atomics + * emulation, or for compare-and-swap emulation. + * Pthreads emulation isn't useful on a native Windows platform, and + * cas emulation is not needed. Thus we skip this on Windows. + */ + +#if defined(HAVE_CONFIG_H) +# include "config.h" +#endif + +#if defined(__native_client__) && !defined(AO_USE_NO_SIGNALS) \ + && !defined(AO_USE_NANOSLEEP) + /* Since NaCl is not recognized by configure yet, we do it here. */ +# define AO_USE_NO_SIGNALS +# define AO_USE_NANOSLEEP +#endif + +#if defined(AO_USE_WIN32_PTHREADS) && !defined(AO_USE_NO_SIGNALS) +# define AO_USE_NO_SIGNALS +#endif + +#undef AO_REQUIRE_CAS +#include "atomic_ops.h" /* Without cas emulation! */ + +#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__BORLANDC__) \ + || defined(AO_USE_NO_SIGNALS) + +#ifndef AO_NO_PTHREADS +# include <pthread.h> +#endif + +#ifndef AO_USE_NO_SIGNALS +# include <signal.h> +#endif + +#ifdef AO_USE_NANOSLEEP + /* This requires _POSIX_TIMERS feature. */ +# include <sys/time.h> +# include <time.h> +#elif defined(AO_USE_WIN32_PTHREADS) +# include <windows.h> /* for Sleep() */ +#elif defined(_HPUX_SOURCE) +# include <sys/time.h> +#else +# include <sys/select.h> +#endif + +#ifndef AO_HAVE_double_t +# include "atomic_ops/sysdeps/standard_ao_double_t.h" +#endif + +/* Lock for pthreads-based implementation. */ +#ifndef AO_NO_PTHREADS + pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; +#endif + +/* + * Out of line compare-and-swap emulation based on test and set. + * + * We use a small table of locks for different compare_and_swap locations. + * Before we update perform a compare-and-swap, we grab the corresponding + * lock. Different locations may hash to the same lock, but since we + * never acquire more than one lock at a time, this can't deadlock. + * We explicitly disable signals while we perform this operation. + * + * TODO: Probably also support emulation based on Lamport + * locks, since we may not have test_and_set either. + */ +#define AO_HASH_SIZE 16 + +#define AO_HASH(x) (((unsigned long)(x) >> 12) & (AO_HASH_SIZE-1)) + +AO_TS_t AO_locks[AO_HASH_SIZE] = { + AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, + AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, + AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, + AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, +}; + +void AO_pause(int); /* defined below */ + +static void lock_ool(volatile AO_TS_t *l) +{ + int i = 0; + + while (AO_test_and_set_acquire(l) == AO_TS_SET) + AO_pause(++i); +} + +AO_INLINE void lock(volatile AO_TS_t *l) +{ + if (AO_EXPECT_FALSE(AO_test_and_set_acquire(l) == AO_TS_SET)) + lock_ool(l); +} + +AO_INLINE void unlock(volatile AO_TS_t *l) +{ + AO_CLEAR(l); +} + +#ifndef AO_USE_NO_SIGNALS + static sigset_t all_sigs; + static volatile AO_t initialized = 0; + static volatile AO_TS_t init_lock = AO_TS_INITIALIZER; + + AO_INLINE void block_all_signals(sigset_t *old_sigs_ptr) + { + if (AO_EXPECT_FALSE(!AO_load_acquire(&initialized))) + { + lock(&init_lock); + if (!initialized) + sigfillset(&all_sigs); + unlock(&init_lock); + AO_store_release(&initialized, 1); + } + sigprocmask(SIG_BLOCK, &all_sigs, old_sigs_ptr); + /* Neither sigprocmask nor pthread_sigmask is 100% */ + /* guaranteed to work here. Sigprocmask is not */ + /* guaranteed be thread safe, and pthread_sigmask */ + /* is not async-signal-safe. Under linuxthreads, */ + /* sigprocmask may block some pthreads-internal */ + /* signals. So long as we do that for short periods, */ + /* we should be OK. */ + } +#endif /* !AO_USE_NO_SIGNALS */ + +AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, AO_t old_val, + AO_t new_val) +{ + AO_TS_t *my_lock = AO_locks + AO_HASH(addr); + AO_t fetched_val; + +# ifndef AO_USE_NO_SIGNALS + sigset_t old_sigs; + block_all_signals(&old_sigs); +# endif + lock(my_lock); + fetched_val = *addr; + if (fetched_val == old_val) + *addr = new_val; + unlock(my_lock); +# ifndef AO_USE_NO_SIGNALS + sigprocmask(SIG_SETMASK, &old_sigs, NULL); +# endif + return fetched_val; +} + +int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, + AO_t old_val1, AO_t old_val2, + AO_t new_val1, AO_t new_val2) +{ + AO_TS_t *my_lock = AO_locks + AO_HASH(addr); + int result; + +# ifndef AO_USE_NO_SIGNALS + sigset_t old_sigs; + block_all_signals(&old_sigs); +# endif + lock(my_lock); + if (addr -> AO_val1 == old_val1 && addr -> AO_val2 == old_val2) + { + addr -> AO_val1 = new_val1; + addr -> AO_val2 = new_val2; + result = 1; + } + else + result = 0; + unlock(my_lock); +# ifndef AO_USE_NO_SIGNALS + sigprocmask(SIG_SETMASK, &old_sigs, NULL); +# endif + return result; +} + +void AO_store_full_emulation(volatile AO_t *addr, AO_t val) +{ + AO_TS_t *my_lock = AO_locks + AO_HASH(addr); + lock(my_lock); + *addr = val; + unlock(my_lock); +} + +#else /* Non-posix platform */ + +# include <windows.h> + +# define AO_USE_WIN32_PTHREADS + /* define to use Sleep() */ + + extern int AO_non_posix_implementation_is_entirely_in_headers; + +#endif + +static AO_t spin_dummy = 1; + +/* Spin for 2**n units. */ +static void AO_spin(int n) +{ + AO_t j = AO_load(&spin_dummy); + int i = 2 << n; + + while (i-- > 0) + j += (j - 1) << 2; + /* Given 'spin_dummy' is initialized to 1, j is 1 after the loop. */ + AO_store(&spin_dummy, j); +} + +void AO_pause(int n) +{ + if (n < 12) + AO_spin(n); + else + { +# ifdef AO_USE_NANOSLEEP + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = (n > 28 ? 100000 * 1000 : 1 << (n - 2)); + nanosleep(&ts, 0); +# elif defined(AO_USE_WIN32_PTHREADS) + Sleep(n > 28 ? 100 : n < 22 ? 1 : 1 << (n - 22)); /* in millis */ +# else + struct timeval tv; + /* Short async-signal-safe sleep. */ + tv.tv_sec = 0; + tv.tv_usec = n > 28 ? 100000 : 1 << (n - 12); + select(0, 0, 0, 0, &tv); +# endif + } +} diff --git a/libatomic_ops-install/include/atomic_ops.h b/libatomic_ops/src/atomic_ops.h index 33fe00e..33fe00e 100644 --- a/libatomic_ops-install/include/atomic_ops.h +++ b/libatomic_ops/src/atomic_ops.h diff --git a/libatomic_ops-install/include/atomic_ops/ao_version.h b/libatomic_ops/src/atomic_ops/ao_version.h index 504fb43..504fb43 100644 --- a/libatomic_ops-install/include/atomic_ops/ao_version.h +++ b/libatomic_ops/src/atomic_ops/ao_version.h diff --git a/libatomic_ops-install/include/atomic_ops/generalize-arithm.h b/libatomic_ops/src/atomic_ops/generalize-arithm.h index e03395a..e925b10 100644 --- a/libatomic_ops-install/include/atomic_ops/generalize-arithm.h +++ b/libatomic_ops/src/atomic_ops/generalize-arithm.h @@ -842,7 +842,7 @@ # define AO_HAVE_char_xor_acquire_read #endif -/* char_and/or/xor_dd_aquire_read are meaningless. */ +/* char_and/or/xor_dd_acquire_read are meaningless. */ /* * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. * @@ -1687,7 +1687,7 @@ # define AO_HAVE_short_xor_acquire_read #endif -/* short_and/or/xor_dd_aquire_read are meaningless. */ +/* short_and/or/xor_dd_acquire_read are meaningless. */ /* * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. * @@ -2532,7 +2532,7 @@ # define AO_HAVE_int_xor_acquire_read #endif -/* int_and/or/xor_dd_aquire_read are meaningless. */ +/* int_and/or/xor_dd_acquire_read are meaningless. */ /* * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. * @@ -3377,4 +3377,4 @@ # define AO_HAVE_xor_acquire_read #endif -/* and/or/xor_dd_aquire_read are meaningless. */ +/* and/or/xor_dd_acquire_read are meaningless. */ diff --git a/libatomic_ops/src/atomic_ops/generalize-arithm.template b/libatomic_ops/src/atomic_ops/generalize-arithm.template new file mode 100644 index 0000000..24161a4 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/generalize-arithm.template @@ -0,0 +1,845 @@ +/* + * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* XSIZE_compare_and_swap (based on fetch_compare_and_swap) */ +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_full) + AO_INLINE int + AO_XSIZE_compare_and_swap_full(volatile XCTYPE *addr, XCTYPE old_val, + XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_full(addr, old_val, new_val) + == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_full +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_acquire) + AO_INLINE int + AO_XSIZE_compare_and_swap_acquire(volatile XCTYPE *addr, XCTYPE old_val, + XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_acquire(addr, old_val, new_val) + == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_acquire +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_release) + AO_INLINE int + AO_XSIZE_compare_and_swap_release(volatile XCTYPE *addr, XCTYPE old_val, + XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_release(addr, old_val, new_val) + == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_release +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_write) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_write) + AO_INLINE int + AO_XSIZE_compare_and_swap_write(volatile XCTYPE *addr, XCTYPE old_val, + XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_write(addr, old_val, new_val) + == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_write +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_read) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_read) + AO_INLINE int + AO_XSIZE_compare_and_swap_read(volatile XCTYPE *addr, XCTYPE old_val, + XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_read(addr, old_val, new_val) + == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_read +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap) + AO_INLINE int + AO_XSIZE_compare_and_swap(volatile XCTYPE *addr, XCTYPE old_val, + XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val) == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release_write) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_release_write) + AO_INLINE int + AO_XSIZE_compare_and_swap_release_write(volatile XCTYPE *addr, + XCTYPE old_val, XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_release_write(addr, old_val, + new_val) == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_release_write +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire_read) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_acquire_read) + AO_INLINE int + AO_XSIZE_compare_and_swap_acquire_read(volatile XCTYPE *addr, + XCTYPE old_val, XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_acquire_read(addr, old_val, + new_val) == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_acquire_read +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_dd_acquire_read) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_dd_acquire_read) + AO_INLINE int + AO_XSIZE_compare_and_swap_dd_acquire_read(volatile XCTYPE *addr, + XCTYPE old_val, XCTYPE new_val) + { + return AO_XSIZE_fetch_compare_and_swap_dd_acquire_read(addr, old_val, + new_val) == old_val; + } +# define AO_HAVE_XSIZE_compare_and_swap_dd_acquire_read +#endif + +/* XSIZE_fetch_and_add */ +/* We first try to implement fetch_and_add variants in terms of the */ +/* corresponding compare_and_swap variants to minimize adding barriers. */ +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_full) + AO_INLINE XCTYPE + AO_XSIZE_fetch_and_add_full(volatile XCTYPE *addr, XCTYPE incr) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_full(addr, old, + old + incr))); + return old; + } +# define AO_HAVE_XSIZE_fetch_and_add_full +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_acquire) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) + AO_INLINE XCTYPE + AO_XSIZE_fetch_and_add_acquire(volatile XCTYPE *addr, XCTYPE incr) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_acquire(addr, old, + old + incr))); + return old; + } +# define AO_HAVE_XSIZE_fetch_and_add_acquire +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_release) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_release) + AO_INLINE XCTYPE + AO_XSIZE_fetch_and_add_release(volatile XCTYPE *addr, XCTYPE incr) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_release(addr, old, + old + incr))); + return old; + } +# define AO_HAVE_XSIZE_fetch_and_add_release +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add) + AO_INLINE XCTYPE + AO_XSIZE_fetch_and_add(volatile XCTYPE *addr, XCTYPE incr) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap(addr, old, + old + incr))); + return old; + } +# define AO_HAVE_XSIZE_fetch_and_add +#endif + +#if defined(AO_HAVE_XSIZE_fetch_and_add_full) +# if !defined(AO_HAVE_XSIZE_fetch_and_add_release) +# define AO_XSIZE_fetch_and_add_release(addr, val) \ + AO_XSIZE_fetch_and_add_full(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_release +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) +# define AO_XSIZE_fetch_and_add_acquire(addr, val) \ + AO_XSIZE_fetch_and_add_full(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_acquire +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_add_write) +# define AO_XSIZE_fetch_and_add_write(addr, val) \ + AO_XSIZE_fetch_and_add_full(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_write +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_add_read) +# define AO_XSIZE_fetch_and_add_read(addr, val) \ + AO_XSIZE_fetch_and_add_full(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_read +# endif +#endif /* AO_HAVE_XSIZE_fetch_and_add_full */ + +#if defined(AO_HAVE_XSIZE_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) + AO_INLINE XCTYPE + AO_XSIZE_fetch_and_add_acquire(volatile XCTYPE *addr, XCTYPE incr) + { + XCTYPE result = AO_XSIZE_fetch_and_add(addr, incr); + AO_nop_full(); + return result; + } +# define AO_HAVE_XSIZE_fetch_and_add_acquire +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add_release) +# define AO_XSIZE_fetch_and_add_release(addr, incr) \ + (AO_nop_full(), AO_XSIZE_fetch_and_add(addr, incr)) +# define AO_HAVE_XSIZE_fetch_and_add_release +#endif + +#if !defined(AO_HAVE_XSIZE_fetch_and_add) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_release) +# define AO_XSIZE_fetch_and_add(addr, val) \ + AO_XSIZE_fetch_and_add_release(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_acquire) +# define AO_XSIZE_fetch_and_add(addr, val) \ + AO_XSIZE_fetch_and_add_acquire(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_write) +# define AO_XSIZE_fetch_and_add(addr, val) \ + AO_XSIZE_fetch_and_add_write(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_read) +# define AO_XSIZE_fetch_and_add(addr, val) \ + AO_XSIZE_fetch_and_add_read(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add +#endif + +#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) \ + && defined(AO_HAVE_nop_full) && !defined(AO_HAVE_XSIZE_fetch_and_add_full) +# define AO_XSIZE_fetch_and_add_full(addr, val) \ + (AO_nop_full(), AO_XSIZE_fetch_and_add_acquire(addr, val)) +# define AO_HAVE_XSIZE_fetch_and_add_full +#endif + +#if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_write) +# define AO_XSIZE_fetch_and_add_release_write(addr, val) \ + AO_XSIZE_fetch_and_add_write(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_release) +# define AO_XSIZE_fetch_and_add_release_write(addr, val) \ + AO_XSIZE_fetch_and_add_release(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_release_write +#endif + +#if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_read) +# define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \ + AO_XSIZE_fetch_and_add_read(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_and_add_acquire) +# define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \ + AO_XSIZE_fetch_and_add_acquire(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_acquire_read +#endif + +#ifdef AO_NO_DD_ORDERING +# if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) +# define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \ + AO_XSIZE_fetch_and_add_acquire_read(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read +# endif +#else +# if defined(AO_HAVE_XSIZE_fetch_and_add) +# define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \ + AO_XSIZE_fetch_and_add(addr, val) +# define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read +# endif +#endif /* !AO_NO_DD_ORDERING */ + +/* XSIZE_fetch_and_add1 */ +#if defined(AO_HAVE_XSIZE_fetch_and_add_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_full) +# define AO_XSIZE_fetch_and_add1_full(addr) \ + AO_XSIZE_fetch_and_add_full(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_full +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_release) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_release) +# define AO_XSIZE_fetch_and_add1_release(addr) \ + AO_XSIZE_fetch_and_add_release(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_release +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) +# define AO_XSIZE_fetch_and_add1_acquire(addr) \ + AO_XSIZE_fetch_and_add_acquire(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_acquire +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_write) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_write) +# define AO_XSIZE_fetch_and_add1_write(addr) \ + AO_XSIZE_fetch_and_add_write(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_write +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_read) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_read) +# define AO_XSIZE_fetch_and_add1_read(addr) \ + AO_XSIZE_fetch_and_add_read(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_read +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) +# define AO_XSIZE_fetch_and_add1_release_write(addr) \ + AO_XSIZE_fetch_and_add_release_write(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_release_write +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) +# define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ + AO_XSIZE_fetch_and_add_acquire_read(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1_acquire_read +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1) +# define AO_XSIZE_fetch_and_add1(addr) AO_XSIZE_fetch_and_add(addr, 1) +# define AO_HAVE_XSIZE_fetch_and_add1 +#endif + +#if defined(AO_HAVE_XSIZE_fetch_and_add1_full) +# if !defined(AO_HAVE_XSIZE_fetch_and_add1_release) +# define AO_XSIZE_fetch_and_add1_release(addr) \ + AO_XSIZE_fetch_and_add1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_release +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) +# define AO_XSIZE_fetch_and_add1_acquire(addr) \ + AO_XSIZE_fetch_and_add1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_acquire +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_add1_write) +# define AO_XSIZE_fetch_and_add1_write(addr) \ + AO_XSIZE_fetch_and_add1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_write +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_add1_read) +# define AO_XSIZE_fetch_and_add1_read(addr) \ + AO_XSIZE_fetch_and_add1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_read +# endif +#endif /* AO_HAVE_XSIZE_fetch_and_add1_full */ + +#if !defined(AO_HAVE_XSIZE_fetch_and_add1) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_release) +# define AO_XSIZE_fetch_and_add1(addr) AO_XSIZE_fetch_and_add1_release(addr) +# define AO_HAVE_XSIZE_fetch_and_add1 +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add1) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) +# define AO_XSIZE_fetch_and_add1(addr) AO_XSIZE_fetch_and_add1_acquire(addr) +# define AO_HAVE_XSIZE_fetch_and_add1 +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add1) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_write) +# define AO_XSIZE_fetch_and_add1(addr) AO_XSIZE_fetch_and_add1_write(addr) +# define AO_HAVE_XSIZE_fetch_and_add1 +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add1) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_read) +# define AO_XSIZE_fetch_and_add1(addr) AO_XSIZE_fetch_and_add1_read(addr) +# define AO_HAVE_XSIZE_fetch_and_add1 +#endif + +#if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) \ + && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_add1_full) +# define AO_XSIZE_fetch_and_add1_full(addr) \ + (AO_nop_full(), AO_XSIZE_fetch_and_add1_acquire(addr)) +# define AO_HAVE_XSIZE_fetch_and_add1_full +#endif + +#if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_write) +# define AO_XSIZE_fetch_and_add1_release_write(addr) \ + AO_XSIZE_fetch_and_add1_write(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_release) +# define AO_XSIZE_fetch_and_add1_release_write(addr) \ + AO_XSIZE_fetch_and_add1_release(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_read) +# define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ + AO_XSIZE_fetch_and_add1_read(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) +# define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ + AO_XSIZE_fetch_and_add1_acquire(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_acquire_read +#endif + +#ifdef AO_NO_DD_ORDERING +# if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) +# define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \ + AO_XSIZE_fetch_and_add1_acquire_read(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read +# endif +#else +# if defined(AO_HAVE_XSIZE_fetch_and_add1) +# define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \ + AO_XSIZE_fetch_and_add1(addr) +# define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read +# endif +#endif /* !AO_NO_DD_ORDERING */ + +/* XSIZE_fetch_and_sub1 */ +#if defined(AO_HAVE_XSIZE_fetch_and_add_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_full) +# define AO_XSIZE_fetch_and_sub1_full(addr) \ + AO_XSIZE_fetch_and_add_full(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_full +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_release) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_release) +# define AO_XSIZE_fetch_and_sub1_release(addr) \ + AO_XSIZE_fetch_and_add_release(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_release +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) +# define AO_XSIZE_fetch_and_sub1_acquire(addr) \ + AO_XSIZE_fetch_and_add_acquire(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_acquire +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_write) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_write) +# define AO_XSIZE_fetch_and_sub1_write(addr) \ + AO_XSIZE_fetch_and_add_write(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_write +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_read) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_read) +# define AO_XSIZE_fetch_and_sub1_read(addr) \ + AO_XSIZE_fetch_and_add_read(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_read +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) +# define AO_XSIZE_fetch_and_sub1_release_write(addr) \ + AO_XSIZE_fetch_and_add_release_write(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_release_write +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) +# define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ + AO_XSIZE_fetch_and_add_acquire_read(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read +#endif +#if defined(AO_HAVE_XSIZE_fetch_and_add) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1) +# define AO_XSIZE_fetch_and_sub1(addr) \ + AO_XSIZE_fetch_and_add(addr, (XCTYPE)(-1)) +# define AO_HAVE_XSIZE_fetch_and_sub1 +#endif + +#if defined(AO_HAVE_XSIZE_fetch_and_sub1_full) +# if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release) +# define AO_XSIZE_fetch_and_sub1_release(addr) \ + AO_XSIZE_fetch_and_sub1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_release +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) +# define AO_XSIZE_fetch_and_sub1_acquire(addr) \ + AO_XSIZE_fetch_and_sub1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_acquire +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_sub1_write) +# define AO_XSIZE_fetch_and_sub1_write(addr) \ + AO_XSIZE_fetch_and_sub1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_write +# endif +# if !defined(AO_HAVE_XSIZE_fetch_and_sub1_read) +# define AO_XSIZE_fetch_and_sub1_read(addr) \ + AO_XSIZE_fetch_and_sub1_full(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_read +# endif +#endif /* AO_HAVE_XSIZE_fetch_and_sub1_full */ + +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_release) +# define AO_XSIZE_fetch_and_sub1(addr) AO_XSIZE_fetch_and_sub1_release(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1 +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) +# define AO_XSIZE_fetch_and_sub1(addr) AO_XSIZE_fetch_and_sub1_acquire(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1 +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_write) +# define AO_XSIZE_fetch_and_sub1(addr) AO_XSIZE_fetch_and_sub1_write(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1 +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_read) +# define AO_XSIZE_fetch_and_sub1(addr) AO_XSIZE_fetch_and_sub1_read(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1 +#endif + +#if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) \ + && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_and_sub1_full) +# define AO_XSIZE_fetch_and_sub1_full(addr) \ + (AO_nop_full(), AO_XSIZE_fetch_and_sub1_acquire(addr)) +# define AO_HAVE_XSIZE_fetch_and_sub1_full +#endif + +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_write) +# define AO_XSIZE_fetch_and_sub1_release_write(addr) \ + AO_XSIZE_fetch_and_sub1_write(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_release) +# define AO_XSIZE_fetch_and_sub1_release_write(addr) \ + AO_XSIZE_fetch_and_sub1_release(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_read) +# define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ + AO_XSIZE_fetch_and_sub1_read(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) +# define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ + AO_XSIZE_fetch_and_sub1_acquire(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read +#endif + +#ifdef AO_NO_DD_ORDERING +# if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) +# define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \ + AO_XSIZE_fetch_and_sub1_acquire_read(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read +# endif +#else +# if defined(AO_HAVE_XSIZE_fetch_and_sub1) +# define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \ + AO_XSIZE_fetch_and_sub1(addr) +# define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read +# endif +#endif /* !AO_NO_DD_ORDERING */ + +/* XSIZE_and */ +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_and_full) + AO_INLINE void + AO_XSIZE_and_full(volatile XCTYPE *addr, XCTYPE value) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_full(addr, old, + old & value))); + } +# define AO_HAVE_XSIZE_and_full +#endif + +#if defined(AO_HAVE_XSIZE_and_full) +# if !defined(AO_HAVE_XSIZE_and_release) +# define AO_XSIZE_and_release(addr, val) AO_XSIZE_and_full(addr, val) +# define AO_HAVE_XSIZE_and_release +# endif +# if !defined(AO_HAVE_XSIZE_and_acquire) +# define AO_XSIZE_and_acquire(addr, val) AO_XSIZE_and_full(addr, val) +# define AO_HAVE_XSIZE_and_acquire +# endif +# if !defined(AO_HAVE_XSIZE_and_write) +# define AO_XSIZE_and_write(addr, val) AO_XSIZE_and_full(addr, val) +# define AO_HAVE_XSIZE_and_write +# endif +# if !defined(AO_HAVE_XSIZE_and_read) +# define AO_XSIZE_and_read(addr, val) AO_XSIZE_and_full(addr, val) +# define AO_HAVE_XSIZE_and_read +# endif +#endif /* AO_HAVE_XSIZE_and_full */ + +#if !defined(AO_HAVE_XSIZE_and) && defined(AO_HAVE_XSIZE_and_release) +# define AO_XSIZE_and(addr, val) AO_XSIZE_and_release(addr, val) +# define AO_HAVE_XSIZE_and +#endif +#if !defined(AO_HAVE_XSIZE_and) && defined(AO_HAVE_XSIZE_and_acquire) +# define AO_XSIZE_and(addr, val) AO_XSIZE_and_acquire(addr, val) +# define AO_HAVE_XSIZE_and +#endif +#if !defined(AO_HAVE_XSIZE_and) && defined(AO_HAVE_XSIZE_and_write) +# define AO_XSIZE_and(addr, val) AO_XSIZE_and_write(addr, val) +# define AO_HAVE_XSIZE_and +#endif +#if !defined(AO_HAVE_XSIZE_and) && defined(AO_HAVE_XSIZE_and_read) +# define AO_XSIZE_and(addr, val) AO_XSIZE_and_read(addr, val) +# define AO_HAVE_XSIZE_and +#endif + +#if defined(AO_HAVE_XSIZE_and_acquire) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_and_full) +# define AO_XSIZE_and_full(addr, val) \ + (AO_nop_full(), AO_XSIZE_and_acquire(addr, val)) +# define AO_HAVE_XSIZE_and_full +#endif + +#if !defined(AO_HAVE_XSIZE_and_release_write) \ + && defined(AO_HAVE_XSIZE_and_write) +# define AO_XSIZE_and_release_write(addr, val) AO_XSIZE_and_write(addr, val) +# define AO_HAVE_XSIZE_and_release_write +#endif +#if !defined(AO_HAVE_XSIZE_and_release_write) \ + && defined(AO_HAVE_XSIZE_and_release) +# define AO_XSIZE_and_release_write(addr, val) AO_XSIZE_and_release(addr, val) +# define AO_HAVE_XSIZE_and_release_write +#endif +#if !defined(AO_HAVE_XSIZE_and_acquire_read) \ + && defined(AO_HAVE_XSIZE_and_read) +# define AO_XSIZE_and_acquire_read(addr, val) AO_XSIZE_and_read(addr, val) +# define AO_HAVE_XSIZE_and_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_and_acquire_read) \ + && defined(AO_HAVE_XSIZE_and_acquire) +# define AO_XSIZE_and_acquire_read(addr, val) AO_XSIZE_and_acquire(addr, val) +# define AO_HAVE_XSIZE_and_acquire_read +#endif + +/* XSIZE_or */ +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_or_full) + AO_INLINE void + AO_XSIZE_or_full(volatile XCTYPE *addr, XCTYPE value) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_full(addr, old, + old | value))); + } +# define AO_HAVE_XSIZE_or_full +#endif + +#if defined(AO_HAVE_XSIZE_or_full) +# if !defined(AO_HAVE_XSIZE_or_release) +# define AO_XSIZE_or_release(addr, val) AO_XSIZE_or_full(addr, val) +# define AO_HAVE_XSIZE_or_release +# endif +# if !defined(AO_HAVE_XSIZE_or_acquire) +# define AO_XSIZE_or_acquire(addr, val) AO_XSIZE_or_full(addr, val) +# define AO_HAVE_XSIZE_or_acquire +# endif +# if !defined(AO_HAVE_XSIZE_or_write) +# define AO_XSIZE_or_write(addr, val) AO_XSIZE_or_full(addr, val) +# define AO_HAVE_XSIZE_or_write +# endif +# if !defined(AO_HAVE_XSIZE_or_read) +# define AO_XSIZE_or_read(addr, val) AO_XSIZE_or_full(addr, val) +# define AO_HAVE_XSIZE_or_read +# endif +#endif /* AO_HAVE_XSIZE_or_full */ + +#if !defined(AO_HAVE_XSIZE_or) && defined(AO_HAVE_XSIZE_or_release) +# define AO_XSIZE_or(addr, val) AO_XSIZE_or_release(addr, val) +# define AO_HAVE_XSIZE_or +#endif +#if !defined(AO_HAVE_XSIZE_or) && defined(AO_HAVE_XSIZE_or_acquire) +# define AO_XSIZE_or(addr, val) AO_XSIZE_or_acquire(addr, val) +# define AO_HAVE_XSIZE_or +#endif +#if !defined(AO_HAVE_XSIZE_or) && defined(AO_HAVE_XSIZE_or_write) +# define AO_XSIZE_or(addr, val) AO_XSIZE_or_write(addr, val) +# define AO_HAVE_XSIZE_or +#endif +#if !defined(AO_HAVE_XSIZE_or) && defined(AO_HAVE_XSIZE_or_read) +# define AO_XSIZE_or(addr, val) AO_XSIZE_or_read(addr, val) +# define AO_HAVE_XSIZE_or +#endif + +#if defined(AO_HAVE_XSIZE_or_acquire) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_or_full) +# define AO_XSIZE_or_full(addr, val) \ + (AO_nop_full(), AO_XSIZE_or_acquire(addr, val)) +# define AO_HAVE_XSIZE_or_full +#endif + +#if !defined(AO_HAVE_XSIZE_or_release_write) \ + && defined(AO_HAVE_XSIZE_or_write) +# define AO_XSIZE_or_release_write(addr, val) AO_XSIZE_or_write(addr, val) +# define AO_HAVE_XSIZE_or_release_write +#endif +#if !defined(AO_HAVE_XSIZE_or_release_write) \ + && defined(AO_HAVE_XSIZE_or_release) +# define AO_XSIZE_or_release_write(addr, val) AO_XSIZE_or_release(addr, val) +# define AO_HAVE_XSIZE_or_release_write +#endif +#if !defined(AO_HAVE_XSIZE_or_acquire_read) && defined(AO_HAVE_XSIZE_or_read) +# define AO_XSIZE_or_acquire_read(addr, val) AO_XSIZE_or_read(addr, val) +# define AO_HAVE_XSIZE_or_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_or_acquire_read) \ + && defined(AO_HAVE_XSIZE_or_acquire) +# define AO_XSIZE_or_acquire_read(addr, val) AO_XSIZE_or_acquire(addr, val) +# define AO_HAVE_XSIZE_or_acquire_read +#endif + +/* XSIZE_xor */ +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_xor_full) + AO_INLINE void + AO_XSIZE_xor_full(volatile XCTYPE *addr, XCTYPE value) + { + XCTYPE old; + + do + { + old = *(XCTYPE *)addr; + } + while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_full(addr, old, + old ^ value))); + } +# define AO_HAVE_XSIZE_xor_full +#endif + +#if defined(AO_HAVE_XSIZE_xor_full) +# if !defined(AO_HAVE_XSIZE_xor_release) +# define AO_XSIZE_xor_release(addr, val) AO_XSIZE_xor_full(addr, val) +# define AO_HAVE_XSIZE_xor_release +# endif +# if !defined(AO_HAVE_XSIZE_xor_acquire) +# define AO_XSIZE_xor_acquire(addr, val) AO_XSIZE_xor_full(addr, val) +# define AO_HAVE_XSIZE_xor_acquire +# endif +# if !defined(AO_HAVE_XSIZE_xor_write) +# define AO_XSIZE_xor_write(addr, val) AO_XSIZE_xor_full(addr, val) +# define AO_HAVE_XSIZE_xor_write +# endif +# if !defined(AO_HAVE_XSIZE_xor_read) +# define AO_XSIZE_xor_read(addr, val) AO_XSIZE_xor_full(addr, val) +# define AO_HAVE_XSIZE_xor_read +# endif +#endif /* AO_HAVE_XSIZE_xor_full */ + +#if !defined(AO_HAVE_XSIZE_xor) && defined(AO_HAVE_XSIZE_xor_release) +# define AO_XSIZE_xor(addr, val) AO_XSIZE_xor_release(addr, val) +# define AO_HAVE_XSIZE_xor +#endif +#if !defined(AO_HAVE_XSIZE_xor) && defined(AO_HAVE_XSIZE_xor_acquire) +# define AO_XSIZE_xor(addr, val) AO_XSIZE_xor_acquire(addr, val) +# define AO_HAVE_XSIZE_xor +#endif +#if !defined(AO_HAVE_XSIZE_xor) && defined(AO_HAVE_XSIZE_xor_write) +# define AO_XSIZE_xor(addr, val) AO_XSIZE_xor_write(addr, val) +# define AO_HAVE_XSIZE_xor +#endif +#if !defined(AO_HAVE_XSIZE_xor) && defined(AO_HAVE_XSIZE_xor_read) +# define AO_XSIZE_xor(addr, val) AO_XSIZE_xor_read(addr, val) +# define AO_HAVE_XSIZE_xor +#endif + +#if defined(AO_HAVE_XSIZE_xor_acquire) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_xor_full) +# define AO_XSIZE_xor_full(addr, val) \ + (AO_nop_full(), AO_XSIZE_xor_acquire(addr, val)) +# define AO_HAVE_XSIZE_xor_full +#endif + +#if !defined(AO_HAVE_XSIZE_xor_release_write) \ + && defined(AO_HAVE_XSIZE_xor_write) +# define AO_XSIZE_xor_release_write(addr, val) AO_XSIZE_xor_write(addr, val) +# define AO_HAVE_XSIZE_xor_release_write +#endif +#if !defined(AO_HAVE_XSIZE_xor_release_write) \ + && defined(AO_HAVE_XSIZE_xor_release) +# define AO_XSIZE_xor_release_write(addr, val) AO_XSIZE_xor_release(addr, val) +# define AO_HAVE_XSIZE_xor_release_write +#endif +#if !defined(AO_HAVE_XSIZE_xor_acquire_read) \ + && defined(AO_HAVE_XSIZE_xor_read) +# define AO_XSIZE_xor_acquire_read(addr, val) AO_XSIZE_xor_read(addr, val) +# define AO_HAVE_XSIZE_xor_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_xor_acquire_read) \ + && defined(AO_HAVE_XSIZE_xor_acquire) +# define AO_XSIZE_xor_acquire_read(addr, val) AO_XSIZE_xor_acquire(addr, val) +# define AO_HAVE_XSIZE_xor_acquire_read +#endif + +/* XSIZE_and/or/xor_dd_acquire_read are meaningless. */ diff --git a/libatomic_ops-install/include/atomic_ops/generalize-small.h b/libatomic_ops/src/atomic_ops/generalize-small.h index 37d1d21..37d1d21 100644 --- a/libatomic_ops-install/include/atomic_ops/generalize-small.h +++ b/libatomic_ops/src/atomic_ops/generalize-small.h diff --git a/libatomic_ops/src/atomic_ops/generalize-small.template b/libatomic_ops/src/atomic_ops/generalize-small.template new file mode 100644 index 0000000..ac916a5 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/generalize-small.template @@ -0,0 +1,520 @@ +/* + * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* XSIZE_fetch_compare_and_swap */ +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire) + AO_INLINE XCTYPE + AO_XSIZE_fetch_compare_and_swap_acquire(volatile XCTYPE *addr, + XCTYPE old_val, XCTYPE new_val) + { + XCTYPE result = AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val); + AO_nop_full(); + return result; + } +# define AO_HAVE_XSIZE_fetch_compare_and_swap_acquire +#endif +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release) +# define AO_XSIZE_fetch_compare_and_swap_release(addr, old_val, new_val) \ + (AO_nop_full(), \ + AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val)) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_release +#endif +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_full) +# if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release) +# define AO_XSIZE_fetch_compare_and_swap_release(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_full(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_release +# endif +# if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire) +# define AO_XSIZE_fetch_compare_and_swap_acquire(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_full(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_acquire +# endif +# if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_write) +# define AO_XSIZE_fetch_compare_and_swap_write(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_full(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_write +# endif +# if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_read) +# define AO_XSIZE_fetch_compare_and_swap_read(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_full(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_read +# endif +#endif /* AO_HAVE_XSIZE_fetch_compare_and_swap_full */ + +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release) +# define AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_release(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap +#endif +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire) +# define AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_acquire(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap +#endif +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_write) +# define AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_write(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap +#endif +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_read) +# define AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val) \ + AO_XSIZE_fetch_compare_and_swap_read(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap +#endif + +#if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire) \ + && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_full) +# define AO_XSIZE_fetch_compare_and_swap_full(addr, old_val, new_val) \ + (AO_nop_full(), \ + AO_XSIZE_fetch_compare_and_swap_acquire(addr, old_val, new_val)) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_full +#endif + +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_write) +# define AO_XSIZE_fetch_compare_and_swap_release_write(addr,old_val,new_val) \ + AO_XSIZE_fetch_compare_and_swap_write(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release_write) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_release) +# define AO_XSIZE_fetch_compare_and_swap_release_write(addr,old_val,new_val) \ + AO_XSIZE_fetch_compare_and_swap_release(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_release_write +#endif +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_read) +# define AO_XSIZE_fetch_compare_and_swap_acquire_read(addr,old_val,new_val) \ + AO_XSIZE_fetch_compare_and_swap_read(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire_read) \ + && defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire) +# define AO_XSIZE_fetch_compare_and_swap_acquire_read(addr,old_val,new_val) \ + AO_XSIZE_fetch_compare_and_swap_acquire(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_acquire_read +#endif + +#ifdef AO_NO_DD_ORDERING +# if defined(AO_HAVE_XSIZE_fetch_compare_and_swap_acquire_read) +# define AO_XSIZE_fetch_compare_and_swap_dd_acquire_read(addr,old_val,new_val) \ + AO_XSIZE_fetch_compare_and_swap_acquire_read(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_dd_acquire_read +# endif +#else +# if defined(AO_HAVE_XSIZE_fetch_compare_and_swap) +# define AO_XSIZE_fetch_compare_and_swap_dd_acquire_read(addr,old_val,new_val) \ + AO_XSIZE_fetch_compare_and_swap(addr, old_val, new_val) +# define AO_HAVE_XSIZE_fetch_compare_and_swap_dd_acquire_read +# endif +#endif /* !AO_NO_DD_ORDERING */ + +/* XSIZE_compare_and_swap */ +#if defined(AO_HAVE_XSIZE_compare_and_swap) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_acquire) + AO_INLINE int + AO_XSIZE_compare_and_swap_acquire(volatile XCTYPE *addr, XCTYPE old, + XCTYPE new_val) + { + int result = AO_XSIZE_compare_and_swap(addr, old, new_val); + AO_nop_full(); + return result; + } +# define AO_HAVE_XSIZE_compare_and_swap_acquire +#endif +#if defined(AO_HAVE_XSIZE_compare_and_swap) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_release) +# define AO_XSIZE_compare_and_swap_release(addr, old, new_val) \ + (AO_nop_full(), AO_XSIZE_compare_and_swap(addr, old, new_val)) +# define AO_HAVE_XSIZE_compare_and_swap_release +#endif +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) +# if !defined(AO_HAVE_XSIZE_compare_and_swap_release) +# define AO_XSIZE_compare_and_swap_release(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_full(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_release +# endif +# if !defined(AO_HAVE_XSIZE_compare_and_swap_acquire) +# define AO_XSIZE_compare_and_swap_acquire(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_full(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_acquire +# endif +# if !defined(AO_HAVE_XSIZE_compare_and_swap_write) +# define AO_XSIZE_compare_and_swap_write(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_full(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_write +# endif +# if !defined(AO_HAVE_XSIZE_compare_and_swap_read) +# define AO_XSIZE_compare_and_swap_read(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_full(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_read +# endif +#endif /* AO_HAVE_XSIZE_compare_and_swap_full */ + +#if !defined(AO_HAVE_XSIZE_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_release) +# define AO_XSIZE_compare_and_swap(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_release(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap +#endif +#if !defined(AO_HAVE_XSIZE_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_acquire) +# define AO_XSIZE_compare_and_swap(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_acquire(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap +#endif +#if !defined(AO_HAVE_XSIZE_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_write) +# define AO_XSIZE_compare_and_swap(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_write(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap +#endif +#if !defined(AO_HAVE_XSIZE_compare_and_swap) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_read) +# define AO_XSIZE_compare_and_swap(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_read(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_acquire) \ + && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_compare_and_swap_full) +# define AO_XSIZE_compare_and_swap_full(addr, old, new_val) \ + (AO_nop_full(), \ + AO_XSIZE_compare_and_swap_acquire(addr, old, new_val)) +# define AO_HAVE_XSIZE_compare_and_swap_full +#endif + +#if !defined(AO_HAVE_XSIZE_compare_and_swap_release_write) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_write) +# define AO_XSIZE_compare_and_swap_release_write(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_write(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_release_write +#endif +#if !defined(AO_HAVE_XSIZE_compare_and_swap_release_write) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_release) +# define AO_XSIZE_compare_and_swap_release_write(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_release(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_release_write +#endif +#if !defined(AO_HAVE_XSIZE_compare_and_swap_acquire_read) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_read) +# define AO_XSIZE_compare_and_swap_acquire_read(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_read(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_acquire_read +#endif +#if !defined(AO_HAVE_XSIZE_compare_and_swap_acquire_read) \ + && defined(AO_HAVE_XSIZE_compare_and_swap_acquire) +# define AO_XSIZE_compare_and_swap_acquire_read(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_acquire(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_acquire_read +#endif + +#ifdef AO_NO_DD_ORDERING +# if defined(AO_HAVE_XSIZE_compare_and_swap_acquire_read) +# define AO_XSIZE_compare_and_swap_dd_acquire_read(addr, old, new_val) \ + AO_XSIZE_compare_and_swap_acquire_read(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_dd_acquire_read +# endif +#else +# if defined(AO_HAVE_XSIZE_compare_and_swap) +# define AO_XSIZE_compare_and_swap_dd_acquire_read(addr, old, new_val) \ + AO_XSIZE_compare_and_swap(addr, old, new_val) +# define AO_HAVE_XSIZE_compare_and_swap_dd_acquire_read +# endif +#endif /* !AO_NO_DD_ORDERING */ + +/* XSIZE_load */ +#if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_acquire) +# define AO_XSIZE_load_acquire(addr) AO_XSIZE_load_full(addr) +# define AO_HAVE_XSIZE_load_acquire +#endif + +#if defined(AO_HAVE_XSIZE_load_acquire) && !defined(AO_HAVE_XSIZE_load) +# define AO_XSIZE_load(addr) AO_XSIZE_load_acquire(addr) +# define AO_HAVE_XSIZE_load +#endif + +#if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_read) +# define AO_XSIZE_load_read(addr) AO_XSIZE_load_full(addr) +# define AO_HAVE_XSIZE_load_read +#endif + +#if !defined(AO_HAVE_XSIZE_load_acquire_read) \ + && defined(AO_HAVE_XSIZE_load_acquire) +# define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_acquire(addr) +# define AO_HAVE_XSIZE_load_acquire_read +#endif + +#if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_load_acquire) + AO_INLINE XCTYPE + AO_XSIZE_load_acquire(const volatile XCTYPE *addr) + { + XCTYPE result = AO_XSIZE_load(addr); + + /* Acquire barrier would be useless, since the load could be delayed */ + /* beyond it. */ + AO_nop_full(); + return result; + } +# define AO_HAVE_XSIZE_load_acquire +#endif + +#if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_read) \ + && !defined(AO_HAVE_XSIZE_load_read) + AO_INLINE XCTYPE + AO_XSIZE_load_read(const volatile XCTYPE *addr) + { + XCTYPE result = AO_XSIZE_load(addr); + + AO_nop_read(); + return result; + } +# define AO_HAVE_XSIZE_load_read +#endif + +#if defined(AO_HAVE_XSIZE_load_acquire) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_load_full) +# define AO_XSIZE_load_full(addr) (AO_nop_full(), AO_XSIZE_load_acquire(addr)) +# define AO_HAVE_XSIZE_load_full +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_read) \ + && !defined(AO_HAVE_XSIZE_load_read) +# define AO_XSIZE_CAS_BASED_LOAD_READ + AO_INLINE XCTYPE + AO_XSIZE_load_read(const volatile XCTYPE *addr) + { + XCTYPE result; + + do { + result = *(const XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_read( + (volatile XCTYPE *)addr, + result, result))); + return result; + } +# define AO_HAVE_XSIZE_load_read +#endif + +#if !defined(AO_HAVE_XSIZE_load_acquire_read) \ + && defined(AO_HAVE_XSIZE_load_read) +# define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_read(addr) +# define AO_HAVE_XSIZE_load_acquire_read +#endif + +#if defined(AO_HAVE_XSIZE_load_acquire_read) && !defined(AO_HAVE_XSIZE_load) \ + && (!defined(AO_XSIZE_CAS_BASED_LOAD_READ) \ + || !defined(AO_HAVE_XSIZE_compare_and_swap)) +# define AO_XSIZE_load(addr) AO_XSIZE_load_acquire_read(addr) +# define AO_HAVE_XSIZE_load +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_load_full) + AO_INLINE XCTYPE + AO_XSIZE_load_full(const volatile XCTYPE *addr) + { + XCTYPE result; + + do { + result = *(const XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_full( + (volatile XCTYPE *)addr, + result, result))); + return result; + } +# define AO_HAVE_XSIZE_load_full +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_acquire) \ + && !defined(AO_HAVE_XSIZE_load_acquire) + AO_INLINE XCTYPE + AO_XSIZE_load_acquire(const volatile XCTYPE *addr) + { + XCTYPE result; + + do { + result = *(const XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_acquire( + (volatile XCTYPE *)addr, + result, result))); + return result; + } +# define AO_HAVE_XSIZE_load_acquire +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap) && !defined(AO_HAVE_XSIZE_load) + AO_INLINE XCTYPE + AO_XSIZE_load(const volatile XCTYPE *addr) + { + XCTYPE result; + + do { + result = *(const XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap( + (volatile XCTYPE *)addr, + result, result))); + return result; + } +# define AO_HAVE_XSIZE_load +#endif + +#ifdef AO_NO_DD_ORDERING +# if defined(AO_HAVE_XSIZE_load_acquire_read) +# define AO_XSIZE_load_dd_acquire_read(addr) \ + AO_XSIZE_load_acquire_read(addr) +# define AO_HAVE_XSIZE_load_dd_acquire_read +# endif +#else +# if defined(AO_HAVE_XSIZE_load) +# define AO_XSIZE_load_dd_acquire_read(addr) AO_XSIZE_load(addr) +# define AO_HAVE_XSIZE_load_dd_acquire_read +# endif +#endif /* !AO_NO_DD_ORDERING */ + +/* XSIZE_store */ +#if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_release) +# define AO_XSIZE_store_release(addr, val) AO_XSIZE_store_full(addr, val) +# define AO_HAVE_XSIZE_store_release +#endif + +#if defined(AO_HAVE_XSIZE_store_release) && !defined(AO_HAVE_XSIZE_store) +# define AO_XSIZE_store(addr, val) AO_XSIZE_store_release(addr, val) +# define AO_HAVE_XSIZE_store +#endif + +#if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_write) +# define AO_XSIZE_store_write(addr, val) AO_XSIZE_store_full(addr, val) +# define AO_HAVE_XSIZE_store_write +#endif + +#if defined(AO_HAVE_XSIZE_store_release) \ + && !defined(AO_HAVE_XSIZE_store_release_write) +# define AO_XSIZE_store_release_write(addr, val) \ + AO_XSIZE_store_release(addr, val) +# define AO_HAVE_XSIZE_store_release_write +#endif + +#if defined(AO_HAVE_XSIZE_store_write) && !defined(AO_HAVE_XSIZE_store) +# define AO_XSIZE_store(addr, val) AO_XSIZE_store_write(addr, val) +# define AO_HAVE_XSIZE_store +#endif + +#if defined(AO_HAVE_XSIZE_store) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_store_release) +# define AO_XSIZE_store_release(addr, val) \ + (AO_nop_full(), AO_XSIZE_store(addr, val)) +# define AO_HAVE_XSIZE_store_release +#endif + +#if defined(AO_HAVE_XSIZE_store) && defined(AO_HAVE_nop_write) \ + && !defined(AO_HAVE_XSIZE_store_write) +# define AO_XSIZE_store_write(addr, val) \ + (AO_nop_write(), AO_XSIZE_store(addr, val)) +# define AO_HAVE_XSIZE_store_write +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_write) \ + && !defined(AO_HAVE_XSIZE_store_write) + AO_INLINE void + AO_XSIZE_store_write(volatile XCTYPE *addr, XCTYPE new_val) + { + XCTYPE old_val; + + do { + old_val = *(XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_write(addr, old_val, + new_val))); + } +# define AO_HAVE_XSIZE_store_write +#endif + +#if defined(AO_HAVE_XSIZE_store_write) \ + && !defined(AO_HAVE_XSIZE_store_release_write) +# define AO_XSIZE_store_release_write(addr, val) \ + AO_XSIZE_store_write(addr, val) +# define AO_HAVE_XSIZE_store_release_write +#endif + +#if defined(AO_HAVE_XSIZE_store_release) && defined(AO_HAVE_nop_full) \ + && !defined(AO_HAVE_XSIZE_store_full) +# define AO_XSIZE_store_full(addr, val) \ + (AO_XSIZE_store_release(addr, val), \ + AO_nop_full()) +# define AO_HAVE_XSIZE_store_full +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap) && !defined(AO_HAVE_XSIZE_store) + AO_INLINE void + AO_XSIZE_store(volatile XCTYPE *addr, XCTYPE new_val) + { + XCTYPE old_val; + + do { + old_val = *(XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap(addr, + old_val, new_val))); + } +# define AO_HAVE_XSIZE_store +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_release) \ + && !defined(AO_HAVE_XSIZE_store_release) + AO_INLINE void + AO_XSIZE_store_release(volatile XCTYPE *addr, XCTYPE new_val) + { + XCTYPE old_val; + + do { + old_val = *(XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_release(addr, old_val, + new_val))); + } +# define AO_HAVE_XSIZE_store_release +#endif + +#if defined(AO_HAVE_XSIZE_compare_and_swap_full) \ + && !defined(AO_HAVE_XSIZE_store_full) + AO_INLINE void + AO_XSIZE_store_full(volatile XCTYPE *addr, XCTYPE new_val) + { + XCTYPE old_val; + + do { + old_val = *(XCTYPE *)addr; + } while (AO_EXPECT_FALSE(!AO_XSIZE_compare_and_swap_full(addr, old_val, + new_val))); + } +# define AO_HAVE_XSIZE_store_full +#endif diff --git a/libatomic_ops-install/include/atomic_ops/generalize.h b/libatomic_ops/src/atomic_ops/generalize.h index 3e66341..3e66341 100644 --- a/libatomic_ops-install/include/atomic_ops/generalize.h +++ b/libatomic_ops/src/atomic_ops/generalize.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/README b/libatomic_ops/src/atomic_ops/sysdeps/README new file mode 100644 index 0000000..605699f --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/README @@ -0,0 +1,7 @@ +There are two kinds of entities in this directory: + +- Subdirectories corresponding to specific compilers (or compiler/OS combinations). + Each of these includes one or more architecture-specific headers. + +- More generic header files corresponding to a particular ordering and/or + atomicity property that might be shared by multiple hardware platforms. diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/all_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h index f0240e4..f0240e4 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/all_acquire_release_volatile.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/all_aligned_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h index 6d81279..6d81279 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/all_aligned_atomic_load_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/all_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h index b9e414f..b9e414f 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/all_atomic_load_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/all_atomic_only_load.h b/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_only_load.h index 695f6b8..695f6b8 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/all_atomic_only_load.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_only_load.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/ao_t_is_int.h b/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h index 295998e..295998e 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/ao_t_is_int.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.template b/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.template new file mode 100644 index 0000000..620faea --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.template @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* Inclusion of this file signifies that AO_t is in fact int. */ +/* Hence any AO_... operation can also serve as AO_int_... operation. */ + +#if defined(AO_HAVE_load_XBAR) && !defined(AO_HAVE_int_load_XBAR) +# define AO_int_load_XBAR(addr) \ + (unsigned)AO_load_XBAR((const volatile AO_t *)(addr)) +# define AO_HAVE_int_load_XBAR +#endif + +#if defined(AO_HAVE_store_XBAR) && !defined(AO_HAVE_int_store_XBAR) +# define AO_int_store_XBAR(addr, val) \ + AO_store_XBAR((volatile AO_t *)(addr), (AO_t)(val)) +# define AO_HAVE_int_store_XBAR +#endif + +#if defined(AO_HAVE_fetch_and_add_XBAR) \ + && !defined(AO_HAVE_int_fetch_and_add_XBAR) +# define AO_int_fetch_and_add_XBAR(addr, incr) \ + (unsigned)AO_fetch_and_add_XBAR((volatile AO_t *)(addr), \ + (AO_t)(incr)) +# define AO_HAVE_int_fetch_and_add_XBAR +#endif + +#if defined(AO_HAVE_fetch_and_add1_XBAR) \ + && !defined(AO_HAVE_int_fetch_and_add1_XBAR) +# define AO_int_fetch_and_add1_XBAR(addr) \ + (unsigned)AO_fetch_and_add1_XBAR((volatile AO_t *)(addr)) +# define AO_HAVE_int_fetch_and_add1_XBAR +#endif + +#if defined(AO_HAVE_fetch_and_sub1_XBAR) \ + && !defined(AO_HAVE_int_fetch_and_sub1_XBAR) +# define AO_int_fetch_and_sub1_XBAR(addr) \ + (unsigned)AO_fetch_and_sub1_XBAR((volatile AO_t *)(addr)) +# define AO_HAVE_int_fetch_and_sub1_XBAR +#endif + +#if defined(AO_HAVE_and_XBAR) && !defined(AO_HAVE_int_and_XBAR) +# define AO_int_and_XBAR(addr, val) \ + AO_and_XBAR((volatile AO_t *)(addr), (AO_t)(val)) +# define AO_HAVE_int_and_XBAR +#endif + +#if defined(AO_HAVE_or_XBAR) && !defined(AO_HAVE_int_or_XBAR) +# define AO_int_or_XBAR(addr, val) \ + AO_or_XBAR((volatile AO_t *)(addr), (AO_t)(val)) +# define AO_HAVE_int_or_XBAR +#endif + +#if defined(AO_HAVE_xor_XBAR) && !defined(AO_HAVE_int_xor_XBAR) +# define AO_int_xor_XBAR(addr, val) \ + AO_xor_XBAR((volatile AO_t *)(addr), (AO_t)(val)) +# define AO_HAVE_int_xor_XBAR +#endif + +#if defined(AO_HAVE_fetch_compare_and_swap_XBAR) \ + && !defined(AO_HAVE_int_fetch_compare_and_swap_XBAR) +# define AO_int_fetch_compare_and_swap_XBAR(addr, old, new_val) \ + (unsigned)AO_fetch_compare_and_swap_XBAR((volatile AO_t *)(addr), \ + (AO_t)(old), (AO_t)(new_val)) +# define AO_HAVE_int_fetch_compare_and_swap_XBAR +#endif + +#if defined(AO_HAVE_compare_and_swap_XBAR) \ + && !defined(AO_HAVE_int_compare_and_swap_XBAR) +# define AO_int_compare_and_swap_XBAR(addr, old, new_val) \ + AO_compare_and_swap_XBAR((volatile AO_t *)(addr), \ + (AO_t)(old), (AO_t)(new_val)) +# define AO_HAVE_int_compare_and_swap_XBAR +#endif diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/armcc/arm_v6.h b/libatomic_ops/src/atomic_ops/sysdeps/armcc/arm_v6.h index 9376e5b..9376e5b 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/armcc/arm_v6.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/armcc/arm_v6.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/emul_cas.h b/libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h index 2a592bc..2a592bc 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/emul_cas.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/aarch64.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/aarch64.h index 6ae26f3..54e6d7f 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/aarch64.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/aarch64.h @@ -171,6 +171,29 @@ return !result; } # define AO_HAVE_double_compare_and_swap_release -#endif + + AO_INLINE int + AO_double_compare_and_swap_full(volatile AO_double_t *addr, + AO_double_t old_val, AO_double_t new_val) + { + AO_double_t tmp; + int result = 1; + + do { + __asm__ __volatile__("//AO_double_compare_and_swap_full\n" + " ldaxp %0, %1, %2\n" + : "=&r" (tmp.AO_val1), "=&r" (tmp.AO_val2) + : "Q" (*addr)); + if (tmp.AO_val1 != old_val.AO_val1 || tmp.AO_val2 != old_val.AO_val2) + break; + __asm__ __volatile__( + " stlxp %w0, %2, %3, %1\n" + : "=&r" (result), "=Q" (*addr) + : "r" (new_val.AO_val1), "r" (new_val.AO_val2)); + } while (AO_EXPECT_FALSE(result)); + return !result; + } +# define AO_HAVE_double_compare_and_swap_full +#endif /* __GNUC__ == 4 */ #include "generic.h" diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/alpha.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h index 3b98bec..3b98bec 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/alpha.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/arm.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h index 9b05216..c19f6da 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/arm.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h @@ -47,7 +47,8 @@ && ((!defined(__ARM_ARCH_5__) && !defined(__ARM_ARCH_5E__) \ && !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) \ && !defined(__ARM_ARCH_5TEJ__) && !defined(__ARM_ARCH_6M__)) \ - || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)) + || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_8A__)) # define AO_ARM_HAVE_LDREX # if !defined(__ARM_ARCH_6__) && !defined(__ARM_ARCH_6J__) \ && !defined(__ARM_ARCH_6T2__) @@ -61,21 +62,26 @@ /* DMB is present in ARMv6M and ARMv7+. */ # define AO_ARM_HAVE_DMB # endif -# if !defined(__thumb__) \ - || (defined(__thumb2__) && !defined(__ARM_ARCH_7__) \ - && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__)) +# if (!defined(__thumb__) \ + || (defined(__thumb2__) && !defined(__ARM_ARCH_7__) \ + && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__))) \ + && (!defined(__clang__) || (__clang_major__ > 3) \ + || (__clang_major__ == 3 && __clang_minor__ >= 3)) /* LDREXD/STREXD present in ARMv6K/M+ (see gas/config/tc-arm.c). */ /* In the Thumb mode, this works only starting from ARMv7 (except */ - /* for the base and 'M' models). */ + /* for the base and 'M' models). Clang3.2 (and earlier) does not */ + /* allocate register pairs for LDREXD/STREXD properly (besides, */ + /* Clang3.1 does not support "%H<r>" operand specification). */ # define AO_ARM_HAVE_LDREXD # endif /* !thumb || ARMv7A || ARMv7R+ */ # endif /* ARMv7+ */ #endif /* ARMv6+ */ #if !defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_6M__) \ - && !defined(__thumb2__) + && !defined(__ARM_ARCH_8A__) && !defined(__thumb2__) # define AO_ARM_HAVE_SWP /* Note: ARMv6M is excluded due to no ARM mode support. */ + /* Also, SWP is obsoleted for ARMv8+. */ #endif /* !__thumb2__ */ #ifdef AO_UNIPROCESSOR @@ -387,7 +393,7 @@ AO_xor(volatile AO_t *p, AO_t value) AO_INLINE unsigned char AO_char_fetch_and_add(volatile unsigned char *p, unsigned char incr) { - unsigned char result, tmp; + unsigned result, tmp; int flag; __asm__ __volatile__("@AO_char_fetch_and_add\n" @@ -399,16 +405,16 @@ AO_xor(volatile AO_t *p, AO_t value) " bne 1b\n" AO_THUMB_RESTORE_MODE : "=&r" (result), "=&r" (flag), "=&r" (tmp), "+m" (*p) - : "r" (incr), "r" (p) + : "r" ((unsigned)incr), "r" (p) : AO_THUMB_SWITCH_CLOBBERS "cc"); - return result; + return (unsigned char)result; } # define AO_HAVE_char_fetch_and_add AO_INLINE unsigned short AO_short_fetch_and_add(volatile unsigned short *p, unsigned short incr) { - unsigned short result, tmp; + unsigned result, tmp; int flag; __asm__ __volatile__("@AO_short_fetch_and_add\n" @@ -420,9 +426,9 @@ AO_xor(volatile AO_t *p, AO_t value) " bne 1b\n" AO_THUMB_RESTORE_MODE : "=&r" (result), "=&r" (flag), "=&r" (tmp), "+m" (*p) - : "r" (incr), "r" (p) + : "r" ((unsigned)incr), "r" (p) : AO_THUMB_SWITCH_CLOBBERS "cc"); - return result; + return (unsigned short)result; } # define AO_HAVE_short_fetch_and_add #endif /* AO_ARM_HAVE_LDREXBH */ @@ -440,6 +446,8 @@ AO_xor(volatile AO_t *p, AO_t value) " ldrex %1, [%3]\n" /* get original */ " teq %1, %4\n" /* see if match */ # ifdef __thumb2__ + /* TODO: Eliminate warning: it blocks containing wide Thumb */ + /* instructions are deprecated in ARMv8. */ " it eq\n" # endif " strexeq %0, %5, [%3]\n" /* store new one if matched */ @@ -495,7 +503,7 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val) /* AO_THUMB_GO_ARM is empty. */ __asm__ __volatile__("@AO_double_load\n" - " ldrexd %0, [%1]" + " ldrexd %0, %H0, [%1]" : "=&r" (result.AO_whole) : "r" (addr) /* : no clobber */); @@ -512,8 +520,8 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val) do { /* AO_THUMB_GO_ARM is empty. */ __asm__ __volatile__("@AO_double_store\n" - " ldrexd %0, [%3]\n" - " strexd %1, %4, [%3]" + " ldrexd %0, %H0, [%3]\n" + " strexd %1, %4, %H4, [%3]" : "=&r" (old_val.AO_whole), "=&r" (status), "+m" (*addr) : "r" (addr), "r" (new_val.AO_whole) : "cc"); @@ -531,16 +539,16 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val) do { /* AO_THUMB_GO_ARM is empty. */ __asm__ __volatile__("@AO_double_compare_and_swap\n" - " ldrexd %0, [%1]\n" /* get original to r1 & r2 */ + " ldrexd %0, %H0, [%1]\n" /* get original to r1 & r2 */ : "=&r"(tmp) : "r"(addr) /* : no clobber */); if (tmp != old_val.AO_whole) break; __asm__ __volatile__( - " strexd %0, %2, [%3]\n" /* store new one if matched */ + " strexd %0, %3, %H3, [%2]\n" /* store new one if matched */ : "=&r"(result), "+m"(*addr) - : "r"(new_val.AO_whole), "r"(addr) + : "r" (addr), "r" (new_val.AO_whole) : "cc"); } while (AO_EXPECT_FALSE(result)); return !result; /* if succeded, return 1 else 0 */ diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/avr32.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h index b0c52c7..b0c52c7 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/avr32.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/cris.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h index 5b9a6f3..5b9a6f3 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/cris.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic-arithm.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.h index 65e7767..65e7767 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic-arithm.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.template b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.template new file mode 100644 index 0000000..2067d55 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-arithm.template @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. + * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. + * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. + * + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +AO_INLINE XCTYPE +AO_XSIZE_fetch_and_add_XBAR(volatile XCTYPE *addr, XCTYPE incr) +{ + return __atomic_fetch_add(addr, incr, __ATOMIC_XGCCBAR); +} +#define AO_HAVE_XSIZE_fetch_and_add_XBAR + +AO_INLINE void +AO_XSIZE_and_XBAR(volatile XCTYPE *addr, XCTYPE value) +{ + (void)__atomic_and_fetch(addr, value, __ATOMIC_XGCCBAR); +} +#define AO_HAVE_XSIZE_and_XBAR + +AO_INLINE void +AO_XSIZE_or_XBAR(volatile XCTYPE *addr, XCTYPE value) +{ + (void)__atomic_or_fetch(addr, value, __ATOMIC_XGCCBAR); +} +#define AO_HAVE_XSIZE_or_XBAR + +AO_INLINE void +AO_XSIZE_xor_XBAR(volatile XCTYPE *addr, XCTYPE value) +{ + (void)__atomic_xor_fetch(addr, value, __ATOMIC_XGCCBAR); +} +#define AO_HAVE_XSIZE_xor_XBAR diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic-small.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.h index 72f4a5b..72f4a5b 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic-small.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.template b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.template new file mode 100644 index 0000000..9685acf --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic-small.template @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. + * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. + * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. + * + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +AO_INLINE XCTYPE +AO_XSIZE_load(const volatile XCTYPE *addr) +{ + return __atomic_load_n(addr, __ATOMIC_RELAXED); +} +#define AO_HAVE_XSIZE_load + +AO_INLINE XCTYPE +AO_XSIZE_load_acquire(const volatile XCTYPE *addr) +{ + return __atomic_load_n(addr, __ATOMIC_ACQUIRE); +} +#define AO_HAVE_XSIZE_load_acquire + +/* XSIZE_load_full is generalized using load and nop_full, so that */ +/* XSIZE_load_read is defined using load and nop_read. */ +/* XSIZE_store_full definition is omitted similar to load_full reason. */ + +AO_INLINE void +AO_XSIZE_store(volatile XCTYPE *addr, XCTYPE value) +{ + __atomic_store_n(addr, value, __ATOMIC_RELAXED); +} +#define AO_HAVE_XSIZE_store + +AO_INLINE void +AO_XSIZE_store_release(volatile XCTYPE *addr, XCTYPE value) +{ + __atomic_store_n(addr, value, __ATOMIC_RELEASE); +} +#define AO_HAVE_XSIZE_store_release + +AO_INLINE XCTYPE +AO_XSIZE_fetch_compare_and_swap(volatile XCTYPE *addr, + XCTYPE old_val, XCTYPE new_val) +{ + return __sync_val_compare_and_swap(addr, old_val, new_val + /* empty protection list */); +} +#define AO_HAVE_XSIZE_fetch_compare_and_swap + +/* TODO: Add CAS _acquire/release/full primitives. */ + +#ifndef AO_GENERALIZE_ASM_BOOL_CAS + AO_INLINE int + AO_XSIZE_compare_and_swap(volatile XCTYPE *addr, + XCTYPE old_val, XCTYPE new_val) + { + return __sync_bool_compare_and_swap(addr, old_val, new_val + /* empty protection list */); + } +# define AO_HAVE_XSIZE_compare_and_swap +#endif /* !AO_GENERALIZE_ASM_BOOL_CAS */ diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic.h index de79edb..de79edb 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/generic.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/generic.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/hexagon.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/hexagon.h index da7eb4e..da7eb4e 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/hexagon.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/hexagon.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/hppa.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h index d36f582..d36f582 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/hppa.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/ia64.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h index f5549fe..f5549fe 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/ia64.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/m68k.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h index 665f7c1..665f7c1 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/m68k.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/mips.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/mips.h index a891de6..a891de6 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/mips.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/mips.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/powerpc.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h index 94e83e7..94e83e7 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/powerpc.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/s390.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h index 36efbac..36efbac 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/s390.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/sh.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/sh.h index 098fb8c..098fb8c 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/sh.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/sh.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/sparc.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h index 79eb763..79eb763 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/sparc.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/x86.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h index 62b50c9..db66dda 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/gcc/x86.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h @@ -114,6 +114,10 @@ AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr) : "memory"); } # define AO_HAVE_xor_full + + /* AO_store_full could be implemented directly using "xchg" but it */ + /* could be generalized efficiently as an ordinary store accomplished */ + /* with AO_nop_full ("mfence" instruction). */ #endif /* !AO_PREFER_GENERALIZED */ AO_INLINE AO_TS_VAL_t diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/generic_pthread.h b/libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h index 3c65624..3c65624 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/generic_pthread.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/hpc/hppa.h b/libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h index 4e27eb2..4e27eb2 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/hpc/hppa.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/hpc/ia64.h b/libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h index 6391eda..6391eda 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/hpc/ia64.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/ibmc/powerpc.h b/libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h index e2d4027..e2d4027 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/ibmc/powerpc.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/icc/ia64.h b/libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h index b43a501..b43a501 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/icc/ia64.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h index 51c8560..51c8560 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template new file mode 100644 index 0000000..10f45a9 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* This file adds definitions appropriate for environments in which */ +/* volatile load of a given type has acquire semantics, and volatile */ +/* store of a given type has release semantics. This is arguably */ +/* supposed to be true with the standard Itanium software conventions. */ +/* Empirically gcc/ia64 does some reordering of ordinary operations */ +/* around volatiles even when we think it should not. GCC v3.3 and */ +/* earlier could reorder a volatile store with another store. As of */ +/* March 2005, gcc pre-4 reuses some previously computed common */ +/* subexpressions across a volatile load; hence, we now add compiler */ +/* barriers for gcc. */ + +#ifndef AO_GCC_BARRIER + /* TODO: Check GCC version (if workaround not needed for modern GCC). */ +# if defined(__GNUC__) +# define AO_GCC_BARRIER() AO_compiler_barrier() +# else +# define AO_GCC_BARRIER() (void)0 +# endif +#endif + +AO_INLINE XCTYPE +AO_XSIZE_load_acquire(const volatile XCTYPE *addr) +{ + XCTYPE result = *addr; + + /* A normal volatile load generates an ld.acq (on IA-64). */ + AO_GCC_BARRIER(); + return result; +} +#define AO_HAVE_XSIZE_load_acquire + +AO_INLINE void +AO_XSIZE_store_release(volatile XCTYPE *addr, XCTYPE new_val) +{ + AO_GCC_BARRIER(); + /* A normal volatile store generates an st.rel (on IA-64). */ + *addr = new_val; +} +#define AO_HAVE_XSIZE_store_release diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/atomic_load.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.h index 8a08b40..8a08b40 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/atomic_load.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.template b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.template new file mode 100644 index 0000000..02dadf5 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_load.template @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* Definitions for architectures on which loads of given type are */ +/* atomic (either for suitably aligned data only or for any legal */ +/* alignment). */ + +AO_INLINE XCTYPE +AO_XSIZE_load(const volatile XCTYPE *addr) +{ +# ifdef AO_ACCESS_XSIZE_CHECK_ALIGNED + assert(((size_t)addr & (sizeof(*addr) - 1)) == 0); +# endif + /* Cast away the volatile for architectures like IA64 where */ + /* volatile adds barrier (fence) semantics. */ + return *(const XCTYPE *)addr; +} +#define AO_HAVE_XSIZE_load diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/atomic_store.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.h index 23be715..23be715 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/atomic_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.template b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.template new file mode 100644 index 0000000..d111f2b --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/atomic_store.template @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* Definitions for architectures on which stores of given type are */ +/* atomic (either for suitably aligned data only or for any legal */ +/* alignment). */ + +AO_INLINE void +AO_XSIZE_store(volatile XCTYPE *addr, XCTYPE new_val) +{ +# ifdef AO_ACCESS_XSIZE_CHECK_ALIGNED + assert(((size_t)addr & (sizeof(*addr) - 1)) == 0); +# endif + *(XCTYPE *)addr = new_val; +} +#define AO_HAVE_XSIZE_store diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h index 6de6b8a..6de6b8a 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_atomic_load.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_atomic_load.h index ef60a17..ef60a17 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_atomic_load.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_atomic_load.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_atomic_store.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_atomic_store.h index 4fd5b21..4fd5b21 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/char_atomic_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/char_atomic_store.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h index 66ce628..66ce628 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h index 6b4875d..6b4875d 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_atomic_load.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_atomic_load.h index 6e9b49d..6e9b49d 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_atomic_load.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_atomic_load.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_atomic_store.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_atomic_store.h index 04adac5..04adac5 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/int_atomic_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/int_atomic_store.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/ordered_loads_only.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h index a64cfaf..a64cfaf 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/ordered_loads_only.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template new file mode 100644 index 0000000..45c5c1d --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef AO_HAVE_XSIZE_load + /* XSIZE_load_read is defined in generalize-small. */ +# define AO_XSIZE_load_acquire(addr) AO_XSIZE_load_read(addr) +# define AO_HAVE_XSIZE_load_acquire +#endif diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/ordered_stores_only.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h index a427f3b..a427f3b 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/ordered_stores_only.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template new file mode 100644 index 0000000..c51abc5 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef AO_HAVE_XSIZE_store +# define AO_XSIZE_store_release(addr, val) \ + (AO_nop_write(), AO_XSIZE_store(addr, val)) +# define AO_HAVE_XSIZE_store_release +#endif diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h index e753133..e753133 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_atomic_load.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_atomic_load.h index e351d99..e351d99 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_atomic_load.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_atomic_load.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_atomic_store.h b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_atomic_store.h index ccfc691..ccfc691 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/loadstore/short_atomic_store.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/loadstore/short_atomic_store.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/arm.h b/libatomic_ops/src/atomic_ops/sysdeps/msftc/arm.h index 647373b..647373b 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/arm.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/msftc/arm.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/common32_defs.h b/libatomic_ops/src/atomic_ops/sysdeps/msftc/common32_defs.h index 989974e..989974e 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/common32_defs.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/msftc/common32_defs.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/x86.h b/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h index 7c2995a..7c2995a 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/x86.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/x86_64.h b/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86_64.h index b4b0a3c..b4b0a3c 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/msftc/x86_64.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86_64.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/ordered.h b/libatomic_ops/src/atomic_ops/sysdeps/ordered.h index ba9822d..ba9822d 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/ordered.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/ordered.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/ordered_except_wr.h b/libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h index 78f4471..78f4471 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/ordered_except_wr.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/read_ordered.h b/libatomic_ops/src/atomic_ops/sysdeps/read_ordered.h index 420cd97..420cd97 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/read_ordered.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/read_ordered.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/standard_ao_double_t.h b/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h index bf76979..bf76979 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/standard_ao_double_t.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h diff --git a/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S b/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S new file mode 100644 index 0000000..4001a67 --- /dev/null +++ b/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S @@ -0,0 +1,5 @@ + .seg "text" + .globl AO_test_and_set_full +AO_test_and_set_full: + retl + ldstub [%o0],%o0 diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/sunc/sparc.h b/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h index 298881f..298881f 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/sunc/sparc.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/sunc/x86.h b/libatomic_ops/src/atomic_ops/sysdeps/sunc/x86.h index a3cb922..a3cb922 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/sunc/x86.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/sunc/x86.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h b/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h index 606f7ac..606f7ac 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h diff --git a/libatomic_ops-install/include/atomic_ops/sysdeps/test_and_set_t_is_char.h b/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h index 8e265aa..8e265aa 100644 --- a/libatomic_ops-install/include/atomic_ops/sysdeps/test_and_set_t_is_char.h +++ b/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h diff --git a/libatomic_ops/src/atomic_ops_malloc.c b/libatomic_ops/src/atomic_ops_malloc.c new file mode 100644 index 0000000..60757cf --- /dev/null +++ b/libatomic_ops/src/atomic_ops_malloc.c @@ -0,0 +1,305 @@ +/* + * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. + * + * This file may be redistributed and/or modified under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2, or (at your option) any later version. + * + * It is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the + * file COPYING for more details. + */ + +#if defined(HAVE_CONFIG_H) +# include "config.h" +#endif + +#define AO_REQUIRE_CAS +#include "atomic_ops_malloc.h" + +#include <string.h> /* for ffs, which is assumed reentrant. */ +#include <stdlib.h> +#include <assert.h> + +#ifdef AO_TRACE_MALLOC +# include <stdio.h> +# include <pthread.h> +#endif + +#if (defined(_WIN32_WCE) || defined(__MINGW32CE__)) && !defined(abort) +# define abort() _exit(-1) /* there is no abort() in WinCE */ +#endif + +/* + * We round up each allocation request to the next power of two + * minus one word. + * We keep one stack of free objects for each size. Each object + * has an initial word (offset -sizeof(AO_t) from the visible pointer) + * which contains either + * The binary log of the object size in bytes (small objects) + * The object size (a multiple of CHUNK_SIZE) for large objects. + * The second case only arises if mmap-based allocation is supported. + * We align the user-visible part of each object on a GRANULARITY + * byte boundary. That means that the actual (hidden) start of + * the object starts a word before this boundary. + */ + +#ifndef LOG_MAX_SIZE +# define LOG_MAX_SIZE 16 + /* We assume that 2**LOG_MAX_SIZE is a multiple of page size. */ +#endif + +#ifndef ALIGNMENT +# define ALIGNMENT 16 + /* Assumed to be at least sizeof(AO_t). */ +#endif + +#define CHUNK_SIZE (1 << LOG_MAX_SIZE) + +#ifndef AO_INITIAL_HEAP_SIZE +# define AO_INITIAL_HEAP_SIZE (2*(LOG_MAX_SIZE+1)*CHUNK_SIZE) +#endif + +char AO_initial_heap[AO_INITIAL_HEAP_SIZE]; + +static volatile AO_t initial_heap_ptr = (AO_t)AO_initial_heap; + +#if defined(HAVE_MMAP) + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/mman.h> + +#if defined(MAP_ANONYMOUS) || defined(MAP_ANON) +# define USE_MMAP_ANON +#endif + +#ifdef USE_MMAP_FIXED +# define GC_MMAP_FLAGS (MAP_FIXED | MAP_PRIVATE) + /* Seems to yield better performance on Solaris 2, but can */ + /* be unreliable if something is already mapped at the address. */ +#else +# define GC_MMAP_FLAGS MAP_PRIVATE +#endif + +#ifdef USE_MMAP_ANON +# ifdef MAP_ANONYMOUS +# define OPT_MAP_ANON MAP_ANONYMOUS +# else +# define OPT_MAP_ANON MAP_ANON +# endif +#else +# define OPT_MAP_ANON 0 +#endif + +static volatile AO_t mmap_enabled = 0; + +void +AO_malloc_enable_mmap(void) +{ +# if defined(__sun) + AO_store_release(&mmap_enabled, 1); + /* Workaround for Sun CC */ +# else + AO_store(&mmap_enabled, 1); +# endif +} + +static char *get_mmaped(size_t sz) +{ + char * result; +# ifdef USE_MMAP_ANON +# define zero_fd -1 +# else + int zero_fd; +# endif + + assert(!(sz & (CHUNK_SIZE - 1))); + if (!mmap_enabled) + return 0; + +# ifndef USE_MMAP_ANON + zero_fd = open("/dev/zero", O_RDONLY); + if (zero_fd == -1) + return 0; +# endif + result = mmap(0, sz, PROT_READ | PROT_WRITE, + GC_MMAP_FLAGS | OPT_MAP_ANON, zero_fd, 0/* offset */); +# ifndef USE_MMAP_ANON + close(zero_fd); +# endif + if (result == MAP_FAILED) + result = 0; + return result; +} + +/* Allocate an object of size (incl. header) of size > CHUNK_SIZE. */ +/* sz includes space for an AO_t-sized header. */ +static char * +AO_malloc_large(size_t sz) +{ + char * result; + /* The header will force us to waste ALIGNMENT bytes, incl. header. */ + sz += ALIGNMENT; + /* Round to multiple of CHUNK_SIZE. */ + sz = (sz + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1); + result = get_mmaped(sz); + if (result == 0) return 0; + result += ALIGNMENT; + ((AO_t *)result)[-1] = (AO_t)sz; + return result; +} + +static void +AO_free_large(char * p) +{ + AO_t sz = ((AO_t *)p)[-1]; + if (munmap(p - ALIGNMENT, (size_t)sz) != 0) + abort(); /* Programmer error. Not really async-signal-safe, but ... */ +} + + +#else /* No MMAP */ + +void +AO_malloc_enable_mmap(void) +{ +} + +#define get_mmaped(sz) ((char*)0) +#define AO_malloc_large(sz) ((char*)0) +#define AO_free_large(p) abort() + /* Programmer error. Not really async-signal-safe, but ... */ + +#endif /* No MMAP */ + +static char * +get_chunk(void) +{ + char *my_chunk_ptr; + + for (;;) { + char *initial_ptr = (char *)AO_load(&initial_heap_ptr); + + my_chunk_ptr = (char *)(((AO_t)initial_ptr + (ALIGNMENT - 1)) + & ~(ALIGNMENT - 1)); + if (initial_ptr != my_chunk_ptr) + { + /* Align correctly. If this fails, someone else did it for us. */ + (void)AO_compare_and_swap_acquire(&initial_heap_ptr, + (AO_t)initial_ptr, (AO_t)my_chunk_ptr); + } + + if (my_chunk_ptr - AO_initial_heap > AO_INITIAL_HEAP_SIZE - CHUNK_SIZE) + break; + if (AO_compare_and_swap(&initial_heap_ptr, (AO_t)my_chunk_ptr, + (AO_t)(my_chunk_ptr + CHUNK_SIZE))) { + return my_chunk_ptr; + } + } + + /* We failed. The initial heap is used up. */ + my_chunk_ptr = get_mmaped(CHUNK_SIZE); + assert (!((AO_t)my_chunk_ptr & (ALIGNMENT-1))); + return my_chunk_ptr; +} + +/* Object free lists. Ith entry corresponds to objects */ +/* of total size 2**i bytes. */ +AO_stack_t AO_free_list[LOG_MAX_SIZE+1]; + +/* Break up the chunk, and add it to the object free list for */ +/* the given size. We have exclusive access to chunk. */ +static void add_chunk_as(void * chunk, unsigned log_sz) +{ + size_t ofs, limit; + size_t sz = (size_t)1 << log_sz; + + assert (CHUNK_SIZE >= sz); + limit = (size_t)CHUNK_SIZE - sz; + for (ofs = ALIGNMENT - sizeof(AO_t); ofs <= limit; ofs += sz) { + AO_stack_push(&AO_free_list[log_sz], (AO_t *)((char *)chunk + ofs)); + } +} + +static const int msbs[16] = {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}; + +/* Return the position of the most significant set bit in the */ +/* argument. */ +/* We follow the conventions of ffs(), i.e. the least */ +/* significant bit is number one. */ +static int msb(size_t s) +{ + int result = 0; + int v; + if ((s & 0xff) != s) { + /* The following is a tricky code ought to be equivalent to */ + /* "(v = s >> 32) != 0" but suppresses warnings on 32-bit arch's. */ + if (sizeof(size_t) > 4 && (v = s >> (sizeof(size_t) > 4 ? 32 : 0)) != 0) + { + s = v; + result += 32; + } + if ((s >> 16) != 0) + { + s >>= 16; + result += 16; + } + if ((s >> 8) != 0) + { + s >>= 8; + result += 8; + } + } + if (s > 15) + { + s >>= 4; + result += 4; + } + result += msbs[s]; + return result; +} + +void * +AO_malloc(size_t sz) +{ + AO_t *result; + int log_sz; + + if (sz > CHUNK_SIZE) + return AO_malloc_large(sz); + log_sz = msb(sz + (sizeof(AO_t) - 1)); + result = AO_stack_pop(AO_free_list+log_sz); + while (0 == result) { + void * chunk = get_chunk(); + if (0 == chunk) return 0; + add_chunk_as(chunk, log_sz); + result = AO_stack_pop(AO_free_list+log_sz); + } + *result = log_sz; +# ifdef AO_TRACE_MALLOC + fprintf(stderr, "%x: AO_malloc(%lu) = %p\n", + (int)pthread_self(), (unsigned long)sz, result+1); +# endif + return result + 1; +} + +void +AO_free(void *p) +{ + char *base = (char *)p - sizeof(AO_t); + int log_sz; + + if (0 == p) return; + log_sz = (int)(*(AO_t *)base); +# ifdef AO_TRACE_MALLOC + fprintf(stderr, "%x: AO_free(%p sz:%lu)\n", (int)pthread_self(), p, + (unsigned long)(log_sz > LOG_MAX_SIZE? log_sz : (1 << log_sz))); +# endif + if (log_sz > LOG_MAX_SIZE) + AO_free_large(p); + else + AO_stack_push(AO_free_list+log_sz, (AO_t *)base); +} diff --git a/libatomic_ops-install/include/atomic_ops_malloc.h b/libatomic_ops/src/atomic_ops_malloc.h index e324d5b..e324d5b 100644 --- a/libatomic_ops-install/include/atomic_ops_malloc.h +++ b/libatomic_ops/src/atomic_ops_malloc.h diff --git a/libatomic_ops/src/atomic_ops_stack.c b/libatomic_ops/src/atomic_ops_stack.c new file mode 100644 index 0000000..642bac0 --- /dev/null +++ b/libatomic_ops/src/atomic_ops_stack.c @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. + * + * This file may be redistributed and/or modified under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2, or (at your option) any later version. + * + * It is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the + * file COPYING for more details. + */ + +#if defined(HAVE_CONFIG_H) +# include "config.h" +#endif + +#include <string.h> +#include <stdlib.h> +#include <assert.h> + +#define AO_REQUIRE_CAS +#include "atomic_ops_stack.h" + +#ifdef AO_USE_ALMOST_LOCK_FREE + + void AO_pause(int); /* defined in atomic_ops.c */ + +/* LIFO linked lists based on compare-and-swap. We need to avoid */ +/* the case of a node deletion and reinsertion while I'm deleting */ +/* it, since that may cause my CAS to succeed eventhough the next */ +/* pointer is now wrong. Our solution is not fully lock-free, but it */ +/* is good enough for signal handlers, provided we have a suitably low */ +/* bound on the number of recursive signal handler reentries. */ +/* A list consists of a first pointer and a blacklist */ +/* of pointer values that are currently being removed. No list element */ +/* on the blacklist may be inserted. If we would otherwise do so, we */ +/* are allowed to insert a variant that differs only in the least */ +/* significant, ignored, bits. If the list is full, we wait. */ + +/* Crucial observation: A particular padded pointer x (i.e. pointer */ +/* plus arbitrary low order bits) can never be newly inserted into */ +/* a list while it's in the corresponding auxiliary data structure. */ + +/* The second argument is a pointer to the link field of the element */ +/* to be inserted. */ +/* Both list headers and link fields contain "perturbed" pointers, i.e. */ +/* pointers with extra bits "or"ed into the low order bits. */ +void +AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, + AO_stack_aux *a) +{ + AO_t x_bits = (AO_t)x; + AO_t next; + + /* No deletions of x can start here, since x is not currently in the */ + /* list. */ + retry: +# if AO_BL_SIZE == 2 + { + /* Start all loads as close to concurrently as possible. */ + AO_t entry1 = AO_load(a -> AO_stack_bl); + AO_t entry2 = AO_load(a -> AO_stack_bl + 1); + if (entry1 == x_bits || entry2 == x_bits) + { + /* Entry is currently being removed. Change it a little. */ + ++x_bits; + if ((x_bits & AO_BIT_MASK) == 0) + /* Version count overflowed; */ + /* EXTREMELY unlikely, but possible. */ + x_bits = (AO_t)x; + goto retry; + } + } +# else + { + int i; + for (i = 0; i < AO_BL_SIZE; ++i) + { + if (AO_load(a -> AO_stack_bl + i) == x_bits) + { + /* Entry is currently being removed. Change it a little. */ + ++x_bits; + if ((x_bits & AO_BIT_MASK) == 0) + /* Version count overflowed; */ + /* EXTREMELY unlikely, but possible. */ + x_bits = (AO_t)x; + goto retry; + } + } + } +# endif + /* x_bits is not currently being deleted */ + do + { + next = AO_load(list); + *x = next; + } + while (AO_EXPECT_FALSE(!AO_compare_and_swap_release(list, next, x_bits))); +} + +/* + * I concluded experimentally that checking a value first before + * performing a compare-and-swap is usually beneficial on X86, but + * slows things down appreciably with contention on Itanium. + * Since the Itanium behavior makes more sense to me (more cache line + * movement unless we're mostly reading, but back-off should guard + * against that), we take Itanium as the default. Measurements on + * other multiprocessor architectures would be useful. (On a uniprocessor, + * the initial check is almost certainly a very small loss.) - HB + */ +#ifdef __i386__ +# define PRECHECK(a) (a) == 0 && +#else +# define PRECHECK(a) +#endif + +AO_t * +AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) +{ + unsigned i; + int j = 0; + AO_t first; + AO_t * first_ptr; + AO_t next; + + retry: + first = AO_load(list); + if (0 == first) return 0; + /* Insert first into aux black list. */ + /* This may spin if more than AO_BL_SIZE removals using auxiliary */ + /* structure a are currently in progress. */ + for (i = 0; ; ) + { + if (PRECHECK(a -> AO_stack_bl[i]) + AO_compare_and_swap_acquire(a->AO_stack_bl+i, 0, first)) + break; + ++i; + if ( i >= AO_BL_SIZE ) + { + i = 0; + AO_pause(++j); + } + } + assert(i < AO_BL_SIZE); + assert(a -> AO_stack_bl[i] == first); + /* First is on the auxiliary black list. It may be removed by */ + /* another thread before we get to it, but a new insertion of x */ + /* cannot be started here. */ + /* Only we can remove it from the black list. */ + /* We need to make sure that first is still the first entry on the */ + /* list. Otherwise it's possible that a reinsertion of it was */ + /* already started before we added the black list entry. */ +# if defined(__alpha__) && (__GNUC__ == 4) + if (first != AO_load(list)) + /* Workaround __builtin_expect bug found in */ + /* gcc-4.6.3/alpha causing test_stack failure. */ +# else + if (AO_EXPECT_FALSE(first != AO_load(list))) +# endif + { + AO_store_release(a->AO_stack_bl+i, 0); + goto retry; + } + first_ptr = AO_REAL_NEXT_PTR(first); + next = AO_load(first_ptr); +# if defined(__alpha__) && (__GNUC__ == 4) + if (!AO_compare_and_swap_release(list, first, next)) +# else + if (AO_EXPECT_FALSE(!AO_compare_and_swap_release(list, first, next))) +# endif + { + AO_store_release(a->AO_stack_bl+i, 0); + goto retry; + } + assert(*list != first); + /* Since we never insert an entry on the black list, this cannot have */ + /* succeeded unless first remained on the list while we were running. */ + /* Thus its next link cannot have changed out from under us, and we */ + /* removed exactly one entry and preserved the rest of the list. */ + /* Note that it is quite possible that an additional entry was */ + /* inserted and removed while we were running; this is OK since the */ + /* part of the list following first must have remained unchanged, and */ + /* first must again have been at the head of the list when the */ + /* compare_and_swap succeeded. */ + AO_store_release(a->AO_stack_bl+i, 0); + return first_ptr; +} + +#else /* ! USE_ALMOST_LOCK_FREE */ + +/* Better names for fields in AO_stack_t */ +#define ptr AO_val2 +#define version AO_val1 + +#if defined(AO_HAVE_compare_double_and_swap_double) + +void AO_stack_push_release(AO_stack_t *list, AO_t *element) +{ + AO_t next; + + do { + next = AO_load(&(list -> ptr)); + *element = next; + } while (AO_EXPECT_FALSE(!AO_compare_and_swap_release(&(list -> ptr), + next, (AO_t)element))); + /* This uses a narrow CAS here, an old optimization suggested */ + /* by Treiber. Pop is still safe, since we run into the ABA */ + /* problem only if there were both intervening "pop"s and "push"es. */ + /* In that case we still see a change in the version number. */ +} + +AO_t *AO_stack_pop_acquire(AO_stack_t *list) +{ +# ifdef __clang__ + AO_t *volatile cptr; + /* Use volatile to workaround a bug in */ + /* clang-1.1/x86 causing test_stack failure. */ +# else + AO_t *cptr; +# endif + AO_t next; + AO_t cversion; + + do { + /* Version must be loaded first. */ + cversion = AO_load_acquire(&(list -> version)); + cptr = (AO_t *)AO_load(&(list -> ptr)); + if (cptr == 0) return 0; + next = *cptr; + } while (AO_EXPECT_FALSE(!AO_compare_double_and_swap_double_release(list, + cversion, (AO_t)cptr, + cversion+1, (AO_t)next))); + return cptr; +} + + +#elif defined(AO_HAVE_compare_and_swap_double) + +/* Needed for future IA64 processors. No current clients? */ + +#error Untested! Probably doesnt work. + +/* We have a wide CAS, but only does an AO_t-wide comparison. */ +/* We can't use the Treiber optimization, since we only check */ +/* for an unchanged version number, not an unchanged pointer. */ +void AO_stack_push_release(AO_stack_t *list, AO_t *element) +{ + AO_t version; + AO_t next_ptr; + + do { + /* Again version must be loaded first, for different reason. */ + version = AO_load_acquire(&(list -> version)); + next_ptr = AO_load(&(list -> ptr)); + *element = next_ptr; + } while (!AO_compare_and_swap_double_release( + list, version, + version+1, (AO_t) element)); +} + +AO_t *AO_stack_pop_acquire(AO_stack_t *list) +{ + AO_t *cptr; + AO_t next; + AO_t cversion; + + do { + cversion = AO_load_acquire(&(list -> version)); + cptr = (AO_t *)AO_load(&(list -> ptr)); + if (cptr == 0) return 0; + next = *cptr; + } while (!AO_compare_double_and_swap_double_release + (list, cversion, (AO_t) cptr, cversion+1, next)); + return cptr; +} + + +#endif /* AO_HAVE_compare_and_swap_double */ + +#endif /* ! USE_ALMOST_LOCK_FREE */ diff --git a/libatomic_ops-install/include/atomic_ops_stack.h b/libatomic_ops/src/atomic_ops_stack.h index 1ca5f40..1ca5f40 100644 --- a/libatomic_ops-install/include/atomic_ops_stack.h +++ b/libatomic_ops/src/atomic_ops_stack.h diff --git a/libatomic_ops/src/config.h.in b/libatomic_ops/src/config.h.in new file mode 100644 index 0000000..c201ecc --- /dev/null +++ b/libatomic_ops/src/config.h.in @@ -0,0 +1,149 @@ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Inline assembly avalable (only VC/x86_64) */ +#undef AO_ASM_X64_AVAILABLE + +/* Assume Windows Server 2003, Vista or later target (only VC/x86) */ +#undef AO_ASSUME_VISTA + +/* Assume hardware compare-and-swap functionality available on target (only + VC/x86) */ +#undef AO_ASSUME_WINDOWS98 + +/* Assume target is not old AMD Opteron chip (only x86_64) */ +#undef AO_CMPXCHG16B_AVAILABLE + +/* Force test_and_set to use SWP instruction instead of LDREX/STREX (only arm + v6+) */ +#undef AO_FORCE_USE_SWP + +/* Force compare_and_swap definition via fetch_compare_and_swap */ +#undef AO_GENERALIZE_ASM_BOOL_CAS + +/* Assume target is not sparc v9+ (only sparc) */ +#undef AO_NO_SPARC_V9 + +/* Assume ancient MS VS Win32 headers (only VC/arm v6+, VC/x86) */ +#undef AO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE + +/* Prefer generalized definitions to direct assembly-based ones */ +#undef AO_PREFER_GENERALIZED + +/* Trace AO_malloc/free calls (for debug only) */ +#undef AO_TRACE_MALLOC + +/* Assume single-core target (only arm v6+) */ +#undef AO_UNIPROCESSOR + +/* Assume Win32 _Interlocked primitives available as intrinsics (only VC/arm) + */ +#undef AO_USE_INTERLOCKED_INTRINSICS + +/* Use nanosleep() instead of select() (only if atomic operations are + emulated) */ +#undef AO_USE_NANOSLEEP + +/* Do not block signals in compare_and_swap (only if atomic operations are + emulated) */ +#undef AO_USE_NO_SIGNALS + +/* Use Pentium 4 'mfence' instruction (only x86) */ +#undef AO_USE_PENTIUM4_INSTRS + +/* Emulate atomic operations via slow and async-signal-unsafe pthread locking + */ +#undef AO_USE_PTHREAD_DEFS + +/* Prefer GCC built-in CAS intrinsics in favor of inline assembly (only + gcc/x86, gcc/x86_64) */ +#undef AO_USE_SYNC_CAS_BUILTIN + +/* Use Win32 Sleep() instead of select() (only if atomic operations are + emulated) */ +#undef AO_USE_WIN32_PTHREADS + +/* Emulate double-width CAS via pthread locking in case of no hardware support + (only gcc/x86_64, the emulation is unsafe) */ +#undef AO_WEAK_DOUBLE_CAS_EMULATION + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to disable assertion checking. */ +#undef NDEBUG + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Indicates the use of pthreads (NetBSD). */ +#undef _PTHREADS + +/* Required define if using POSIX threads. */ +#undef _REENTRANT |