From f4bdc9fc4ff736f797551386000d3dcfee54d063 Mon Sep 17 00:00:00 2001 From: Yi Lin Date: Mon, 8 May 2023 02:20:09 +0000 Subject: [PATCH] Do not cache roots for sanity if we are already in sanity. Do not schedule VM specific roots work for sanity. Reset edge logger before sanity GC. --- src/scheduler/gc_work.rs | 4 ++-- src/util/sanity/sanity_checker.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/scheduler/gc_work.rs b/src/scheduler/gc_work.rs index 2fb579c5f4..0a05608fe7 100644 --- a/src/scheduler/gc_work.rs +++ b/src/scheduler/gc_work.rs @@ -645,7 +645,7 @@ impl GCWork for E { self.flush(); } #[cfg(feature = "sanity")] - if self.roots { + if self.roots && !_mmtk.plan.is_in_sanity() { self.cache_roots_for_sanity_gc(); } trace!("ProcessEdgesWork End"); @@ -765,7 +765,7 @@ pub trait ScanObjectsWork: GCWork + Sized { #[cfg(feature = "sanity")] { - if self.roots() { + if self.roots() && !mmtk.plan.is_in_sanity() { mmtk.sanity_checker .lock() .unwrap() diff --git a/src/util/sanity/sanity_checker.rs b/src/util/sanity/sanity_checker.rs index 976ddf239b..f3853e7c38 100644 --- a/src/util/sanity/sanity_checker.rs +++ b/src/util/sanity/sanity_checker.rs @@ -67,6 +67,10 @@ impl GCWork for ScheduleSanityGC

{ scheduler.reset_state(); + // We are going to do sanity GC which will traverse the object graph again. Reset edge logger to clear recorded edges. + #[cfg(feature = "extreme_assertions")] + mmtk.edge_logger.reset(); + plan.base().inside_sanity.store(true, Ordering::SeqCst); // Stop & scan mutators (mutator scanning can happen before STW) @@ -96,8 +100,6 @@ impl GCWork for ScheduleSanityGC

{ )); } } - scheduler.work_buckets[WorkBucketStage::Prepare] - .add(ScanVMSpecificRoots::>::new()); // Prepare global/collectors/mutators worker.scheduler().work_buckets[WorkBucketStage::Prepare] .add(SanityPrepare::

::new(plan.downcast_ref::

().unwrap()));