Skip to content

Commit

Permalink
Fix sanity GC
Browse files Browse the repository at this point in the history
  • Loading branch information
qinsoon committed Jan 30, 2024
1 parent 42754a5 commit c9df2cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
6 changes: 5 additions & 1 deletion src/scheduler/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,11 @@ impl<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceObject<E::VM>> GCWork<E
/// but creates the work to scan these objects using E. This is necessary to guarantee that these objects do not move
/// (`I` should trace them without moving) as we do not have the information about the edges pointing to them.
struct ProcessRootNode<VM: VMBinding, I: ProcessEdgesWork<VM = VM>, E: ProcessEdgesWork<VM = VM>> {
pub(crate) struct ProcessRootNode<
VM: VMBinding,
I: ProcessEdgesWork<VM = VM>,
E: ProcessEdgesWork<VM = VM>,
> {
phantom: PhantomData<(VM, I, E)>,
roots: Vec<ObjectReference>,
bucket: WorkBucketStage,
Expand Down
22 changes: 3 additions & 19 deletions src/util/sanity/sanity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ impl<P: Plan> GCWork<P::VM> for ScheduleSanityGC<P> {
);
}
for roots in &sanity_checker.root_nodes {
scheduler.work_buckets[WorkBucketStage::Closure].add(ScanObjects::<
scheduler.work_buckets[WorkBucketStage::Closure].add(ProcessRootNode::<
P::VM,
SanityGCProcessEdges<P::VM>,
SanityGCProcessEdges<P::VM>,
>::new(
roots.clone(),
false,
true,
WorkBucketStage::Closure,
));
}
Expand Down Expand Up @@ -132,14 +132,6 @@ impl<P: Plan> GCWork<P::VM> for SanityPrepare<P> {
let mut sanity_checker = mmtk.sanity_checker.lock().unwrap();
sanity_checker.refs.clear();
}
for mutator in <P::VM as VMBinding>::VMActivePlan::mutators() {
mmtk.scheduler.work_buckets[WorkBucketStage::Prepare]
.add(PrepareMutator::<P::VM>::new(mutator));
}
for w in &mmtk.scheduler.worker_group.workers_shared {
let result = w.designated_work.push(Box::new(PrepareCollector));
debug_assert!(result.is_ok());
}
}
}

Expand All @@ -157,14 +149,6 @@ impl<P: Plan> GCWork<P::VM> for SanityRelease<P> {
fn do_work(&mut self, _worker: &mut GCWorker<P::VM>, mmtk: &'static MMTK<P::VM>) {
info!("Sanity GC release");
mmtk.sanity_checker.lock().unwrap().clear_roots_cache();
for mutator in <P::VM as VMBinding>::VMActivePlan::mutators() {
mmtk.scheduler.work_buckets[WorkBucketStage::Release]
.add(ReleaseMutator::<P::VM>::new(mutator));
}
for w in &mmtk.scheduler.worker_group.workers_shared {
let result = w.designated_work.push(Box::new(ReleaseCollector));
debug_assert!(result.is_ok());
}
mmtk.sanity_end();
}
}
Expand Down

0 comments on commit c9df2cf

Please sign in to comment.