Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/tutorial/code/mygc_semispace/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub struct MyGCProcessEdges<VM: VMBinding> {
// ANCHOR: mygc_process_edges_impl
impl<VM:VMBinding> ProcessEdgesWork for MyGCProcessEdges<VM> {
type VM = VM;
type ScanObjectsWorkType = ScanObjects<Self>;

fn new(edges: Vec<Address>, roots: bool, mmtk: &'static MMTK<VM>) -> Self {
let base = ProcessEdgesBase::new(edges, roots, mmtk);
let plan = base.plan().downcast_ref::<MyGC<VM>>().unwrap();
Expand Down Expand Up @@ -71,6 +73,11 @@ impl<VM:VMBinding> ProcessEdgesWork for MyGCProcessEdges<VM> {
self.plan.common.trace_object(queue, object, worker)
}
}

#[inline(always)]
fn create_scan_work(&self, nodes: Vec<ObjectReference>, roots: bool) -> ScanObjects<Self> {
ScanObjects::<Self>::new(nodes, false, roots)
}
}
// ANCHOR_END: mygc_process_edges_impl

Expand Down
6 changes: 6 additions & 0 deletions src/plan/generational/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct GenNurseryProcessEdges<VM: VMBinding> {

impl<VM: VMBinding> ProcessEdgesWork for GenNurseryProcessEdges<VM> {
type VM = VM;
type ScanObjectsWorkType = ScanObjects<Self>;

fn new(edges: Vec<Address>, roots: bool, mmtk: &'static MMTK<VM>) -> Self {
let base = ProcessEdgesBase::new(edges, roots, mmtk);
Expand All @@ -39,6 +40,11 @@ impl<VM: VMBinding> ProcessEdgesWork for GenNurseryProcessEdges<VM> {
debug_assert!(!self.gen.nursery.in_space(new_object));
unsafe { slot.store(new_object) };
}

#[inline(always)]
fn create_scan_work(&self, nodes: Vec<ObjectReference>, roots: bool) -> ScanObjects<Self> {
ScanObjects::<Self>::new(nodes, false, roots)
}
}

impl<VM: VMBinding> Deref for GenNurseryProcessEdges<VM> {
Expand Down
Loading