Skip to content

SpiderMonkey js185 arm64: darwin artifact install script - #762

Open
Depal1 wants to merge 1 commit into
OoliteProject:masterfrom
Depal1:pr-2-js185-arm64
Open

Depal1 wants to merge 1 commit into
OoliteProject:masterfrom
Depal1:pr-2-js185-arm64

Conversation

@Depal1

@Depal1 Depal1 commented Oct 9, 2026 •

Copy link
Copy Markdown

DRAFT: PR #2, SpiderMonkey js185 arm64 enablement

Base: master @ 8ffe02d. Branch: pr-2-js185-arm64.
Commits in this PR (oolite repo): one, ShellScripts/Darwin/install_mozilla_js.sh, the darwin twin of the Linux install script. The engine changes themselves are PRs to OoliteProject/spidermonkey-ff4, and the patched build plus release artifact live in a new mozillajs-macos repo, mirroring mozillajs-linux. Interim note: until that repo is published, the mac CI job vendors the verified artifact tarball (see PR #3); this PR swaps it to the install-script download.


What this is

The js185 SpiderMonkey that Oolite pins (mozilla-2.0, via the spidermonkey-ff4 source
repo) has never built on aarch64: the configure scripts predate the architecture, the
CPU cases set x86/ARMv7-only defines, the YARR assembler has no arm64 backend, and the
darwin GC allocator placement can violate the 2^47 address assumption in the 64-bit
value layout. oolite#360 named exactly this ("libjs needs to be updated to take
advantage of the ARMv8/ARM64 architecture") as the first blocker for an ARM Mac build.

This is not an engine upgrade. The JS API surface is untouched; the several hundred OXPs
written against js185 keep working. The engine runs as an interpreter on arm64 (there is
no ARM64 JIT backend in this tree to port, and the interpreter is the reference
implementation), with regexes on the bundled pcre engine, following the powerpc/sparc
precedent already in the Makefile.

The patches (filed against OoliteProject/spidermonkey-ff4, one PR per patch)

  1. config.guess/config.sub: recognize darwin-arm64 (the 2009 scripts report
    arm-apple-darwin because they use uname -p, which returns arm on Apple
    Silicon; config.sub rejects both arm64 and aarch64 triplets). Follows the amd64
    to x86_64 alias precedent.
  2. configure/configure.in: aarch64 CPU cases (interpreter-only: no JIT or IC vars,
    JS_PUNBOX64 defined), plus an empty AVMPLUS case.
  3. js/src/Makefile.in: extend the powerpc/sparc pcre-path filter with aarch64/arm64;
    otherwise the Nitro assembler sources fail with MacroAssembler's hard error.
  4. js/src/jsgcchunk.cpp: on darwin, try vm_allocate at descending fixed addresses
    below 2^47 before falling back to VM_FLAGS_ANYWHERE (the 64-bit value layout
    requires GC chunks below that line for the debug assertions to be sound).
  5. finite() to isfinite() (the symbol is gone from modern macOS SDK headers).
  6. MethodJIT.cpp file-scope asm: drop volatile (clang 16+ hard error; needed for the
    x86_64 reference builds).
  7. Logging.h: keep the JaegerSpew stub when methodjit is disabled (the interpreter-only
    x86_64 reference build hits the missing symbol through the YARR assembler headers).

Each patch PR carries its own verification evidence: live config.guess/config.sub
outputs before and after, generated-header greps (JS_PUNBOX64 and HAVE_64BIT_OS present;
zero JIT/IC defines), a GC-stress soak sampling 48,384 live object pointers across 600
waves (all below 2^47), and the js185 test suite run on the arm64 build. The test-suite
delta versus x86_64 is fully classified: four Date harness-environment failures, four
pcre-versus-YARR regexp semantic differences, one allocation-expectation test, one
timeout. No arm64 engine-level failure cluster.

The artifact repo

mozillajs-macos (content ready to transfer to the OoliteProject org, see the design
issue) mirrors mozillajs-linux: the patched js/src tree, a build script, CI on the
macos-26 runner, README with the pinned source commit, and a release artifact
(include/ + lib/js_static.a, MPL 2.0 license included). It also publishes the
benchmark numbers and the two documented behavioral notes for darwin:

  • The engine runs interpreter-only (no ARM64 JIT backend exists in js185; the consumer
    forces the JIT option bits off).
  • Regexes run on pcre instead of YARR (no arm64 YARR backend; the pcre path is the same
    one powerpc and sparc use).

Measured: the native arm64 interpreter outperforms an x86_64 JIT build running under
Rosetta on every kernel of the benchmark harness (for example 21 ms versus 208 ms on the
strings kernel), so the interpreter-only configuration is not a performance regression
against today's Rosetta-based option.

The oolite-side change

One script, ShellScripts/Darwin/install_mozilla_js.sh, mirroring
ShellScripts/Linux/install_mozilla_js.sh: download the release artifact, stage it
under the same build/mozilla_js layout the Meson scan expects. Nothing else in the
oolite tree changes for the dependency; oolite has no submodules and the js patches
belong in the engine source repo, not here.

Relation to open issues

  • Apple silicon release #721: "requires updating some major game dependencies" is the prerequisite this PR and
    its spidermonkey-ff4 companions implement. Restriction check: the dependency update
    adds no oolite-side platform code, the engine stays a single source tree for all
    targets (aarch64 follows the powerpc/sparc fallback precedent), and the consumer
    port's adherence to the SDL3/meson/espeak-ng restrictions is covered by PR Memory spike on wormhole chaining #1 and the
    design issue.
  • ARM Mac build is broken. #360: the 2020 blockers list named the arm64 libjs build first. The 2020 rejection of
    an engine swap was about breaking OXPs; this series does not touch the JS API.

AI-assistance disclosure: developed with AI assistance (GLM-5.3-Flash); verified by the builds/tests described.

Design issue: #760

Downloads the mozillajs-macos release artifact (interpreter-only js185 for
aarch64, built from this org's spidermonkey-ff4 source with the pcre regex
path, mirroring the mozillajs-linux flow) and stages include/ + lib into
build/mozilla_js for the Meson darwin scan. Prerequisite for the Apple
Silicon build described in oolite#721; one of the blockers listed in
oolite#360.
@Depal1
Depal1 requested review from mcarans, oocube and phkb as code owners October 9, 2026 05:52

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant