This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] atomicity.h update



The following fixes up the naming problems connected with the 
<atomicity.h> header file.  (It involves moving some files,
in addition to the patch.)  The change is needed because 
the standard header <string> sub-includes <atomicity.h>
(now, <bits/atomicity.h>), so name-cleanliness is necessary
for standard conformance.

The attached shar file (after the diff) contains the new versions 
of the atomicity.h headers, in their new place.  The names used 
in it are uglified, and dependence on <inttypes.h> is eliminated.
Note that none of the ASM code is changed, only the local variable
names it binds to.

The old atomicity.h files should be obsoleted in the CVS tree.
Here is the list of old files:

  config/cpu/*/atomicity.h
  config/cpu/sparc/*/atomicity.h

The attached patch also includes a workaround for the __dso_handle 
binutils bug.

Nathan Myers
ncm at cantrip dot org

------------------------------------------------------------------
Index: libstdc++-v3/ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- ChangeLog	2000/04/25 07:41:28	1.4
+++ ChangeLog	2000/04/26 23:13:25
@@ -1,3 +1,12 @@
+2000-04-26  Nathan C. Myers <ncm@cantrip.org>
+
+	* bits/basic_string.h: include <bits/atomicity.h> instead
+	of <atomicity.h>, and use the uglified names.
+	* config/cpu/*/atomicity.h: replace with bits/atomicity.h;
+	uglify names, eliminate dependence on <inttypes.h>.
+	* src/Makefile.in, src/Makefile.am: refer to correct place
+	for atomicity.h header.
+
 2000-04-24  Loren J. Rittle  <ljrittle@acm.org>
 
         * mkcheck.in: Report compiler version used for test.  Find
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.362
diff -u -r1.362 configure.in
--- configure.in	2000/04/26 00:03:37	1.362
+++ configure.in	2000/04/26 22:34:08
@@ -4404,9 +4404,10 @@
 fi
 AC_MSG_RESULT($gcc_cv_as_weak)
 
-AC_MSG_CHECKING(assembler hidden support)
+AC_MSG_CHECKING(assembler hidden support: DISABLED [FIXME])
 gcc_cv_as_hidden=
-if test x$gcc_cv_as != x; then
+if false; then  # FIXME: binutils 4.9.5.0.33 screws up hidden __dso_handle
+# if test x$gcc_cv_as != x; then
 	# Check if we have .hidden
 	echo "	.hidden foobar" > conftest.s
 	echo "foobar:" >> conftest.s
Index: libstdc++-v3/acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.2
diff -u -r1.2 acinclude.m4
--- acinclude.m4	2000/04/25 06:39:48	1.2
+++ acinclude.m4	2000/04/26 21:43:43
@@ -242,8 +242,8 @@
 dnl supported, use special hand-crafted routines to provide thread
 dnl primitives.
 dnl 
-dnl Depending on what is found, select various configure/cpu/*/atomicity.h 
-dnl If not found, select configure/cpu/generic/atomicity.h
+dnl Depending on what is found, select various configure/cpu/*/bits/atomicity.h 
+dnl If not found, select configure/cpu/generic/bits/atomicity.h
 dnl
 dnl GLIBCPP_CHECK_CPU
 AC_DEFUN(GLIBCPP_CHECK_CPU, [
@@ -255,7 +255,7 @@
       arm*)
 	cpu_include_dir="config/cpu/arm"
         ;;
-      i486 | i586 | i686 | i786)
+      i386 | i486 | i586 | i686 | i786)
 	cpu_include_dir="config/cpu/i386"
         ;;
       powerpc | rs6000)
Index: libstdc++-v3/bits/basic_string.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/bits/basic_string.h,v
retrieving revision 1.1
diff -u -r1.1 basic_string.h
--- basic_string.h	2000/04/21 20:33:28	1.1
+++ basic_string.h	2000/04/26 21:44:11
@@ -35,7 +35,7 @@
 #define _CPP_BITS_STRING_H	1
 
 #include <bits/exception_support.h>
-#include <atomicity.h>
+#include <bits/atomicity.h>
 
 namespace std {
 
@@ -123,10 +123,6 @@
 	// Types:
 	typedef typename _Alloc::rebind<char>::other _Raw_bytes_alloc;
 
-	// NB: Would be better if atomicity.h defined type(s) itself.
-	typedef uint32_t _State_type; 
-	typedef int32_t _Signed_state_type;
-
 	// (Public) Data members: 
 
 	// The maximum number of individual char_type elements of an
@@ -145,19 +141,19 @@
 
 	size_type 		_M_length;
 	size_type 		_M_capacity;
-	_State_type		_M_state;
+	_Atomic_word		_M_state;
 	
         bool
 	_M_is_leaked() const
-        { return static_cast<_Signed_state_type>(_M_state) < 0; }
+        { return _M_state < 0; }
 
         bool
 	_M_is_shared() const
-        { return static_cast<_Signed_state_type>(_M_state) > 0; }
+        { return _M_state > 0; }
 
         void
 	_M_set_leaked() 
-        { _M_state = _State_type(-1); }
+        { _M_state = -1; }
 
         void
 	_M_set_sharable() 
@@ -183,7 +179,7 @@
 	void 
 	_M_dispose(const _Alloc& __a)
 	{ 
-	  if (_Signed_state_type(exchange_and_add(&_M_state, -1)) <= 0)  
+	  if (__exchange_and_add(&_M_state, -1) <= 0)  
 	    _M_destroy(__a); 
 	}  // XXX MT
 
@@ -193,7 +189,7 @@
 	_CharT* 
 	_M_refcopy() throw()
 	{ 
-	  atomic_add(&_M_state, 1); 
+	  __atomic_add(&_M_state, 1); 
 	  return _M_refdata(); 
 	}  // XXX MT
 
Index: libstdc++-v3/src/Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- Makefile.am	2000/04/25 06:39:48	1.2
+++ Makefile.am	2000/04/26 21:44:51
@@ -166,7 +166,7 @@
 	bits/std_limits.h bits/c++config.h bits/c++threads.h bits/c++io.h
 
 cpu_headers = \
-	 $(top_srcdir)/@cpu_include_dir@/atomicity.h 
+	 $(top_srcdir)/@cpu_include_dir@/bits/atomicity.h 
 
 string_sources = \
 	stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \
Index: libstdc++-v3/src/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- Makefile.in	2000/04/25 06:39:48	1.2
+++ Makefile.in	2000/04/26 21:45:09
@@ -247,7 +247,7 @@
 
 
 cpu_headers = \
-	 $(top_srcdir)/@cpu_include_dir@/atomicity.h 
+	 $(top_srcdir)/@cpu_include_dir@/bits/atomicity.h 
 
 
 string_sources = \


--------------------------------
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2000-04-26 15:45 PDT by <ncm@store>.
# Source directory was `/home/ncm/Libc/egcs'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   2471 -rw-r--r-- libstdc++-v3/config/cpu/alpha/bits/atomicity.h
#   3020 -rw-r--r-- libstdc++-v3/config/cpu/arm/bits/atomicity.h
#   1523 -rw-r--r-- libstdc++-v3/config/cpu/generic/bits/atomicity.h
#   1945 -rw-r--r-- libstdc++-v3/config/cpu/i386/bits/atomicity.h
#   2728 -rw-r--r-- libstdc++-v3/config/cpu/powerpc/bits/atomicity.h
#   2629 -rw-r--r-- libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h
#   2530 -rw-r--r-- libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh23789; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= libstdc++-v3/config/cpu/alpha/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3'
  mkdir 'libstdc++-v3'
fi
if test ! -d 'libstdc++-v3/config'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config'
  mkdir 'libstdc++-v3/config'
fi
if test ! -d 'libstdc++-v3/config/cpu'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu'
  mkdir 'libstdc++-v3/config/cpu'
fi
if test ! -d 'libstdc++-v3/config/cpu/alpha'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/alpha'
  mkdir 'libstdc++-v3/config/cpu/alpha'
fi
if test ! -d 'libstdc++-v3/config/cpu/alpha/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/alpha/bits'
  mkdir 'libstdc++-v3/config/cpu/alpha/bits'
fi
if test -f 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  Alpha version.
X   Copyright (C) 1999 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H	1
X
typedef int _Atomic_word;
X
static inline _Atomic_word
__attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
X  register int __result, __tmp;
X
X  __asm__ __volatile__ (
X	"/* Inline exchange & add */\n"
X	"1:\t"
X	"ldl_l	%0,%3\n\t"
X	"addl	%0,%4,%1\n\t"
X	"stl_c	%1,%2\n\t"
X	"beq	%1,2f\n"
X	".subsection 1\n"
X	"2:\t"
X	"br	1b\n"
X	".previous\n\t"
X	"mb\n\t"
X	"/* End exchange & add */"
X	: "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
X	: "m" (*__mem), "r"(__val));
X
X  return __result;
}
X
static inline void
__attribute__ ((unused))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
X  register _Atomic_word __result;
X
X  __asm__ __volatile__ (
X	"/* Inline exchange & add */\n"
X	"1:\t"
X	"ldl_l	%0,%2\n\t"
X	"addl	%0,%3,%0\n\t"
X	"stl_c	%0,%1\n\t"
X	"beq	%0,2f\n\t"
X	".subsection 1\n"
X	"2:\t"
X	"br	1b\n"
X	".previous\n\t"
X	"mb\n\t"
X	"/* End exchange & add */"
X	: "=&r"(__result), "=m"(*__mem)
X	: "m" (*__mem), "r"(__val));
}
X
static inline intint
__attribute__ ((unused))
__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
X  int __ret;
X
X  __asm__ __volatile__ (
X	"/* Inline compare & swap */\n"
X	"1:\t"
X	"ldq_l	%0,%4\n\t"
X	"cmpeq	%0,%2,%0\n\t"
X	"beq	%0,3f\n\t"
X	"mov	%3,%0\n\t"
X	"stq_c	%0,%1\n\t"
X	"beq	%0,2f\n\t"
X	".subsection 1\n"
X	"2:\t"
X	"br	1b\n"
X	".previous\n\t"
X	"3:\t"
X	"mb\n\t"
X	"/* End compare & swap */"
X	: "=&r"(__ret), "=m"(*__p)
X	: "r"(__oldval), "r"(__newval), "m"(*__p));
X
X  return __ret;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503362000 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h:' 'MD5 check failed'
84b189d5cbd54352b79427ce05266749  libstdc++-v3/config/cpu/alpha/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h'`"
    test 2471 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/alpha/bits/atomicity.h:' 'original size' '2471,' 'current size' "$shar_count!"
  fi
