Skip to content

Commit 96855d2

Browse files
Javad Amiriqinsoon
andauthored
README updated (#154)
* Update README.md for release-0.1 Co-authored-by: Yi Lin <[email protected]>
1 parent 72dc4f3 commit 96855d2

File tree

1 file changed

+72
-26
lines changed

1 file changed

+72
-26
lines changed

README.md

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,90 @@
11
# MMTk
22

33
MMTk is a framework for the design and implementation of memory managers.
4-
This repo hosts the Rust port of MMTk.
4+
This repository hosts the Rust port of MMTk.
5+
6+
## Contents
7+
8+
* [Requirements](#requirements)
9+
* [Build](#build)
10+
* [Usage](#Usage)
11+
* [Tests](#tests)
12+
13+
## Requirements
14+
15+
We maintain an up to date list of the prerequisite for building MMTk and its bindings in the [mmtk-dev-env](https://github.com/mmtk/mmtk-dev-env) repository.
516

617
## Build
7-
```bash
8-
cargo +nightly build --no-default-features --features <space seperated features>
18+
19+
Building MMTk requires a nightly Rust toolchain.
20+
As the Rust language and its libraries (crates) are frequently evolving, we recommend using the nightly toolchain specified in the [mmtk-dev-env](https://github.com/mmtk/mmtk-dev-env).
21+
22+
```console
23+
$ # replace nightly-YYYY-MM-DD with the toolchain version specified in mmtk-dev
24+
$ Export RUSTUP_TOOLCHAIN=nightly-YYYY-MM-DD
25+
26+
$ cargo build --features <space separated features>
927
```
1028

11-
The available features can be seen by examining `Cargo.toml`.
12-
Currently, there are two different VMs to choose from (JikesRVM and OpenJDK),
13-
and there are three different plans to choose from (NoGC, SemiSpace and G1).
29+
You must specify a GC plan as a feature at build time.
30+
Currently, there are two different plans to choose from:
31+
32+
* `--features nogc` for NoGC, and
33+
* `--features semispace` for SemiSpace.
34+
35+
A full list of available features can be seen by examining [`Cargo.toml`](Cargo.toml).
1436
By passing the `--features` flag to the Rust compiler,
15-
we conditionally compile VM or plan specific code.
16-
You can optionally enable sanity checks by add `sanity` to the set of features
37+
we conditionally compile plan-specific code.
38+
You can optionally enable sanity checks by adding `sanity` to the set of features
1739
you want to use.
1840

1941
You can pass the `--release` flag to the `cargo build` command to use the
2042
optimizing compiler of Rust for better performance.
2143

22-
Cross compilation can be done by using the `--target` flag.
23-
2444
The artefact produced produced by the build process can be found under
25-
`target/debug` (or `target/release` for release build).
45+
`target/debug` (or `target/release` for the release build).
46+
47+
[`ci-build.sh`](.github/scripts/ci-build.sh) shows the builds we builds tested by the CI.
2648

2749
## Usage
28-
The API exposed by MMTk can be found under `api/mmtk.h`.
29-
A client of the memory manager can use MMTk like a C library in the standard way.
30-
A simple example client that uses MMTk for just allocation can be found under
31-
`examples/main.c`.
50+
51+
MMTk does not run standalone. You would need to integrate MMTk with a language implementation. You can either try out one of the VM bindings we have been working on, or implement your own binding in your VM for MMTk.
52+
53+
### Try out our current bindings
54+
55+
We maintain three VM bindings for MMTk. These bindings are accessible in the following repositories:
56+
57+
* [OpenJDK](https://github.com/mmtk/mmtk-openjdk),
58+
* [JikesRVM](https://github.com/mmtk/mmtk-jikesrvm),
59+
* [V8](https://github.com/mmtk/mmtk-v8).
60+
61+
For more information on these bindings, please visit their repositories.
62+
63+
### Implement your binding
64+
65+
MMTk provides a bi-directional interface with the language VM.
66+
67+
1. MMTk exposes a set of [APIs](src/mm/memory_manager.rs). The language VM can call into MMTk by using those APIs.
68+
2. MMTk provides a trait [`VMBinding`](src/vm/mod.rs) that each language VM must implement. MMTk use `VMBinding` to call into the VM.
69+
70+
To integrate MMTk with your language implementation, you need to provide an implementation of `VMBinding`, and
71+
you can optionally call MMTk's API for your needs.
3272

3373
## Tests
34-
The Rust unit tests can be found under `tests`.
35-
Currently,
36-
the CI will run all the Rust unit tests.
37-
The CI will also build both the 32-bit and 64-bit versions of MMTk for each plan
38-
to test the `alloc` function.
39-
40-
## VM specific notes
41-
### JikesRVM
42-
Please DO NOT build MMTk manually,
43-
as machine generated code is involved during the build process (e.g. `src/vm/jikesrvm/entrypoint.rs` and `src/vm/jikesrvm/inc.asm`).
44-
Instead, please invoke the `buildit` script from JikesRVM.
74+
75+
We use both unit tests and VM binding tests to test MMTk in the CI.
76+
77+
### Unit tests
78+
79+
MMTk uses Rust's testing framework for unit tests. For example, you can use the following to run unit tests for the `nogc` plan.
80+
81+
```console
82+
$ cargo test --features nogc
83+
```
84+
85+
A full list of all the unit tests we run in our CI can be found [here](.github/scripts/ci-test.sh).
86+
87+
### VM binding tests
88+
89+
MMTk is also tested with the VM bindings we are maintaining by running standard test/benchmark suites for the VMs.
90+
For details, please refer to each VM binding repository.

0 commit comments

Comments
 (0)