This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: AIX atomicity.h support
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: AIX atomicity.h support
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Tue, 26 Sep 2000 14:18:08 -0400
- cc: libstdc++ at sources dot redhat dot com, Mark Mitchell <mark at codesourcery dot com>, Geoff Keating <geoffk at cygnus dot com>
Appended are the current version of my v3/acinclude.m4 patch and
atomicity.h. If cpu_include_dir is blank, then the Makefiles point to
invalid directory hierarchies or hierarchies with two slashes, so I am not
sure what value to use on AIX.
Also, as I mentioned before, I implemented all of the atomicity
functions from powerpc/bits/atomicity.h, but generic/bits/atomicity.h
defines fewer functions which more easily match the primitives provided by
AIX. It would be better to remove the extra functions if they are
unused.
David
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.59
diff -c -p -r1.59 acinclude.m4
*** acinclude.m4 2000/09/12 01:06:02 1.59
--- acinclude.m4 2000/09/26 18:08:30
*************** AC_DEFUN(GLIBCPP_CHECK_CPU, [
*** 714,721 ****
cpu_include_dir="config/cpu/i486"
;;
powerpc | rs6000)
! cpu_include_dir="config/cpu/powerpc"
! CPU_FLAGS='-mcpu=powerpc'
;;
sparc64 | ultrasparc)
cpu_include_dir="config/cpu/sparc/sparc64"
--- 714,730 ----
cpu_include_dir="config/cpu/i486"
;;
powerpc | rs6000)
! case "${target_os}" in
! aix3*)
! cpu_include_dir="config/cpu/generic"
! ;;
! aix[[456789]]*)
! cpu_include_dir=""
! ;;
! *)
! cpu_include_dir="config/cpu/powerpc"
! ;;
! esac
;;
sparc64 | ultrasparc)
cpu_include_dir="config/cpu/sparc/sparc64"
*************** AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
*** 1312,1318 ****
target_thread_file=''
;;
xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
! xsolaris | xwin32 | xdce | xvxworks)
target_thread_file=$enable_threads_flag
;;
*)
--- 1321,1327 ----
target_thread_file=''
;;
xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
! xsolaris | xwin32 | xdce | xvxworks | xaix)
target_thread_file=$enable_threads_flag
;;
*)
*************** AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
*** 1326,1332 ****
no | none | single)
THREADS=none
;;
! posix | pthreads)
THREADS=posix
case "$target" in
*-*-linux*)
--- 1335,1341 ----
no | none | single)
THREADS=none
;;
! posix | pthreads | aix)
THREADS=posix
case "$target" in
*-*-linux*)
*************** AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
*** 1355,1361 ****
THREADSPEC=-lpthread
dnl Not presently used
dnl THREADOBJS=threads-posix.lo
! THREADH=threads-posix.h
;;
none)
dnl Not presently used
--- 1364,1377 ----
THREADSPEC=-lpthread
dnl Not presently used
dnl THREADOBJS=threads-posix.lo
! case "${target_os}" in
! aix[[456789]]*)
! THREADH=threads-aix.h
! ;;
! *)
! THREADH=threads-posix.h
! ;;
! esac
;;
none)
dnl Not presently used
----- config/aix/bits/atomicity.h -----
/* Low-level functions for atomic operations. AIX version.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H 1
#include <sys/atomic_op.h>
static inline int
__attribute__ ((unused))
__exchange_and_add (atomic_p __mem, int __val)
{
return fetch_and_add (__mem, __val);
}
static inline void
__attribute__ ((unused))
__atomic_add (atomic_p __mem, int __val)
{
(void) fetch_and_add (__mem, __val);
}
static inline int
__attribute__ ((unused))
__compare_and_swap (atomic_l __p, long int __oldval, long int __newval)
{
return compare_and_swaplp (__p, &__oldval, __newval);
}
static inline long
__attribute__ ((unused))
__always_swap (atomic_l __p, long int __newval)
{
volatile long __val = *__p;
while (! compare_and_swaplp (__p, &__val, __newval))
/* EMPTY */;
return __val;
}
static inline int
__attribute__ ((unused))
__test_and_set (atomic_l __p, long int __newval)
{
long __val = 0;
(void) compare_and_swaplp (__p, &__val, __newval);
return __val;
}
#endif /* atomicity.h */
===============================================================================
David Edelsohn T.J. Watson Research Center
dje@watson.ibm.com P.O. Box 218
+1 914 945 4364 (TL 862) Yorktown Heights, NY 10598