+2003-05-26 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Fix
+ typo in register name.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Use parameters
+ correctly. Actually use requeue. Little optimization.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Store
+ mutex address early. Handle cancellation state as 32-bit value.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+ Remove unnecessary label.
+
2003-05-25 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread_cond_broadcast.c: Try using FUTEX_REQUEUE
__pthread_cond_signal:
/* Get internal lock. */
+ movq %rdi, %r8
movl $1, %esi
LOCK
#if cond_lock == 0
- xaddl %esi, (%r8)
+ xaddl %esi, (%rdi)
#else
- xaddl %esi, cond_lock(%r8)
+ xaddl %esi, cond_lock(%rdi)
#endif
testl %esi, %esi
jne 1f
-2: leaq wakeup_seq(%r8), %rdi
+2: addq $wakeup_seq, %rdi
movq total_seq(%r8), %rcx
cmpq (%rdi), %rcx
jbe 4f
addq $1, (%rdi)
/* Wake up one thread. */
- movq $FUTEX_WAKE, %rsi
+ movq $FUTEX_REQUEUE, %rsi
movq $SYS_futex, %rax
xorq %rdx, %rdx
movq $1, %r10
/* Unlock. */
4: LOCK
+#if cond_lock == 0
+ decl (%r8)
+#else
decl cond_lock(%r8)
+#endif
jne 5f
6: xorl %eax, %eax
#endif
jmp 2b
- /* Unlock in loop requires waekup. */
+ /* Unlock in loop requires wakeup. */
5:
#if cond_lock != 0
addq $cond_lock-wakeup_seq, %rdi
#ifndef __ASSUME_FUTEX_REQUEUE
7: /* The futex requeue functionality is not available. */
movq $1, %rdx
- movq $FUTEX_WAKE, %esi
+ movq $FUTEX_WAKE, %rsi
movq $SYS_futex, %rax
syscall
jmp 4b
+#endif
.size __pthread_cond_signal, .-__pthread_cond_signal
versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2)
movq %rsi, 16(%rsp)
movq %rdx, %r13
+ movq %rsi, dep_mutex(%rdi)
+
/* Get internal lock. */
movl $1, %esi
LOCK
jne 1f
/* Unlock the mutex. */
-2: movq %rdi, %rax
- movq 16(%rsp), %rdi
- movq %rdi, dep_mutex(%rax)
+2: movq 16(%rsp), %rdi
callq __pthread_mutex_unlock_internal
testl %eax, %eax
jne 3f
4: callq __pthread_enable_asynccancel
- movq %rax, (%rsp)
+ movl %eax, (%rsp)
/* Get the current time. */
#ifdef __NR_clock_gettime
syscall
movq %rax, %r14
- movq (%rsp), %rdi
+ movl (%rsp), %edi
callq __pthread_disable_asynccancel
/* Lock. */
movq 16(%r8), %rdi
callq __pthread_mutex_cond_lock
-3: retq
+ retq
.size __condvar_cleanup, .-__condvar_cleanup
movq %rdi, 8(%rsp)
movq %rsi, 16(%rsp)
+ movq %rsi, dep_mutex(%rdi)
+
/* Get internal lock. */
movl $1, %esi
LOCK
jne 1f
/* Unlock the mutex. */
-2: movq %rdi, %rax
- movq 16(%rsp), %rdi
- movq %rdi, dep_mutex(%rax)
+2: movq 16(%rsp), %rdi
callq __pthread_mutex_unlock_internal
testl %eax, %eax
jne 3f
4: callq __pthread_enable_asynccancel
- movq %rax, (%rsp)
+ movl %eax, (%rsp)
movq 8(%rsp), %rdi
xorq %r10, %r10
movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
syscall
- movq (%rsp), %rdi
+ movl (%rsp), %edi
callq __pthread_disable_asynccancel
/* Lock. */