Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/libatomic_ops.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-25 15:08:56 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-07-25 15:08:56 +0400
commitf2b5ace8beddf760d0148c59d2a2598ee6b59d32 (patch)
tree2521521104879f4398c103fa1dbc14780fff01ba
parent1dc2fb35335ad4fad0eaf3555bf078aed0ab88e6 (diff)
libatomic_ops-1.1 tarball importlibatomic_ops-1_1
-rw-r--r--ChangeLog21
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rwxr-xr-xsrc/atomic_ops.h1
-rw-r--r--src/atomic_ops/Makefile.am2
-rw-r--r--src/atomic_ops/Makefile.in2
-rw-r--r--src/atomic_ops/sysdeps/Makefile.am1
-rw-r--r--src/atomic_ops/sysdeps/Makefile.in1
-rw-r--r--src/atomic_ops/sysdeps/gcc/arm.h30
-rw-r--r--src/atomic_ops/sysdeps/ordered_except_wr.h74
-rw-r--r--src/atomic_ops/sysdeps/read_ordered.h102
-rw-r--r--tests/test_stack.c2
12 files changed, 162 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog
index af8055b..dcf2d43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+[1.1 release]
+
+2003-09-27 Hans Boehm <Hans.Boehm@hp.com>
+ *src/atomic_ops.h: Define AO_CAN_EMUL_CAS for arm.
+ *src/atomic_ops/sysdeps/read_ordered.h: New file, extracted from
+ ordered_except_wr.h.
+ *src/atomic_ops/sysdeps/ordered_except_wr.h: include read_ordered.h
+ instead of duplicating it.
+ *src/atomic_ops/sysdeps/gcc/arm.h: Include read_ordered.h.
+
+2003-09-16 Hans Boehm <Hans.Boehm@hp.com>
+ *src/atomic_ops/sysdeps/gcc/arm.h: Replace the AO_test_and_set
+ definition with one that might actually work. (Thanks to Kazu
+ Hirata and Paul Brook.)
+
+2003-08-01 Hans Boehm <Hans.Boehm@hp.com>
+ *src/atomic_ops/Makefile.am: Change function naming from "byte" to
+ "char" (again).
+
+[1.0 release]
+
2005-03-21 Hans Boehm <Hans.Boehm@hp.com>
Fix various acquire_release_volatile.h files to reflect the fact
that both icc and gcc seem to reorder ordinary memory accesses around
diff --git a/configure b/configure
index e3a2dcd..941bfff 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for libatomic_ops 1.0.
+# Generated by GNU Autoconf 2.59 for libatomic_ops 1.1.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
@@ -267,8 +267,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='libatomic_ops'
PACKAGE_TARNAME='libatomic_ops'
-PACKAGE_VERSION='1.0'
-PACKAGE_STRING='libatomic_ops 1.0'
+PACKAGE_VERSION='1.1'
+PACKAGE_STRING='libatomic_ops 1.1'
PACKAGE_BUGREPORT=''
ac_unique_file="src/atomic_ops.c"
@@ -786,7 +786,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libatomic_ops 1.0 to adapt to many kinds of systems.
+\`configure' configures libatomic_ops 1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -853,7 +853,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libatomic_ops 1.0:";;
+ short | recursive ) echo "Configuration of libatomic_ops 1.1:";;
esac
cat <<\_ACEOF
@@ -972,7 +972,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-libatomic_ops configure 1.0
+libatomic_ops configure 1.1
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -986,7 +986,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libatomic_ops $as_me 1.0, which was
+It was created by libatomic_ops $as_me 1.1, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1712,7 +1712,7 @@ fi
# Define the identity of the package.
PACKAGE='libatomic_ops'
- VERSION='1.0'
+ VERSION='1.1'
cat >>confdefs.h <<_ACEOF
@@ -4559,7 +4559,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by libatomic_ops $as_me 1.0, which was
+This file was extended by libatomic_ops $as_me 1.1, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4622,7 +4622,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-libatomic_ops config.status 1.0
+libatomic_ops config.status 1.1
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 00e878e..5d9d245 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([libatomic_ops],[1.0])
+AC_INIT([libatomic_ops],[1.1])
AC_CANONICAL_TARGET([])
AC_CONFIG_SRCDIR(src/atomic_ops.c)
AM_INIT_AUTOMAKE
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index a77bfd6..3a65030 100755
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -215,6 +215,7 @@
# endif /* __powerpc__ */
# if defined(__arm__) && !defined(AO_USE_PTHREAD_DEFS)
# include "atomic_ops/sysdeps/gcc/arm.h"
+# define AO_CAN_EMUL_CAS
# endif /* __arm__ */
# if defined(__cris__) || defined(CRIS)
# include "atomic_ops/sysdeps/gcc/cris.h"
diff --git a/src/atomic_ops/Makefile.am b/src/atomic_ops/Makefile.am
index a710df0..8000273 100644
--- a/src/atomic_ops/Makefile.am
+++ b/src/atomic_ops/Makefile.am
@@ -7,6 +7,6 @@ private_HEADERS=generalize.h generalize-small.h
privatedir=${includedir}/atomic_ops/
generalize-small.h: generalize-small.template
- sed -e s:XSIZE:byte:g -e s:XCTYPE:char:g $? > $@
+ sed -e s:XSIZE:char:g -e s:XCTYPE:char:g $? > $@
sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@
sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@
diff --git a/src/atomic_ops/Makefile.in b/src/atomic_ops/Makefile.in
index d236333..33e8123 100644
--- a/src/atomic_ops/Makefile.in
+++ b/src/atomic_ops/Makefile.in
@@ -472,7 +472,7 @@ uninstall-info: uninstall-info-recursive
generalize-small.h: generalize-small.template
- sed -e s:XSIZE:byte:g -e s:XCTYPE:char:g $? > $@
+ sed -e s:XSIZE:char:g -e s:XCTYPE:char:g $? > $@
sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@
sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/atomic_ops/sysdeps/Makefile.am b/src/atomic_ops/sysdeps/Makefile.am
index 5234381..74122b4 100644
--- a/src/atomic_ops/sysdeps/Makefile.am
+++ b/src/atomic_ops/sysdeps/Makefile.am
@@ -14,6 +14,7 @@ nobase_sysdep_HEADERS= generic_pthread.h \
all_acquire_release_volatile.h \
all_aligned_atomic_load_store.h \
all_atomic_load_store.h \
+ read_ordered.h \
ordered_except_wr.h \
ordered.h \
ao_t_is_int.h \
diff --git a/src/atomic_ops/sysdeps/Makefile.in b/src/atomic_ops/sysdeps/Makefile.in
index 91d0789..102d2e0 100644
--- a/src/atomic_ops/sysdeps/Makefile.in
+++ b/src/atomic_ops/sysdeps/Makefile.in
@@ -168,6 +168,7 @@ nobase_sysdep_HEADERS = generic_pthread.h \
all_acquire_release_volatile.h \
all_aligned_atomic_load_store.h \
all_atomic_load_store.h \
+ read_ordered.h \
ordered_except_wr.h \
ordered.h \
ao_t_is_int.h \
diff --git a/src/atomic_ops/sysdeps/gcc/arm.h b/src/atomic_ops/sysdeps/gcc/arm.h
index e10ffa0..9548a32 100644
--- a/src/atomic_ops/sysdeps/gcc/arm.h
+++ b/src/atomic_ops/sysdeps/gcc/arm.h
@@ -15,24 +15,34 @@
*
*/
-/* FIXME. Very incomplete. No support for 64 bits. */
+/* There exist multiprocessor SoC ARM processors, so this may actually */
+/* matter. */
+/* I found a slide set that, if I read it correctly, claims that */
+/* Loads followed by either a Load or Store are ordered, but nothing */
+/* else is. */
+/* It appears that SWP is the only simple memory barrier. */
#include "../all_atomic_load_store.h"
+#include "../read_ordered.h"
+
#include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */
+
AO_INLINE AO_TS_VAL_t
AO_test_and_set_full(volatile AO_TS_t *addr) {
int oldval;
- int temp = 1; /* locked value */
-
- __asm__ __volatile__ (
- " l %0,0(%2)\n"
- "0: cs %0,%1,0(%2)\n"
- " jl 0b"
- : "=&d" (ret)
- : "d" (1), "a" (addr)
- : "cc", "memory");
+ /* SWP on ARM is very similar to XCHG on x86. */
+ /* The first operand is the result, the second the value */
+ /* to be stored. Both registers must be different from addr. */
+ /* Make the address operand an early clobber output so it */
+ /* doesn't overlap with the other operands. The early clobber*/
+ /* on oldval is neccessary to prevent the compiler allocating */
+ /* them to the same register if they are both unused. */
+ __asm__ __volatile__("swp %0, %2, [%3]"
+ : "=&r"(oldval), "=&r"(addr)
+ : "r"(1), "1"(addr)
+ : "memory");
return oldval;
}
diff --git a/src/atomic_ops/sysdeps/ordered_except_wr.h b/src/atomic_ops/sysdeps/ordered_except_wr.h
index b984f0d..4f29303 100644
--- a/src/atomic_ops/sysdeps/ordered_except_wr.h
+++ b/src/atomic_ops/sysdeps/ordered_except_wr.h
@@ -27,6 +27,8 @@
* except apparently for some IDT WinChips, which we ignore.
*/
+#include "read_ordered.h"
+
AO_INLINE void
AO_nop_write()
{
@@ -37,78 +39,6 @@ AO_nop_write()
#define AO_HAVE_NOP_WRITE
-AO_INLINE void
-AO_nop_read()
-{
- AO_compiler_barrier();
-}
-
-#define AO_HAVE_NOP_READ
-
-#ifdef AO_HAVE_load
-
-AO_INLINE AO_t
-AO_load_read(volatile AO_t *addr)
-{
- AO_t result = AO_load(addr);
- AO_compiler_barrier();
- return result;
-}
-#define AO_HAVE_load_read
-
-#define AO_load_acquire(addr) AO_load_read(addr)
-#define AO_HAVE_load_acquire
-
-#endif /* AO_HAVE_load */
-
-#ifdef AO_HAVE_char_load
-
-AO_INLINE AO_t
-AO_char_load_read(volatile unsigned char *addr)
-{
- AO_t result = AO_char_load(addr);
- AO_compiler_barrier();
- return result;
-}
-#define AO_HAVE_char_load_read
-
-#define AO_char_load_acquire(addr) AO_char_load_read(addr)
-#define AO_HAVE_char_load_acquire
-
-#endif /* AO_HAVE_char_load */
-
-#ifdef AO_HAVE_short_load
-
-AO_INLINE AO_t
-AO_short_load_read(volatile unsigned short *addr)
-{
- AO_t result = AO_short_load(addr);
- AO_compiler_barrier();
- return result;
-}
-#define AO_HAVE_short_load_read
-
-#define AO_short_load_acquire(addr) AO_short_load_read(addr)
-#define AO_HAVE_short_load_acquire
-
-#endif /* AO_HAVE_short_load */
-
-#ifdef AO_HAVE_int_load
-
-AO_INLINE AO_t
-AO_int_load_read(volatile unsigned int *addr)
-{
- AO_t result = AO_int_load(addr);
- AO_compiler_barrier();
- return result;
-}
-#define AO_HAVE_int_load_read
-
-#define AO_int_load_acquire(addr) AO_int_load_read(addr)
-#define AO_HAVE_int_load_acquire
-
-#endif /* AO_HAVE_int_load */
-
#if defined(AO_HAVE_store)
AO_INLINE void
diff --git a/src/atomic_ops/sysdeps/read_ordered.h b/src/atomic_ops/sysdeps/read_ordered.h
new file mode 100644
index 0000000..e928881
--- /dev/null
+++ b/src/atomic_ops/sysdeps/read_ordered.h
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+/*
+ * These are common definitions for architectures that provide processor
+ * ordered memory operations except that a later read may pass an
+ * earlier write. Real x86 implementations seem to be in this category,
+ * except apparently for some IDT WinChips, which we ignore.
+ */
+
+AO_INLINE void
+AO_nop_read()
+{
+ AO_compiler_barrier();
+}
+
+#define AO_HAVE_NOP_READ
+
+#ifdef AO_HAVE_load
+
+AO_INLINE AO_t
+AO_load_read(volatile AO_t *addr)
+{
+ AO_t result = AO_load(addr);
+ AO_compiler_barrier();
+ return result;
+}
+#define AO_HAVE_load_read
+
+#define AO_load_acquire(addr) AO_load_read(addr)
+#define AO_HAVE_load_acquire
+
+#endif /* AO_HAVE_load */
+
+#ifdef AO_HAVE_char_load
+
+AO_INLINE AO_t
+AO_char_load_read(volatile unsigned char *addr)
+{
+ AO_t result = AO_char_load(addr);
+ AO_compiler_barrier();
+ return result;
+}
+#define AO_HAVE_char_load_read
+
+#define AO_char_load_acquire(addr) AO_char_load_read(addr)
+#define AO_HAVE_char_load_acquire
+
+#endif /* AO_HAVE_char_load */
+
+#ifdef AO_HAVE_short_load
+
+AO_INLINE AO_t
+AO_short_load_read(volatile unsigned short *addr)
+{
+ AO_t result = AO_short_load(addr);
+ AO_compiler_barrier();
+ return result;
+}
+#define AO_HAVE_short_load_read
+
+#define AO_short_load_acquire(addr) AO_short_load_read(addr)
+#define AO_HAVE_short_load_acquire
+
+#endif /* AO_HAVE_short_load */
+
+#ifdef AO_HAVE_int_load
+
+AO_INLINE AO_t
+AO_int_load_read(volatile unsigned int *addr)
+{
+ AO_t result = AO_int_load(addr);
+ AO_compiler_barrier();
+ return result;
+}
+#define AO_HAVE_int_load_read
+
+#define AO_int_load_acquire(addr) AO_int_load_read(addr)
+#define AO_HAVE_int_load_acquire
+
+#endif /* AO_HAVE_int_load */
+
+
diff --git a/tests/test_stack.c b/tests/test_stack.c
index 29cdbd8..8a8ba50 100644
--- a/tests/test_stack.c
+++ b/tests/test_stack.c
@@ -164,7 +164,7 @@ int main(int argc, char **argv)
}
else
{
- fprintf(stderr, "Usage: %s [max # of threads]\n");
+ fprintf(stderr, "Usage: %s [max # of threads]\n", argv[0]);
exit(1);
}
for (exper_n = 0; exper_n < N_EXPERIMENTS; ++ exper_n)