libatomic_ops-1.1 tarball import libatomic_ops-1_1
authorIvan Maidanski <ivmai@mail.ru>
Mon, 25 Jul 2011 11:08:56 +0000 (15:08 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 25 Jul 2011 11:08:56 +0000 (15:08 +0400)
12 files changed:
ChangeLog
configure
configure.ac
src/atomic_ops.h
src/atomic_ops/Makefile.am
src/atomic_ops/Makefile.in
src/atomic_ops/sysdeps/Makefile.am
src/atomic_ops/sysdeps/Makefile.in
src/atomic_ops/sysdeps/gcc/arm.h
src/atomic_ops/sysdeps/ordered_except_wr.h
src/atomic_ops/sysdeps/read_ordered.h [new file with mode: 0644]
tests/test_stack.c

index af8055b522e35f1a01dd203e3ec8e370d9884224..dcf2d43704224b8d475e981547cf02d2ca0247fd 100644 (file)
--- 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
index e3a2dcdd84a124f8c75b49c4384cae94e03d15e0..941bfffbca8634ae739f842a811cdda6aa7a218f 100755 (executable)
--- 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'`\\"
 
index 00e878ef7092f51f0cf39a53b03326f7dd21b8bf..5d9d245450831fa2c6221d9c1230ac8e917ef1d5 100644 (file)
@@ -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
index a77bfd6d048b215b4432db82407a1324877dcb31..3a650305758ad8b4f85c5a38691750570ed41fc7 100755 (executable)
 # 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"
index a710df0787487e3da91520dea9906e0d2039eb12..8000273f28610a9e1ffe90484b690fe96e4428eb 100644 (file)
@@ -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 $? >> $@
index d23633315b9d4e724c3c3c76fd92f47c902695dd..33e8123265c9d3c511f20c662cc1d81bcd309853 100644 (file)
@@ -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.
index 52343810565f9a4dbce07dc5270188bfc3772c9b..74122b48a1d5730cd36abe9cb3020adf04e36d75 100644 (file)
@@ -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 \
index 91d0789a87a8cd6d7e0d875ca030fa4c6c526dc3..102d2e0da25c054a18be431205494178fe3dd8ef 100644 (file)
@@ -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 \
index e10ffa0588ea650021e4f07e2a9757cb06dea4b5..9548a32b0e0e5ba177676fa17a3b1dbeb226b59b 100644 (file)
  *
  */
 
-/* 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;
 }
 
index b984f0d259ab2ef84525eb136cf54fbfb6db601f..4f2930314bd4d4a44202d763f1b876ac9b0b6668 100644 (file)
@@ -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 (file)
index 0000000..e928881
--- /dev/null
@@ -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 */
+
+
index 29cdbd82caed006d2d3386def33ea5461168d0ae..8a8ba50d037a38734bf1c6a9c5dcf2679b47c05f 100644 (file)
@@ -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)