This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
Spidermonkey
Benjamin Bouvier edited this page Mar 30, 2020
·
3 revisions
Cranelift is being used in Spidermonkey (see also this document). Here is a collection of tricks related to this use case.
- Open the top-level
Cargo.toml
file in your local Gecko clone, and locate the twopatch
sections related tocranelift-codegen
andcranelift-wasm
. - Update the commit hashes (
rev = ...
) to the desired Cranelift git hash. - Check that the Cranelift version specified in its
Cargo.toml
file matches the version numbers in the Gecko'sjs/src/wasm/cranelift/Cargo.toml
file. Otherwise, the Cargo patches won't apply properly. - Run
./mach vendor rust
. This will create changes to the globalCargo.lock
file, which should be committed separately (later). - Compile Spidermonkey as usual, update to latest Cranelift API changes, if any.
- Once you're done, create two Gecko commits (using for instance the
hg record
extension):- once for the
Cargo.toml
changes as well as API changes. - once for the result of the
mach vendor rust
command.
- once for the
- Ideally, run the test suite with Cranelift, and at least note failures in the associated bug, so we keep track of known failures over time.
- And then upload them for review to a wasm peer. The second commit exists to separate meaningful changes from changes already reviewed on Cranelift's github repository. So this latter commit may only be rubberstamp by its reviewer.
Almost the same steps as above: instead of replacing the rev
field by another hash commit in Gecko's top-level Cargo.toml file, you need to:
- replace the repository username, if needed.
- then point to a specific commit with
rev = COMMIT_HASH
, or a specific branch withbranch = BRANCH_NAME
. - and then, re-run
mach vendor rust
as usual.
- Edit $MOZROOT/js/src/wasm/cranelift/Cargo.toml
- Replace both lines
cranelift-codegen
/cranelift-wasm
by the following form:
cranelift-codegen = { path = “/abs/path/to/your/local/wasmtime/cranelift/cranelift-codegen” }
- Remove the two
patch
sections in Gecko's top-level Cargo.toml file, sections resembling this:
[patch.crates-io.cranelift-codegen]
git = "https://github.com/bytecodealliance/wasmtime"
rev = "538a0662bf90a1daa9921c10f34827ace134abf1"
-
cd MOZROOT && ./mach vendor rust
to synchronize the global Cargo.lock file. - then compile as usual.
$MOZROOT/js/src/jit-test/jit_test.py --args=”--wasm-compiler=cranelift --no-wasm-multi-value --shared-memory=off” /path/to/built/shell/js wasm