This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
V3: use generic atomic ops, move atomic-ops detection into configure.target
- To: libstdc++ at sources dot redhat dot com, gcc-patches at gcc dot gnu dot org
- Subject: V3: use generic atomic ops, move atomic-ops detection into configure.target
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Fri, 17 Nov 2000 15:12:06 -0500
The patch below doesn't contain any of the rebuilt configury files.
This does two things for GLIBCPP_ENABLE_ATOMICITY. First, the case
statement is moved into configure.target, where a stub had already been
set up. That's trivial.
Secondly -- this is the part that needs attention and approval from the
experts -- if we don't have a specific file already set up for atomic
integer ops, we give a warning and use the stub implementations in
config/cpu/generic, rather than printing an error message and bailing as
currently done.
The generic stub implementations aren't actually atomic, e.g., __atomic_add
is done with "*__mem += __val;" rather than assembly.
So on the plus side, we allow the library to build on J. Random Platform
even though it hasn't been specifically ported. On the minus side, we lose
a few clock cycles of performance, and maybe some correctness, since the
"atomic operations" aren't. It's the correctness part that worries me.
A lot.
Note that ENABLE_ATOMICITY configury is separate from ENABLE_THREADS.
As my prof used to say: Questions? Comments? Witty remarks?
Phil
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.93
diff -c -3 -p -r1.93 acinclude.m4
*** acinclude.m4 2000/11/17 01:04:00 1.93
--- acinclude.m4 2000/11/17 19:43:19
*************** dnl Enable atomic locking
*** 1401,1418 ****
dnl GLIBCPP_ENABLE_ATOMICITY
AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
AC_MSG_CHECKING([for atomicity.h])
! case "$target" in
! *-*-linux* | sparc*-*-* | *-*-freebsd*)
! ATOMICITYH=$cpu_include_dir
! ;;
! *-*-aix* | *-*-irix*)
! ATOMICITYH=$os_include_dir
! ;;
! *)
! # bit of overkill on this text...
! AC_MSG_ERROR([Atomic locking requested, but $enable_threads is an unknown thread package and atomic operations are not present in the CPU])
! ;;
! esac
AC_MSG_RESULT($ATOMICITYH/bits/atomicity.h)
AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
])
--- 1401,1410 ----
dnl GLIBCPP_ENABLE_ATOMICITY
AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
AC_MSG_CHECKING([for atomicity.h])
! # We have ATOMICITY already from GLIBCPP_CONFIGURE
! if test "$ATOMICITYH" = "config/cpu/generic"; then
! AC_MSG_WARN([No ATOMICITY settings found, using generic atomic ops.])
! fi
AC_MSG_RESULT($ATOMICITYH/bits/atomicity.h)
AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
])
Index: configure.target
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/configure.target,v
retrieving revision 1.1
diff -c -3 -p -r1.1 configure.target
*** configure.target 2000/11/13 23:49:41 1.1
--- configure.target 2000/11/17 19:43:19
*************** esac
*** 108,120 ****
# Set any flags dependant on the full target triplet.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
! #case "${target}" in
! # *-*-telepathic)
! # # On the MindReader 10000 platform, you really *can* tell the
! # # compiler to "do what I mean".
! # l_glibcpp_cxxflags='-fDWIM'
! # ;;
! #esac
# Okay, folks, show's over. Move along, move along.
--- 108,133 ----
# Set any flags dependant on the full target triplet.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
! case "${target}" in
! *-*-aix*)
! ATOMICITYH=$os_include_dir
! ;;
! *-*-freebsd*)
! ATOMICITYH=$cpu_include_dir
! ;;
! *-*-irix*)
! ATOMICITYH=$os_include_dir
! ;;
! *-*-linux*)
! ATOMICITYH=$cpu_include_dir
! ;;
! sparc*-*-*)
! ATOMICITYH=$cpu_include_dir
! ;;
! *)
! ATOMICITYH="config/cpu/generic"
! ;;
! esac
# Okay, folks, show's over. Move along, move along.