-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back
DummyVM
as a part of the porting guide. Minor changes to M…
…MTk initialization in the porting guide. (#1142) Following the discussion here: https://mmtk.zulipchat.com/#narrow/stream/315620-Porting/topic/Porting.20MMTK.20to.20Clasp.20Common.20Lisp/near/442123897. It is useful for the language implementers to have a Rust binding crate that implements all the boilerplate code and can compile to start with. This PR adds back `DummyVM` to the porting guide, and includes some minor changes to the porting guide. --------- Co-authored-by: Kunal Sareen <[email protected]> Co-authored-by: Kunshan Wang <[email protected]>
- Loading branch information
1 parent
a9b619a
commit 401803c
Showing
15 changed files
with
690 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,4 @@ style_check_auxiliary_crate() { | |
} | ||
|
||
style_check_auxiliary_crate macros | ||
style_check_auxiliary_crate docs/dummyvm |
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,28 @@ | ||
[package] | ||
name = "mmtk_dummyvm" | ||
version = "0.0.1" | ||
authors = [" <>"] | ||
edition = "2021" | ||
|
||
[lib] | ||
name = "mmtk_dummyvm" | ||
# be careful - LTO is only allowed for certain crate types | ||
# We know that cdylib should work for LTO. | ||
crate-type = ["cdylib"] | ||
|
||
[profile.release] | ||
lto = true | ||
|
||
[dependencies] | ||
# We use a local path as the MMTk dependency here, as we want to test the code with the current version. | ||
# Generally for a binding, you would like to use a specific version, or a git commit. | ||
# mmtk = "0.25.0" | ||
# mmtk = { git = "https://github.com/mmtk/mmtk-core.git", branch = "master" } | ||
mmtk = { path = "../../." } | ||
libc = "0.2" | ||
atomic = "0.6" | ||
|
||
[features] | ||
default = [] | ||
is_mmtk_object = ["mmtk/is_mmtk_object"] | ||
malloc_counted_size = ["mmtk/malloc_counted_size"] |
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,7 @@ | ||
An example of MMTk/Rust-side Binding Implementation | ||
=== | ||
|
||
A binding needs to implement certain Rust traits and may need to expose MMTk's Rust API to native code. | ||
This Rust crate illustrates a minimal example of what needs to be implemented on the binding side in Rust. | ||
When starting a new port of MMTk, developers can use this crate as a starting point by directly copying | ||
it to their port. For more details, see [the porting guide](https://docs.mmtk.io/portingguide/howto/nogc.html#set-up). |
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,26 @@ | ||
use crate::DummyVM; | ||
use mmtk::util::opaque_pointer::*; | ||
use mmtk::vm::ActivePlan; | ||
use mmtk::Mutator; | ||
|
||
pub struct VMActivePlan {} | ||
|
||
// Documentation: https://docs.mmtk.io/api/mmtk/vm/active_plan/trait.ActivePlan.html | ||
impl ActivePlan<DummyVM> for VMActivePlan { | ||
fn number_of_mutators() -> usize { | ||
unimplemented!() | ||
} | ||
|
||
fn is_mutator(_tls: VMThread) -> bool { | ||
// FIXME: Properly check if the thread is a mutator | ||
true | ||
} | ||
|
||
fn mutator(_tls: VMMutatorThread) -> &'static mut Mutator<DummyVM> { | ||
unimplemented!() | ||
} | ||
|
||
fn mutators<'a>() -> Box<dyn Iterator<Item = &'a mut Mutator<DummyVM>> + 'a> { | ||
unimplemented!() | ||
} | ||
} |
Oops, something went wrong.