This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: hash-synchronization for alpha
- To: java-patches at gcc dot gnu dot org
- Subject: PATCH: hash-synchronization for alpha
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Sun, 22 Jul 2001 13:12:07 -0400 (EDT)
2001-07-22 Jeff Sturm <jsturm@one-point.com>
* configure.host: Enable hash synchronization for alpha*-*.
* include/posix-threads.h (_Jv_ThreadSelf): Added inline
function for alpha.
* java/lang/natObject.cc (compare_and_swap, release_set,
compare_and_swap_release): Added inline functions for alpha.
Index: configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.20
diff -u -p -r1.20 configure.host
--- configure.host 2001/05/24 05:40:36 1.20
+++ configure.host 2001/07/22 16:48:08
@@ -70,6 +70,7 @@ case "${host}" in
alpha*-*)
libgcj_flags="${libgcj_flags} -mieee"
libgcj_interpreter=yes
+ enable_hash_synchronization_default=yes
;;
powerpc*-*)
libgcj_interpreter=yes
Index: include/posix-threads.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/posix-threads.h,v
retrieving revision 1.19
diff -u -p -r1.19 posix-threads.h
--- posix-threads.h 2001/05/24 05:40:36 1.19
+++ posix-threads.h 2001/07/22 16:48:11
@@ -250,6 +250,24 @@ _Jv_ThreadSelf (void)
#endif /* __ia64__ */
+#ifdef __alpha__
+
+#include <asm/pal.h>
+
+typedef unsigned long _Jv_ThreadId_t;
+
+inline _Jv_ThreadId_t
+_Jv_ThreadSelf (void)
+{
+ unsigned long id;
+ __asm__ ("call_pal %1\n\tmov $0, %0" : "=r"(id) : "i"(PAL_rduniq) : "$0");
+ return id;
+}
+
+#define JV_SELF_DEFINED
+
+#endif /* __alpha__ */
+
#if defined(SLOW_PTHREAD_SELF)
typedef pthread_t _Jv_ThreadId_t;
Index: java/lang/natObject.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natObject.cc,v
retrieving revision 1.16
diff -u -p -r1.16 natObject.cc
--- natObject.cc 2001/05/24 18:03:47 1.16
+++ natObject.cc 2001/07/22 16:48:15
@@ -391,6 +391,44 @@ typedef size_t obj_addr_t; /* Integer ty
}
#endif
+#if defined(__GNUC__) && defined(__alpha__)
+ inline static bool
+ compare_and_swap(volatile obj_addr_t *addr,
+ obj_addr_t old,
+ obj_addr_t new_val)
+ {
+ unsigned long oldval;
+ char result;
+ __asm__ __volatile__(
+ "1:ldq_l %0, %1\n\t" \
+ "cmpeq %0, %5, %2\n\t" \
+ "beq %2, 2f\n\t" \
+ "mov %3, %0\n\t" \
+ "stq_c %0, %1\n\t" \
+ "bne %0, 2f\n\t" \
+ "br 1b\n\t" \
+ "2:mb"
+ : "=&r"(oldval), "=m"(*addr), "=&r"(result)
+ : "r" (new_val), "m"(*addr), "r"(old) : "memory");
+ return (bool) result;
+ }
+
+ inline static void
+ release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
+ {
+ __asm__ __volatile__("mb" : : : "memory");
+ *(addr) = new_val;
+ }
+
+ inline static bool
+ 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);
+ }
+#endif
+
// Try to determine whether we are on a multiprocessor, i.e. whether
// spinning may be profitable.
// This should really use a suitable autoconf macro.