diff options
author | Jason Merrill <jason@redhat.com> | 2004-12-27 23:36:54 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2004-12-27 23:36:54 -0500 |
commit | 445cf5eb0d91d2aa401ff3907fcf993a44e4c8b4 (patch) | |
tree | d723d1a31c0c3358f41a176191bde7ef4add806e /gcc/config | |
parent | 1f7edb8b3d65da166df57999ae6053bfdbf939de (diff) | |
download | gcc-445cf5eb0d91d2aa401ff3907fcf993a44e4c8b4.zip gcc-445cf5eb0d91d2aa401ff3907fcf993a44e4c8b4.tar.gz gcc-445cf5eb0d91d2aa401ff3907fcf993a44e4c8b4.tar.bz2 |
Add memory barriers to the double-checked locking used for static initialization.
libstdc++:
Add memory barriers to the double-checked locking used for static
initialization.
* libsupc++/guard.cc (__test_and_acquire): Define default.
(_GLIBCXX_GUARD_TEST_AND_ACQUIRE, __set_and_release)
(_GLIBCXX_GUARD_SET_AND_RELEASE): Likewise.
(recursion_push, recursion_pop): New abstraction functions.
(__cxa_guard_acquire): Use _GLIBCXX_GUARD_TEST_AND_ACQUIRE.
(__cxa_guard_release): Use _GLIBCXX_GUARD_SET_AND_RELEASE.
* config/cpu/generic/cxxabi_tweaks.h (_GLIBCXX_GUARD_TEST): Rename
from _GLIBCXX_GUARD_ACQUIRE and reverse sense.
(_GLIBCXX_GUARD_SET): Rename from _GLIBCXX_GUARD_RELEASE.
* config/cpu/arm/cxxabi_tweaks.h: Likewise.
* config/cpu/alpha/atomic_word.h (_GLIBCXX_READ_MEM_BARRIER)
(_GLIBCXX_WRITE_MEM_BARRIER): Define.
* config/cpu/powerpc/atomic_word.h: Likewise.
* config/cpu/sparc/atomic_word.h: Likewise.
* config/cpu/generic/atomic_word.h: Define them, commented out.
* include/bits/atomicity.h: Define defaults.
* config/cpu/ia64/atomic_word.h (__test_and_acquire)
(__set_and_release): New inlines.
(_GLIBCXX_GUARD_TEST_AND_ACQUIRE): Define.
(_GLIBCXX_GUARD_SET_AND_RELEASE): Define.
* libsupc++/guard.cc (acquire_1): Use __builtin_trap instead of
abort();
gcc:
* doc/tm.texi (TARGET_RELAXED_ORDERING): Document.
* target.h (struct gcc_target): Add relaxed_ordering field.
* target-def.h (TARGET_RELAXED_ORDERING): Define default.
(TARGET_INITIALIZER): Add it.
* config/alpha/alpha.c (TARGET_RELAXED_ORDERING): Define.
* config/ia64/ia64.c (TARGET_RELAXED_ORDERING): Define.
* config/rs6000/rs6000.c (TARGET_RELAXED_ORDERING): Define.
* config/sparc/sparc.c (TARGET_RELAXED_ORDERING): Define.
* cp/decl.c (expand_static_init): Don't use shortcut if
targetm.relaxed_ordering.
From-SVN: r92659
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/alpha/alpha.c | 6 | ||||
-rw-r--r-- | gcc/config/ia64/ia64.c | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 11 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 5 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 823cdbc..042ffa6 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -9462,6 +9462,12 @@ alpha_init_libfuncs (void) #undef TARGET_BUILD_BUILTIN_VA_LIST #define TARGET_BUILD_BUILTIN_VA_LIST alpha_build_builtin_va_list +/* The Alpha architecture does not require sequential consistency. See + http://www.cs.umd.edu/~pugh/java/memoryModel/AlphaReordering.html + for an example of how it can be violated in practice. */ +#undef TARGET_RELAXED_ORDERING +#define TARGET_RELAXED_ORDERING true + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 64a4e54..332fa9b 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -420,6 +420,11 @@ static const struct attribute_spec ia64_attribute_table[] = #undef TARGET_SCALAR_MODE_SUPPORTED_P #define TARGET_SCALAR_MODE_SUPPORTED_P ia64_scalar_mode_supported_p +/* ia64 architecture manual 4.4.7: ... reads, writes, and flushes may occur + in an order different from the specified program order. */ +#undef TARGET_RELAXED_ORDERING +#define TARGET_RELAXED_ORDERING true + struct gcc_target targetm = TARGET_INITIALIZER; typedef enum diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index cf7c8ee..95a7b16 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1004,6 +1004,17 @@ static const char alt_reg_names[][8] = #undef TARGET_VECTOR_MODE_SUPPORTED_P #define TARGET_VECTOR_MODE_SUPPORTED_P rs6000_vector_mode_supported_p +/* MPC604EUM 3.5.2 Weak Consistency between Multiple Processors + The PowerPC architecture requires only weak consistency among + processors--that is, memory accesses between processors need not be + sequentially consistent and memory accesses among processors can occur + in any order. The ability to order memory accesses weakly provides + opportunities for more efficient use of the system bus. Unless a + dependency exists, the 604e allows read operations to precede store + operations. */ +#undef TARGET_RELAXED_ORDERING +#define TARGET_RELAXED_ORDERING true + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 0eff775..dd83f54 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -494,6 +494,11 @@ enum processor_type sparc_cpu; #define TARGET_ATTRIBUTE_TABLE sparc_attribute_table #endif +/* The SPARC v9 architecture defines a relaxed memory ordering model (RMO) + which requires this if enabled, though it is never used in userspace, + and the Ultra3 processors don't implement it. */ +#define TARGET_RELAXED_ORDERING TARGET_V9 + struct gcc_target targetm = TARGET_INITIALIZER; /* Validate and override various options, and do some machine dependent |