Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpiderMonkey CMake package: use alternate artifacts if specified. #90

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

cfallin
Copy link
Member

@cfallin cfallin commented Jul 26, 2024

When developing StarlingMonkey using an existing SpiderMonkey build with no SM changes, it is very convenient to download and use pre-built artifacts for SM from the CI on spidermonkey-wasi-embedding, and we do not want to lose this convenience or approachability.

However, when modifying SpiderMonkey itself, it is nearly impossible to do development with the current setup: the debug loop requires merging changes to gecko-dev with one PR, updating the hash in spidermonkey-wasi-embedding with another PR, getting both merged and waiting for the build in CI before StarlingMonkey can use the new engine.

Rather than require a local hack for such cases, this modifies the SpiderMonkey CMake module to recognize a SPIDERMONKEY_BINARIES environment variable, and use artifacts there instead. This allows the developer to point this to a local clone of spidermonkey-wasi-embedding with a modified gecko-dev, rebuilt with rebuild.sh as needed. The README is updated with details on how to use this.

cfallin added a commit to cfallin/StarlingMonkey that referenced this pull request Jul 27, 2024
This depends on a bunch of pending PRs:

- Stacked on top of bytecodealliance#89 and bytecodealliance#90
- Pulls in spidermonkey-wasi-embedding artifacts from
  bytecodealliance/spidermonkey-wasi-embedding#18 (hash updated, but use
  local checkout variant from bytecodealliance#90 to test before that merges)

When built with:

```
$ mkdir build/; cd build/
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_WASM_OPT=OFF -DWEVAL=ON
$ make
```

This PR will result in a `starling.wasm`, a prebuilt compilation cache
of ICs in `starling-ics.wevalcache` (~1.8MiB), and a `componentize.sh`
that takes a `--aot` option.

I haven't yet quite worked out how to successfully use componentize.sh,
so I can't claim this is end-to-end tested yet, but it is invoking weval
successfully and ICs are wevaled at least.
Copy link
Member

@tschneidereit tschneidereit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would somewhat prefer using an env var for this instead of hard-coding a specific path to check. Would you mind looking at how the WPT harness does this and seeing if that kind of setup works for you?

And if it does work, please also update the README to document this.

When developing StarlingMonkey using an existing SpiderMonkey build with
no SM changes, it is very convenient to download and use pre-built
artifacts for SM from the CI on `spidermonkey-wasi-embedding`, and we do
not want to lose this convenience or approachability.

However, when modifying SpiderMonkey itself, it is nearly impossible to
do development with the current setup: the debug loop requires merging
changes to `gecko-dev` with one PR, updating the hash in
`spidermonkey-wasi-embedding` with another PR, getting both merged
and waiting for the build in CI before StarlingMonkey can use the
new engine.

Rather than require a local hack for such cases, this modifies the
SpiderMonkey CMake module to recognize a `SPIDERMONKEY_BINARIES`
environment variable, and use artifacts there instead. This allows the
developer to point this to a local clone of
`spidermonkey-wasi-embedding` with a modified `gecko-dev`, rebuilt with
`rebuild.sh` as needed. The `README` is updated with details on how to
use this.
@cfallin cfallin changed the title SpiderMonkey CMake package: use inline sub-repository if present rather than fetching artifacts. SpiderMonkey CMake package: use alternate artifacts if specified. Jul 29, 2024
@cfallin
Copy link
Member Author

cfallin commented Jul 29, 2024

Sure thing, updated! This now takes a SPIDERMONKEY_BINARIES environment variable. I've added a section at the end of README.md describing the workflow for developing the engine itself too.

(cc @guybedford I think from #81: this check that Till linked above is checking DEFINED $ENV{VAR}, while CMake seems to require DEFINED ENV{VAR} (at least, that is what worked for me in testing this PR). I don't know enough about the WPT plumbing to test whether the above is doing what you mean but it might be good to verify?)

cfallin added a commit to cfallin/StarlingMonkey that referenced this pull request Jul 29, 2024
This depends on a bunch of pending PRs:

- Stacked on top of bytecodealliance#89 and bytecodealliance#90
- Pulls in spidermonkey-wasi-embedding artifacts from
  bytecodealliance/spidermonkey-wasi-embedding#18 (hash updated, but use
  local checkout variant from bytecodealliance#90 to test before that merges)

When built with:

```
$ mkdir build/; cd build/
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_WASM_OPT=OFF -DWEVAL=ON
$ make
```

This PR will result in a `starling.wasm`, a prebuilt compilation cache
of ICs in `starling-ics.wevalcache` (~1.8MiB), and a `componentize.sh`
that takes a `--aot` option.

I haven't yet quite worked out how to successfully use componentize.sh,
so I can't claim this is end-to-end tested yet, but it is invoking weval
successfully and ICs are wevaled at least.
cfallin added a commit to cfallin/StarlingMonkey that referenced this pull request Jul 29, 2024
(Stacked on top of bytecodealliance#90.)

When built with:

```
$ mkdir build/; cd build/
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_WASM_OPT=OFF -DWEVAL=ON
$ make
```

This PR will result in a `starling.wasm`, a prebuilt compilation cache
of ICs in `starling-ics.wevalcache` (~1.8MiB), and a `componentize.sh`
that takes a `--aot` option.

I haven't yet quite worked out how to successfully use componentize.sh,
so I can't claim this is end-to-end tested yet, but it is invoking weval
successfully and ICs are wevaled at least.
cfallin added a commit to cfallin/StarlingMonkey that referenced this pull request Jul 29, 2024
(Stacked on top of bytecodealliance#90.)

When built with:

```
$ mkdir build/; cd build/
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_WASM_OPT=OFF -DWEVAL=ON
$ make
```

This PR will result in a `starling.wasm`, a prebuilt compilation cache
of ICs in `starling-ics.wevalcache` (~1.8MiB), and a `componentize.sh`
that takes a `--aot` option.

I haven't yet quite worked out how to successfully use componentize.sh,
so I can't claim this is end-to-end tested yet, but it is invoking weval
successfully and ICs are wevaled at least.
@guybedford guybedford merged commit a163c55 into bytecodealliance:main Jul 29, 2024
2 checks passed
cfallin added a commit to cfallin/StarlingMonkey that referenced this pull request Jul 29, 2024
(Stacked on top of bytecodealliance#90.)

When built with:

```
$ mkdir build/; cd build/
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_WASM_OPT=OFF -DWEVAL=ON
$ make
```

This PR will result in a `starling.wasm`, a prebuilt compilation cache
of ICs in `starling-ics.wevalcache` (~1.8MiB), and a `componentize.sh`
that takes a `--aot` option.

I haven't yet quite worked out how to successfully use componentize.sh,
so I can't claim this is end-to-end tested yet, but it is invoking weval
successfully and ICs are wevaled at least.
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.

3 participants