зеркало из https://github.com/mozilla/gecko-dev.git
Implement js_CompareAndSwap for GCC x86 (Linux, FreeBSD etc). This gives us fast thin locks on Linux. bug 20357 r=brendan a=brendan
This version should now work on older binutils too.
This commit is contained in:
Родитель
87650f51b9
Коммит
96b564fb5b
|
@ -93,6 +93,25 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|||
}
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__) && defined(__i386__) && !defined(NSPR_LOCK)
|
||||
|
||||
/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
|
||||
JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"lock\n"
|
||||
"cmpxchgl %2, (%1)\n"
|
||||
"sete %%al\n"
|
||||
"andl $1, %%eax\n"
|
||||
: "=a" (res)
|
||||
: "r" (w), "r" (nv), "a" (ov)
|
||||
: "cc", "memory");
|
||||
return res;
|
||||
}
|
||||
|
||||
#elif defined(SOLARIS) && defined(sparc) && !defined(NSPR_LOCK)
|
||||
|
||||
#ifndef ULTRA_SPARC
|
||||
|
|
|
@ -159,7 +159,8 @@ extern JSBool js_IsScopeLocked(JSScope *scope);
|
|||
JS_LOCK_RUNTIME_VOID(_rt, e); \
|
||||
JS_END_MACRO
|
||||
|
||||
#if defined(JS_USE_ONLY_NSPR_LOCKS) || !(defined(_WIN32) || defined(SOLARIS) || defined(AIX))
|
||||
#if defined(JS_USE_ONLY_NSPR_LOCKS) || \
|
||||
!( (defined(_WIN32) && defined(_M_IX86)) || defined(SOLARIS) || defined(AIX) || (defined(__GNUC__) && defined(__i386__)) )
|
||||
|
||||
#undef JS_LOCK0
|
||||
#undef JS_UNLOCK0
|
||||
|
|
Загрузка…
Ссылка в новой задаче