17633
|
1 |
diff --git a/js/src/jslock.cpp b/js/src/jslock.cpp
|
|
2 |
--- a/js/src/jslock.cpp
|
|
3 |
+++ b/js/src/jslock.cpp
|
|
4 |
@@ -109,17 +109,17 @@ NativeCompareAndSwap(jsword *w, jsword o
|
|
5 |
|
|
6 |
static JS_ALWAYS_INLINE int
|
|
7 |
NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|
8 |
{
|
|
9 |
/* Details on these functions available in the manpage for atomic */
|
|
10 |
return OSAtomicCompareAndSwapPtrBarrier(ov, nv, w);
|
|
11 |
}
|
|
12 |
|
|
13 |
-#elif defined(__i386) && (defined(__GNUC__) || defined(__SUNPRO_CC))
|
|
14 |
+#elif defined(__i386) && defined(__GNUC__)
|
|
15 |
|
|
16 |
/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
|
|
17 |
static JS_ALWAYS_INLINE int
|
|
18 |
NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|
19 |
{
|
|
20 |
unsigned int res;
|
|
21 |
|
|
22 |
__asm__ __volatile__ (
|
|
23 |
@@ -128,16 +128,37 @@ NativeCompareAndSwap(jsword *w, jsword o
|
|
24 |
"sete %%al\n"
|
|
25 |
"andl $1, %%eax\n"
|
|
26 |
: "=a" (res)
|
|
27 |
: "r" (w), "r" (nv), "a" (ov)
|
|
28 |
: "cc", "memory");
|
|
29 |
return (int)res;
|
|
30 |
}
|
|
31 |
|
|
32 |
+#elif defined(__i386) && defined(__SUNPRO_CC)
|
|
33 |
+
|
|
34 |
+/* Different code for Sun Studio because of a bug of SS12U1 */
|
|
35 |
+
|
|
36 |
+/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
|
|
37 |
+static JS_ALWAYS_INLINE int
|
|
38 |
+NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|
39 |
+{
|
|
40 |
+ unsigned int res;
|
|
41 |
+
|
|
42 |
+ __asm__ __volatile__ (
|
|
43 |
+ "lock\n"
|
|
44 |
+ "cmpxchgl %2, (%1)\n"
|
|
45 |
+ "sete %%al\n"
|
|
46 |
+ "andl $1, %%eax\n"
|
|
47 |
+ : "=a" (res)
|
|
48 |
+ : "c" (w), "d" (nv), "a" (ov)
|
|
49 |
+ : "cc", "memory");
|
|
50 |
+ return (int)res;
|
|
51 |
+}
|
|
52 |
+
|
|
53 |
#elif defined(__x86_64) && (defined(__GNUC__) || defined(__SUNPRO_CC))
|
|
54 |
|
|
55 |
static JS_ALWAYS_INLINE int
|
|
56 |
NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|
57 |
{
|
|
58 |
unsigned int res;
|
|
59 |
|
|
60 |
__asm__ __volatile__ (
|