mirror of git://sourceware.org/git/glibc.git
(__lll_mutex_lock_wait): Replace one memory operation with one register operation.
This commit is contained in:
parent
d38145ff0b
commit
a14c918ddd
|
|
@ -45,21 +45,23 @@ __lll_mutex_lock_wait:
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
pushl %edx
|
pushl %edx
|
||||||
|
|
||||||
|
/* In the loop we are going to add 2 instead of 1 which is what
|
||||||
|
the caller did. Account for that. */
|
||||||
|
subl $1, %eax
|
||||||
|
|
||||||
movl %ecx, %ebx
|
movl %ecx, %ebx
|
||||||
xorl %esi, %esi /* No timeout. */
|
xorl %esi, %esi /* No timeout. */
|
||||||
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
||||||
1:
|
1:
|
||||||
leal 1(%eax), %edx /* account for the preceeded xadd. */
|
leal 2(%eax), %edx /* account for the preceeded xadd. */
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
|
|
||||||
movl $1, %eax
|
movl $2, %eax
|
||||||
LOCK
|
LOCK
|
||||||
xaddl %eax, (%ebx)
|
xaddl %eax, (%ebx)
|
||||||
testl %eax, %eax
|
testl %eax, %eax
|
||||||
jne 1b
|
jne,pn 1b
|
||||||
|
|
||||||
movl $2, (%ebx)
|
|
||||||
|
|
||||||
popl %edx
|
popl %edx
|
||||||
popl %ebx
|
popl %ebx
|
||||||
|
|
@ -83,13 +85,17 @@ __lll_mutex_timedlock_wait:
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
|
|
||||||
|
/* In the loop we are going to add 2 instead of 1 which is what
|
||||||
|
the caller did. Account for that. */
|
||||||
|
subl $1, %eax
|
||||||
|
|
||||||
/* Stack frame for the timespec and timeval structs. */
|
/* Stack frame for the timespec and timeval structs. */
|
||||||
subl $8, %esp
|
subl $8, %esp
|
||||||
|
|
||||||
movl %ecx, %ebp
|
movl %ecx, %ebp
|
||||||
movl %edx, %edi
|
movl %edx, %edi
|
||||||
|
|
||||||
1: leal 1(%eax), %esi
|
1: leal 2(%eax), %esi
|
||||||
|
|
||||||
/* Get current time. */
|
/* Get current time. */
|
||||||
movl %esp, %ebx
|
movl %esp, %ebx
|
||||||
|
|
@ -122,13 +128,12 @@ __lll_mutex_timedlock_wait:
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
movl %eax, %ecx
|
movl %eax, %ecx
|
||||||
|
|
||||||
movl $1, %eax
|
movl $2, %eax
|
||||||
LOCK
|
LOCK
|
||||||
xaddl %eax, (%ebx)
|
xaddl %eax, (%ebx)
|
||||||
testl %eax, %eax
|
testl %eax, %eax
|
||||||
jne 7f
|
jne 7f
|
||||||
|
|
||||||
movl $2, (%ebx)
|
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
|
|
||||||
6: addl $8, %esp
|
6: addl $8, %esp
|
||||||
|
|
|
||||||
|
|
@ -46,22 +46,24 @@ __lll_mutex_lock_wait:
|
||||||
pushq %r10
|
pushq %r10
|
||||||
pushq %rdx
|
pushq %rdx
|
||||||
|
|
||||||
|
/* In the loop we are going to add 2 instead of 1 which is what
|
||||||
|
the caller did. Account for that. */
|
||||||
|
decq %rsi
|
||||||
|
|
||||||
xorq %r10, %r10 /* No timeout. */
|
xorq %r10, %r10 /* No timeout. */
|
||||||
|
|
||||||
1:
|
1:
|
||||||
leaq 1(%rsi), %rdx /* account for the preceeded xadd. */
|
leaq 2(%rsi), %rdx /* account for the preceeded xadd. */
|
||||||
movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
|
movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
|
||||||
movq $SYS_futex, %rax
|
movq $SYS_futex, %rax
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
movl $1, %esi
|
movl $2, %esi
|
||||||
LOCK
|
LOCK
|
||||||
xaddl %esi, (%rdi)
|
xaddl %esi, (%rdi)
|
||||||
testl %esi, %esi
|
testl %esi, %esi
|
||||||
jne 1b
|
jne 1b
|
||||||
|
|
||||||
movl $2, (%rdi)
|
|
||||||
|
|
||||||
popq %rdx
|
popq %rdx
|
||||||
popq %r10
|
popq %r10
|
||||||
retq
|
retq
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue