Bug 1421791 - move --enable-{ion,simulator} definitions to moz.configure; r=nalexander

--enable-ion was only used by --enable-simulator and related options, so
there wasn't much point in making two separate commits.

This translation is a little more verbose than the original
old-configure code, but I think it is more readable and easier to
follow.  We also don't port over --enable-simulator=no, as there doesn't
seem to be much point in doing so.
This commit is contained in:
Nathan Froyd 2017-12-01 21:29:27 -05:00
parent 1198705b7d
commit d7b5304b9d
3 changed files with 92 additions and 117 deletions

View File

@ -191,7 +191,6 @@ def old_configure_options(*options):
'--enable-hardware-aec-ns',
'--enable-icf',
'--enable-install-strip',
'--enable-ion',
'--enable-ios-target',
'--enable-jitspew',
'--enable-libjpeg-turbo',
@ -217,7 +216,6 @@ def old_configure_options(*options):
'--enable-reflow-perf',
'--enable-sandbox',
'--enable-signmar',
'--enable-simulator',
'--enable-small-chunk-size',
'--enable-startup-notification',
'--enable-startupcache',

View File

@ -102,6 +102,98 @@ def disable_export_js(value):
value.format('DISABLE_EXPORT_JS'), suggestion)
# JIT support
# =======================================================
@depends(target)
def ion_default(target):
if target.cpu in ('x86', 'x86_64', 'arm', 'aarch64', 'mips32', 'mips64'):
return True
js_option('--enable-ion',
default=ion_default,
help='Enable use of the IonMonkey JIT')
set_config('ENABLE_ION', depends_if('--enable-ion')(lambda x: True))
# JIT code simulator for cross compiles
# =======================================================
js_option('--enable-simulator', choices=('arm', 'arm64', 'mips32', 'mips64'),
nargs=1,
help='Enable a JIT code simulator for the specified architecture')
@depends('--enable-ion', '--enable-simulator', target)
def simulator(ion_enabled, simulator_enabled, target):
if not ion_enabled or not simulator_enabled:
return
sim_cpu = simulator_enabled[0]
if sim_cpu in ('arm', 'mips32'):
if target.cpu != 'x86':
die('The %s simulator only works on x86.' % sim_cpu)
if sim_cpu in ('arm64', 'mips64'):
if target.cpu != 'x86_64':
die('The %s simulator only works on x86-64.' % sim_cpu)
return namespace(**{sim_cpu: True})
set_config('JS_SIMULATOR', depends_if(simulator)(lambda x: True))
set_config('JS_SIMULATOR_ARM', simulator.arm)
set_config('JS_SIMULATOR_ARM64', simulator.arm64)
set_config('JS_SIMULATOR_MIPS32', simulator.mips32)
set_config('JS_SIMULATOR_MIPS64', simulator.mips64)
set_define('JS_SIMULATOR', depends_if(simulator)(lambda x: True))
set_define('JS_SIMULATOR_ARM', simulator.arm)
set_define('JS_SIMULATOR_ARM64', simulator.arm64)
set_define('JS_SIMULATOR_MIPS32', simulator.mips32)
set_define('JS_SIMULATOR_MIPS64', simulator.mips64)
@depends('--enable-ion', simulator, target)
def jit_codegen(ion_enabled, simulator, target):
if not ion_enabled:
return namespace(none=True)
if simulator:
return simulator
if target.cpu == 'aarch64':
return namespace(arm64=True)
elif target.cpu == 'x86_64':
return namespace(x64=True)
return namespace(**{str(target.cpu): True})
set_config('JS_CODEGEN_NONE', jit_codegen.none)
set_config('JS_CODEGEN_ARM', jit_codegen.arm)
set_config('JS_CODEGEN_ARM64', jit_codegen.arm64)
set_config('JS_CODEGEN_MIPS32', jit_codegen.mips32)
set_config('JS_CODEGEN_MIPS64', jit_codegen.mips64)
set_config('JS_CODEGEN_X86', jit_codegen.x86)
set_config('JS_CODEGEN_X64', jit_codegen.x64)
set_define('JS_CODEGEN_NONE', jit_codegen.none)
set_define('JS_CODEGEN_ARM', jit_codegen.arm)
set_define('JS_CODEGEN_ARM64', jit_codegen.arm64)
set_define('JS_CODEGEN_MIPS32', jit_codegen.mips32)
set_define('JS_CODEGEN_MIPS64', jit_codegen.mips64)
set_define('JS_CODEGEN_X86', jit_codegen.x86)
set_define('JS_CODEGEN_X64', jit_codegen.x64)
@depends('--enable-ion', simulator, target, moz_debug)
def jit_disasm_arm(ion_enabled, simulator, target, debug):
if not ion_enabled:
return
if simulator:
if getattr(simulator, 'arm', None):
return True
if target.cpu == 'arm' and debug:
return True
set_config('JS_DISASM_ARM', jit_disasm_arm)
set_define('JS_DISASM_ARM', jit_disasm_arm)
# Profiling
# =======================================================
js_option('--enable-instruments', env='MOZ_INSTRUMENTS',

View File

@ -892,20 +892,6 @@ if test -z "$COMPILE_ENVIRONMENT"; then
SKIP_LIBRARY_CHECKS=1
fi
dnl Configure JIT support
case "$CPU_ARCH" in
x86|x86_64|arm|aarch64|mips*)
ENABLE_ION=1
;;
esac
MOZ_ARG_DISABLE_BOOL(ion,
[ --disable-ion Disable use of the IonMonkey JIT],
ENABLE_ION= )
AC_SUBST(ENABLE_ION)
if test -n "$COMPILE_ENVIRONMENT"; then
MOZ_COMPILER_OPTS
fi
@ -1571,107 +1557,6 @@ if test -n "$MOZ_VALGRIND"; then
fi
AC_SUBST(MOZ_VALGRIND)
dnl ========================================================
dnl = Use a JIT code simulator for a foreign architecture.
dnl ========================================================
MOZ_ARG_ENABLE_STRING(simulator,
[ --enable-simulator=ARCH
Enable a JIT code simulator for the specified arch.
(arm, arm64, mips32, mips64).],
JS_SIMULATOR="$enableval")
if test -n "$JS_SIMULATOR"; then
case "$JS_SIMULATOR" in
arm|arm64|mips32|mips64) ;;
no)
JS_SIMULATOR=
;;
*) AC_MSG_ERROR([Invalid simulator. Valid simulators are: arm, arm64, mips32, mips64.]) ;;
esac
fi
if test -z "$ENABLE_ION"; then
AC_DEFINE(JS_CODEGEN_NONE)
JS_CODEGEN_NONE=1
elif test "$JS_SIMULATOR" = arm; then
if test "$CPU_ARCH" != "x86"; then
AC_MSG_ERROR([The ARM simulator only works on x86.])
fi
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_ARM)
AC_DEFINE(JS_DISASM_ARM)
AC_DEFINE(JS_CODEGEN_ARM)
JS_SIMULATOR_ARM=1
JS_DISASM_ARM=1
JS_CODEGEN_ARM=1
elif test "$JS_SIMULATOR" = arm64; then
if test "$CPU_ARCH" != "x86_64"; then
AC_MSG_ERROR([The ARM64 simulator only works on x86_64.])
fi
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_ARM64)
AC_DEFINE(JS_CODEGEN_ARM64)
JS_SIMULATOR_ARM64=1
JS_CODEGEN_ARM64=1
elif test "$JS_SIMULATOR" = mips32; then
if test "$CPU_ARCH" != "x86"; then
AC_MSG_ERROR([The MIPS32 simulator only works on x86.])
fi
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_MIPS32)
AC_DEFINE(JS_CODEGEN_MIPS32)
JS_SIMULATOR_MIPS32=1
JS_CODEGEN_MIPS32=1
elif test "$JS_SIMULATOR" = mips64; then
if test "$CPU_ARCH" != "x86_64"; then
AC_MSG_ERROR([The MIPS64 simulator only works on x86_64.])
fi
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_MIPS64)
AC_DEFINE(JS_CODEGEN_MIPS64)
JS_SIMULATOR_MIPS64=1
JS_CODEGEN_MIPS64=1
elif test "$CPU_ARCH" = "x86"; then
AC_DEFINE(JS_CODEGEN_X86)
JS_CODEGEN_X86=1
elif test "$CPU_ARCH" = "x86_64"; then
AC_DEFINE(JS_CODEGEN_X64)
JS_CODEGEN_X64=1
elif test "$CPU_ARCH" = "arm"; then
AC_DEFINE(JS_CODEGEN_ARM)
JS_CODEGEN_ARM=1
if test -n "$MOZ_DEBUG"; then
AC_DEFINE(JS_DISASM_ARM)
JS_DISASM_ARM=1
fi
dnl ARM platforms may trap on unaligned accesses; catch the signal and
dnl recover.
elif test "$CPU_ARCH" = "aarch64"; then
AC_DEFINE(JS_CODEGEN_ARM64)
JS_CODEGEN_ARM64=1
elif test "$CPU_ARCH" = "mips32"; then
AC_DEFINE(JS_CODEGEN_MIPS32)
JS_CODEGEN_MIPS32=1
elif test "$CPU_ARCH" = "mips64"; then
AC_DEFINE(JS_CODEGEN_MIPS64)
JS_CODEGEN_MIPS64=1
fi
AC_SUBST(JS_SIMULATOR)
AC_SUBST(JS_SIMULATOR_ARM)
AC_SUBST(JS_SIMULATOR_ARM64)
AC_SUBST(JS_SIMULATOR_MIPS32)
AC_SUBST(JS_SIMULATOR_MIPS64)
AC_SUBST(JS_CODEGEN_ARM)
AC_SUBST(JS_CODEGEN_ARM64)
AC_SUBST(JS_CODEGEN_MIPS32)
AC_SUBST(JS_CODEGEN_MIPS64)
AC_SUBST(JS_CODEGEN_X86)
AC_SUBST(JS_CODEGEN_X64)
AC_SUBST(JS_CODEGEN_NONE)
AC_SUBST(JS_DISASM_ARM)
dnl ========================================================
dnl instruments
dnl ========================================================