mirror of git://gcc.gnu.org/git/gcc.git
re PR libgcj/49193 (__sync_xxxx builtins aren't used in sysdep/*/locks.h)
PR libgcj/49193 * sysdep/alpha/locks.h (compare_and_swap): Call __sync_bool_compare_and_swap. (release_set): Call __sync_synchronize. From-SVN: r182692
This commit is contained in:
parent
6231d28e0b
commit
a055ca4382
|
|
@ -1,3 +1,10 @@
|
||||||
|
2011-12-27 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
|
PR libgcj/49193
|
||||||
|
* sysdep/alpha/locks.h (compare_and_swap): Call
|
||||||
|
__sync_bool_compare_and_swap.
|
||||||
|
(release_set): Call __sync_synchronize.
|
||||||
|
|
||||||
2011-12-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
2011-12-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* configure.ac (i?86-*-linux*): Set SIGNAL_HANDLER_AUX.
|
* configure.ac (i?86-*-linux*): Set SIGNAL_HANDLER_AUX.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// locks.h - Thread synchronization primitives. Alpha implementation.
|
// locks.h - Thread synchronization primitives. Alpha implementation.
|
||||||
|
|
||||||
/* Copyright (C) 2002 Free Software Foundation
|
/* Copyright (C) 2002, 2011 Free Software Foundation
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
|
|
@ -11,37 +11,34 @@ details. */
|
||||||
#ifndef __SYSDEP_LOCKS_H__
|
#ifndef __SYSDEP_LOCKS_H__
|
||||||
#define __SYSDEP_LOCKS_H__
|
#define __SYSDEP_LOCKS_H__
|
||||||
|
|
||||||
typedef size_t obj_addr_t; /* Integer type big enough for object */
|
/* Integer type big enough for object address. */
|
||||||
/* address. */
|
typedef size_t obj_addr_t;
|
||||||
|
|
||||||
|
// Atomically replace *addr by new_val if it was initially equal to old.
|
||||||
|
// Return true if the comparison succeeded.
|
||||||
|
// Assumed to have acquire semantics, i.e. later memory operations
|
||||||
|
// cannot execute before the compare_and_swap finishes.
|
||||||
inline static bool
|
inline static bool
|
||||||
compare_and_swap(volatile obj_addr_t *addr,
|
compare_and_swap(volatile obj_addr_t *addr,
|
||||||
obj_addr_t old,
|
obj_addr_t old,
|
||||||
obj_addr_t new_val)
|
obj_addr_t new_val)
|
||||||
{
|
{
|
||||||
unsigned long oldval;
|
return __sync_bool_compare_and_swap(addr, old, new_val);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set *addr to new_val with release semantics, i.e. making sure
|
||||||
|
// that prior loads and stores complete before this
|
||||||
|
// assignment.
|
||||||
inline static void
|
inline static void
|
||||||
release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
|
release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__("mb" : : : "memory");
|
__sync_synchronize();
|
||||||
*(addr) = new_val;
|
*(addr) = new_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compare_and_swap with release semantics instead of acquire semantics.
|
||||||
|
// On many architecture, the operation makes both guarantees, so the
|
||||||
|
// implementation can be the same.
|
||||||
inline static bool
|
inline static bool
|
||||||
compare_and_swap_release(volatile obj_addr_t *addr,
|
compare_and_swap_release(volatile obj_addr_t *addr,
|
||||||
obj_addr_t old,
|
obj_addr_t old,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue