mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 02:03:35 +08:00
Get rid of lll_robust_trylock.
This commit is contained in:
parent
5853672669
commit
887865fcfa
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
||||
2014-07-10 Roland McGrath <roland@hack.frob.com>
|
||||
|
||||
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
|
||||
Use atomic_compare_and_exchange_val_acq directly rather than
|
||||
lll_robust_trylock.
|
||||
* sysdeps/unix/sysv/linux/aarch64/lowlevellock.h
|
||||
(__lll_robust_trylock, lll_robust_trylock): Removed.
|
||||
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/arm/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/m68k/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/mips/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/sh/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/tile/lowlevellock.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
|
||||
|
||||
2014-07-02 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* manual/locale.texi (Locale Names): New section documenting
|
||||
|
@ -72,7 +72,7 @@ __pthread_mutex_trylock (mutex)
|
||||
elision:
|
||||
if (lll_trylock_elision (mutex->__data.__lock,
|
||||
mutex->__data.__elision) != 0)
|
||||
break;
|
||||
break;
|
||||
/* Don't record the ownership. */
|
||||
return 0;
|
||||
|
||||
@ -159,7 +159,8 @@ __pthread_mutex_trylock (mutex)
|
||||
}
|
||||
}
|
||||
|
||||
oldval = lll_robust_trylock (mutex->__data.__lock, id);
|
||||
oldval = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
|
||||
id, 0);
|
||||
if (oldval != 0 && (oldval & FUTEX_OWNER_DIED) == 0)
|
||||
{
|
||||
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
|
||||
|
@ -180,11 +180,6 @@
|
||||
#define lll_cond_trylock(lock) \
|
||||
atomic_compare_and_exchange_val_acq(&(lock), 2, 0)
|
||||
|
||||
#define __lll_robust_trylock(futex, id) \
|
||||
(atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
__lll_robust_trylock (&(lock), id)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -187,14 +187,6 @@ __lll_cond_trylock(int *futex)
|
||||
#define lll_cond_trylock(lock) __lll_cond_trylock (&(lock))
|
||||
|
||||
|
||||
static inline int __attribute__((always_inline))
|
||||
__lll_robust_trylock(int *futex, int id)
|
||||
{
|
||||
return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
|
||||
}
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
__lll_robust_trylock (&(lock), id)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -176,11 +176,6 @@
|
||||
#define lll_cond_trylock(lock) \
|
||||
atomic_compare_and_exchange_val_acq(&(lock), 2, 0)
|
||||
|
||||
#define __lll_robust_trylock(futex, id) \
|
||||
(atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
__lll_robust_trylock (&(lock), id)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -193,15 +193,6 @@ typedef int lll_lock_t;
|
||||
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
|
||||
})
|
||||
|
||||
static inline int
|
||||
__attribute__ ((always_inline))
|
||||
__lll_robust_trylock (int *futex, int id)
|
||||
{
|
||||
return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
|
||||
}
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
__lll_robust_trylock (&(futex), id)
|
||||
|
||||
static inline int
|
||||
__attribute__ ((always_inline))
|
||||
__lll_cond_trylock (int *futex)
|
||||
|
@ -188,15 +188,6 @@
|
||||
: "memory"); \
|
||||
ret; })
|
||||
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
({ int ret; \
|
||||
__asm __volatile (LOCK_INSTR "cmpxchgl %2, %1" \
|
||||
: "=a" (ret), "=m" (futex) \
|
||||
: "r" (id), "m" (futex), \
|
||||
"0" (LLL_LOCK_INITIALIZER) \
|
||||
: "memory"); \
|
||||
ret; })
|
||||
|
||||
|
||||
#define lll_cond_trylock(futex) \
|
||||
({ int ret; \
|
||||
|
@ -169,12 +169,6 @@ while (0)
|
||||
#define lll_trylock(futex) __lll_trylock (&(futex))
|
||||
|
||||
|
||||
#define __lll_robust_trylock(futex, id) \
|
||||
(atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
__lll_robust_trylock (&(futex), id)
|
||||
|
||||
|
||||
#define __lll_cond_trylock(futex) \
|
||||
(atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0)
|
||||
#define lll_cond_trylock(futex) __lll_cond_trylock (&(futex))
|
||||
|
@ -177,9 +177,6 @@
|
||||
#define lll_cond_trylock(lock) \
|
||||
atomic_compare_and_exchange_val_acq (&(lock), 2, 0)
|
||||
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
atomic_compare_and_exchange_val_acq (&(lock), id, 0)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -180,11 +180,6 @@
|
||||
#define lll_cond_trylock(lock) \
|
||||
atomic_compare_and_exchange_val_acq(&(lock), 2, 0)
|
||||
|
||||
#define __lll_robust_trylock(futex, id) \
|
||||
(atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
__lll_robust_trylock (&(lock), id)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -187,14 +187,6 @@ __lll_cond_trylock(int *futex)
|
||||
#define lll_cond_trylock(lock) __lll_cond_trylock (&(lock))
|
||||
|
||||
|
||||
static inline int __attribute__((always_inline))
|
||||
__lll_robust_trylock(int *futex, int id)
|
||||
{
|
||||
return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
|
||||
}
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
__lll_robust_trylock (&(lock), id)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -202,23 +202,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Set *futex to ID if it is 0, atomically. Returns the old value */
|
||||
#define __lll_robust_trylock(futex, id) \
|
||||
({ int __val; \
|
||||
__asm __volatile ("1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
|
||||
" cmpwi 0,%0,0\n" \
|
||||
" bne 2f\n" \
|
||||
" stwcx. %3,0,%2\n" \
|
||||
" bne- 1b\n" \
|
||||
"2: " __lll_acq_instr \
|
||||
: "=&r" (__val), "=m" (*futex) \
|
||||
: "r" (futex), "r" (id), "m" (*futex) \
|
||||
: "cr0", "memory"); \
|
||||
__val; \
|
||||
})
|
||||
|
||||
#define lll_robust_trylock(lock, id) __lll_robust_trylock (&(lock), id)
|
||||
|
||||
/* Set *futex to 1 if it is 0, atomically. Returns the old value */
|
||||
#define __lll_trylock(futex) __lll_robust_trylock (futex, 1)
|
||||
|
||||
|
@ -210,21 +210,6 @@ __lll_cond_trylock (int *futex)
|
||||
#define lll_cond_trylock(futex) __lll_cond_trylock (&(futex))
|
||||
|
||||
|
||||
static inline int
|
||||
__attribute__ ((always_inline))
|
||||
__lll_robust_trylock (int *futex, int id)
|
||||
{
|
||||
unsigned int old;
|
||||
|
||||
__asm __volatile ("cs %0,%3,%1"
|
||||
: "=d" (old), "=Q" (*futex)
|
||||
: "0" (0), "d" (id), "m" (*futex) : "cc", "memory" );
|
||||
return old != 0;
|
||||
}
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
__lll_robust_trylock (&(futex), id)
|
||||
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -118,28 +118,6 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
|
||||
: "r0", "r1", "r2", "t", "memory"); \
|
||||
__result; })
|
||||
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
({ unsigned char __result; \
|
||||
__asm __volatile ("\
|
||||
.align 2\n\
|
||||
mova 1f,r0\n\
|
||||
nop\n\
|
||||
mov r15,r1\n\
|
||||
mov #-8,r15\n\
|
||||
0: mov.l @%1,r2\n\
|
||||
cmp/eq r2,%3\n\
|
||||
bf 1f\n\
|
||||
mov.l %2,@%1\n\
|
||||
1: mov r1,r15\n\
|
||||
mov #-1,%0\n\
|
||||
negc %0,%0"\
|
||||
: "=r" (__result) \
|
||||
: "r" (&(futex)), \
|
||||
"r" (id), \
|
||||
"r" (LLL_LOCK_INITIALIZER) \
|
||||
: "r0", "r1", "r2", "t", "memory"); \
|
||||
__result; })
|
||||
|
||||
#define lll_cond_trylock(futex) \
|
||||
({ unsigned char __result; \
|
||||
__asm __volatile ("\
|
||||
|
@ -203,15 +203,6 @@ __lll_cond_trylock (int *futex)
|
||||
}
|
||||
#define lll_cond_trylock(futex) __lll_cond_trylock (&(futex))
|
||||
|
||||
static inline int
|
||||
__attribute__ ((always_inline))
|
||||
__lll_robust_trylock (int *futex, int id)
|
||||
{
|
||||
return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
|
||||
}
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
__lll_robust_trylock (&(futex), id)
|
||||
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -186,14 +186,6 @@ __lll_cond_trylock (int *futex)
|
||||
#define lll_cond_trylock(lock) __lll_cond_trylock (&(lock))
|
||||
|
||||
|
||||
static inline int __attribute__ ((always_inline))
|
||||
__lll_robust_trylock (int *futex, int id)
|
||||
{
|
||||
return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
|
||||
}
|
||||
#define lll_robust_trylock(lock, id) \
|
||||
__lll_robust_trylock (&(lock), id)
|
||||
|
||||
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
|
||||
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
|
||||
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
|
||||
|
@ -165,14 +165,6 @@
|
||||
: "memory"); \
|
||||
ret; })
|
||||
|
||||
#define lll_robust_trylock(futex, id) \
|
||||
({ int ret; \
|
||||
__asm __volatile (LOCK_INSTR "cmpxchgl %2, %1" \
|
||||
: "=a" (ret), "=m" (futex) \
|
||||
: "r" (id), "m" (futex), "0" (LLL_LOCK_INITIALIZER) \
|
||||
: "memory"); \
|
||||
ret; })
|
||||
|
||||
#define lll_cond_trylock(futex) \
|
||||
({ int ret; \
|
||||
__asm __volatile (LOCK_INSTR "cmpxchgl %2, %1" \
|
||||
|
Loading…
Reference in New Issue
Block a user