Bug 1421791 - move --enable-{ion,simulator} definitions to moz.configure; r=nalexander
authorNathan Froyd <froydnj@mozilla.com>
Fri, 01 Dec 2017 21:29:27 -0500
changeset 394589 08fb3c18e98dabddbc9d982e5ee47ee128f71a3c
parent 394588 1536601cf41631517d888231300672c6988fe5ba
child 394590 f9231cda92d8fee90ffee34513b433a07b7b8d18
push id33011
push usernerli@mozilla.com
push dateSat, 02 Dec 2017 21:41:32 +0000
treeherdermozilla-central@de1f7a92e872 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1421791
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
build/moz.configure/old.configure
js/moz.configure
js/src/old-configure.in
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -186,17 +186,16 @@ def old_configure_options(*options):
     '--enable-faststripe',
     '--enable-feeds',
     '--enable-gamepad',
     '--enable-gconf',
     '--enable-gczeal',
     '--enable-hardware-aec-ns',
     '--enable-icf',
     '--enable-install-strip',
-    '--enable-ion',
     '--enable-ios-target',
     '--enable-jitspew',
     '--enable-libjpeg-turbo',
     '--enable-libproxy',
     '--enable-llvm-hacks',
     '--enable-logrefcnt',
     '--enable-maintenance-service',
     '--enable-memory-sanitizer',
@@ -212,17 +211,16 @@ def old_configure_options(*options):
     '--enable-posix-nspr-emulation',
     '--enable-pref-extensions',
     '--enable-pulseaudio',
     '--enable-raw',
     '--enable-readline',
     '--enable-reflow-perf',
     '--enable-sandbox',
     '--enable-signmar',
-    '--enable-simulator',
     '--enable-small-chunk-size',
     '--enable-startup-notification',
     '--enable-startupcache',
     '--enable-stdcxx-compat',
     '--enable-strip',
     '--enable-synth-pico',
     '--enable-system-cairo',
     '--enable-system-extension-dirs',
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -97,16 +97,108 @@ def disable_export_js(value):
         suggestion = '--disable-export-js'
     else:
         suggestion = '--enable-export-js'
 
     die('Setting %s is deprecated, use %s instead.',
         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',
           help='Enable instruments remote profiling')
 
 @depends('--enable-instruments', target)
 def instruments(value, target):
     if value and target.os != 'OSX':
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -887,30 +887,16 @@ dnl Only one oddball right now (QNX), bu
 dnl if any other platforms need to override this in the future.
 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
 
 if test -z "$COMPILE_ENVIRONMENT"; then
     SKIP_COMPILER_CHECKS=1
     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
 
 if test -z "$SKIP_COMPILER_CHECKS"; then
 dnl Checks for typedefs, structures, and compiler characteristics.
 dnl ========================================================
 AC_C_CONST
@@ -1567,117 +1553,16 @@ if test -n "$MOZ_VALGRIND"; then
         AC_MSG_ERROR(
             [--enable-valgrind specified but Valgrind is not installed]))
     AC_DEFINE(MOZ_VALGRIND)
     MOZ_VALGRIND=1
 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 ========================================================
 if test -n "$MOZ_INSTRUMENTS"; then
     LIBS="$LIBS -framework CoreFoundation"
 fi
 
 dnl ========================================================
 dnl JitSpew.  Enabled by default in debug builds.