зеркало из https://github.com/mozilla/gecko-dev.git
Bug 502696 js_CompareAndSwap on sparc should not use PRLock() r=jorendorff sr=benjamin
This commit is contained in:
Родитель
a699dd7fda
Коммит
1d78b17e21
15
configure.in
15
configure.in
|
@ -6291,21 +6291,6 @@ MOZ_ARG_DISABLE_BOOL(zipwriter,
|
|||
MOZ_ZIPWRITER=1 )
|
||||
AC_SUBST(MOZ_ZIPWRITER)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable Ultrasparc specific optimizations for JS
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
|
||||
[ --enable-js-ultrasparc Use UltraSPARC optimizations in JS],
|
||||
JS_ULTRASPARC_OPTS=1,
|
||||
JS_ULTRASPARC_OPTS= )
|
||||
|
||||
dnl only enable option for ultrasparcs
|
||||
if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
|
||||
"$OS_TEST" != "sun4u"; then
|
||||
JS_ULTRASPARC_OPTS=
|
||||
fi
|
||||
AC_SUBST(JS_ULTRASPARC_OPTS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Hildon and OSSO checks
|
||||
dnl ========================================================
|
||||
|
|
|
@ -275,15 +275,6 @@ EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
|
|||
endif
|
||||
endif
|
||||
|
||||
# When using gcc the assembly is inlined in the C-file (see jslock.cpp)
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
ifneq (86,$(findstring 86,$(OS_TEST)))
|
||||
ifndef GNU_CC
|
||||
ASFILES = lock_$(OS_ARCH).s
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef BUILD_OPT
|
||||
MOCHAFILE = 1
|
||||
endif
|
||||
|
@ -437,15 +428,12 @@ endif
|
|||
ifeq ($(OS_ARCH),SunOS)
|
||||
ifeq ($(TARGET_CPU),sparc)
|
||||
|
||||
ifdef JS_ULTRASPARC_OPTS
|
||||
DEFINES += -DULTRA_SPARC
|
||||
ifdef GNU_CC
|
||||
CFLAGS += -Wa,-xarch=v8plus,-DULTRA_SPARC,-P,-L,-D_ASM,-D__STDC__=0
|
||||
CXXFLAGS += -Wa,-xarch=v8plus,-DULTRA_SPARC,-P,-L,-D_ASM,-D__STDC__=0,-K,PIC
|
||||
CFLAGS += -mcpu=v9
|
||||
CXXFLAGS += -mcpu=v9
|
||||
else
|
||||
ASFLAGS += -xarch=v8plus -DULTRA_SPARC -P -L -D_ASM -D__STDC__=0 -K PIC
|
||||
ASFLAGS += -xarch=v8plus -P -L -D_ASM -D__STDC__=0 -K PIC
|
||||
endif # GNU_CC
|
||||
endif # JS_ULTRASPARC_OPTS
|
||||
|
||||
endif
|
||||
ifeq ($(OS_RELEASE),4.1)
|
||||
|
|
|
@ -3905,21 +3905,6 @@ dnl =
|
|||
dnl ========================================================
|
||||
MOZ_ARG_HEADER(Individual module options)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable Ultrasparc specific optimizations for JS
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
|
||||
[ --enable-js-ultrasparc Use UltraSPARC optimizations in JS],
|
||||
JS_ULTRASPARC_OPTS=1,
|
||||
JS_ULTRASPARC_OPTS= )
|
||||
|
||||
dnl only enable option for ultrasparcs
|
||||
if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
|
||||
"$OS_TEST" != "sun4u"; then
|
||||
JS_ULTRASPARC_OPTS=
|
||||
fi
|
||||
AC_SUBST(JS_ULTRASPARC_OPTS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Debugging Options
|
||||
|
|
|
@ -59,6 +59,11 @@
|
|||
|
||||
#define ReadWord(W) (W)
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
# define __asm__ asm
|
||||
# define __volatile__ volatile
|
||||
#endif
|
||||
|
||||
/* Implement NativeCompareAndSwap. */
|
||||
|
||||
#if defined(_WIN32) && defined(_M_IX86)
|
||||
|
@ -97,7 +102,7 @@ NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|||
return OSAtomicCompareAndSwapPtrBarrier(ov, nv, w);
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__) && defined(__i386__)
|
||||
#elif defined(__i386) && (defined(__GNUC__) || defined(__SUNPRO_CC))
|
||||
|
||||
/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
|
||||
static JS_ALWAYS_INLINE int
|
||||
|
@ -116,7 +121,8 @@ NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|||
return (int)res;
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
#elif defined(__x86_64) && (defined(__GNUC__) || defined(__SUNPRO_CC))
|
||||
|
||||
static JS_ALWAYS_INLINE int
|
||||
NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
|
@ -133,30 +139,24 @@ NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|||
return (int)res;
|
||||
}
|
||||
|
||||
#elif defined(SOLARIS) && defined(sparc) && defined(ULTRA_SPARC)
|
||||
#elif defined(__sparc) && (defined(__GNUC__) || defined(__SUNPRO_CC))
|
||||
|
||||
static JS_ALWAYS_INLINE int
|
||||
NativeCompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
unsigned int res;
|
||||
JS_ASSERT(ov != nv);
|
||||
asm volatile ("\
|
||||
stbar\n\
|
||||
cas [%1],%2,%3\n\
|
||||
cmp %2,%3\n\
|
||||
be,a 1f\n\
|
||||
mov 1,%0\n\
|
||||
mov 0,%0\n\
|
||||
1:"
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"stbar\n"
|
||||
"cas [%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));
|
||||
return (int)res;
|
||||
#else /* !__GNUC__ */
|
||||
extern int compare_and_swap(jsword*, jsword, jsword);
|
||||
JS_ASSERT(ov != nv);
|
||||
return compare_and_swap(w, ov, nv);
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(AIX)
|
||||
|
@ -210,7 +210,7 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
|||
#elif defined(NSPR_LOCK)
|
||||
|
||||
# ifdef __GNUC__
|
||||
# warning "js_CompareAndSwap is implemented using NSSP lock"
|
||||
# warning "js_CompareAndSwap is implemented using NSPR lock"
|
||||
# endif
|
||||
|
||||
JSBool
|
||||
|
|
|
@ -55,9 +55,9 @@ JS_BEGIN_EXTERN_C
|
|||
#ifdef JS_THREADSAFE
|
||||
|
||||
#if (defined(_WIN32) && defined(_M_IX86)) || \
|
||||
(defined(__GNUC__) && defined(__i386__)) || \
|
||||
(defined(__GNUC__) && defined(__x86_64__)) || \
|
||||
(defined(SOLARIS) && defined(sparc) && defined(ULTRA_SPARC)) || \
|
||||
(defined(__i386) && (defined(__GNUC__) || defined(__SUNPRO_CC))) || \
|
||||
(defined(__x86_64) && (defined(__GNUC__) || defined(__SUNPRO_CC))) || \
|
||||
(defined(__sparc) && (defined(__GNUC__) || defined(__SUNPRO_CC))) || \
|
||||
defined(AIX) || \
|
||||
defined(USE_ARM_KUSER)
|
||||
# define JS_HAS_NATIVE_COMPARE_AND_SWAP 1
|
||||
|
|
Загрузка…
Ссылка в новой задаче