Bugzilla bug #30902: added an alternative implementation of PR_AtomicSet

using cmpxchg in the comments.  Made PR_AtomicAdd a little more efficient.
This commit is contained in:
wtc%netscape.com 2000-04-25 22:33:10 +00:00
Родитель 352faceb63
Коммит a0a04fcb0a
1 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -52,6 +52,20 @@ _PR_x86_AtomicDecrement:
/
/ Atomically set the integer pointed to by 'val' to the new
/ value 'newval' and return the old value.
/
/ An alternative implementation:
/ .text
/ .globl _PR_x86_AtomicSet
/ .align 4
/_PR_x86_AtomicSet:
/ movl 4(%esp), %ecx
/ movl 8(%esp), %edx
/ movl (%ecx), %eax
/retry:
/ lock
/ cmpxchgl %edx, (%ecx)
/ jne retry
/ ret
/
.text
.globl _PR_x86_AtomicSet
@ -74,7 +88,7 @@ _PR_x86_AtomicSet:
_PR_x86_AtomicAdd:
movl 4(%esp), %ecx
movl 8(%esp), %eax
movl 8(%esp), %edx
movl %eax, %edx
lock
xaddl %eax, (%ecx)
addl %edx, %eax