$NetBSD: patch-bb,v 1.1 2010/05/11 11:42:45 yhardy Exp $

# make sure the inline assembler code works on the same word size as
# the C/C++ code on sparc64 when compiling for 64bit
# https://bugzilla.mozilla.org/show_bug.cgi?id=550271

--- js/src/jslock.cpp.orig	2010-02-27 02:32:31.000000000 +0000
+++ js/src/jslock.cpp
@@ -159,6 +159,7 @@ NativeCompareAndSwap(jsword *w, jsword o
 {
     unsigned int res;
 
+#if JS_BITS_PER_WORD == 32
     __asm__ __volatile__ (
                   "stbar\n"
                   "cas [%1],%2,%3\n"
@@ -169,6 +170,18 @@ NativeCompareAndSwap(jsword *w, jsword o
                   "1:"
                   : "=r" (res)
                   : "r" (w), "r" (ov), "r" (nv));
+#else
+    __asm__ __volatile__ (
+                  "stbar\n"
+                  "casx [%1],%2,%3\n"
+                  "cmp %2,%3\n"
+                  "be,a 1f\n"
+                  "mov 1,%0\n"
+                  "mov 0,%0\n"
+                  "1:"
+                  : "=r" (res)
+                  : "r" (w), "r" (ov), "r" (nv));
+#endif
     return (int)res;
 }
 
