1 // locks.h - Thread synchronization primitives. IA64 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 #include <ia64intrin.h>
16 typedef size_t obj_addr_t
; /* Integer type big enough for object */
20 compare_and_swap(volatile obj_addr_t
*addr
,
24 return __sync_bool_compare_and_swap (addr
, old
, new_val
);
27 // The fact that *addr is volatile should cause the compiler to
28 // automatically generate an st8.rel.
30 release_set(volatile obj_addr_t
*addr
, obj_addr_t new_val
)
32 __asm__
__volatile__("" : : : "memory");
37 compare_and_swap_release(volatile obj_addr_t
*addr
,
41 register unsigned long ar_ccv
__asm__("ar.ccv") = old
;
43 __asm__
__volatile__("cmpxchg8.rel %0=%1,%2,%4"
44 : "=r"(out
), "=m"(*addr
)
45 : "r"(new_val
), "m"(*addr
), "d"(ar_ccv
) : "memory");
52 __sync_synchronize ();
58 __sync_synchronize ();