Skip to content

Commit de92aeb

Browse files
committed
Remove CollectRoots
1 parent 19f29e4 commit de92aeb

2 files changed

Lines changed: 6 additions & 28 deletions

File tree

src/plan/lxr/gc_work/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use super::global::LXR;
2+
use crate::plan::lxr::gc_work::rc::{ProcessIncs, EDGE_KIND_ROOT};
23
use crate::plan::tracing::UnsupportedTrace;
34
use crate::scheduler::gc_work::RootKind;
45
use crate::util::ObjectReference;
56
use crate::vm::{RootsWorkFactory, VMBinding};
6-
use crate::MMTK;
7+
use crate::{Plan, MMTK};
78
use std::marker::PhantomData;
89

910
pub mod mature_evac;
@@ -13,8 +14,6 @@ pub mod prepare;
1314
pub mod rc;
1415
pub mod tracing;
1516

16-
use rc::CollectRoots;
17-
1817
/// The [`crate::scheduler::GCWorkContext`] for LXR.
1918
///
2019
/// LXR does not use the generic `Trace`-based closures. Instead it schedules its own custom work
@@ -55,8 +54,10 @@ impl<VM: VMBinding> LXRRootsWorkFactory<VM> {
5554

5655
impl<VM: VMBinding> RootsWorkFactory<VM::VMSlot> for LXRRootsWorkFactory<VM> {
5756
fn create_process_roots_work_with_root_kind(&mut self, slots: Vec<VM::VMSlot>, kind: RootKind) {
58-
let stage = self.mmtk.get_plan().root_scanning_stage();
59-
let w = CollectRoots::new(slots, kind);
57+
let lxr = self.mmtk.get_plan().downcast_ref::<LXR<VM>>().unwrap();
58+
let stage = lxr.root_scanning_stage();
59+
let mut w = ProcessIncs::<_, EDGE_KIND_ROOT>::new(slots, lxr);
60+
w.root_kind = Some(kind);
6061
crate::memory_manager::add_work_packet(self.mmtk, stage, w);
6162
}
6263

src/plan/lxr/gc_work/rc.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -729,26 +729,3 @@ impl<VM: VMBinding> GCWork<VM> for ProcessDecs<VM> {
729729
self.flush(worker);
730730
}
731731
}
732-
733-
pub struct CollectRoots<VM: VMBinding> {
734-
slots: Vec<VM::VMSlot>,
735-
root_kind: RootKind,
736-
}
737-
738-
impl<VM: VMBinding> CollectRoots<VM> {
739-
pub fn new(slots: Vec<VM::VMSlot>, root_kind: RootKind) -> Self {
740-
Self { slots, root_kind }
741-
}
742-
}
743-
744-
impl<VM: VMBinding> GCWork<VM> for CollectRoots<VM> {
745-
fn do_work(&mut self, worker: &mut GCWorker<VM>, mmtk: &'static MMTK<VM>) {
746-
if !self.slots.is_empty() {
747-
let lxr = mmtk.get_plan().downcast_ref::<LXR<VM>>().unwrap();
748-
let roots = std::mem::take(&mut self.slots);
749-
let mut w = ProcessIncs::<_, EDGE_KIND_ROOT>::new(roots, lxr);
750-
w.root_kind = Some(self.root_kind);
751-
GCWork::do_work(&mut w, worker, mmtk)
752-
}
753-
}
754-
}

0 commit comments

Comments
 (0)