Skip to content

Commit

Permalink
Use the new API with Edge trait (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
wks authored Aug 29, 2022
1 parent 4252dd2 commit 973b6d2
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 12 deletions.
223 changes: 216 additions & 7 deletions mmtk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ log = "*"
# - change branch
# - change repo name
# But other changes including adding/removing whitespaces in commented lines may break the CI.
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "a96e8f991c91a81df51e7975849441f52fdbcdcc" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "76131c493be38e421f5fb157f9900f850584554f" }
# Uncomment the following and fix the path to mmtk-core to build locally
# mmtk = { path = "../repos/mmtk-core" }

Expand Down
9 changes: 9 additions & 0 deletions mmtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::ptr::null_mut;

use libc::c_void;
use mmtk::util::opaque_pointer::*;
use mmtk::util::Address;
use mmtk::util::ObjectReference;
use mmtk::vm::VMBinding;
use mmtk::MMTKBuilder;
Expand Down Expand Up @@ -46,13 +47,21 @@ pub static mut UPCALLS: *const V8_Upcalls = null_mut();
#[derive(Default)]
pub struct V8;

/// The edge type of V8.
///
/// TODO: We start with Address to transition from the old API.
/// We should define an edge type suitable for V8.
pub type V8Edge = Address;

impl VMBinding for V8 {
type VMObjectModel = object_model::VMObjectModel;
type VMScanning = scanning::VMScanning;
type VMCollection = collection::VMCollection;
type VMActivePlan = active_plan::VMActivePlan;
type VMReferenceGlue = reference_glue::VMReferenceGlue;

type VMEdge = V8Edge;

const MAX_ALIGNMENT: usize = 32;
}

Expand Down
9 changes: 5 additions & 4 deletions mmtk/src/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ use mmtk::vm::RootsWorkFactory;
use mmtk::vm::Scanning;
use mmtk::Mutator;
use V8;
use V8Edge;

pub struct VMScanning {}

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

fn scan_object<EV: EdgeVisitor>(
fn scan_object<EV: EdgeVisitor<V8Edge>>(
_tls: VMWorkerThread,
_object: ObjectReference,
_edge_visitor: &mut EV,
Expand All @@ -24,19 +25,19 @@ impl Scanning<V8> for VMScanning {
unimplemented!()
}

fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) {
fn scan_thread_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory<V8Edge>) {
unimplemented!()
}

fn scan_thread_root(
_tls: VMWorkerThread,
_mutator: &'static mut Mutator<V8>,
_factory: impl RootsWorkFactory,
_factory: impl RootsWorkFactory<V8Edge>,
) {
unimplemented!()
}

fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory) {
fn scan_vm_specific_roots(_tls: VMWorkerThread, _factory: impl RootsWorkFactory<V8Edge>) {
unimplemented!()
}

Expand Down

0 comments on commit 973b6d2

Please sign in to comment.