mirror of git://gcc.gnu.org/git/gcc.git
atomicity.h: Include c++config.h to get defines.
2004-02-27 Benjamin Kosnik <bkoz@redhat.com> * config/cpu/hppa/atomicity.h: Include c++config.h to get defines. * src/misc-inst.cc (_S_atomicity_lock): Move to __gnu_cxx. * config/os/irix/irix5.2/atomicity.h: Merge.. * config/os/irix/irix6.5/atomicity.h: Merge.. * config/os/irix/atomicity.h: ...into this. * config/os/irix/atomic_word.h: New. * configure.host: Set atomic_word_dir for irix. * hppa/atomicity.h: Change __Atomicity_lock to _Atomicity_lock. * i386/atomicity.h: Same. * m68k/atomicity.h: Same. * sparc/atomicity.h: Same. From-SVN: r78577
This commit is contained in:
parent
c284a1261d
commit
00d04db682
|
@ -1,7 +1,24 @@
|
||||||
|
2004-02-27 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
|
* config/cpu/hppa/atomicity.h: Include c++config.h to get defines.
|
||||||
|
|
||||||
|
* src/misc-inst.cc (_S_atomicity_lock): Move to __gnu_cxx.
|
||||||
|
|
||||||
|
* config/os/irix/irix5.2/atomicity.h: Merge..
|
||||||
|
* config/os/irix/irix6.5/atomicity.h: Merge..
|
||||||
|
* config/os/irix/atomicity.h: ...into this.
|
||||||
|
* config/os/irix/atomic_word.h: New.
|
||||||
|
* configure.host: Set atomic_word_dir for irix.
|
||||||
|
|
||||||
|
* hppa/atomicity.h: Change __Atomicity_lock to _Atomicity_lock.
|
||||||
|
* i386/atomicity.h: Same.
|
||||||
|
* m68k/atomicity.h: Same.
|
||||||
|
* sparc/atomicity.h: Same.
|
||||||
|
|
||||||
2004-02-27 David Edelsohn <edelsohn@gnu.org>
|
2004-02-27 David Edelsohn <edelsohn@gnu.org>
|
||||||
|
|
||||||
* config/os/aix/atomicity.h: Use __gnu_cxx namespace. Remove
|
* config/os/aix/atomicity.h: Use __gnu_cxx namespace. Remove
|
||||||
static, and inline keyworks.
|
static, and inline keywords.
|
||||||
|
|
||||||
2004-02-27 Paolo Carlini <pcarlini@suse.de>
|
2004-02-27 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
@ -74,7 +91,7 @@
|
||||||
(ios_base::Init::~Init): Same.
|
(ios_base::Init::~Init): Same.
|
||||||
* src/locale.cc (locale::id::_M_id): Same.
|
* src/locale.cc (locale::id::_M_id): Same.
|
||||||
* config/cpu/i486/atomicity.h: Use __gnu_cxx namespace. Remove
|
* config/cpu/i486/atomicity.h: Use __gnu_cxx namespace. Remove
|
||||||
static, and inline keyworks.
|
static, and inline keywords.
|
||||||
* config/cpu/alpha/atomicity.h: Same.
|
* config/cpu/alpha/atomicity.h: Same.
|
||||||
* config/cpu/cris/atomicity.h: Same.
|
* config/cpu/cris/atomicity.h: Same.
|
||||||
* config/cpu/generic/atomicity.h: Same.
|
* config/cpu/generic/atomicity.h: Same.
|
||||||
|
|
|
@ -27,26 +27,26 @@
|
||||||
// invalidate any other reasons why the executable file might be covered by
|
// invalidate any other reasons why the executable file might be covered by
|
||||||
// the GNU General Public License.
|
// the GNU General Public License.
|
||||||
|
|
||||||
|
#include <bits/c++config.h>
|
||||||
#include <bits/atomicity.h>
|
#include <bits/atomicity.h>
|
||||||
|
|
||||||
namespace __gnu_cxx
|
namespace __gnu_cxx
|
||||||
{
|
{
|
||||||
template<int __inst>
|
template<int _Inst>
|
||||||
struct __Atomicity_lock
|
struct _Atomicity_lock
|
||||||
{
|
{
|
||||||
static volatile int _S_atomicity_lock;
|
static volatile int _S_atomicity_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int __inst>
|
template<int _Inst>
|
||||||
volatile int
|
volatile int
|
||||||
__Atomicity_lock<__inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1;
|
_Atomicity_lock<_Inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1;
|
||||||
|
|
||||||
/* Because of the lack of weak support when using the hpux
|
// Because of the lack of weak support when using the hpux som
|
||||||
som linker, we explicitly instantiate the atomicity lock
|
// linker, we explicitly instantiate the atomicity lock in
|
||||||
in src/misc-inst.cc when _GLIBCXX_INST_ATOMICITY_LOCK
|
// src/misc-inst.cc when _GLIBCXX_INST_ATOMICITY_LOCK is defined.
|
||||||
is defined. */
|
|
||||||
#ifndef _GLIBCXX_INST_ATOMICITY_LOCK
|
#ifndef _GLIBCXX_INST_ATOMICITY_LOCK
|
||||||
template volatile int __Atomicity_lock<0>::_S_atomicity_lock;
|
template volatile int _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -55,7 +55,7 @@ namespace __gnu_cxx
|
||||||
{
|
{
|
||||||
_Atomic_word result;
|
_Atomic_word result;
|
||||||
int tmp;
|
int tmp;
|
||||||
volatile int& lock = __Atomicity_lock<0>::_S_atomicity_lock;
|
volatile int& lock = _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
|
|
||||||
__asm__ __volatile__ ("ldcw 0(%1),%0\n\t"
|
__asm__ __volatile__ ("ldcw 0(%1),%0\n\t"
|
||||||
"cmpib,<>,n 0,%0,.+20\n\t"
|
"cmpib,<>,n 0,%0,.+20\n\t"
|
||||||
|
@ -79,7 +79,7 @@ namespace __gnu_cxx
|
||||||
__atomic_add(_Atomic_word* __mem, int __val)
|
__atomic_add(_Atomic_word* __mem, int __val)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
volatile int& lock = __Atomicity_lock<0>::_S_atomicity_lock;
|
volatile int& lock = _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
|
|
||||||
__asm__ __volatile__ ("ldcw 0(%1),%0\n\t"
|
__asm__ __volatile__ ("ldcw 0(%1),%0\n\t"
|
||||||
"cmpib,<>,n 0,%0,.+20\n\t"
|
"cmpib,<>,n 0,%0,.+20\n\t"
|
||||||
|
|
|
@ -32,15 +32,15 @@
|
||||||
namespace __gnu_cxx
|
namespace __gnu_cxx
|
||||||
{
|
{
|
||||||
template<int __inst>
|
template<int __inst>
|
||||||
struct __Atomicity_lock
|
struct _Atomicity_lock
|
||||||
{
|
{
|
||||||
static volatile _Atomic_word _S_atomicity_lock;
|
static volatile _Atomic_word _S_atomicity_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int __inst>
|
template<int __inst>
|
||||||
volatile _Atomic_word __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
|
volatile _Atomic_word _Atomicity_lock<__inst>::_S_atomicity_lock = 0;
|
||||||
|
|
||||||
template volatile _Atomic_word __Atomicity_lock<0>::_S_atomicity_lock;
|
template volatile _Atomic_word _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
|
|
||||||
_Atomic_word
|
_Atomic_word
|
||||||
__attribute__ ((__unused__))
|
__attribute__ ((__unused__))
|
||||||
|
@ -52,9 +52,9 @@ namespace __gnu_cxx
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ ("xchg{l} {%0,%1|%1,%0}"
|
__asm__ __volatile__ ("xchg{l} {%0,%1|%1,%0}"
|
||||||
: "=m" (__Atomicity_lock<0>::_S_atomicity_lock),
|
: "=m" (_Atomicity_lock<0>::_S_atomicity_lock),
|
||||||
"+r" (__tmp)
|
"+r" (__tmp)
|
||||||
: "m" (__Atomicity_lock<0>::_S_atomicity_lock));
|
: "m" (_Atomicity_lock<0>::_S_atomicity_lock));
|
||||||
}
|
}
|
||||||
while (__tmp);
|
while (__tmp);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ namespace __gnu_cxx
|
||||||
*__mem += __val;
|
*__mem += __val;
|
||||||
|
|
||||||
// Release spin lock.
|
// Release spin lock.
|
||||||
__Atomicity_lock<0>::_S_atomicity_lock = 0;
|
_Atomicity_lock<0>::_S_atomicity_lock = 0;
|
||||||
|
|
||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,15 +72,15 @@ namespace __gnu_cxx
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template<int __inst>
|
template<int __inst>
|
||||||
struct __Atomicity_lock
|
struct _Atomicity_lock
|
||||||
{
|
{
|
||||||
static volatile unsigned char _S_atomicity_lock;
|
static volatile unsigned char _S_atomicity_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int __inst>
|
template<int __inst>
|
||||||
volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
|
volatile unsigned char _Atomicity_lock<__inst>::_S_atomicity_lock = 0;
|
||||||
|
|
||||||
template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
|
template volatile unsigned char _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
|
|
||||||
_Atomic_word
|
_Atomic_word
|
||||||
__attribute__ ((__unused__))
|
__attribute__ ((__unused__))
|
||||||
|
@ -92,13 +92,13 @@ namespace __gnu_cxx
|
||||||
#if defined(__mcf5200__) || defined(__mcf5300__)
|
#if defined(__mcf5200__) || defined(__mcf5300__)
|
||||||
__asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b"
|
__asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b"
|
||||||
: /* no outputs */
|
: /* no outputs */
|
||||||
: "a"(&__Atomicity_lock<0>::_S_atomicity_lock)
|
: "a"(&_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: "cc", "memory");
|
: "cc", "memory");
|
||||||
|
|
||||||
// CPU32 and MCF5400 support test-and-set (SMP-safe).
|
// CPU32 and MCF5400 support test-and-set (SMP-safe).
|
||||||
#elif defined(__mcpu32__) || defined(__mcf5400__)
|
#elif defined(__mcpu32__) || defined(__mcf5400__)
|
||||||
__asm__ __volatile__("1: tas %0\n\tjbne 1b"
|
__asm__ __volatile__("1: tas %0\n\tjbne 1b"
|
||||||
: "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
|
: "+m"(_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: /* none */
|
: /* none */
|
||||||
: "cc");
|
: "cc");
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ namespace __gnu_cxx
|
||||||
// memory controllers.
|
// memory controllers.
|
||||||
#else
|
#else
|
||||||
__asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b"
|
__asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b"
|
||||||
: "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
|
: "+m"(_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: /* none */
|
: /* none */
|
||||||
: "cc");
|
: "cc");
|
||||||
#endif
|
#endif
|
||||||
|
@ -115,7 +115,7 @@ namespace __gnu_cxx
|
||||||
__result = *__mem;
|
__result = *__mem;
|
||||||
*__mem = __result + __val;
|
*__mem = __result + __val;
|
||||||
|
|
||||||
__Atomicity_lock<0>::_S_atomicity_lock = 0;
|
_Atomicity_lock<0>::_S_atomicity_lock = 0;
|
||||||
|
|
||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,15 +70,15 @@ namespace __gnu_cxx
|
||||||
#else /* __arch32__ */
|
#else /* __arch32__ */
|
||||||
|
|
||||||
template<int __inst>
|
template<int __inst>
|
||||||
struct __Atomicity_lock
|
struct _Atomicity_lock
|
||||||
{
|
{
|
||||||
static unsigned char _S_atomicity_lock;
|
static unsigned char _S_atomicity_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int __inst>
|
template<int __inst>
|
||||||
unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
|
unsigned char _Atomicity_lock<__inst>::_S_atomicity_lock = 0;
|
||||||
|
|
||||||
template unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
|
template unsigned char _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
|
|
||||||
_Atomic_word
|
_Atomic_word
|
||||||
__attribute__ ((__unused__))
|
__attribute__ ((__unused__))
|
||||||
|
@ -91,13 +91,13 @@ namespace __gnu_cxx
|
||||||
" bne 1b\n\t"
|
" bne 1b\n\t"
|
||||||
" nop"
|
" nop"
|
||||||
: "=&r" (__tmp)
|
: "=&r" (__tmp)
|
||||||
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
|
: "r" (&_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: "memory");
|
: "memory");
|
||||||
__result = *__mem;
|
__result = *__mem;
|
||||||
*__mem += __val;
|
*__mem += __val;
|
||||||
__asm__ __volatile__("stb %%g0, [%0]"
|
__asm__ __volatile__("stb %%g0, [%0]"
|
||||||
: /* no outputs */
|
: /* no outputs */
|
||||||
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
|
: "r" (&_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: "memory");
|
: "memory");
|
||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
@ -113,12 +113,12 @@ namespace __gnu_cxx
|
||||||
" bne 1b\n\t"
|
" bne 1b\n\t"
|
||||||
" nop"
|
" nop"
|
||||||
: "=&r" (__tmp)
|
: "=&r" (__tmp)
|
||||||
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
|
: "r" (&_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: "memory");
|
: "memory");
|
||||||
*__mem += __val;
|
*__mem += __val;
|
||||||
__asm__ __volatile__("stb %%g0, [%0]"
|
__asm__ __volatile__("stb %%g0, [%0]"
|
||||||
: /* no outputs */
|
: /* no outputs */
|
||||||
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
|
: "r" (&_Atomicity_lock<0>::_S_atomicity_lock)
|
||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
#endif /* __arch32__ */
|
#endif /* __arch32__ */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Low-level functions for atomic operations: IRIX version -*- C++ -*-
|
// Low-level type for atomic operations -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
// Copyright (C) 2004 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
@ -27,24 +27,9 @@
|
||||||
// invalidate any other reasons why the executable file might be covered by
|
// invalidate any other reasons why the executable file might be covered by
|
||||||
// the GNU General Public License.
|
// the GNU General Public License.
|
||||||
|
|
||||||
#ifndef _BITS_ATOMICITY_H
|
#ifndef _GLIBCXX_ATOMIC_WORD_H
|
||||||
#define _BITS_ATOMICITY_H 1
|
#define _GLIBCXX_ATOMIC_WORD_H 1
|
||||||
|
|
||||||
#include <mutex.h>
|
|
||||||
|
|
||||||
typedef long _Atomic_word;
|
typedef long _Atomic_word;
|
||||||
|
|
||||||
static inline _Atomic_word
|
#endif
|
||||||
__exchange_and_add (_Atomic_word* __mem, int __val)
|
|
||||||
{
|
|
||||||
return (_Atomic_word) test_then_add ((unsigned long*) __mem, __val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
__atomic_add (_Atomic_word* __mem, int __val)
|
|
||||||
{
|
|
||||||
__exchange_and_add (__mem, __val);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* atomicity.h */
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Low-level functions for atomic operations: IRIX version -*- C++ -*-
|
// Low-level functions for atomic operations: IRIX version -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
// Copyright (C) 2001, 2004 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
@ -27,24 +27,16 @@
|
||||||
// invalidate any other reasons why the executable file might be covered by
|
// invalidate any other reasons why the executable file might be covered by
|
||||||
// the GNU General Public License.
|
// the GNU General Public License.
|
||||||
|
|
||||||
#ifndef _BITS_ATOMICITY_H
|
|
||||||
#define _BITS_ATOMICITY_H 1
|
|
||||||
|
|
||||||
#include <mutex.h>
|
#include <mutex.h>
|
||||||
|
#include <bits/atomicity.h>
|
||||||
|
|
||||||
typedef long _Atomic_word;
|
namespace __gnu_cxx
|
||||||
|
|
||||||
static inline _Atomic_word
|
|
||||||
__exchange_and_add (_Atomic_word* __mem, int __val)
|
|
||||||
{
|
{
|
||||||
return (_Atomic_word) test_then_add ((unsigned long*) __mem, __val);
|
_Atomic_word
|
||||||
}
|
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
|
||||||
|
{ return (_Atomic_word) test_then_add((unsigned long*) const_cast<_Atomic_word*>(__mem), __val); }
|
||||||
|
|
||||||
|
void
|
||||||
static inline void
|
__atomic_add(volatile _Atomic_word* __mem, int __val)
|
||||||
__atomic_add (_Atomic_word* __mem, int __val)
|
{ __exchange_and_add(__mem, __val); }
|
||||||
{
|
} // namespace __gnu_cxx
|
||||||
__exchange_and_add (__mem, __val);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* atomicity.h */
|
|
|
@ -170,11 +170,13 @@ case "${host_os}" in
|
||||||
irix[1-6] | irix[1-5].* | irix6.[0-4]*)
|
irix[1-6] | irix[1-5].* | irix6.[0-4]*)
|
||||||
# This is known to work on at least IRIX 5.2 and 6.3.
|
# This is known to work on at least IRIX 5.2 and 6.3.
|
||||||
os_include_dir="os/irix/irix5.2"
|
os_include_dir="os/irix/irix5.2"
|
||||||
atomicity_dir=$os_include_dir
|
atomicity_dir=os/irix
|
||||||
|
atomic_word_dir=os/irix
|
||||||
;;
|
;;
|
||||||
irix6.5*)
|
irix6.5*)
|
||||||
os_include_dir="os/irix/irix6.5"
|
os_include_dir="os/irix/irix6.5"
|
||||||
atomicity_dir=$os_include_dir
|
atomicity_dir=os/irix
|
||||||
|
atomic_word_dir=os/irix
|
||||||
;;
|
;;
|
||||||
mingw32*)
|
mingw32*)
|
||||||
os_include_dir="os/mingw32"
|
os_include_dir="os/mingw32"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Explicit instantiation file.
|
// Explicit instantiation file.
|
||||||
|
|
||||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
@ -42,10 +42,6 @@
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
#ifdef _GLIBCXX_INST_ATOMICITY_LOCK
|
|
||||||
template volatile int __Atomicity_lock<0>::_S_atomicity_lock;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// string related to iostreams
|
// string related to iostreams
|
||||||
template
|
template
|
||||||
basic_istream<char>&
|
basic_istream<char>&
|
||||||
|
@ -77,6 +73,10 @@ namespace std
|
||||||
|
|
||||||
namespace __gnu_cxx
|
namespace __gnu_cxx
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIBCXX_INST_ATOMICITY_LOCK
|
||||||
|
template volatile int _Atomicity_lock<0>::_S_atomicity_lock;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _GLIBCXX_NEED_GENERIC_MUTEX
|
#ifdef _GLIBCXX_NEED_GENERIC_MUTEX
|
||||||
#ifdef __GTHREAD_MUTEX_INIT
|
#ifdef __GTHREAD_MUTEX_INIT
|
||||||
__gthread_mutex_t _Atomic_add_mutex = __GTHREAD_MUTEX_INIT;
|
__gthread_mutex_t _Atomic_add_mutex = __GTHREAD_MUTEX_INIT;
|
||||||
|
|
Loading…
Reference in New Issue