зеркало из https://github.com/mozilla/gecko-dev.git
Added compare-and-swap patches for AIX (_check_lock) and Solaris (stbar).
This commit is contained in:
Родитель
e8b2ca845e
Коммит
501ca3dfad
|
@ -102,6 +102,7 @@ js_CompareAndSwap(prword *w, prword ov, prword nv)
|
|||
#ifndef ULTRA_SPARC
|
||||
PR_ASSERT(nv >= 0);
|
||||
asm volatile ("
|
||||
stbar
|
||||
swap [%1],%4
|
||||
1: tst %4
|
||||
bneg,a 1b
|
||||
|
@ -119,6 +120,7 @@ mov 0,%0
|
|||
#else /* ULTRA_SPARC */
|
||||
PR_ASSERT(ov != nv);
|
||||
asm volatile ("
|
||||
stbar
|
||||
cas [%1],%2,%3
|
||||
cmp %2,%3
|
||||
be,a 1f
|
||||
|
@ -141,25 +143,12 @@ mov 0,%0
|
|||
}
|
||||
|
||||
#elif defined(AIX) && !defined(NSPR_LOCK)
|
||||
#include <sys/atomic_op.h>
|
||||
|
||||
PR_INLINE int
|
||||
js_CompareAndSwap(prword *w, prword ov, prword nv)
|
||||
{
|
||||
/*
|
||||
int i = -1;
|
||||
|
||||
lwarx reg,0,w
|
||||
cmpw reg,ov
|
||||
bne no
|
||||
stwcx. nv,0,w
|
||||
beq yes
|
||||
no:
|
||||
li res,0
|
||||
yes:
|
||||
*/
|
||||
extern int compare_and_swap(int*,int*,int);
|
||||
|
||||
return compare_and_swap(w,&ov,nv);
|
||||
return !_check_lock(w,ov,nv);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
ENTRY(compare_and_swap) ! standard assembler/ELF prologue
|
||||
|
||||
stbar
|
||||
mov -1,%o3 ! busy flag
|
||||
swap [%o0],%o3 ! get current value
|
||||
l1: tst %o3 ! busy?
|
||||
|
@ -61,6 +62,7 @@ l2: retl
|
|||
|
||||
ENTRY(compare_and_swap) ! standard assembler/ELF prologue
|
||||
|
||||
stbar
|
||||
cas [%o0],%o1,%o2 ! compare *w with old value and set to new if equal
|
||||
cmp %o1,%o2 ! did we succeed?
|
||||
be,a m1 ! yes
|
||||
|
|
Загрузка…
Ссылка в новой задаче