Repository navigation
feat(runtime): V8 JIT on Mac Catalyst, with a Catalyst CI lane - #533
Draft
edusperoni wants to merge 4 commits into
Draft
edusperoni wants to merge 4 commits into
edusperoni wants to merge 4 commits into
Conversation
build_libffi.sh had no arm64-maccatalyst slice, so the Catalyst framework's -lffi found no archive and the linker fell back to the macOS SDK's libffi.tbd: the shipped Catalyst slice links Apple's /usr/lib/libffi.dylib while the runtime compiles against our fork's headers (vector types and the fork's closure layout included). arm64 macabi has no deployment target below 14.0, so the slice gets its own minimum.
…ilds Xcode does not export IPHONEOS_DEPLOYMENT_TARGET to Mac Catalyst script phases, so the fallback raised KeyError and, since the phase does not fail the build, left a 0-byte metadata file. Fall back to LLVM_TARGET_TRIPLE_OS_VERSION, which Catalyst builds always carry.
…JIT memory
Catalyst V8 now ships with Sparkplug, Maglev and TurboFan. A hardened
runtime process may only map JIT memory with
com.apple.security.cs.allow-jit (or allow-unsigned-executable-memory), and
V8 does not fall back on its own, so before V8::Initialize the runtime
probes an mmap(MAP_JIT) allocation and passes --jitless when it fails.
`"ios": { "jit": false }` in the app's package.json forces the
interpreter. iOS is unchanged: its V8 is lite mode, which implies
--jitless.
TestRunner and its dependencies now build for Mac Catalyst (arm64), ad-hoc signed with hardened runtime and allow-jit like a shipped app, and `./run_tests.sh --catalyst` runs the suite on the host Mac. A CI job does the same on macos-15. CatalystJitTests asserts that V8 holds executable memory there, which it maps only with its JIT on. The UI-testing runner needs macOS Automation Mode without authentication (preconfigured on GitHub's macOS images); run_tests.sh checks for it.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on NativeScript/v8-buildscripts#10. This stays a draft until that PR is merged and tagged, and
V8_RELEASEhere is bumped to the new release.What
V8::Initialize, the runtime tries one smallmmap(MAP_JIT)allocation. If it fails, the runtime passes--jitless."ios": { "jit": false }in the app'spackage.jsonforces the interpreter. iOS is unchanged: its V8 is lite mode, which implies--jitless.allow-jit, like a shipped app../run_tests.sh --catalystruns the suite on the host Mac, and a newtest-catalystCI job does the same onmacos-15.CatalystJitTestsasserts that V8 holds executable memory, which it only maps with the JIT on./usr/lib/libffi.dylib.build_libffi.shhad noarm64-maccatalystslice, so-lffifell back to the SDK'slibffi.tbd, while the runtime compiled against our fork's headers; the published 9.1.0 framework shows this withotool -L. The slice is now built and committed.IPHONEOS_DEPLOYMENT_TARGETto Catalyst script phases, so the fix(metadata-generator): emit UIKit metadata for Mac Catalyst #433 fallback raisedKeyError. It now falls back toLLVM_TARGET_TRIPLE_OS_VERSION. User Catalyst apps run the same script.Why the runtime check is needed
V8 doesn't fall back to the interpreter on its own. In a hardened-runtime process without
allow-jit(orallow-unsigned-executable-memory), the JIT build dies at its first code allocation; I saw a SIGTRAP at startup in a probe. With the entitlement, or without hardened runtime, the JIT runs.The current app template already has
allow-unsigned-executable-memory, so existing Catalyst apps will start using the JIT once they pick up this runtime.Verification
--jitless, and--trace-optreports optimizations under ad-hoc, hardened +allow-jit, and hardened +allow-unsigned-executable-memory../run_tests.sh --temp-sim): 1835 specs, 0 failures, 11 skipped.sudo automationmodetool enable-automationmode-without-authentication). GitHub's macOS images ship with it enabled. The Catalyst framework did build and link with the JIT archives (Maglev and TurboFan symbols present).V8_RELEASEis bumped, the Catalyst job downloads the lite-7release, soCatalystJitTestsis expected to fail there. Everything else in that lane should pass.Notes
disable-library-validation. Ad-hoc signatures carry no Team ID, so hardened-runtime library validation would refuse the embedded frameworks. This is test-only.--catalystruns are serialized per Mac with a lock, becauseXCUIApplicationkills any running app with the same bundle ID.ios.jitkey isn't in the@nativescript/coreconfig typings yet.