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

Add Rust bindings for the runtime and the SpiderMonkey engines #103

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tschneidereit
Copy link
Member

This PR introduces rust-bindgen generated bindings for the StarlingMonkey runtime itself, as well as generated bindings and higher-level abstractions building on those for the SpiderMonkey engine.

The latter are derived from the Servo project's mozjs crate and share much of the code. The build system is substantially overhauled though to enable direct use of the Bytecode Alliance's fork of the repository containing SpiderMonkey, instead of having to update tarball based source code drops.

To ensure compliance with mozjs's license and easy code movement between files, all Rust code in the core runtime is licensed under the MPL2 instead of the Bytecode Alliance's default Apache 2.0 with LLVM exceptions. At the board meeting on 2024-07-25, the BA's board approved a license exception to permit use of the MPL2 for part or all of the StarlingMonkey project, as required by our IP policy.

@tschneidereit
Copy link
Member Author

Note that this is a draft for now, because there's some build system wrangling still required to make it not just Work On My Machine™️, because documentation is entirely absent, and because after the latest SpiderMonkey upgrade things don't entirely work: compilation and linking work just fine, but the componentization step fails with the message error: updating metadata for section component-type:bindings.

This commit includes updates of various tools used for building and testing StarlingMonkey:
- Binaryen
- Corrosion CMake Cargo integration
- wasm-tools
- Wasmtime
- Wizer

No changes in behavior should occur as a result of these updates.
…mpiling multiple crates to static libs and trying to link all of them into the final binary

This also replaces linking SpiderMonkey's Rust static library with including the required crates into our own library, achieving an end result of having a single static Rust library to link.
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