Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implements the current garbage collector in Rust. No changes were made to the GC design -- it's just ports the one implemented in code generator to Rust. The goals are: - Evaluate Rust for Motoko's RTS implementation - Make the collector easier to read, understand, modify, and extend. Currently passes the tests locally. We can't run this branch on CI yet as it needs to download rustc nightly and xargo and the domains are not allowed on the CI. I think in the final version we'll have to build rustc outselves instead of downloading. (Nightly rustc is needed as "core" distributed with rustc is not built with PIC relocation model on wam32, so we can't use it to generate a shared wasm32 library) Main changes: - New Rust crate "motoko-rts" introduced, which currently implements the garbage collector. It also has some utilities for printing the heap or individual objects, to be used when debugging. - Nix files updated to download rustc and xargo. These are used to build Rust's "core" library with PIC relocation model for wasm32. - We no longer build memset and memcpy of musl as those are provided by Rust's "core" now. The main algorithm is in `gc.rs`. Rest of the Rust files are helpers, mainly for debugging. Other changes: - I had to update lots of ic-ref-run outputs. See #1854 for the details. Remaining work and issues: - Figure out how to use rustc nightly (with PIC wasm32 libraries) in CI. Note to reviewers: - The main algorithm is in `gc.rs`, everything else is helpers. Start reading from `gc.rs`.
- Loading branch information