Skip to content

Commit 973b6d2

Browse files
authored
Use the new API with Edge trait (#66)
1 parent 4252dd2 commit 973b6d2

File tree

4 files changed

+231
-12
lines changed

4 files changed

+231
-12
lines changed

mmtk/Cargo.lock

Lines changed: 216 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ log = "*"
2727
# - change branch
2828
# - change repo name
2929
# But other changes including adding/removing whitespaces in commented lines may break the CI.
30-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "a96e8f991c91a81df51e7975849441f52fdbcdcc" }
30+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "76131c493be38e421f5fb157f9900f850584554f" }
3131
# Uncomment the following and fix the path to mmtk-core to build locally
3232
# mmtk = { path = "../repos/mmtk-core" }
3333

mmtk/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use std::ptr::null_mut;
1010

1111
use libc::c_void;
1212
use mmtk::util::opaque_pointer::*;
13+
use mmtk::util::Address;
1314
use mmtk::util::ObjectReference;
1415
use mmtk::vm::VMBinding;
1516
use mmtk::MMTKBuilder;
@@ -46,13 +47,21 @@ pub static mut UPCALLS: *const V8_Upcalls = null_mut();
4647
#[derive(Default)]
4748
pub struct V8;
4849

50+
/// The edge type of V8.
51+
///
52+
/// TODO: We start with Address to transition from the old API.
53+
/// We should define an edge type suitable for V8.
54+
pub type V8Edge = Address;
55+
4956
impl VMBinding for V8 {
5057
type VMObjectModel = object_model::VMObjectModel;
5158
type VMScanning = scanning::VMScanning;
5259
type VMCollection = collection::VMCollection;
5360
type VMActivePlan = active_plan::VMActivePlan;
5461
type VMReferenceGlue = reference_glue::VMReferenceGlue;
5562

63+
type VMEdge = V8Edge;
64+
5665
const MAX_ALIGNMENT: usize = 32;
5766
}
5867

mmtk/src/scanning.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ use mmtk::vm::RootsWorkFactory;
55
use mmtk::vm::Scanning;
66
use mmtk::Mutator;
77
use V8;
8+
use V8Edge;
89

910
pub struct VMScanning {}
1011

1112
impl Scanning<V8> for VMScanning {
1213
const SCAN_MUTATORS_IN_SAFEPOINT: bool = false;
1314
const SINGLE_THREAD_MUTATOR_SCANNING: bool = false;
1415

15-
fn scan_object<EV: EdgeVisitor>(
16+
fn scan_object<EV: EdgeVisitor<V8Edge>>(
1617
_tls: VMWorkerThread,
1718
_object: ObjectReference,
1819
_edge_visitor: &mut EV,
@@ -24,19 +25,19 @@ impl Scanning<V8> for VMScanning {
2425
unimplemented!()
2526
}
2627

27-
fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) {
28+
fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory<V8Edge>) {
2829
unimplemented!()
2930
}
3031

3132
fn scan_thread_root(
3233
_tls: VMWorkerThread,
3334
_mutator: &'static mut Mutator<V8>,
34-
_factory: impl RootsWorkFactory,
35+
_factory: impl RootsWorkFactory<V8Edge>,
3536
) {
3637
unimplemented!()
3738
}
3839

39-
fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) {
40+
fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory<V8Edge>) {
4041
unimplemented!()
4142
}
4243

0 commit comments

Comments
 (0)