2016-07-14 16:16:42 +00:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2016-03-08 04:49:35 +00:00
|
|
|
# vim: set filetype=python:
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2016-03-09 06:27:42 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends(build_project)
|
2020-10-07 17:48:06 +00:00
|
|
|
def js_standalone(build_project):
|
|
|
|
if build_project == "js":
|
|
|
|
return True
|
2016-03-18 10:03:09 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2022-12-12 21:43:51 +00:00
|
|
|
# Debug (see Bug 939505)
|
|
|
|
# ==============================================================
|
|
|
|
set_define("JS_DEBUG", True, when=moz_debug)
|
|
|
|
|
|
|
|
|
2020-08-11 15:58:52 +00:00
|
|
|
# Branding
|
|
|
|
# ==============================================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--with-app-name",
|
|
|
|
env="MOZ_APP_NAME",
|
|
|
|
nargs=1,
|
|
|
|
help="Used for e.g. the binary program file name. If not set, "
|
|
|
|
"defaults to a lowercase form of MOZ_APP_BASENAME.",
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-08-11 15:58:52 +00:00
|
|
|
|
2020-10-07 17:48:06 +00:00
|
|
|
@depends("--with-app-name", js_standalone, moz_app_basename)
|
2020-08-11 15:58:52 +00:00
|
|
|
def moz_app_name(value, js_standalone, moz_app_basename):
|
|
|
|
if value:
|
|
|
|
return value[0]
|
|
|
|
if js_standalone:
|
|
|
|
return "js"
|
|
|
|
return moz_app_basename.lower()
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-08-11 15:58:52 +00:00
|
|
|
set_config("MOZ_APP_NAME", moz_app_name)
|
|
|
|
|
2020-02-28 14:17:33 +00:00
|
|
|
# SmooshMonkey (new frontend)
|
|
|
|
# ==================================================
|
|
|
|
|
|
|
|
# Define here in order to use the option from bindgen.configure.
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-smoosh",
|
|
|
|
default=False,
|
|
|
|
help="Enable SmooshMonkey (new JS engine frontend)",
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-02-28 14:17:33 +00:00
|
|
|
|
|
|
|
@depends("--enable-smoosh")
|
|
|
|
def enable_smoosh(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("JS_ENABLE_SMOOSH", enable_smoosh)
|
|
|
|
set_define("JS_ENABLE_SMOOSH", enable_smoosh)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-29 17:11:27 +00:00
|
|
|
include("../build/moz.configure/nspr.configure", when="--enable-compile-environment")
|
2018-08-02 16:00:21 +00:00
|
|
|
include("../build/moz.configure/rust.configure", when="--enable-compile-environment")
|
2019-02-15 15:23:08 +00:00
|
|
|
include("../build/moz.configure/bindgen.configure", when="--enable-compile-environment")
|
2018-08-02 16:00:21 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config("JS_STANDALONE", js_standalone)
|
2017-08-31 22:59:13 +00:00
|
|
|
set_define("JS_STANDALONE", js_standalone)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment("JS_STANDALONE", js_standalone)
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-js-shell", default=js_standalone, help="{Build|Do not build} the JS shell"
|
|
|
|
)
|
2016-03-09 06:27:42 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-10-07 17:48:06 +00:00
|
|
|
@depends("--enable-js-shell")
|
2016-03-22 05:21:32 +00:00
|
|
|
def js_disable_shell(value):
|
2016-03-09 06:27:42 +00:00
|
|
|
if not value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config("JS_DISABLE_SHELL", js_disable_shell)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2018-02-22 08:40:00 +00:00
|
|
|
set_define("JS_64BIT", depends(target)(lambda t: t.bitness == 64 or None))
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2017-12-02 02:29:28 +00:00
|
|
|
set_define("JS_PUNBOX64", depends(target)(lambda t: t.bitness == 64 or None))
|
|
|
|
set_define("JS_NUNBOX32", depends(target)(lambda t: t.bitness == 32 or None))
|
|
|
|
|
|
|
|
|
2016-03-09 08:41:40 +00:00
|
|
|
# SpiderMonkey as a shared library, and how its symbols are exported
|
|
|
|
# ==================================================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--disable-shared-js",
|
|
|
|
when=js_standalone,
|
|
|
|
help="{Create|Do not create} a shared library",
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
option(
|
2019-05-28 18:45:03 +00:00
|
|
|
"--disable-export-js",
|
2020-10-08 04:07:46 +00:00
|
|
|
when=js_standalone,
|
|
|
|
help="{Mark|Do not mark} JS symbols as DLL exported/visible",
|
|
|
|
)
|
2016-03-09 08:41:40 +00:00
|
|
|
|
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends("--disable-shared-js", "--disable-export-js", when=js_standalone)
|
2016-03-23 01:22:08 +00:00
|
|
|
def shared_js(shared_js, export_js):
|
2016-03-09 08:41:40 +00:00
|
|
|
if shared_js:
|
|
|
|
if not export_js:
|
2016-03-25 06:48:21 +00:00
|
|
|
die("Must export JS symbols when building a shared library.")
|
2016-03-23 01:22:08 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("JS_SHARED_LIBRARY", shared_js)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends(shared_js, "--disable-export-js", when=js_standalone)
|
2016-03-23 01:22:08 +00:00
|
|
|
def exportable_js_api(shared_js, export_js):
|
|
|
|
if not shared_js and export_js:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("STATIC_EXPORTABLE_JS_API", exportable_js_api)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends(shared_js, exportable_js_api)
|
2016-03-23 01:22:08 +00:00
|
|
|
def static_js_api(shared_js, export_js):
|
|
|
|
if not shared_js and not export_js:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("STATIC_JS_API", static_js_api)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2019-05-28 18:45:03 +00:00
|
|
|
@depends(shared_js)
|
2016-03-23 01:22:08 +00:00
|
|
|
def static_js(value):
|
|
|
|
if not value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
2016-03-09 08:41:40 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("MOZ_STATIC_JS", static_js)
|
2016-03-17 07:12:44 +00:00
|
|
|
|
2019-11-15 13:14:42 +00:00
|
|
|
|
2021-12-20 15:17:16 +00:00
|
|
|
# Enable records and tuples
|
|
|
|
# ===================================================
|
|
|
|
option(
|
|
|
|
"--enable-record-tuple",
|
|
|
|
default=False,
|
|
|
|
help="Enable records and tuples (and disables JIT)",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-record-tuple")
|
|
|
|
def enable_record_tuple(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_RECORD_TUPLE", enable_record_tuple)
|
|
|
|
set_define("ENABLE_RECORD_TUPLE", enable_record_tuple)
|
|
|
|
|
2022-07-13 18:40:18 +00:00
|
|
|
# Enable decorators
|
|
|
|
# ===================================================
|
|
|
|
option(
|
|
|
|
"--enable-decorators",
|
|
|
|
default=False,
|
|
|
|
help="Enable experimental JS Decorators support",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-decorators")
|
|
|
|
def enable_decorators(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_DECORATORS", enable_decorators)
|
|
|
|
set_define("ENABLE_DECORATORS", enable_decorators)
|
|
|
|
|
2024-05-19 08:01:59 +00:00
|
|
|
# Enable explicit resource management
|
|
|
|
# ===================================================
|
|
|
|
option(
|
|
|
|
"--enable-explicit-resource-management",
|
|
|
|
default=False,
|
|
|
|
help="Enable explicit resource management",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-explicit-resource-management")
|
|
|
|
def enable_explicit_resource_management(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_EXPLICIT_RESOURCE_MANAGEMENT", enable_explicit_resource_management)
|
|
|
|
set_define("ENABLE_EXPLICIT_RESOURCE_MANAGEMENT", enable_explicit_resource_management)
|
|
|
|
|
2024-03-20 21:17:23 +00:00
|
|
|
|
2024-02-05 23:40:26 +00:00
|
|
|
# Enable JSON.parse with source
|
|
|
|
# ===================================================
|
2024-03-20 21:17:23 +00:00
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def enable_json_parse_with_source(is_nightly):
|
|
|
|
if is_nightly:
|
2024-02-05 23:40:26 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_JSON_PARSE_WITH_SOURCE", enable_json_parse_with_source)
|
|
|
|
set_define("ENABLE_JSON_PARSE_WITH_SOURCE", enable_json_parse_with_source)
|
|
|
|
|
2023-09-06 16:14:30 +00:00
|
|
|
|
2023-10-12 23:16:47 +00:00
|
|
|
# Portable Baseline Intepreter
|
|
|
|
# =======================================================
|
|
|
|
option(
|
|
|
|
"--enable-portable-baseline-interp",
|
|
|
|
default=False,
|
|
|
|
help="{Enable|Disable} the portable baseline interpreter.",
|
|
|
|
)
|
|
|
|
set_define(
|
|
|
|
"ENABLE_PORTABLE_BASELINE_INTERP",
|
|
|
|
depends_if("--enable-portable-baseline-interp")(lambda _: True),
|
|
|
|
)
|
|
|
|
set_config(
|
|
|
|
"ENABLE_PORTABLE_BASELINE_INTERP",
|
|
|
|
depends_if("--enable-portable-baseline-interp")(lambda _: True),
|
|
|
|
)
|
|
|
|
|
|
|
|
# Option to always force PBL tier.
|
|
|
|
option(
|
|
|
|
"--enable-portable-baseline-interp-force",
|
|
|
|
default=False,
|
|
|
|
help="{Enable|Disable} forcing use of the portable baseline interpreter.",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_define(
|
|
|
|
"ENABLE_PORTABLE_BASELINE_INTERP_FORCE",
|
|
|
|
depends_if("--enable-portable-baseline-interp-force")(lambda _: True),
|
|
|
|
)
|
|
|
|
set_config(
|
|
|
|
"ENABLE_PORTABLE_BASELINE_INTERP_FORCE",
|
|
|
|
depends_if("--enable-portable-baseline-interp-force")(lambda _: True),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
# JIT support
|
|
|
|
# =======================================================
|
2023-10-12 23:16:47 +00:00
|
|
|
@depends(target, "--enable-record-tuple", "--enable-portable-baseline-interp")
|
|
|
|
def jit_default(target, enable_record_tuple, enable_portable_baseline_interp):
|
2021-12-20 15:17:16 +00:00
|
|
|
if enable_record_tuple:
|
|
|
|
return False
|
2023-10-12 23:16:47 +00:00
|
|
|
if enable_portable_baseline_interp:
|
|
|
|
return False
|
2022-02-25 14:55:26 +00:00
|
|
|
if target.cpu in (
|
|
|
|
"x86",
|
|
|
|
"x86_64",
|
|
|
|
"arm",
|
|
|
|
"aarch64",
|
|
|
|
"mips32",
|
|
|
|
"mips64",
|
|
|
|
"loongarch64",
|
|
|
|
):
|
2017-12-02 02:29:27 +00:00
|
|
|
return True
|
Bug 1366287 - Part 1.0: Define a new BigInt primitive type, with a GDB prettyprinter, Rust binding support, and a new out-of-line TraceKind. (Disabled by default, implemented only incompletely, currently passing --enable-bigint will disable JITs, will be flipped on Eventually once every sub-aspect is in place, Don't Have A Cow, Man.) r=jwalden, r=Ms2ger, r=sfink
--HG--
extra : rebase_source : aa13bd94bc6157ff8134894e3ba2e7a2b53e28d9
2018-05-24 18:26:09 +00:00
|
|
|
return False
|
2017-12-02 02:29:27 +00:00
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--enable-jit", default=jit_default, help="{Enable|Disable} use of the JITs")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@deprecated_option("--enable-ion")
|
|
|
|
def report_deprecated(value):
|
|
|
|
if value:
|
|
|
|
die("--enable-ion is deprecated, use --enable-jit instead")
|
|
|
|
else:
|
|
|
|
die("--disable-ion is deprecated, use --disable-jit instead")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
|
|
|
|
# JIT code simulator for cross compiles
|
|
|
|
# =======================================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-simulator",
|
2023-01-23 11:51:34 +00:00
|
|
|
choices=("arm", "arm64", "mips32", "mips64", "loong64", "riscv64"),
|
2020-10-08 04:07:46 +00:00
|
|
|
nargs=1,
|
|
|
|
help="Enable a JIT code simulator for the specified architecture",
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
|
2021-02-18 22:44:40 +00:00
|
|
|
@depends("--enable-jit", "--enable-simulator", target)
|
|
|
|
def simulator(jit_enabled, simulator_enabled, target):
|
2020-04-07 14:52:33 +00:00
|
|
|
if not jit_enabled or not simulator_enabled:
|
2017-12-02 02:29:27 +00:00
|
|
|
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)
|
|
|
|
|
2023-01-23 11:51:34 +00:00
|
|
|
if sim_cpu in ("arm64", "mips64", "loong64", "riscv64"):
|
2022-05-27 06:40:33 +00:00
|
|
|
if target.cpu != "x86_64" and target.cpu != "aarch64":
|
|
|
|
die("The %s simulator only works on x86-64 or arm64." % sim_cpu)
|
2017-12-02 02:29:27 +00:00
|
|
|
|
2021-02-18 23:25:47 +00:00
|
|
|
return namespace(**{sim_cpu: True})
|
2017-12-02 02:29:27 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
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)
|
2022-02-25 14:55:26 +00:00
|
|
|
set_config("JS_SIMULATOR_LOONG64", simulator.loong64)
|
2023-01-23 11:51:34 +00:00
|
|
|
set_config("JS_SIMULATOR_RISCV64", simulator.riscv64)
|
2017-12-02 02:29:27 +00:00
|
|
|
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)
|
2022-02-25 14:55:26 +00:00
|
|
|
set_define("JS_SIMULATOR_LOONG64", simulator.loong64)
|
2023-01-23 11:51:34 +00:00
|
|
|
set_define("JS_SIMULATOR_RISCV64", simulator.riscv64)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends("--enable-jit", simulator, target)
|
|
|
|
def jit_codegen(jit_enabled, simulator, target):
|
|
|
|
if not jit_enabled:
|
2017-12-02 02:29:27 +00:00
|
|
|
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)
|
2022-10-10 13:22:35 +00:00
|
|
|
elif target.cpu == "loongarch64":
|
|
|
|
return namespace(loong64=True)
|
2023-04-13 08:30:05 +00:00
|
|
|
elif target.cpu == "riscv64":
|
|
|
|
return namespace(riscv64=True)
|
2017-12-02 02:29:27 +00:00
|
|
|
|
|
|
|
return namespace(**{str(target.cpu): True})
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
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)
|
2022-02-25 14:55:26 +00:00
|
|
|
set_config("JS_CODEGEN_LOONG64", jit_codegen.loong64)
|
2023-01-23 11:51:34 +00:00
|
|
|
set_config("JS_CODEGEN_RISCV64", jit_codegen.riscv64)
|
2017-12-02 02:29:27 +00:00
|
|
|
set_config("JS_CODEGEN_X86", jit_codegen.x86)
|
|
|
|
set_config("JS_CODEGEN_X64", jit_codegen.x64)
|
2022-07-01 04:23:16 +00:00
|
|
|
set_config("JS_CODEGEN_WASM32", jit_codegen.wasm32)
|
2023-01-23 11:51:34 +00:00
|
|
|
|
2017-12-02 02:29:27 +00:00
|
|
|
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)
|
2022-02-25 14:55:26 +00:00
|
|
|
set_define("JS_CODEGEN_LOONG64", jit_codegen.loong64)
|
2023-01-23 11:51:34 +00:00
|
|
|
set_define("JS_CODEGEN_RISCV64", jit_codegen.riscv64)
|
2017-12-02 02:29:27 +00:00
|
|
|
set_define("JS_CODEGEN_X86", jit_codegen.x86)
|
|
|
|
set_define("JS_CODEGEN_X64", jit_codegen.x64)
|
2022-07-01 04:23:16 +00:00
|
|
|
set_define("JS_CODEGEN_WASM32", jit_codegen.wasm32)
|
2017-12-02 02:29:27 +00:00
|
|
|
|
2023-01-23 11:51:34 +00:00
|
|
|
|
2016-03-17 07:12:44 +00:00
|
|
|
# Profiling
|
|
|
|
# =======================================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-instruments",
|
|
|
|
env="MOZ_INSTRUMENTS",
|
|
|
|
help="Enable instruments remote profiling",
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-17 07:12:44 +00:00
|
|
|
|
|
|
|
@depends("--enable-instruments", target)
|
|
|
|
def instruments(value, target):
|
|
|
|
if value and target.os != "OSX":
|
2016-03-25 06:48:21 +00:00
|
|
|
die("--enable-instruments cannot be used when targeting %s", target.os)
|
2016-03-17 07:12:44 +00:00
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
2016-03-17 07:17:36 +00:00
|
|
|
|
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config("MOZ_INSTRUMENTS", instruments)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("MOZ_INSTRUMENTS", instruments)
|
2016-03-23 07:34:59 +00:00
|
|
|
add_old_configure_assignment("MOZ_INSTRUMENTS", instruments)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option("--enable-profiling", instruments, reason="--enable-instruments")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--enable-callgrind", env="MOZ_CALLGRIND", help="Enable callgrind profiling")
|
2016-03-17 07:17:36 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-17 07:17:36 +00:00
|
|
|
@depends("--enable-callgrind")
|
|
|
|
def callgrind(value):
|
|
|
|
if value:
|
2016-03-23 01:22:08 +00:00
|
|
|
return True
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("MOZ_CALLGRIND", callgrind)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option("--enable-profiling", callgrind)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends(milestone)
|
|
|
|
def enable_profiling(milestone):
|
2016-11-29 21:47:38 +00:00
|
|
|
return milestone.is_nightly
|
|
|
|
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
option(
|
2016-03-23 05:18:57 +00:00
|
|
|
"--enable-profiling",
|
2020-10-08 04:07:46 +00:00
|
|
|
env="MOZ_PROFILING",
|
|
|
|
default=enable_profiling,
|
|
|
|
help="{Set|Do not set} compile flags necessary for using sampling "
|
|
|
|
"profilers (e.g. shark, perf)",
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-03-23 05:18:57 +00:00
|
|
|
@depends("--enable-profiling")
|
|
|
|
def profiling(value):
|
2016-03-17 07:24:30 +00:00
|
|
|
if value:
|
2016-03-23 05:18:57 +00:00
|
|
|
return True
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-23 07:34:59 +00:00
|
|
|
|
2019-06-12 22:30:46 +00:00
|
|
|
with only_when("--enable-compile-environment"):
|
|
|
|
imply_option("--enable-frame-pointers", True, when=profiling)
|
|
|
|
|
|
|
|
|
2016-03-23 05:18:57 +00:00
|
|
|
@depends(profiling, target)
|
|
|
|
def imply_vtune(value, target):
|
2017-01-17 22:35:42 +00:00
|
|
|
ok_cpu = target.cpu in ["x86", "x86_64"]
|
|
|
|
ok_kernel = target.kernel == "WINNT" or (
|
|
|
|
target.kernel == "Linux" and target.os == "GNU"
|
|
|
|
)
|
|
|
|
|
|
|
|
if value and ok_cpu and ok_kernel:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
2016-03-17 07:24:30 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config("MOZ_PROFILING", profiling)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("MOZ_PROFILING", profiling)
|
2016-03-23 05:18:57 +00:00
|
|
|
imply_option("--enable-vtune", imply_vtune, reason="--enable-profiling")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--enable-vtune", env="MOZ_VTUNE", help="Enable VTune profiling")
|
2016-03-17 07:24:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-vtune")
|
|
|
|
def vtune(value):
|
|
|
|
if value:
|
2016-03-22 05:21:32 +00:00
|
|
|
return True
|
|
|
|
|
2016-08-10 11:06:40 +00:00
|
|
|
|
2016-03-22 05:21:32 +00:00
|
|
|
set_config("MOZ_VTUNE", vtune)
|
2016-03-23 01:22:08 +00:00
|
|
|
set_define("MOZ_VTUNE", vtune)
|
2016-08-10 11:06:40 +00:00
|
|
|
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
option(
|
2020-10-08 04:07:46 +00:00
|
|
|
"--enable-gc-probes",
|
|
|
|
env="JS_GC_PROBES",
|
|
|
|
help="Turn on probes for allocation and finalization",
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-05-05 16:35:14 +00:00
|
|
|
@depends("--enable-gc-probes")
|
|
|
|
def gc_probes(value):
|
2016-08-10 11:06:40 +00:00
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-05 16:35:14 +00:00
|
|
|
set_define("JS_GC_PROBES", gc_probes)
|
2016-08-10 11:06:49 +00:00
|
|
|
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-gczeal",
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
|
|
|
help="{Enable|Disable} zealous GCing",
|
|
|
|
)
|
2017-12-03 18:40:03 +00:00
|
|
|
|
|
|
|
set_define("JS_GC_ZEAL", depends_if("--enable-gczeal")(lambda _: True))
|
|
|
|
|
|
|
|
|
2018-01-31 19:35:57 +00:00
|
|
|
# Enable breakpoint for artificial OOMs
|
|
|
|
# =======================================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-oom-breakpoint", help="Enable a breakpoint function for artificial OOMs"
|
|
|
|
)
|
2018-01-31 19:35:57 +00:00
|
|
|
|
|
|
|
set_define("JS_OOM_BREAKPOINT", depends_if("--enable-oom-breakpoint")(lambda _: True))
|
|
|
|
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--enable-perf", env="JS_ION_PERF", help="Enable Linux perf integration")
|
2016-08-10 11:06:49 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2022-06-08 13:14:17 +00:00
|
|
|
@depends("--enable-perf", target)
|
|
|
|
def ion_perf(value, target):
|
2023-06-16 01:11:22 +00:00
|
|
|
is_linux = target.kernel == "Linux"
|
2023-04-11 17:35:48 +00:00
|
|
|
is_mac = target.kernel == "Darwin" and target.os == "OSX"
|
|
|
|
|
|
|
|
if value and (is_linux or is_mac):
|
2016-08-10 11:06:49 +00:00
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-08-10 11:06:49 +00:00
|
|
|
set_define("JS_ION_PERF", ion_perf)
|
2016-08-10 11:06:55 +00:00
|
|
|
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-jitspew",
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
|
|
|
help="{Enable|Disable} the Jit spew and IONFLAGS environment " "variable",
|
|
|
|
)
|
2017-12-02 18:43:40 +00:00
|
|
|
|
|
|
|
set_define("JS_JITSPEW", depends_if("--enable-jitspew")(lambda _: True))
|
|
|
|
set_config("JS_JITSPEW", depends_if("--enable-jitspew")(lambda _: True))
|
|
|
|
|
2018-11-29 14:37:01 +00:00
|
|
|
# Also enable the structured spewer
|
|
|
|
set_define("JS_STRUCTURED_SPEW", depends_if("--enable-jitspew")(lambda _: True))
|
|
|
|
set_config("JS_STRUCTURED_SPEW", depends_if("--enable-jitspew")(lambda _: True))
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2019-04-03 16:47:49 +00:00
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends("--enable-jit", "--enable-jitspew", simulator, target, moz_debug)
|
|
|
|
def jit_disasm_arm(jit_enabled, spew, simulator, target, debug):
|
|
|
|
if not jit_enabled:
|
2019-04-03 16:47:49 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if simulator and (debug or spew):
|
|
|
|
if getattr(simulator, "arm", None):
|
|
|
|
return True
|
|
|
|
|
|
|
|
if target.cpu == "arm" and (debug or spew):
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("JS_DISASM_ARM", jit_disasm_arm)
|
|
|
|
set_define("JS_DISASM_ARM", jit_disasm_arm)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
|
|
|
|
2023-01-23 11:51:34 +00:00
|
|
|
@depends("--enable-jit", "--enable-jitspew", simulator, target, moz_debug)
|
|
|
|
def jit_disasm_riscv(jit_enabled, spew, simulator, target, debug):
|
|
|
|
if not jit_enabled:
|
|
|
|
return
|
|
|
|
|
|
|
|
if simulator and (debug or spew):
|
|
|
|
if getattr(simulator, "riscv64", None):
|
|
|
|
return True
|
|
|
|
|
|
|
|
if target.cpu == "riscv64" and (debug or spew):
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("JS_DISASM_RISCV64", jit_disasm_riscv)
|
|
|
|
set_define("JS_DISASM_RISCV64", jit_disasm_riscv)
|
|
|
|
|
|
|
|
|
2020-04-07 14:52:33 +00:00
|
|
|
@depends("--enable-jit", "--enable-jitspew", simulator, target, moz_debug)
|
|
|
|
def jit_disasm_arm64(jit_enabled, spew, simulator, target, debug):
|
|
|
|
if not jit_enabled:
|
2019-04-03 16:47:49 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if simulator and (debug or spew):
|
|
|
|
if getattr(simulator, "arm64", None):
|
|
|
|
return True
|
|
|
|
|
|
|
|
if target.cpu == "aarch64" and (debug or spew):
|
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2019-04-03 16:47:49 +00:00
|
|
|
set_config("JS_DISASM_ARM64", jit_disasm_arm64)
|
|
|
|
set_define("JS_DISASM_ARM64", jit_disasm_arm64)
|
|
|
|
|
2018-10-24 13:07:53 +00:00
|
|
|
# When enabled, masm will generate assumeUnreachable calls that act as
|
|
|
|
# assertions in the generated code. This option is worth disabling when you
|
|
|
|
# have to track mutated values through the generated code, to avoid constantly
|
|
|
|
# dumping registers on and off the stack.
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-masm-verbose",
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
|
|
|
help="{Enable|Disable} MacroAssembler verbosity of generated code.",
|
|
|
|
)
|
2018-10-24 13:07:53 +00:00
|
|
|
set_define("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True))
|
|
|
|
set_config("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True))
|
|
|
|
|
2021-01-21 12:06:33 +00:00
|
|
|
# Architecture feature flags
|
|
|
|
# =======================================================
|
|
|
|
|
2023-09-06 16:14:30 +00:00
|
|
|
|
2021-01-21 12:06:33 +00:00
|
|
|
# Apple silicon does not seem to have any way to query the OS for the JSCVT
|
|
|
|
# flag stored in the ID_AA64ISAR1_EL1 system register. In the mean time, we
|
|
|
|
# hard code the value of the JSCVT flag which guards the implementation of
|
|
|
|
# FJCVTZS instruction as part of ARMv8.3-JSConv.
|
|
|
|
@depends(target)
|
|
|
|
def is_apple_silicon(target):
|
2024-02-29 00:49:10 +00:00
|
|
|
return target.kernel == "Darwin" and target.cpu == "aarch64"
|
2021-01-21 12:06:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-arm64-fjcvtzs",
|
|
|
|
default=is_apple_silicon,
|
2021-01-21 19:00:50 +00:00
|
|
|
help="{Enable|Disable} static use of FJCVTZS instruction on Aarch64 targets.",
|
2021-01-21 12:06:33 +00:00
|
|
|
)
|
|
|
|
|
2023-09-06 16:14:30 +00:00
|
|
|
|
2021-01-21 12:06:33 +00:00
|
|
|
# The "ARM Architecture Reference Manual" for ARMv8 defines the JSCVT flag as
|
|
|
|
# being a 4 bit integer (D12.2.52) and it can be manipulated using >= operator
|
|
|
|
# (D12.1.4).
|
|
|
|
#
|
|
|
|
# The FJCVTZS instruction is implemented if ID_AA64ISAR1_EL1.JSCVT >= 1.
|
|
|
|
@depends("--enable-arm64-fjcvtzs", target, simulator)
|
|
|
|
def aarch64_jscvt(fjcvtzs, target, simulator):
|
|
|
|
if target.cpu == "aarch64" and fjcvtzs:
|
|
|
|
return 1
|
|
|
|
|
|
|
|
if simulator and getattr(simulator, "arm64", False) and fjcvtzs:
|
|
|
|
return 1
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
set_define("MOZ_AARCH64_JSCVT", aarch64_jscvt)
|
2017-12-02 18:43:40 +00:00
|
|
|
|
2023-06-15 20:48:37 +00:00
|
|
|
|
|
|
|
@depends(target)
|
2024-03-25 17:12:53 +00:00
|
|
|
def has_apple_fast_wx(target):
|
|
|
|
return target.kernel == "Darwin" and target.cpu == "aarch64"
|
2023-06-15 20:48:37 +00:00
|
|
|
|
|
|
|
|
2024-03-25 17:12:53 +00:00
|
|
|
# On Apple Silicon macOS we use MAP_JIT with pthread_jit_write_protect_np to
|
|
|
|
# implement JIT code write protection, while on iOS we use MAP_JIT with
|
|
|
|
# be_memory_inline_jit_restrict_*.
|
|
|
|
set_define("JS_USE_APPLE_FAST_WX", True, when=has_apple_fast_wx)
|
2023-06-12 09:24:25 +00:00
|
|
|
|
2023-09-06 16:14:30 +00:00
|
|
|
|
2016-10-04 05:57:00 +00:00
|
|
|
# CTypes
|
|
|
|
# =======================================================
|
2020-10-07 17:48:06 +00:00
|
|
|
@depends(js_standalone)
|
|
|
|
def ctypes_default(js_standalone):
|
|
|
|
return not js_standalone
|
2016-10-04 05:57:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
option("--enable-ctypes", default=ctypes_default, help="{Enable|Disable} js-ctypes")
|
|
|
|
|
|
|
|
build_ctypes = depends_if("--enable-ctypes")(lambda _: True)
|
|
|
|
|
Bug 1669633 - Don't recurse into js/src for the python-part of configure. r=firefox-build-system-reviewers,rstewart
Instead, we now run js/src/old-configure from the top-level configure
after having run old-configure and extracted a few variables to inherit
from it.
Because we're now running from the top-level, $_objdir is always the
top-level objdir, which simplifies some things. The topobjdir in
js/src/config.status, however, needs to stay in js/src because of the
build frontend expecting it there.
When running js/src/old-configure, we used to need some special
treatment for a large number of variables for historic reasons, where
we'd take values from the assigned values before running old-configure
for some, or from AC_SUBSTs after running old-configure.
Now that both old-configure and js/src/old-configure get the same
assignments from old-configure.vars, we don't need anything special for
the former. And only a few remaining variables still need manual work
for the latter.
One notable difference, though, is that the new code doesn't try to
avoid running js subconfigure, which added complexity, and was actually
error-prone.
Differential Revision: https://phabricator.services.mozilla.com/D92725
2020-10-07 21:13:19 +00:00
|
|
|
set_config("BUILD_CTYPES", build_ctypes)
|
|
|
|
set_define("BUILD_CTYPES", build_ctypes)
|
2016-10-04 05:57:00 +00:00
|
|
|
|
|
|
|
set_config("JS_HAS_CTYPES", build_ctypes)
|
|
|
|
set_define("JS_HAS_CTYPES", build_ctypes)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
|
|
|
|
2018-12-11 19:34:28 +00:00
|
|
|
@depends("--enable-ctypes", "--enable-compile-environment")
|
|
|
|
def ctypes_and_compile_environment(ctypes, compile_environment):
|
2016-10-04 05:57:00 +00:00
|
|
|
return ctypes and compile_environment
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2016-10-13 08:15:24 +00:00
|
|
|
include("ffi.configure", when=ctypes_and_compile_environment)
|
2017-01-23 23:40:38 +00:00
|
|
|
|
|
|
|
|
2017-10-17 04:10:00 +00:00
|
|
|
# Enable pipeline operator
|
|
|
|
# ===================================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--enable-pipeline-operator", default=False, help="Enable pipeline operator")
|
2017-10-17 04:10:00 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2017-10-17 04:10:00 +00:00
|
|
|
@depends("--enable-pipeline-operator")
|
|
|
|
def enable_pipeline_operator(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2017-10-17 04:10:00 +00:00
|
|
|
set_config("ENABLE_PIPELINE_OPERATOR", enable_pipeline_operator)
|
|
|
|
set_define("ENABLE_PIPELINE_OPERATOR", enable_pipeline_operator)
|
2017-12-15 15:54:55 +00:00
|
|
|
|
|
|
|
|
2019-09-24 00:26:55 +00:00
|
|
|
# SIMD acceleration for encoding_rs
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-rust-simd", env="MOZ_RUST_SIMD", help="Enable explicit SIMD in Rust code."
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2019-09-24 00:26:55 +00:00
|
|
|
|
|
|
|
@depends("--enable-rust-simd", target)
|
|
|
|
def rust_simd(value, target):
|
|
|
|
# As of 2019-09-17, the simd-accel feature of encoding_rs has not
|
|
|
|
# been properly set up outside aarch64, armv7, x86 and x86_64.
|
|
|
|
if target.cpu in ("aarch64", "arm", "x86", "x86_64") and value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2019-09-24 00:26:55 +00:00
|
|
|
set_config("MOZ_RUST_SIMD", rust_simd)
|
|
|
|
set_define("MOZ_RUST_SIMD", rust_simd)
|
|
|
|
|
Bug 1656638: Add Wasm compile- and run-time telemetry to track Wasm compiler performance. r=lth
This patch adds telemetry to measure the time spent in Wasm compilers
and in the code that they generate (actually, all JS and Wasm code).
For simplicity, it measures wallclock time as a proxy for CPU time.
Furthermore, it measures runtime for all JS and Wasm code, and all
native functions invoked by the JS or Wasm code, by timing from
top-level entry to exit. This is for efficiency reasons: we do not want
to add a VM call in the transition stubs between native and JS or JS and
Wasm; that would be a Very Bad Thing for performance, even for a Nightly
build instrumented with telemetry. Because of that, it's difficult to
separate JITted JS and JITted Wasm runtime, but observing their sum
should still be useful when making comparisons across compiler changes
because absolute reductions will still be visible.
The plumbing is somewhat awkward, given that Wasm compilers can run on
background threads. It appears that the telemetry-callback API that
SpiderMonkey includes to avoid a direct dependency on the Gecko
embedding had artificially limited the callback to main-thread use only.
This patch removes that limitation, which is safe at least for Gecko;
the telemetry hooks in Gecko are thread-safe (they take a global mutex).
That way, the background threads performing compilation can directly add
telemetry incrementally, without having to pass this up through the main
thread somehow.
Finally, I have chosen to add the relevant metrics as Scalar telemetry
values rather than Histograms. This is because what we are really
interested in is the sum of all these values (all CPU time spent in
compilation + running Wasm code); if this value goes down as a result of
a Wasm compiler change, then that Wasm compiler change is good because
it reduces CPU time on the user's machine. It is difficult to add two
Histograms together because the bins may have different boundaries. If
we instead need to use a binned histogram for other reasons, then we
could simply report the sum (of all compiler time plus run time) as
another histogram.
Differential Revision: https://phabricator.services.mozilla.com/D85654
2020-08-06 01:28:45 +00:00
|
|
|
# Telemetry to measure compile time and generated-code runtime
|
|
|
|
# ============================================================
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-spidermonkey-telemetry",
|
|
|
|
default=milestone.is_nightly,
|
|
|
|
help="{Enable|Disable} performance telemetry for SpiderMonkey (e.g. compile and run times)",
|
|
|
|
)
|
Bug 1656638: Add Wasm compile- and run-time telemetry to track Wasm compiler performance. r=lth
This patch adds telemetry to measure the time spent in Wasm compilers
and in the code that they generate (actually, all JS and Wasm code).
For simplicity, it measures wallclock time as a proxy for CPU time.
Furthermore, it measures runtime for all JS and Wasm code, and all
native functions invoked by the JS or Wasm code, by timing from
top-level entry to exit. This is for efficiency reasons: we do not want
to add a VM call in the transition stubs between native and JS or JS and
Wasm; that would be a Very Bad Thing for performance, even for a Nightly
build instrumented with telemetry. Because of that, it's difficult to
separate JITted JS and JITted Wasm runtime, but observing their sum
should still be useful when making comparisons across compiler changes
because absolute reductions will still be visible.
The plumbing is somewhat awkward, given that Wasm compilers can run on
background threads. It appears that the telemetry-callback API that
SpiderMonkey includes to avoid a direct dependency on the Gecko
embedding had artificially limited the callback to main-thread use only.
This patch removes that limitation, which is safe at least for Gecko;
the telemetry hooks in Gecko are thread-safe (they take a global mutex).
That way, the background threads performing compilation can directly add
telemetry incrementally, without having to pass this up through the main
thread somehow.
Finally, I have chosen to add the relevant metrics as Scalar telemetry
values rather than Histograms. This is because what we are really
interested in is the sum of all these values (all CPU time spent in
compilation + running Wasm code); if this value goes down as a result of
a Wasm compiler change, then that Wasm compiler change is good because
it reduces CPU time on the user's machine. It is difficult to add two
Histograms together because the bins may have different boundaries. If
we instead need to use a binned histogram for other reasons, then we
could simply report the sum (of all compiler time plus run time) as
another histogram.
Differential Revision: https://phabricator.services.mozilla.com/D85654
2020-08-06 01:28:45 +00:00
|
|
|
|
|
|
|
set_define(
|
|
|
|
"ENABLE_SPIDERMONKEY_TELEMETRY",
|
|
|
|
depends_if("--enable-spidermonkey-telemetry")(lambda x: True),
|
|
|
|
)
|
2019-01-31 17:29:02 +00:00
|
|
|
|
|
|
|
# Support for debugging code generated by wasm backends
|
|
|
|
# =====================================================
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-wasm-codegen-debug",
|
|
|
|
default=depends(when=moz_debug)(lambda: True),
|
|
|
|
help="{Enable|Disable} debugging for wasm codegen",
|
|
|
|
)
|
2019-01-31 17:29:02 +00:00
|
|
|
|
|
|
|
set_config(
|
|
|
|
"WASM_CODEGEN_DEBUG", depends_if("--enable-wasm-codegen-debug")(lambda x: True)
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
2019-01-31 17:29:02 +00:00
|
|
|
set_define(
|
|
|
|
"WASM_CODEGEN_DEBUG", depends_if("--enable-wasm-codegen-debug")(lambda x: True)
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
2019-02-14 11:44:25 +00:00
|
|
|
|
2023-02-17 00:11:38 +00:00
|
|
|
# WebAssembly feature flags
|
|
|
|
# ==================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--wasm-no-experimental",
|
|
|
|
default=False,
|
|
|
|
help="Force disable all wasm experimental features for testing.",
|
|
|
|
)
|
|
|
|
|
2023-08-01 16:45:49 +00:00
|
|
|
# Support for WebAssembly tail-calls.
|
|
|
|
# ===========================
|
|
|
|
|
|
|
|
|
2023-09-27 13:55:25 +00:00
|
|
|
@depends(target)
|
|
|
|
def default_wasm_tail_calls(target):
|
|
|
|
if target.cpu in ("x86", "x86_64", "arm", "aarch64", "loongarch64", "mips64"):
|
2023-08-01 16:45:49 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-tail-calls",
|
|
|
|
default=default_wasm_tail_calls,
|
|
|
|
help="{Enable|Disable} WebAssembly tail-calls",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-wasm-tail-calls", target)
|
|
|
|
def wasm_tail_calls(value, target):
|
|
|
|
if not value:
|
|
|
|
return
|
|
|
|
|
2023-08-04 17:17:17 +00:00
|
|
|
if target.cpu in ("x86", "x86_64", "arm", "aarch64", "loongarch64", "mips64"):
|
2023-08-01 16:45:49 +00:00
|
|
|
return True
|
|
|
|
|
2023-09-27 13:55:25 +00:00
|
|
|
die(
|
|
|
|
"--enable-wasm-tail-calls only possible when targeting the x86_64/x86/arm64/arm/loongarch64/mips64 jits"
|
|
|
|
)
|
|
|
|
|
2023-08-01 16:45:49 +00:00
|
|
|
|
|
|
|
set_config("ENABLE_WASM_TAIL_CALLS", wasm_tail_calls)
|
|
|
|
set_define("ENABLE_WASM_TAIL_CALLS", wasm_tail_calls)
|
|
|
|
|
2019-02-14 11:59:38 +00:00
|
|
|
# Support for WebAssembly GC.
|
|
|
|
# ===========================
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2024-02-27 16:56:03 +00:00
|
|
|
option("--disable-wasm-gc", default=True, help="{Enable|Disable} WebAssembly GC")
|
2019-02-14 11:59:38 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2024-03-05 22:31:05 +00:00
|
|
|
@depends("--disable-wasm-gc")
|
|
|
|
def wasm_gc(value):
|
|
|
|
if not value:
|
2020-06-03 10:45:14 +00:00
|
|
|
return
|
2024-02-27 16:56:03 +00:00
|
|
|
return True
|
2020-06-03 10:45:14 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-06-03 10:45:14 +00:00
|
|
|
set_config("ENABLE_WASM_GC", wasm_gc)
|
|
|
|
set_define("ENABLE_WASM_GC", wasm_gc)
|
2019-02-14 11:59:38 +00:00
|
|
|
|
2024-04-23 21:18:56 +00:00
|
|
|
# Support for JS PI spec.
|
|
|
|
# ===========================
|
|
|
|
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
milestone.is_nightly,
|
|
|
|
"--enable-jit",
|
|
|
|
"--enable-simulator",
|
|
|
|
"--enable-wasm-gc",
|
|
|
|
"--enable-wasm-tail-calls",
|
|
|
|
target,
|
|
|
|
)
|
|
|
|
def default_wasm_jspi(
|
|
|
|
is_nightly,
|
|
|
|
jit_enabled,
|
|
|
|
simulator,
|
|
|
|
gc,
|
|
|
|
tail_calls,
|
|
|
|
target,
|
|
|
|
):
|
|
|
|
if not jit_enabled or simulator:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not gc or not tail_calls:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not is_nightly:
|
|
|
|
return
|
|
|
|
|
|
|
|
if target.cpu in ("x86_64", "aarch64"):
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-jspi",
|
|
|
|
default=default_wasm_jspi,
|
|
|
|
help="{Enable|Disable} WebAssembly JS PI",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
"--enable-wasm-jspi",
|
|
|
|
"--enable-jit",
|
|
|
|
"--enable-simulator",
|
|
|
|
"--enable-wasm-gc",
|
|
|
|
"--enable-wasm-tail-calls",
|
|
|
|
"--wasm-no-experimental",
|
|
|
|
target,
|
|
|
|
)
|
|
|
|
def wasm_jspi(value, jit_enabled, simulator, gc, tail_calls, no_experimental, target):
|
|
|
|
if no_experimental or not value:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not jit_enabled:
|
|
|
|
die("--enable-wasm-jspi requires --enable-jit")
|
|
|
|
|
|
|
|
if not gc:
|
|
|
|
die("--enable-wasm-jspi requires --enable-wasm-gc")
|
|
|
|
|
|
|
|
if not tail_calls:
|
|
|
|
die("--enable-wasm-jspi requires --enable-wasm-tail-calls")
|
|
|
|
|
|
|
|
if simulator:
|
|
|
|
die("--enable-wasm-jspi is not supported for simulators")
|
|
|
|
|
|
|
|
if target.cpu in ("x86_64", "aarch64"):
|
|
|
|
return True
|
|
|
|
|
|
|
|
die("--enable-wasm-jspi only possible when targeting the x86_64/arm64 jits")
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_JSPI", wasm_jspi)
|
|
|
|
set_define("ENABLE_WASM_JSPI", wasm_jspi)
|
|
|
|
|
2023-11-30 00:46:32 +00:00
|
|
|
# Support for WebAssembly JS String Builtins
|
|
|
|
# ==========================================
|
|
|
|
|
2023-11-30 00:46:32 +00:00
|
|
|
|
2023-11-30 00:46:32 +00:00
|
|
|
option(
|
2024-03-12 17:01:44 +00:00
|
|
|
"--disable-wasm-js-string-builtins",
|
|
|
|
default=True,
|
2023-11-30 00:46:32 +00:00
|
|
|
help="{Enable|Disable} WebAssembly JS String Builtins",
|
2023-11-30 00:46:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-03-12 17:01:44 +00:00
|
|
|
@depends("--disable-wasm-js-string-builtins", "--wasm-no-experimental")
|
2023-11-30 00:46:32 +00:00
|
|
|
def wasm_js_string_builtins(value, no_experimental):
|
|
|
|
if no_experimental or not value:
|
|
|
|
return
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_JS_STRING_BUILTINS", wasm_js_string_builtins)
|
|
|
|
set_define("ENABLE_WASM_JS_STRING_BUILTINS", wasm_js_string_builtins)
|
2019-02-14 11:59:38 +00:00
|
|
|
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
# Support for WebAssembly shared memory and atomics.
|
|
|
|
#
|
2022-07-27 22:30:17 +00:00
|
|
|
# This affects the JS shell only.
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
# =====================================================
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--disable-shared-memory", help="Disable JS/WebAssembly shared memory and atomics"
|
|
|
|
)
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-03-27 16:56:25 +00:00
|
|
|
@depends("--disable-shared-memory")
|
|
|
|
def enable_shared_memory(value):
|
|
|
|
if value:
|
|
|
|
return True
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-03-27 16:56:25 +00:00
|
|
|
set_config("ENABLE_SHARED_MEMORY", enable_shared_memory)
|
|
|
|
set_define("ENABLE_SHARED_MEMORY", enable_shared_memory)
|
Bug 1566427 - Improved compiler availability computation. r=bbouvier
This patch cleans up wasm compiler selection and a few related things
with as few semantic changes as possible. The intent is to centralize
compiler availability computation so that all parts of the system stay
in sync and it is easy to change compiler selection policy.
First, we introduce new predicates <Compiler>Available(cx) to test for
the actual availability of a compiler. These predicates take into
account whether a compiler is compiled into the executable, whether it
supports the hardware, whether it is (currently) selected by
options/switches, and whether it can be used as a result of the
runtime environment (for example, Ion and Cranelift are not available
if the debugger is observing the page or if the GC feature is enabled;
Cranelift is not available if shared memory and atomics are enabled).
We switch to using these predicates almost everywhere that used
<Compiler>CanCompile() or cx->options().wasm<Compiler>(), since those
don't tell the full story.
Second, we implement a priority order of the optimizing compilers and
make it easy to change this order (see comments in code). At the
moment, Cranelift is prioritized over Ion since Ion is enabled by
default and Cranelift is not; thus the desire of somebody flipping the
pref for Cranelift is to deselect Ion. The priority order may change
in the future or may become platform-dependent. The default compiler
selection in both browser and shell remains Baseline+Ion.
Third, we rename HasCompilerSupport() as HasPlatformSupport(), since
the predicate does not test whether compilers are available, only
whether they are present in the executable and support the hardware.
And to make that more sensible, <Compiler>CanCompile() is renamed
as <Compiler>PlatformSupport().
Fourth, we remove some redundant testing predicates (we don't need
both wasmDebugSupport and wasmDebuggingIsSupported, nor do we need
wasmUsesCranelift because wasmCompileMode is more reliable).
Fifth, we introduce a few new test cases that try to ensure that
compiler selection works as it should. These are white-box and may
need to change if the compiler priority order changes.
Sixth, we rename the internal wasm::Has<Feature>Support() predicates
as wasm::<Feature>Available(), since they all actually test for
compiler availability.
Differential Revision: https://phabricator.services.mozilla.com/D64946
--HG--
extra : moz-landing-system : lando
2020-03-11 15:03:45 +00:00
|
|
|
|
2020-05-05 08:17:47 +00:00
|
|
|
# Support for WebAssembly SIMD
|
|
|
|
# =====================================================
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2022-07-27 22:30:17 +00:00
|
|
|
@depends("--enable-jit", "--enable-simulator", target)
|
|
|
|
def default_wasm_simd(jit_enabled, simulator, target):
|
2021-01-27 11:35:40 +00:00
|
|
|
if not jit_enabled:
|
2020-05-05 08:17:47 +00:00
|
|
|
return
|
|
|
|
|
2021-05-05 16:53:02 +00:00
|
|
|
if simulator and (simulator[0] != "arm64"):
|
2021-03-12 17:23:54 +00:00
|
|
|
return
|
2021-01-27 11:35:40 +00:00
|
|
|
|
2021-05-05 16:53:02 +00:00
|
|
|
if target.cpu in ("x86_64", "x86", "aarch64"):
|
2020-05-05 08:17:47 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
option(
|
2020-10-06 12:10:56 +00:00
|
|
|
"--enable-wasm-simd",
|
2020-10-08 04:07:46 +00:00
|
|
|
default=default_wasm_simd,
|
|
|
|
help="{Enable|Disable} WebAssembly SIMD",
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-05-05 16:53:02 +00:00
|
|
|
@depends(
|
|
|
|
"--enable-wasm-simd",
|
|
|
|
"--enable-jit",
|
|
|
|
"--enable-simulator",
|
|
|
|
target,
|
2023-02-17 00:11:38 +00:00
|
|
|
"--wasm-no-experimental",
|
2021-05-05 16:53:02 +00:00
|
|
|
)
|
2023-02-17 00:11:38 +00:00
|
|
|
def wasm_simd(value, jit_enabled, simulator, target, no_experimental):
|
|
|
|
if no_experimental or not value:
|
2020-05-20 07:01:38 +00:00
|
|
|
return
|
|
|
|
|
2021-01-27 11:35:40 +00:00
|
|
|
if not jit_enabled:
|
2021-05-05 16:53:02 +00:00
|
|
|
die("--enable-wasm-simd requires --enable-jit")
|
2021-01-27 11:35:40 +00:00
|
|
|
|
2021-05-05 16:53:02 +00:00
|
|
|
if simulator and (simulator[0] != "arm64"):
|
|
|
|
die("--enable-wasm-simd is not supported for simulators, except arm64")
|
2020-05-20 07:01:38 +00:00
|
|
|
|
2021-05-05 16:53:02 +00:00
|
|
|
if target.cpu in ("x86_64", "x86", "aarch64"):
|
2020-10-02 13:12:42 +00:00
|
|
|
return True
|
|
|
|
|
2021-05-05 16:53:02 +00:00
|
|
|
die("--enable-wasm-simd only possible when targeting the x86_64/x86/arm64 jits")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-20 07:01:38 +00:00
|
|
|
|
|
|
|
set_config("ENABLE_WASM_SIMD", wasm_simd)
|
|
|
|
set_define("ENABLE_WASM_SIMD", wasm_simd)
|
2020-05-21 22:38:46 +00:00
|
|
|
|
2022-05-05 01:31:04 +00:00
|
|
|
# Whether to check for field changes in WebAssembly serialization
|
|
|
|
#
|
|
|
|
# See the comment for 'WASM_VERIFY_SERIALIZATION_FOR_SIZE' in WasmSerialize.cpp
|
|
|
|
# for more background.
|
|
|
|
# =====================================================================
|
|
|
|
|
|
|
|
|
2023-02-17 00:11:38 +00:00
|
|
|
@depends(
|
|
|
|
target,
|
|
|
|
c_compiler,
|
|
|
|
moz_debug,
|
|
|
|
milestone,
|
|
|
|
"--wasm-no-experimental",
|
|
|
|
)
|
|
|
|
def wasm_verify_serialization_for_size(
|
|
|
|
target, c_compiler, debug, milestone, no_experimental
|
|
|
|
):
|
2022-05-05 01:31:04 +00:00
|
|
|
if (
|
|
|
|
debug == True
|
|
|
|
and target.kernel == "Linux"
|
|
|
|
and target.cpu == "x86_64"
|
2022-05-09 14:26:57 +00:00
|
|
|
and c_compiler
|
2022-05-05 01:31:04 +00:00
|
|
|
and c_compiler.type == "clang"
|
2022-05-05 14:56:52 +00:00
|
|
|
and milestone.is_nightly
|
2023-02-17 00:11:38 +00:00
|
|
|
and not no_experimental
|
2022-05-05 01:31:04 +00:00
|
|
|
):
|
|
|
|
return True
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
set_define(
|
|
|
|
"ENABLE_WASM_VERIFY_SERIALIZATION_FOR_SIZE", wasm_verify_serialization_for_size
|
|
|
|
)
|
2022-03-18 15:07:31 +00:00
|
|
|
|
|
|
|
# Support for Intel AVX instruction.
|
|
|
|
#
|
|
|
|
# AVX is exclusively used in WebAssembly SIMD instructions at the moment:
|
|
|
|
# set direct dependency on "--enable-wasm-simd".
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
|
2022-04-21 12:43:20 +00:00
|
|
|
@depends("--enable-wasm-simd", "--enable-simulator", target)
|
|
|
|
def default_wasm_avx(wasm_simd_enabled, simulator, target):
|
2022-03-18 15:07:31 +00:00
|
|
|
if not wasm_simd_enabled:
|
|
|
|
return
|
|
|
|
|
|
|
|
if simulator:
|
|
|
|
return
|
|
|
|
|
|
|
|
if target.cpu in ("x86_64", "x86"):
|
2022-04-21 12:43:20 +00:00
|
|
|
return True
|
2022-03-18 15:07:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-avx",
|
|
|
|
default=default_wasm_avx,
|
|
|
|
help="{Enable|Disable} AVX support for WebAssembly SIMD",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-02-17 00:11:38 +00:00
|
|
|
@depends(
|
|
|
|
"--enable-wasm-avx",
|
|
|
|
"--enable-wasm-simd",
|
|
|
|
"--enable-simulator",
|
|
|
|
target,
|
|
|
|
"--wasm-no-experimental",
|
|
|
|
)
|
|
|
|
def wasm_avx(value, wasm_simd_enabled, simulator, target, no_experimental):
|
|
|
|
if no_experimental or not value:
|
2022-03-18 15:07:31 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if not wasm_simd_enabled:
|
|
|
|
die("--enable-wasm-avx requires --enable-wasm-simd")
|
|
|
|
|
|
|
|
if simulator:
|
|
|
|
die("--enable-wasm-avx is not supported for simulators")
|
|
|
|
|
|
|
|
if target.cpu in ("x86_64", "x86"):
|
|
|
|
return True
|
|
|
|
|
|
|
|
die("--enable-wasm-avx only possible when targeting the x86_64/x86 jits")
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_AVX", wasm_avx)
|
|
|
|
set_define("ENABLE_WASM_AVX", wasm_avx)
|
|
|
|
|
2021-05-04 06:26:13 +00:00
|
|
|
# Support for WebAssembly relaxed SIMD
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly, "--enable-wasm-simd")
|
|
|
|
def default_wasm_relaxed_simd(is_nightly, wasm_simd):
|
|
|
|
if is_nightly and wasm_simd:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-relaxed-simd",
|
|
|
|
default=default_wasm_relaxed_simd,
|
|
|
|
help="{Enable|Disable} WebAssembly relaxed SIMD",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-02-17 00:11:38 +00:00
|
|
|
@depends("--enable-wasm-relaxed-simd", "--enable-wasm-simd", "--wasm-no-experimental")
|
|
|
|
def wasm_relaxed_simd(value, wasm_simd, no_experimental):
|
|
|
|
if no_experimental or not value:
|
2021-05-04 06:26:13 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if not wasm_simd:
|
|
|
|
die("relaxed SIMD requires SIMD")
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_RELAXED_SIMD", wasm_relaxed_simd)
|
|
|
|
set_define("ENABLE_WASM_RELAXED_SIMD", wasm_relaxed_simd)
|
|
|
|
|
2021-08-06 19:14:23 +00:00
|
|
|
# Support for WebAssembly intgemm private intrinsics
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
|
2024-01-30 09:03:56 +00:00
|
|
|
@depends(target)
|
|
|
|
def default_wasm_moz_intgemm(target):
|
|
|
|
return target.cpu in ("x86", "x86_64", "aarch64")
|
2021-08-06 19:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-moz-intgemm",
|
|
|
|
default=default_wasm_moz_intgemm,
|
|
|
|
help="{Enable|Disable} WebAssembly intgemm private intrinsics",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-01-30 09:03:56 +00:00
|
|
|
@depends("--enable-wasm-moz-intgemm", "--wasm-no-experimental")
|
|
|
|
def wasm_moz_intgemm(value, no_experimental):
|
2023-02-17 00:11:38 +00:00
|
|
|
if no_experimental:
|
|
|
|
return
|
|
|
|
|
2024-01-30 09:03:56 +00:00
|
|
|
if value:
|
2022-02-04 14:28:29 +00:00
|
|
|
return True
|
2021-08-06 19:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_MOZ_INTGEMM", wasm_moz_intgemm)
|
|
|
|
set_define("ENABLE_WASM_MOZ_INTGEMM", wasm_moz_intgemm)
|
|
|
|
|
2021-07-16 20:58:09 +00:00
|
|
|
# Support for WebAssembly Memory64.
|
|
|
|
# ===========================
|
|
|
|
|
2021-10-18 09:58:13 +00:00
|
|
|
|
2022-07-27 22:30:17 +00:00
|
|
|
@depends(milestone.is_nightly, "--enable-simulator", target)
|
|
|
|
def default_wasm_memory64(is_nightly, simulator, target):
|
2021-11-26 08:49:32 +00:00
|
|
|
if target.cpu == "mips32":
|
2021-10-18 09:58:13 +00:00
|
|
|
return
|
|
|
|
|
2021-11-26 08:49:32 +00:00
|
|
|
if simulator and simulator[0] == "mips32":
|
2021-10-18 09:58:13 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if is_nightly:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2021-07-16 20:58:09 +00:00
|
|
|
option(
|
|
|
|
"--enable-wasm-memory64",
|
2021-10-18 09:58:13 +00:00
|
|
|
default=default_wasm_memory64,
|
2021-07-16 20:58:09 +00:00
|
|
|
help="{Enable|Disable} WebAssembly Memory64",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-02-17 00:11:38 +00:00
|
|
|
@depends(
|
|
|
|
"--enable-wasm-memory64", "--enable-simulator", target, "--wasm-no-experimental"
|
|
|
|
)
|
|
|
|
def wasm_memory64(value, simulator, target, no_experimental):
|
|
|
|
if no_experimental or not value:
|
2021-10-18 09:58:13 +00:00
|
|
|
return
|
|
|
|
|
2021-11-26 08:49:32 +00:00
|
|
|
if target.cpu == "mips32":
|
|
|
|
die("Memory64 is incompatible with MIPS32 target")
|
2021-10-18 09:58:13 +00:00
|
|
|
|
2021-11-26 08:49:32 +00:00
|
|
|
if simulator and simulator[0] == "mips32":
|
|
|
|
die("Memory64 is incompatible with MIPS32 simulator")
|
2021-10-18 09:58:13 +00:00
|
|
|
|
|
|
|
return True
|
2021-07-16 20:58:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_MEMORY64", wasm_memory64)
|
|
|
|
set_define("ENABLE_WASM_MEMORY64", wasm_memory64)
|
2021-05-04 06:26:13 +00:00
|
|
|
|
2023-02-14 19:27:54 +00:00
|
|
|
|
|
|
|
# Support for WebAssembly memory control.
|
|
|
|
# ===========================
|
|
|
|
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_wasm_memory_control(is_nightly):
|
|
|
|
if is_nightly:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-memory-control",
|
|
|
|
default=default_wasm_memory_control,
|
|
|
|
help="{Enable|Disable} WebAssembly fine-grained memory control instructions",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-02-17 00:11:38 +00:00
|
|
|
@depends("--enable-wasm-memory-control", "--wasm-no-experimental")
|
|
|
|
def wasm_memory_control(value, no_experimental):
|
|
|
|
if no_experimental or not value:
|
2023-02-14 19:27:54 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_MEMORY_CONTROL", wasm_memory_control)
|
|
|
|
set_define("ENABLE_WASM_MEMORY_CONTROL", wasm_memory_control)
|
|
|
|
|
|
|
|
|
2023-07-07 19:07:40 +00:00
|
|
|
# Support for WebAssembly Multi Memory.
|
|
|
|
# =====================================
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
2024-02-28 17:05:32 +00:00
|
|
|
"--disable-wasm-multi-memory",
|
2023-07-07 19:07:40 +00:00
|
|
|
help="{Enable|Disable} WebAssembly multi-memory",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-02-28 17:05:32 +00:00
|
|
|
@depends("--disable-wasm-multi-memory")
|
|
|
|
def wasm_multi_memory(value):
|
|
|
|
if value:
|
|
|
|
return True
|
2023-07-07 19:07:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_MULTI_MEMORY", wasm_multi_memory)
|
|
|
|
set_define("ENABLE_WASM_MULTI_MEMORY", wasm_multi_memory)
|
|
|
|
|
2024-04-16 18:24:01 +00:00
|
|
|
|
|
|
|
# Support for WebAssembly Branch-hinting.
|
|
|
|
# ===========================
|
|
|
|
|
|
|
|
|
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_wasm_branch_hinting(is_nightly):
|
|
|
|
if is_nightly:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-wasm-branch-hinting",
|
|
|
|
default=default_wasm_branch_hinting,
|
|
|
|
help="{Enable|Disable} WebAssembly Branch hints",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-wasm-branch-hinting", "--wasm-no-experimental")
|
|
|
|
def wasm_branch_hinting(value, no_experimental):
|
|
|
|
if no_experimental or not value:
|
|
|
|
return
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ENABLE_WASM_BRANCH_HINTING", wasm_branch_hinting)
|
|
|
|
set_define("ENABLE_WASM_BRANCH_HINTING", wasm_branch_hinting)
|
|
|
|
|
2020-05-21 22:38:46 +00:00
|
|
|
# Options for generating the shell as a script
|
|
|
|
# ============================================
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--with-qemu-exe", nargs=1, help="Use path as an arm emulator on host platforms")
|
2020-05-21 22:38:46 +00:00
|
|
|
set_config("QEMU_EXE", depends_if("--with-qemu-exe")(lambda x: x))
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--with-cross-lib",
|
|
|
|
nargs=1,
|
|
|
|
default=depends(target.alias)(lambda x: "/usr/%s" % x),
|
|
|
|
help="Use dir as the location for arm libraries",
|
|
|
|
)
|
2020-05-21 22:38:46 +00:00
|
|
|
set_config("CROSS_LIB", depends_if("--with-cross-lib")(lambda x: x))
|
2020-05-21 22:38:46 +00:00
|
|
|
|
|
|
|
# Enable static checking using sixgill
|
|
|
|
# ====================================
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option("--with-sixgill", nargs=1, help="Enable static checking of code using sixgill")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-21 22:38:46 +00:00
|
|
|
|
|
|
|
@depends_if("--with-sixgill")
|
|
|
|
@imports("os")
|
|
|
|
def sixgill(value):
|
|
|
|
for f in ("bin/xdbfind", "gcc/xgill.so", "scripts/wrap_gcc/g++"):
|
|
|
|
if not os.path.exists(os.path.join(value[0], f)):
|
|
|
|
die("The sixgill plugin and binaries are not at the specified path")
|
|
|
|
return value[0]
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-21 22:38:46 +00:00
|
|
|
set_config("SIXGILL_PATH", sixgill)
|
2020-05-21 22:38:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Support for readline
|
|
|
|
# =====================================================
|
2021-04-20 05:15:28 +00:00
|
|
|
|
|
|
|
|
2021-04-22 04:25:04 +00:00
|
|
|
@depends("--enable-js-shell", target_is_windows, compile_environment, target)
|
|
|
|
def editline(js_shell, is_windows, compile_environment, target):
|
|
|
|
return js_shell and not is_windows and compile_environment and (target.os != "WASI")
|
2020-05-21 22:38:46 +00:00
|
|
|
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
option(
|
2020-05-21 22:38:46 +00:00
|
|
|
"--enable-readline", help="Link js shell to system readline library", when=editline
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
|
|
|
|
2020-05-21 22:38:46 +00:00
|
|
|
has_readline = check_symbol(
|
2020-10-26 18:34:53 +00:00
|
|
|
"readline",
|
2020-05-21 22:38:46 +00:00
|
|
|
flags=["-lreadline"],
|
|
|
|
when="--enable-readline",
|
|
|
|
onerror=lambda: die("No system readline library found"),
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-21 22:38:46 +00:00
|
|
|
set_config("EDITLINE_LIBS", ["-lreadline"], when=has_readline)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-readline", editline, when=editline)
|
|
|
|
def bundled_editline(readline, editline):
|
|
|
|
return editline and not readline
|
|
|
|
|
|
|
|
|
|
|
|
set_config("JS_BUNDLED_EDITLINE", bundled_editline)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-21 22:38:46 +00:00
|
|
|
set_define("EDITLINE", True, when=editline)
|
2020-05-29 12:17:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
# JIT observers
|
|
|
|
# =============
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--with-jitreport-granularity",
|
|
|
|
default="3",
|
|
|
|
choices=("0", "1", "2", "3"),
|
|
|
|
help="Default granularity at which to report JIT code to external tools "
|
|
|
|
"(0 - no info, 1 - code ranges for while functions only, "
|
|
|
|
"2 - per-line information, 3 - per-op information)",
|
|
|
|
)
|
2020-05-29 12:17:26 +00:00
|
|
|
|
|
|
|
set_define(
|
|
|
|
"JS_DEFAULT_JITREPORT_GRANULARITY",
|
|
|
|
depends_if("--with-jitreport-granularity")(lambda value: value[0]),
|
|
|
|
)
|
2020-05-29 21:29:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
# ECMAScript Internationalization API Support (uses ICU)
|
|
|
|
# ======================================================
|
2024-05-23 01:50:13 +00:00
|
|
|
system_lib_option("--with-system-icu", help="Use system ICU")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2023-11-14 15:07:57 +00:00
|
|
|
system_icu = pkg_check_modules("MOZ_ICU", "icu-i18n >= 73.1", when="--with-system-icu")
|
2020-05-29 21:29:52 +00:00
|
|
|
|
2021-11-30 21:34:14 +00:00
|
|
|
|
2024-05-23 01:50:13 +00:00
|
|
|
@depends("--with-system-icu")
|
2021-11-30 21:34:14 +00:00
|
|
|
def in_tree_icu(system_icu):
|
|
|
|
return not system_icu
|
|
|
|
|
|
|
|
|
|
|
|
# Set MOZ_ICU_CFLAGS to an explicit empty value when --with-system-icu is *not* used,
|
|
|
|
# for layout/style/extra-bindgen-flags
|
|
|
|
set_config("MOZ_ICU_CFLAGS", [], when=in_tree_icu)
|
|
|
|
|
2020-05-29 21:29:52 +00:00
|
|
|
set_config("MOZ_SYSTEM_ICU", True, when=system_icu)
|
|
|
|
set_define("MOZ_SYSTEM_ICU", True, when=system_icu)
|
|
|
|
|
|
|
|
option("--without-intl-api", help="Disable ECMAScript Internationalization API")
|
|
|
|
|
|
|
|
|
2020-10-07 17:48:06 +00:00
|
|
|
@depends("--with-intl-api", js_standalone)
|
|
|
|
def check_intl_api(enabled, js_standalone):
|
|
|
|
if not enabled and not js_standalone:
|
2020-05-29 21:29:52 +00:00
|
|
|
die("--without-intl-api is not supported")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-29 21:29:52 +00:00
|
|
|
|
|
|
|
set_config("JS_HAS_INTL_API", True, when="--with-intl-api")
|
|
|
|
set_define("JS_HAS_INTL_API", True, when="--with-intl-api")
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2021-12-23 20:47:47 +00:00
|
|
|
@depends(build_environment, when="--with-intl-api")
|
2020-05-29 21:29:52 +00:00
|
|
|
@imports(_from="__builtin__", _import="open")
|
|
|
|
@imports(_from="__builtin__", _import="ValueError")
|
|
|
|
def icu_version(build_env):
|
|
|
|
path = os.path.join(
|
|
|
|
build_env.topsrcdir, "intl", "icu", "source", "common", "unicode", "uvernum.h"
|
|
|
|
)
|
|
|
|
with open(path, encoding="utf-8") as fh:
|
|
|
|
for line in fh:
|
|
|
|
if line.startswith("#define"):
|
|
|
|
define = line.split(None, 3)
|
|
|
|
if len(define) == 3 and define[1] == "U_ICU_VERSION_MAJOR_NUM":
|
|
|
|
try:
|
|
|
|
return str(int(define[2]))
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
die("Cannot determine ICU version number from uvernum.h header file")
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-29 21:29:52 +00:00
|
|
|
|
|
|
|
set_config("MOZ_ICU_VERSION", icu_version)
|
|
|
|
|
|
|
|
# Source files that use ICU should have control over which parts of the ICU
|
|
|
|
# namespace they want to use.
|
|
|
|
set_define("U_USING_ICU_NAMESPACE", "0", when="--with-intl-api")
|
|
|
|
|
|
|
|
# We build ICU as a static library.
|
|
|
|
set_define("U_STATIC_IMPLEMENTATION", True, when=depends(system_icu)(lambda x: not x))
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-05-29 21:29:52 +00:00
|
|
|
|
2023-06-21 20:27:38 +00:00
|
|
|
# ECMAScript Temporal API Support (uses ICU)
|
|
|
|
# ======================================================
|
|
|
|
|
|
|
|
option("--with-temporal-api", default=False, help="Enable ECMAScript Temporal API")
|
|
|
|
|
|
|
|
set_config("JS_HAS_TEMPORAL_API", True, when="--with-temporal-api")
|
|
|
|
set_define("JS_HAS_TEMPORAL_API", True, when="--with-temporal-api")
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--with-temporal-api", "--with-intl-api")
|
|
|
|
def check_temporal_api(temporal_enabled, intl_enabled):
|
|
|
|
if temporal_enabled and not intl_enabled:
|
|
|
|
die("Can't use both --with-temporal-api and --without-intl-api")
|
|
|
|
|
|
|
|
|
2020-09-21 11:01:19 +00:00
|
|
|
# Initial support for WebAssembly JS-API Type Reflections
|
|
|
|
# =======================================================
|
|
|
|
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-09-21 11:01:19 +00:00
|
|
|
@depends(milestone.is_nightly)
|
|
|
|
def default_wasm_type_reflections(is_nightly):
|
|
|
|
return is_nightly
|
|
|
|
|
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
option(
|
|
|
|
"--enable-wasm-type-reflections",
|
|
|
|
default=default_wasm_type_reflections,
|
|
|
|
help="{Enable|Disable} type reflection in WASM JS-API",
|
|
|
|
)
|
2020-10-26 18:34:53 +00:00
|
|
|
|
2020-10-08 04:07:46 +00:00
|
|
|
set_config(
|
2020-09-21 11:01:19 +00:00
|
|
|
"ENABLE_WASM_TYPE_REFLECTIONS",
|
|
|
|
depends_if("--enable-wasm-type-reflections")(lambda x: True),
|
|
|
|
)
|
|
|
|
set_define(
|
|
|
|
"ENABLE_WASM_TYPE_REFLECTIONS",
|
|
|
|
depends_if("--enable-wasm-type-reflections")(lambda x: True),
|
2020-10-26 18:34:53 +00:00
|
|
|
)
|
2020-12-04 22:47:29 +00:00
|
|
|
|
2022-02-24 07:33:32 +00:00
|
|
|
# Wasi configuration
|
|
|
|
# ===================================================
|
|
|
|
|
2021-10-06 08:56:32 +00:00
|
|
|
|
2022-03-09 08:03:33 +00:00
|
|
|
@depends(target.os)
|
|
|
|
def is_wasi_target(os):
|
|
|
|
return os == "WASI"
|
|
|
|
|
|
|
|
|
|
|
|
set_define("_WASI_EMULATED_PROCESS_CLOCKS", True, when=is_wasi_target)
|
|
|
|
set_define("_WASI_EMULATED_GETPID", True, when=is_wasi_target)
|
2021-10-22 18:38:09 +00:00
|
|
|
|
2021-12-16 07:37:34 +00:00
|
|
|
|
|
|
|
@depends(milestone.version)
|
|
|
|
def js_version(version):
|
|
|
|
return Version(version)
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZJS_MAJOR_VERSION", depends(js_version.major)(lambda m: str(m)))
|
|
|
|
set_define("MOZJS_MAJOR_VERSION", js_version.major)
|
|
|
|
set_config("MOZJS_MINOR_VERSION", depends(js_version.minor)(lambda m: str(m)))
|
|
|
|
set_define("MOZJS_MINOR_VERSION", js_version.minor)
|
|
|
|
set_config("MOZJS_PATCH_VERSION", depends(js_version.patch)(lambda p: str(p)))
|
|
|
|
set_config(
|
|
|
|
"MOZJS_ALPHA",
|
2021-12-22 05:44:13 +00:00
|
|
|
depends(js_version)(
|
|
|
|
lambda x: x.version[-2] if str(x.version[-2]) in "ab" else None
|
|
|
|
),
|
2021-12-16 07:37:34 +00:00
|
|
|
)
|
2021-12-23 20:50:38 +00:00
|
|
|
|
|
|
|
|
2022-02-15 07:03:30 +00:00
|
|
|
# Some platforms have HeapReg, some don't
|
|
|
|
# =====================================================
|
|
|
|
|
|
|
|
# The ARM simulator runs on x86 and might be excluded by the first test,
|
|
|
|
# so we special-case it.
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-simulator", target)
|
|
|
|
def wasm_has_heapreg(simulator, target):
|
|
|
|
if target.cpu != "x86":
|
|
|
|
return True
|
|
|
|
|
|
|
|
if simulator and simulator[0] == "arm":
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_define("WASM_HAS_HEAPREG", wasm_has_heapreg)
|
|
|
|
|
2021-12-23 20:50:38 +00:00
|
|
|
# Check for tm_zone, tm_gmtoff in struct tm
|
|
|
|
# ===================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
set_define(
|
|
|
|
"HAVE_TM_ZONE_TM_GMTOFF",
|
|
|
|
c_compiler.try_compile(
|
|
|
|
includes=["time.h"],
|
|
|
|
body="struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;",
|
|
|
|
check_msg="for tm_zone and tm_gmtoff in struct tm",
|
|
|
|
),
|
|
|
|
)
|
2022-01-20 21:01:20 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Checks for library functions
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT")):
|
|
|
|
set_define("HAVE_GETPAGESIZE", check_symbol("getpagesize"))
|
|
|
|
set_define("HAVE_GMTIME_R", check_symbol("gmtime_r"))
|
|
|
|
set_define("HAVE_LOCALTIME_R", check_symbol("localtime_r"))
|
|
|
|
set_define("HAVE_GETTID", check_symbol("gettid"))
|
|
|
|
set_define("HAVE_SETPRIORITY", check_symbol("setpriority"))
|
|
|
|
set_define("HAVE_SYSCALL", check_symbol("syscall"))
|
|
|
|
set_define("HAVE_GETC_UNLOCKED", check_symbol("getc_unlocked"))
|
|
|
|
set_define("HAVE_PTHREAD_GETNAME_NP", check_symbol("pthread_getname_np"))
|
|
|
|
set_define("HAVE_PTHREAD_GET_NAME_NP", check_symbol("pthread_get_name_np"))
|
|
|
|
set_define("HAVE_STRERROR", check_symbol("strerror"))
|
|
|
|
|
2024-02-28 11:11:18 +00:00
|
|
|
set_config(
|
|
|
|
"HAVE_LANGINFO_CODESET",
|
|
|
|
try_link(
|
|
|
|
includes=["langinfo.h"],
|
|
|
|
body="char* cs = nl_langinfo(CODESET);",
|
|
|
|
check_msg="for nl_langinfo and CODESET",
|
2024-05-23 21:35:35 +00:00
|
|
|
when=building_with_gnu_cc,
|
2024-02-28 11:11:18 +00:00
|
|
|
),
|
|
|
|
)
|
|
|
|
|
2022-01-20 21:01:20 +00:00
|
|
|
@depends(check_symbol("__cxa_demangle", language="C++"), moz_debug, dmd)
|
|
|
|
def demangle_symbols(cxa_demangle, moz_debug, dmd):
|
|
|
|
# Demangle only for debug or DMD builds
|
|
|
|
if cxa_demangle and (moz_debug or dmd):
|
|
|
|
return True
|
|
|
|
|
|
|
|
set_define("MOZ_DEMANGLE_SYMBOLS", demangle_symbols)
|
|
|
|
|
2023-10-24 00:52:34 +00:00
|
|
|
set_define("HAVE__UNWIND_BACKTRACE", True, when=have_unwind)
|
2022-01-20 21:01:20 +00:00
|
|
|
|
|
|
|
with only_when(compile_environment):
|
|
|
|
set_define("HAVE__GETC_NOLOCK", check_symbol("_getc_nolock"))
|
|
|
|
set_define("HAVE_LOCALECONV", check_symbol("localeconv"))
|