1 // locks.h - Thread synchronization primitives. Alpha implementation.
3 /* Copyright (C) 2002 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 #ifndef __SYSDEP_LOCKS_H__
12 #define __SYSDEP_LOCKS_H__
14 typedef size_t obj_addr_t; /* Integer type big enough for object */
18 compare_and_swap(volatile obj_addr_t *addr,
25 "1:ldq_l %0, %1\n\t" \
26 "cmpeq %0, %5, %2\n\t" \
33 : "=&r"(oldval), "=m"(*addr), "=&r"(result)
34 : "r" (new_val), "m"(*addr), "r"(old) : "memory");
39 release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
41 __asm__ __volatile__("mb" : : : "memory");
46 compare_and_swap_release(volatile obj_addr_t *addr,
50 return compare_and_swap(addr, old, new_val);
53 // Ensure that prior stores to memory are completed with respect to other
58 __asm__ __volatile__("wmb" : : : "memory");