From 4838bfc05bf7b35b1e07a57a0878df308655d6d8 Mon Sep 17 00:00:00 2001 From: Andreas Tobler Date: Sat, 27 Jan 2007 21:46:15 +0000 Subject: [PATCH] re PR libgcj/30513 (Bootstrap failure with libgcj on sparc-sun-solaris2.10) 2007-01-27 Andreas Tobler PR libgcj/30513 * configure.host: Add forgottten sysdep_dir to sparc. Add a flag to libgcj_flags to undefine 'sun' at compile time. * sysdep/sparc/locks.h (read_barrier): New functions for 32 and 64 bit Sparc. (write_barrier): Likewise. From-SVN: r121239 --- libjava/ChangeLog | 11 ++++++++++- libjava/configure.host | 4 ++++ libjava/sysdep/sparc/locks.h | 36 +++++++++++++++++++++++++++++------- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4e6e238684e..7aea26537ca 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,12 @@ +2007-01-27 Andreas Tobler + + PR libgcj/30513 + * configure.host: Add forgottten sysdep_dir to sparc. Add a flag to + libgcj_flags to undefine 'sun' at compile time. + * sysdep/sparc/locks.h (read_barrier): New functions for 32 and 64 bit + Sparc. + (write_barrier): Likewise. + 2007-01-27 Keith Seitz * gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -61,7 +70,7 @@ * libjava/testsuite/libjava.jvmti/jvmti-interp.exp: New file. * libjava/testsuite/libjava.jvmti/interp: New folder. * libjava/testsuite/lib/libjava.exp (exec_gij): New Method. - + 2007-01-24 Keith Seitz * link.cc (_Jv_Linker::wait_for_state): Add JVMTI diff --git a/libjava/configure.host b/libjava/configure.host index e19a61a147e..edaa679b44e 100644 --- a/libjava/configure.host +++ b/libjava/configure.host @@ -159,6 +159,10 @@ case "${host}" in enable_hash_synchronization_default=yes ;; sparc*-*) + sysdeps_dir=sparc + # On Solaris we have defined 'sun' which later conflicts with + # namespace usage. So to work this away we use the below undefine. + libgcj_flags="${libgcj_flags} -Usun" libgcj_interpreter=yes ;; ia64-*) diff --git a/libjava/sysdep/sparc/locks.h b/libjava/sysdep/sparc/locks.h index 7339567d7d4..7c30d7c3b0f 100644 --- a/libjava/sysdep/sparc/locks.h +++ b/libjava/sysdep/sparc/locks.h @@ -1,6 +1,6 @@ // locks.h - Thread synchronization primitives. Sparc implementation. -/* Copyright (C) 2002 Free Software Foundation +/* Copyright (C) 2002, 2007 Free Software Foundation This file is part of libgcj. @@ -38,12 +38,23 @@ release_set(volatile obj_addr_t *addr, obj_addr_t new_val) } inline static bool -compare_and_swap_release(volatile obj_addr_t *addr, - obj_addr_t old, - obj_addr_t new_val) +compare_and_swap_release(volatile obj_addr_t *addr, obj_addr_t old, + obj_addr_t new_val) { return compare_and_swap(addr, old, new_val); } + +inline static void +read_barrier() +{ + __asm__ __volatile__("membar #LoadLoad | #LoadStore" : : : "memory"); +} + +inline static void +write_barrier() +{ + __asm__ __volatile__("membar #StoreLoad | #StoreStore" : : : "memory"); +} #else /* Sparc32 implementation, use a spinlock. */ static unsigned char __cas_lock = 0; @@ -109,12 +120,23 @@ release_set(volatile obj_addr_t *addr, obj_addr_t new_val) } inline static bool -compare_and_swap_release(volatile obj_addr_t *addr, - obj_addr_t old, - obj_addr_t new_val) +compare_and_swap_release(volatile obj_addr_t *addr, obj_addr_t old, + obj_addr_t new_val) { return compare_and_swap(addr, old, new_val); } + +inline static void +read_barrier() +{ + __asm__ __volatile__ ("" : : : "memory"); +} + +inline static void +write_barrier() +{ + __asm__ __volatile__ ("" : : : "memory"); +} #endif /* __arch64__ */ #endif /* ! __SYSDEP_LOCKS_H__ */