@@ -177,8 +177,6 @@ impl<VM: VMBinding> GCWork<VM> for ReleaseCollector {
177177
178178/// Stop all mutators
179179///
180- /// Schedule a `ScanStackRoots` immediately after a mutator is paused
181- ///
182180/// TODO: Smaller work granularity
183181#[ derive( Default ) ]
184182pub struct StopMutators < ScanEdges : ProcessEdgesWork > ( PhantomData < ScanEdges > ) ;
@@ -194,33 +192,13 @@ impl<E: ProcessEdgesWork> GCWork<E::VM> for StopMutators<E> {
194192 trace ! ( "stop_all_mutators start" ) ;
195193 mmtk. plan . base ( ) . prepare_for_stack_scanning ( ) ;
196194 <E :: VM as VMBinding >:: VMCollection :: stop_all_mutators ( worker. tls , |mutator| {
197- mmtk. scheduler . work_buckets [ WorkBucketStage :: Prepare ] . add ( ScanStackRoot :: < E > ( mutator) ) ;
195+ // TODO: The stack scanning work won't start immediately, as the `Prepare` bucket is not opened yet (the bucket is opened in notify_mutators_paused).
196+ // Should we push to Unconstrained instead?
197+ mmtk. scheduler . work_buckets [ WorkBucketStage :: Prepare ]
198+ . add ( ScanMutatorRoots :: < E > ( mutator) ) ;
198199 } ) ;
199200 trace ! ( "stop_all_mutators end" ) ;
200201 mmtk. scheduler . notify_mutators_paused ( mmtk) ;
201- if <E :: VM as VMBinding >:: VMScanning :: SCAN_MUTATORS_IN_SAFEPOINT {
202- // Prepare mutators if necessary
203- // FIXME: This test is probably redundant. JikesRVM requires to call `prepare_mutator` once after mutators are paused
204- if !mmtk. plan . base ( ) . stacks_prepared ( ) {
205- for mutator in <E :: VM as VMBinding >:: VMActivePlan :: mutators ( ) {
206- <E :: VM as VMBinding >:: VMCollection :: prepare_mutator (
207- worker. tls ,
208- mutator. get_tls ( ) ,
209- mutator,
210- ) ;
211- }
212- }
213- // Scan mutators
214- if <E :: VM as VMBinding >:: VMScanning :: SINGLE_THREAD_MUTATOR_SCANNING {
215- mmtk. scheduler . work_buckets [ WorkBucketStage :: Prepare ]
216- . add ( ScanStackRoots :: < E > :: new ( ) ) ;
217- } else {
218- for mutator in <E :: VM as VMBinding >:: VMActivePlan :: mutators ( ) {
219- mmtk. scheduler . work_buckets [ WorkBucketStage :: Prepare ]
220- . add ( ScanStackRoot :: < E > ( mutator) ) ;
221- }
222- }
223- }
224202 mmtk. scheduler . work_buckets [ WorkBucketStage :: Prepare ] . add ( ScanVMSpecificRoots :: < E > :: new ( ) ) ;
225203 }
226204}
@@ -465,33 +443,11 @@ impl<VM: VMBinding> GCWork<VM> for VMPostForwarding<VM> {
465443 }
466444}
467445
468- #[ derive( Default ) ]
469- pub struct ScanStackRoots < Edges : ProcessEdgesWork > ( PhantomData < Edges > ) ;
470-
471- impl < E : ProcessEdgesWork > ScanStackRoots < E > {
472- pub fn new ( ) -> Self {
473- Self ( PhantomData )
474- }
475- }
476-
477- impl < E : ProcessEdgesWork > GCWork < E :: VM > for ScanStackRoots < E > {
478- fn do_work ( & mut self , worker : & mut GCWorker < E :: VM > , mmtk : & ' static MMTK < E :: VM > ) {
479- trace ! ( "ScanStackRoots" ) ;
480- let factory = ProcessEdgesWorkRootsWorkFactory :: < E > :: new ( mmtk) ;
481- <E :: VM as VMBinding >:: VMScanning :: scan_roots_in_all_mutator_threads ( worker. tls , factory) ;
482- <E :: VM as VMBinding >:: VMScanning :: notify_initial_thread_scan_complete ( false , worker. tls ) ;
483- for mutator in <E :: VM as VMBinding >:: VMActivePlan :: mutators ( ) {
484- mutator. flush ( ) ;
485- }
486- mmtk. plan . common ( ) . base . set_gc_status ( GcStatus :: GcProper ) ;
487- }
488- }
489-
490- pub struct ScanStackRoot < Edges : ProcessEdgesWork > ( pub & ' static mut Mutator < Edges :: VM > ) ;
446+ pub struct ScanMutatorRoots < Edges : ProcessEdgesWork > ( pub & ' static mut Mutator < Edges :: VM > ) ;
491447
492- impl < E : ProcessEdgesWork > GCWork < E :: VM > for ScanStackRoot < E > {
448+ impl < E : ProcessEdgesWork > GCWork < E :: VM > for ScanMutatorRoots < E > {
493449 fn do_work ( & mut self , worker : & mut GCWorker < E :: VM > , mmtk : & ' static MMTK < E :: VM > ) {
494- trace ! ( "ScanStackRoot for mutator {:?}" , self . 0 . get_tls( ) ) ;
450+ trace ! ( "ScanMutatorRoots for mutator {:?}" , self . 0 . get_tls( ) ) ;
495451 let base = & mmtk. plan . base ( ) ;
496452 let mutators = <E :: VM as VMBinding >:: VMActivePlan :: number_of_mutators ( ) ;
497453 let factory = ProcessEdgesWorkRootsWorkFactory :: < E > :: new ( mmtk) ;
0 commit comments