fi
# ============= libstdc++-v3/config/cpu/arm/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3/config/cpu/arm'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/arm'
  mkdir 'libstdc++-v3/config/cpu/arm'
fi
if test ! -d 'libstdc++-v3/config/cpu/arm/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/arm/bits'
  mkdir 'libstdc++-v3/config/cpu/arm/bits'
fi
if test -f 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  ARM version.
X   Copyright (C) 2000 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H    1
X
typedef int _Atomic_word;
X
static inline _Atomic_word
__attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
X  _Atomic_word __tmp, __tmp2, __result;
X  __asm__ ("\
0:      ldr     %0,[%3]
X        add     %1,%0,%4
X        swp     %2,%1,[%3]
X        cmp     %0,%2
X        swpne   %1,%2,[%3]
X        bne     0b
" : "=&r"(__result), "=&r"(__tmp), "=&r"(__tmp2) 
X  : "r" (__mem), "r"(__val) 
X  : "cc", "memory");
X  return __result;
}
X
static inline void
__attribute__ ((unused))
__atomic_add (volatile _Atomic_word *__mem, int __val)
{
X  _Atomic_word __tmp, __tmp2, __tmp3;
X  __asm__ ("\
0:      ldr     %0,[%3]
X        add     %1,%0,%4
X        swp     %2,%1,[%3]
X        cmp     %0,%2
X        swpne   %1,%2,[%3]
X        bne     0b
" : "=&r"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3) 
X  : "r" (__mem), "r"(__val) 
X  : "cc", "memory");
}
X
static inline int
__attribute__ ((unused))
__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
X  int __result;
X  long __tmp;
X  __asm__ ("\
0:      ldr     %1,[%2]
X        mov     %0,#0
X        cmp     %1,%4
X        bne     1f
X        swp     %0,%3,[%2]
X        cmp     %1,%0
X        swpne   %1,%0,[%2]
X        bne     0b
X        mov     %0,#1
1:
" : "=&r"(__result), "=&r"(__tmp) 
X  : "r" (__p), "r" (__newval), "r" (__oldval) 
X  : "cc", "memory");
X  return __result;
}
X
static inline long
__attribute__ ((unused))
__always_swap (volatile long *__p, long __newval)
{
X  long __result;
X  __asm__ ("\
X        swp     %0,%2,[%1]
" : "=&r"(__result) : "r"(__p), "r"(__newval) : "memory");
X  return __result;
}
X
static inline int
__attribute__ ((unused))
__test_and_set (volatile long *__p, long __newval)
{
X  int __result;
X  long __tmp;
X  __asm__ ("\
0:      ldr     %0,[%2]
X        cmp     %0,#0
X        bne     1f
X        swp     %1,%3,[%2]
X        cmp     %0,%1
X        swpne   %0,%1,[%2]
X        bne     0b
1:
" : "=&r"(__result), "=r" (__tmp) 
X  : "r"(__p), "r"(__newval) 
X  : "cc", "memory");
X  return __result;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503402000 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/arm/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/arm/bits/atomicity.h:' 'MD5 check failed'
8cc00763554d04b2cdfd071c78c65bfb  libstdc++-v3/config/cpu/arm/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/arm/bits/atomicity.h'`"
    test 3020 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/arm/bits/atomicity.h:' 'original size' '3020,' 'current size' "$shar_count!"
  fi
fi
# ============= libstdc++-v3/config/cpu/generic/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3/config/cpu/generic'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/generic'
  mkdir 'libstdc++-v3/config/cpu/generic'
fi
if test ! -d 'libstdc++-v3/config/cpu/generic/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/generic/bits'
  mkdir 'libstdc++-v3/config/cpu/generic/bits'
fi
if test -f 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  Stub version.
X   Copyright (C) 1997 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H	1
X
typedef int _Atomic_word;
X
static inline _Atomic_word
__attribute__ ((unused))
__exchange_and_add (_Atomic_word* __mem, int __val)
{
X  _Atomic_word __result = *__mem;
X  *__mem += __val;
X  return __result;
}
X
static inline void
__attribute__ ((unused))
__atomic_add (_Atomic_word* __mem, int __val)
{
X  *__mem += __val;
}
X
static inline int
__attribute__ ((unused))
__compare_and_swap (long *__p, long __oldval, long __newval)
{
X  if (*__p != __oldval)
X    return 0;
X
X  *__p = __newval;
X  return 1;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503412000 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/generic/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/generic/bits/atomicity.h:' 'MD5 check failed'
ab5baf23a981a0d9aab3fda77a044ad5  libstdc++-v3/config/cpu/generic/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/generic/bits/atomicity.h'`"
    test 1523 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/generic/bits/atomicity.h:' 'original size' '1523,' 'current size' "$shar_count!"
  fi
fi
# ============= libstdc++-v3/config/cpu/i386/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3/config/cpu/i386'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/i386'
  mkdir 'libstdc++-v3/config/cpu/i386'
fi
if test ! -d 'libstdc++-v3/config/cpu/i386/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/i386/bits'
  mkdir 'libstdc++-v3/config/cpu/i386/bits'
fi
if test -f 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  ix86 version, x >= 4.
X   Copyright (C) 1997 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H	1
X
typedef int _Atomic_word;
X
static inline _Atomic_word 
__attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word *__mem, int __val)
{
X  register _Atomic_word __result;
X  __asm__ __volatile__ ("lock; xaddl %0,%2"
X			: "=r" (__result) 
X                        : "0" (__val), "m" (*__mem) 
X                        : "memory");
X  return __result;
}
X
static inline void
__attribute__ ((unused))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
X  __asm__ __volatile__ ("lock; addl %0,%1"
X			: : "ir" (__val), "m" (*__mem) : "memory");
}
X
static inline char
__attribute__ ((unused))
__compare_and_swap (volatile long* __p, long __oldval, long __newval)
{
X  char __ret;
X  long __readval;
X
X  __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
X                        : "=q" (__ret), "=m" (*__p), "=a" (__readval)
X                        : "r" (__newval), "m" (*__p), "a" (__oldval));
X  return __ret;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503422000 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/i386/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/i386/bits/atomicity.h:' 'MD5 check failed'
73d553d674bab6894d09888399ec844e  libstdc++-v3/config/cpu/i386/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/i386/bits/atomicity.h'`"
    test 1945 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/i386/bits/atomicity.h:' 'original size' '1945,' 'current size' "$shar_count!"
  fi
fi
# ============= libstdc++-v3/config/cpu/powerpc/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3/config/cpu/powerpc'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/powerpc'
  mkdir 'libstdc++-v3/config/cpu/powerpc'
fi
if test ! -d 'libstdc++-v3/config/cpu/powerpc/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/powerpc/bits'
  mkdir 'libstdc++-v3/config/cpu/powerpc/bits'
fi
if test -f 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  PowerPC version.
X   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H	1
X
typedef int _Atomic_word;
X
#if BROKEN_PPC_ASM_CR0
# define __ATOMICITY_INLINE /* nothing */
#else
# define __ATOMICITY_INLINE inline
#endif
X
static __ATOMICITY_INLINE _Atomic_word
__attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
X  _Atomic_word __tmp, __result;
X  __asm__ ("\
0:	lwarx	%0,0,%2
X	add%I3	%1,%0,%3
X	stwcx.	%1,0,%2
X	bne-	0b
" : "=&b"(__result), "=&r"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
X  return __result;
}
X
static __ATOMICITY_INLINE void
__attribute__ ((unused))
__atomic_add (volatile _Atomic_word *__mem, int __val)
{
X  _Atomic_word __tmp;
X  __asm__ ("\
0:	lwarx	%0,0,%1
X	add%I2	%0,%0,%2
X	stwcx.	%0,0,%1
X	bne-	0b
" : "=&b"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
}
X
static __ATOMICITY_INLINE int
__attribute__ ((unused))
__compare_and_swap (volatile long *p, long int __oldval, long int __newval)
{
X  int __result;
X  __asm__ ("\
0:	lwarx	%0,0,%1
X	sub%I2c.	%0,%0,%2
X	cntlzw	%0,%0
X	bne-	1f
X	stwcx.	%3,0,%1
X	bne-	0b
1:
" : "=&b"(__result) 
X  : "r"(__p), "Ir"(__oldval), "r"(__newval) 
X  : "cr0", "memory");
X  return __result >> 5;
}
X
static __ATOMICITY_INLINE long
__attribute__ ((unused))
__always_swap (volatile long *__p, long int __newval)
{
X  long __result;
X  __asm__ ("\
0:	lwarx	%0,0,%1
X	stwcx.	%2,0,%1
X	bne-	0b
" : "=&r"(__result) : "r"(__p), "r"(__newval) : "cr0", "memory");
X  return __result;
}
X
static __ATOMICITY_INLINE int
__attribute__ ((unused))
__test_and_set (volatile long *__p, long int __newval)
{
X  int __result;
X  __asm__ ("\
0:	lwarx	%0,0,%1
X	cmpwi	%0,0
X	bne-	1f
X	stwcx.	%2,0,%1
X	bne-	0b
1:
" : "=&r"(__result) : "r"(__p), "r"(__newval) : "cr0", "memory");
X  return __result;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503462000 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h:' 'MD5 check failed'
c1f99abc00bd1791460b6d243e16365d  libstdc++-v3/config/cpu/powerpc/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h'`"
    test 2728 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/powerpc/bits/atomicity.h:' 'original size' '2728,' 'current size' "$shar_count!"
  fi
fi
# ============= libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3/config/cpu/sparc'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/sparc'
  mkdir 'libstdc++-v3/config/cpu/sparc'
fi
if test ! -d 'libstdc++-v3/config/cpu/sparc/sparc32'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/sparc/sparc32'
  mkdir 'libstdc++-v3/config/cpu/sparc/sparc32'
fi
if test ! -d 'libstdc++-v3/config/cpu/sparc/sparc32/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/sparc/sparc32/bits'
  mkdir 'libstdc++-v3/config/cpu/sparc/sparc32/bits'
fi
if test -f 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  Sparc32 version.
X   Copyright (C) 1999 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H	1
X
typedef int _Atomic_word;
X
static int
__attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
X  static unsigned char __lock;
X  _Atomic_word __result, __tmp;
X
X  __asm__ __volatile__("1:	ldstub	[%1], %0\n\t"
X		       "	cmp	%0, 0\n\t"
X		       "	bne	1b\n\t"
X		       "	 nop"
X		       : "=&r" (__tmp)
X		       : "r" (&__lock)
X		       : "memory");
X  __result = *__mem;
X  *__mem += __val;
X  __asm__ __volatile__("stb	%%g0, [%0]"
X		       : /* no outputs */
X		       : "r" (&__lock)
X		       : "memory");
X  return __result;
}
X
static void
__attribute__ ((unused))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
X  static unsigned char __lock;
X  _Atomic_word __tmp;
X
X  __asm__ __volatile__("1:	ldstub	[%1], %0\n\t"
X		       "	cmp	%0, 0\n\t"
X		       "	bne	1b\n\t"
X		       "	 nop"
X		       : "=&r" (__tmp)
X		       : "r" (&__lock)
X		       : "memory");
X  *__mem += __val;
X  __asm__ __volatile__("stb	%%g0, [%0]"
X		       : /* no outputs */
X		       : "r" (&__lock)
X		       : "memory");
}
X
static int
__attribute__ ((unused))
__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
X  static unsigned char __lock;
X  long __ret, __tmp;
X
X  __asm__ __volatile__("1:	ldstub	[%1], %0\n\t"
X		       "	cmp	%0, 0\n\t"
X		       "	bne	1b\n\t"
X		       "	 nop"
X		       : "=&r" (__tmp)
X		       : "r" (&__lock)
X		       : "memory");
X  if (*__p != __oldval)
X    __ret = 0;
X  else
X    {
X      *__p = __newval;
X      __ret = 1;
X    }
X  __asm__ __volatile__("stb	%%g0, [%0]"
X		       : /* no outputs */
X		       : "r" (&__lock)
X		       : "memory");
X
X  return __ret;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503472000 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h:' 'MD5 check failed'
c7e8a57d669ca1b4610c8a4d464e3ed6  libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h'`"
    test 2629 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h:' 'original size' '2629,' 'current size' "$shar_count!"
  fi
fi
# ============= libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h ==============
if test ! -d 'libstdc++-v3/config/cpu/sparc/sparc64'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/sparc/sparc64'
  mkdir 'libstdc++-v3/config/cpu/sparc/sparc64'
fi
if test ! -d 'libstdc++-v3/config/cpu/sparc/sparc64/bits'; then
  $echo 'x -' 'creating directory' 'libstdc++-v3/config/cpu/sparc/sparc64/bits'
  mkdir 'libstdc++-v3/config/cpu/sparc/sparc64/bits'
fi
if test -f 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' '(file already exists)'
else
  $echo 'x -' extracting 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' &&
/* Low-level functions for atomic operations.  Sparc64 version.
X   Copyright (C) 1999 Free Software Foundation, Inc.
X   This file is part of the GNU C Library.
X
X   The GNU C Library is free software; you can redistribute it and/or
X   modify it under the terms of the GNU Library General Public License as
X   published by the Free Software Foundation; either version 2 of the
X   License, or (at your option) any later version.
X
X   The GNU C Library is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X   Library General Public License for more details.
X
X   You should have received a copy of the GNU Library General Public
X   License along with the GNU C Library; see the file COPYING.LIB.  If not,
X   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
X   Boston, MA 02111-1307, USA.  */
X
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H	1
X
typedef long _Atomic_word;
X
static inline _Atomic_word
__attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word *__mem, int __val)
{
X  _Atomic_word __tmp1, __tmp2;
X
X  __asm__ __volatile__("1:	lduw	[%2], %0\n\t"
X		       "	add	%0, %3, %1\n\t"
X		       "	cas	[%2], %0, %1\n\t"
X		       "	sub	%0, %1, %0\n\t"
X		       "	brnz,pn	%0, 1b\n\t"
X		       "	 nop"
X		       : "=&r" (__tmp1), "=&r" (__tmp2)
X		       : "r" (__mem), "r" (__val)
X		       : "memory");
X  return __tmp2;
}
X
static inline void
__attribute__ ((unused))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
X  _Atomic_word __tmp1, __tmp2;
X
X  __asm__ __volatile__("1:	lduw	[%2], %0\n\t"
X		       "	add	%0, %3, %1\n\t"
X		       "	cas	[%2], %0, %1\n\t"
X		       "	sub	%0, %1, %0\n\t"
X		       "	brnz,pn	%0, 1b\n\t"
X		       "	 nop"
X		       : "=&r" (__tmp1), "=&r" (__tmp2)
X		       : "r" (__mem), "r" (__val)
X		       : "memory");
}
X
static inline int
__attribute__ ((unused))
__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
X  register int __tmp, 
X  register long __tmp2;
X
X  __asm__ __volatile__("1:	ldx	[%4], %0\n\t"
X		       "	mov	%2, %1\n\t"
X		       "	cmp	%0, %3\n\t"
X		       "	bne,a,pn %%xcc, 2f\n\t"
X		       "	 mov	0, %0\n\t"
X		       "	casx	[%4], %0, %1\n\t"
X		       "	sub	%0, %1, %0\n\t"
X		       "	brnz,pn	%0, 1b\n\t"
X		       "	 mov	1, %0\n\t"
X		       "2:"
X		       : "=&r" (__tmp), "=&r" (__tmp2)
X		       : "r" (__newval), "r" (__oldval), "r" (__p)
X		       : "memory");
X  return __tmp;
}
X
#endif /* atomicity.h */
SHAR_EOF
  $shar_touch -am 042503512000 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' &&
  chmod 0644 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' ||
  $echo 'restore of' 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h:' 'MD5 check failed'
805799abdfe43756d3fc80a59fab7ee0  libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h'`"
    test 2530 -eq "$shar_count" ||
    $echo 'libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h:' 'original size' '2530,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh23789
exit 0

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]