mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 678558 - Detect broken vrp and disable it.
Test if the gcc we are using has PR49911 and if so disable value range propagation to avoid. --HG-- extra : rebase_source : d539914fa66a44f69399f2964740315f0723378f
This commit is contained in:
parent
db5146dfb9
commit
540dd95eb4
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -15,6 +15,7 @@ builtin(include, build/autoconf/mozprog.m4)dnl
|
||||
builtin(include, build/autoconf/mozheader.m4)dnl
|
||||
builtin(include, build/autoconf/acwinpaths.m4)dnl
|
||||
builtin(include, build/autoconf/lto.m4)dnl
|
||||
builtin(include, build/autoconf/gcc-pr49911.m4)dnl
|
||||
|
||||
MOZ_PROG_CHECKMSYS()
|
||||
|
||||
|
67
build/autoconf/gcc-pr49911.m4
Normal file
67
build/autoconf/gcc-pr49911.m4
Normal file
@ -0,0 +1,67 @@
|
||||
dnl Check if the compiler is gcc and has PR49911. If so
|
||||
dnl disable vrp.
|
||||
|
||||
AC_DEFUN([MOZ_GCC_PR49911],
|
||||
[
|
||||
if test "$GNU_CC"; then
|
||||
|
||||
AC_MSG_CHECKING(for gcc PR49911)
|
||||
ac_have_gcc_pr49911="no"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
_SAVE_CXXFLAGS=$CXXFLAGS
|
||||
CXXFLAGS="-O2"
|
||||
AC_TRY_RUN([
|
||||
extern "C" void abort(void);
|
||||
typedef enum {
|
||||
eax, ecx, edx, ebx, esp, ebp,
|
||||
esi, edi }
|
||||
RegisterID;
|
||||
union StateRemat {
|
||||
RegisterID reg_;
|
||||
int offset_;
|
||||
};
|
||||
static StateRemat FromRegister(RegisterID reg) {
|
||||
StateRemat sr;
|
||||
sr.reg_ = reg;
|
||||
return sr;
|
||||
}
|
||||
static StateRemat FromAddress3(int address) {
|
||||
StateRemat sr;
|
||||
sr.offset_ = address;
|
||||
if (address < 46 && address >= 0) {
|
||||
abort();
|
||||
}
|
||||
return sr;
|
||||
}
|
||||
struct FrameState {
|
||||
StateRemat dataRematInfo2(bool y, int z) {
|
||||
if (y) return FromRegister(RegisterID(1));
|
||||
return FromAddress3(z);
|
||||
}
|
||||
};
|
||||
FrameState frame;
|
||||
StateRemat x;
|
||||
__attribute__((noinline)) void jsop_setelem(bool y, int z) {
|
||||
x = frame.dataRematInfo2(y, z);
|
||||
}
|
||||
int main(void) {
|
||||
jsop_setelem(0, 47);
|
||||
}
|
||||
], true,
|
||||
ac_have_gcc_pr49911="yes",
|
||||
true)
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
if test "$ac_have_gcc_pr49911" == "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="$CFLAGS -fno-tree-vrp"
|
||||
CXXFLAGS="$CXXFLAGS -fno-tree-vrp"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
])
|
@ -3237,6 +3237,8 @@ fi # Sun Studio on Solaris
|
||||
AC_SUBST(WRAP_SYSTEM_INCLUDES)
|
||||
AC_SUBST(VISIBILITY_FLAGS)
|
||||
|
||||
MOZ_GCC_PR49911
|
||||
|
||||
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
|
||||
dnl ========================================================
|
||||
if test "$GNU_CC"; then
|
||||
|
1
js/src/aclocal.m4
vendored
1
js/src/aclocal.m4
vendored
@ -10,5 +10,6 @@ builtin(include, build/autoconf/moznbytetype.m4)dnl
|
||||
builtin(include, build/autoconf/mozprog.m4)dnl
|
||||
builtin(include, build/autoconf/acwinpaths.m4)dnl
|
||||
builtin(include, build/autoconf/lto.m4)dnl
|
||||
builtin(include, build/autoconf/gcc-pr49911.m4)dnl
|
||||
|
||||
MOZ_PROG_CHECKMSYS()
|
||||
|
67
js/src/build/autoconf/gcc-pr49911.m4
Normal file
67
js/src/build/autoconf/gcc-pr49911.m4
Normal file
@ -0,0 +1,67 @@
|
||||
dnl Check if the compiler is gcc and has PR49911. If so
|
||||
dnl disable vrp.
|
||||
|
||||
AC_DEFUN([MOZ_GCC_PR49911],
|
||||
[
|
||||
if test "$GNU_CC"; then
|
||||
|
||||
AC_MSG_CHECKING(for gcc PR49911)
|
||||
ac_have_gcc_pr49911="no"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
_SAVE_CXXFLAGS=$CXXFLAGS
|
||||
CXXFLAGS="-O2"
|
||||
AC_TRY_RUN([
|
||||
extern "C" void abort(void);
|
||||
typedef enum {
|
||||
eax, ecx, edx, ebx, esp, ebp,
|
||||
esi, edi }
|
||||
RegisterID;
|
||||
union StateRemat {
|
||||
RegisterID reg_;
|
||||
int offset_;
|
||||
};
|
||||
static StateRemat FromRegister(RegisterID reg) {
|
||||
StateRemat sr;
|
||||
sr.reg_ = reg;
|
||||
return sr;
|
||||
}
|
||||
static StateRemat FromAddress3(int address) {
|
||||
StateRemat sr;
|
||||
sr.offset_ = address;
|
||||
if (address < 46 && address >= 0) {
|
||||
abort();
|
||||
}
|
||||
return sr;
|
||||
}
|
||||
struct FrameState {
|
||||
StateRemat dataRematInfo2(bool y, int z) {
|
||||
if (y) return FromRegister(RegisterID(1));
|
||||
return FromAddress3(z);
|
||||
}
|
||||
};
|
||||
FrameState frame;
|
||||
StateRemat x;
|
||||
__attribute__((noinline)) void jsop_setelem(bool y, int z) {
|
||||
x = frame.dataRematInfo2(y, z);
|
||||
}
|
||||
int main(void) {
|
||||
jsop_setelem(0, 47);
|
||||
}
|
||||
], true,
|
||||
ac_have_gcc_pr49911="yes",
|
||||
true)
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
if test "$ac_have_gcc_pr49911" == "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="$CFLAGS -fno-tree-vrp"
|
||||
CXXFLAGS="$CXXFLAGS -fno-tree-vrp"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
])
|
@ -3226,6 +3226,8 @@ fi # Sun Studio on Solaris
|
||||
AC_SUBST(WRAP_SYSTEM_INCLUDES)
|
||||
AC_SUBST(VISIBILITY_FLAGS)
|
||||
|
||||
MOZ_GCC_PR49911
|
||||
|
||||
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
|
||||
dnl ========================================================
|
||||
if test "$GNU_CC"; then
|
||||
|
Loading…
Reference in New Issue
Block a user