-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support weval-based ahead-of-time compilation of JavaScript. (#91)
* Support weval-based ahead-of-time compilation of JavaScript. When the `WEVAL` option is turned on (`cmake -DWEVAL=ON`), this PR adds: - Integration to the CMake machinery to fetch a PBL+weval-ified version of SpiderMonkey artifacts; - Likewise, to fetch weval binaries; - A rule to pre-build a compilation cache of IC bodies specific to the StarlingMonkey build, so weval can use this cache and spend time only on user-provided code on first run; - Integration in `componentize.sh`. When built with: ``` $ mkdir build/; cd build/ $ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_WASM_OPT=OFF -DWEVAL=ON $ make ``` We can then do: ``` $ build/componentize.sh file.js --aot -o file.wasm $ wasmtime serve -S cli=y file.wasm ``` Using the Richards Octane benchmark adapted slightly with a `main()` for the HTTP server world [1], I get the following results: ``` % build/componentize.sh richards.js --aot -o weval.wasm Componentizing richards.js into weval.wasm [ verbose weval progress output ] % wasmtime serve -S cli=y weval.wasm Serving HTTP on http://0.0.0.0:8080/ stdout [0] :: Log: Richards: 676 stdout [0] :: Log: ---- stdout [0] :: Log: Score (version 9): 676 % wasmtime serve -S cli=y base.wasm Serving HTTP on http://0.0.0.0:8080/ stdout [0] :: Log: Richards: 189 stdout [0] :: Log: ---- stdout [0] :: Log: Score (version 9): 189 ``` [1]: https://gist.github.com/cfallin/4b18da12413e93f7e88568a92d09e4b7 * support weval testing * add ci workflow for Weval test suite * Update weval, resolving two test failures. This commit updates to weval v0.2.7 which has no output by default, allowing the expected-failure tests checking syntax error messages to pass; we now pass 9/10 integration tests. It also updates the flags on `componentize.sh`: a `--verbose` flag to allow the user to see weval progress messages (perhaps useful if the build is taking a long time, or to see the stats on function specializations); and removal of the `--aot` flag, because there is only one valid setting for a build configuration and it is not baked into the shell script automatically. * Update SpiderMonkey version to include two fixes (bytecodealliance/spidermonkey-wasi-embedding#19). --------- Co-authored-by: Guy Bedford <[email protected]>
- Loading branch information
1 parent
1a1dc3d
commit f7e2745
Showing
9 changed files
with
101 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(WEVAL_VERSION v0.2.7) | ||
|
||
set(WEVAL_URL https://github.com/cfallin/weval/releases/download/${WEVAL_VERSION}/weval-${WEVAL_VERSION}-${HOST_ARCH}-${HOST_OS}.tar.xz) | ||
CPMAddPackage(NAME weval URL ${WEVAL_URL} DOWNLOAD_ONLY TRUE) | ||
set(WEVAL_DIR ${CPM_PACKAGE_weval_SOURCE_DIR}) | ||
set(WEVAL_BIN ${WEVAL_DIR}/weval) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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