aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorJeff Sturm <jsturm@one-point.com>2001-07-23 03:51:17 +0000
committerJeff Sturm <jsturm@gcc.gnu.org>2001-07-23 03:51:17 +0000
commit092a1f5ab3fa380240b5452d20ab83d150ee70c4 (patch)
tree1a10855b6573d1527d123a6882488123ba1b42b5 /libjava/java
parent0b6301aebeb907d1ebaee5b075c05595db9fa08f (diff)
downloadgcc-092a1f5ab3fa380240b5452d20ab83d150ee70c4.zip
gcc-092a1f5ab3fa380240b5452d20ab83d150ee70c4.tar.gz
gcc-092a1f5ab3fa380240b5452d20ab83d150ee70c4.tar.bz2
configure.host: Enable hash synchronization for alpha*-*.
* 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. From-SVN: r44251
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/lang/natObject.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc
index 956b944..adb487a 100644
--- a/libjava/java/lang/natObject.cc
+++ b/libjava/java/lang/natObject.cc
@@ -391,6 +391,44 @@ typedef size_t obj_addr_t; /* Integer type big enough for object */
}
#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.