Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create separate work packet types for object tracing from mod buf #1090

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 3 additions & 5 deletions src/plan/generational/barrier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ use crate::vm::edge_shape::MemorySlice;
use crate::vm::VMBinding;
use crate::MMTK;

use super::gc_work::GenNurseryProcessEdges;
use super::gc_work::ProcessModBuf;
use super::gc_work::ProcessRegionModBuf;
use super::gc_work::*;
use super::global::GenerationalPlanExt;

pub struct GenObjectBarrierSemantics<
Expand Down Expand Up @@ -45,7 +43,7 @@ impl<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>>
let buf = self.modbuf.take();
if !buf.is_empty() {
self.mmtk.scheduler.work_buckets[WorkBucketStage::Closure]
.add(ProcessModBuf::<GenNurseryProcessEdges<VM, P>>::new(buf));
.add(ProcessModBuf::<GenNurseryProcessEdgesFromModBuf<VM, P>>::new(buf));
}
}

Expand All @@ -54,7 +52,7 @@ impl<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>>
if !buf.is_empty() {
debug_assert!(!buf.is_empty());
self.mmtk.scheduler.work_buckets[WorkBucketStage::Closure].add(ProcessRegionModBuf::<
GenNurseryProcessEdges<VM, P>,
GenNurseryProcessEdgesFromRegionModBuf<VM, P>,
>::new(buf));
}
}
Expand Down
51 changes: 51 additions & 0 deletions src/plan/generational/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,57 @@ impl<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>> DerefMut
}
}

macro_rules! wrap_nursery_process_edges_as_new_type {
($ty_name: ident) => {
pub struct $ty_name<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>>(
GenNurseryProcessEdges<VM, P>,
);
impl<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>> ProcessEdgesWork
for $ty_name<VM, P>
{
type VM = <GenNurseryProcessEdges<VM, P> as ProcessEdgesWork>::VM;
type ScanObjectsWorkType =
<GenNurseryProcessEdges<VM, P> as ProcessEdgesWork>::ScanObjectsWorkType;
fn new(
edges: Vec<EdgeOf<Self>>,
roots: bool,
mmtk: &'static MMTK<VM>,
bucket: WorkBucketStage,
) -> Self {
Self(GenNurseryProcessEdges::new(edges, roots, mmtk, bucket))
}
fn trace_object(&mut self, object: ObjectReference) -> ObjectReference {
self.0.trace_object(object)
}
fn process_edge(&mut self, slot: EdgeOf<Self>) {
self.0.process_edge(slot)
}

fn create_scan_work(&self, nodes: Vec<ObjectReference>) -> Self::ScanObjectsWorkType {
self.0.create_scan_work(nodes)
}
}
impl<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>> Deref
for $ty_name<VM, P>
{
type Target = ProcessEdgesBase<VM>;
fn deref(&self) -> &Self::Target {
self.0.deref()
}
}
impl<VM: VMBinding, P: GenerationalPlanExt<VM> + PlanTraceObject<VM>> DerefMut
for $ty_name<VM, P>
{
fn deref_mut(&mut self) -> &mut Self::Target {
self.0.deref_mut()
}
}
};
}

wrap_nursery_process_edges_as_new_type!(GenNurseryProcessEdgesFromModBuf);
wrap_nursery_process_edges_as_new_type!(GenNurseryProcessEdgesFromRegionModBuf);

/// The modbuf contains a list of objects in mature space(s) that
/// may contain pointers to the nursery space.
/// This work packet scans the recorded objects and forwards pointers if necessary.
Expand Down
Loading