@@ -7,20 +7,15 @@ use crate::plan::AllocationSemantics;
7
7
use crate :: plan:: Plan ;
8
8
use crate :: plan:: PlanConstraints ;
9
9
use crate :: policy:: space:: Space ;
10
- use crate :: scheduler:: gc_work:: * ;
11
10
use crate :: scheduler:: * ;
12
11
use crate :: util:: alloc:: allocators:: AllocatorSelector ;
13
- #[ cfg( feature = "analysis" ) ]
14
- use crate :: util:: analysis:: GcHookWork ;
15
12
use crate :: util:: heap:: layout:: heap_layout:: Mmapper ;
16
13
use crate :: util:: heap:: layout:: heap_layout:: VMMap ;
17
14
use crate :: util:: heap:: layout:: vm_layout_constants:: { HEAP_END , HEAP_START } ;
18
15
use crate :: util:: heap:: HeapMeta ;
19
16
use crate :: util:: metadata:: side_metadata:: SideMetadataContext ;
20
17
use crate :: util:: metadata:: side_metadata:: SideMetadataSanity ;
21
18
use crate :: util:: options:: UnsafeOptionsWrapper ;
22
- #[ cfg( feature = "sanity" ) ]
23
- use crate :: util:: sanity:: sanity_checker:: * ;
24
19
use crate :: vm:: VMBinding ;
25
20
use crate :: { mmtk:: MMTK , policy:: immix:: ImmixSpace , util:: opaque_pointer:: VMWorkerThread } ;
26
21
use std:: sync:: atomic:: AtomicBool ;
@@ -92,45 +87,16 @@ impl<VM: VMBinding> Plan for Immix<VM> {
92
87
self . base ( ) . is_user_triggered_collection ( ) ,
93
88
self . base ( ) . options . full_heap_system_gc ,
94
89
) ;
95
- // Stop & scan mutators (mutator scanning can happen before STW)
96
- // The blocks are not identical, clippy is wrong. Probably it does not recognize the constant type parameter.
97
- #[ allow( clippy:: if_same_then_else) ]
98
- // The two StopMutators have different types parameters, thus we cannot extract the common code before add().
99
- #[ allow( clippy:: branches_sharing_code) ]
100
- if in_defrag {
101
- scheduler. work_buckets [ WorkBucketStage :: Unconstrained ]
102
- . add ( StopMutators :: < ImmixProcessEdges < VM , { TraceKind :: Defrag } > > :: new ( ) ) ;
103
- } else {
104
- scheduler. work_buckets [ WorkBucketStage :: Unconstrained ]
105
- . add ( StopMutators :: < ImmixProcessEdges < VM , { TraceKind :: Fast } > > :: new ( ) ) ;
106
- }
107
- // Prepare global/collectors/mutators
108
- scheduler. work_buckets [ WorkBucketStage :: Prepare ]
109
- . add ( Prepare :: < Self , ImmixCopyContext < VM > > :: new ( self ) ) ;
90
+
110
91
// The blocks are not identical, clippy is wrong. Probably it does not recognize the constant type parameter.
111
92
#[ allow( clippy:: if_same_then_else) ]
112
- // The two StopMutators have different types parameters, thus we cannot extract the common code before add().
113
- #[ allow( clippy:: branches_sharing_code) ]
114
93
if in_defrag {
115
- scheduler. work_buckets [ WorkBucketStage :: RefClosure ] . add ( ProcessWeakRefs :: <
116
- ImmixProcessEdges < VM , { TraceKind :: Defrag } > ,
117
- > :: new ( ) ) ;
94
+ self . common ( )
95
+ . schedule_common :: < Self , ImmixProcessEdges < VM , { TraceKind :: Defrag } > , ImmixCopyContext < VM > > ( self , & IMMIX_CONSTRAINTS , scheduler) ;
118
96
} else {
119
- scheduler . work_buckets [ WorkBucketStage :: RefClosure ]
120
- . add ( ProcessWeakRefs :: < ImmixProcessEdges < VM , { TraceKind :: Fast } > > :: new ( ) ) ;
97
+ self . common ( )
98
+ . schedule_common :: < Self , ImmixProcessEdges < VM , { TraceKind :: Fast } > , ImmixCopyContext < VM > > ( self , & IMMIX_CONSTRAINTS , scheduler ) ;
121
99
}
122
- // Release global/collectors/mutators
123
- scheduler. work_buckets [ WorkBucketStage :: Release ]
124
- . add ( Release :: < Self , ImmixCopyContext < VM > > :: new ( self ) ) ;
125
- // Analysis routine that is ran. It is generally recommended to take advantage
126
- // of the scheduling system we have in place for more performance
127
- #[ cfg( feature = "analysis" ) ]
128
- scheduler. work_buckets [ WorkBucketStage :: Unconstrained ] . add ( GcHookWork ) ;
129
- // Resume mutators
130
- #[ cfg( feature = "sanity" ) ]
131
- scheduler. work_buckets [ WorkBucketStage :: Final ]
132
- . add ( ScheduleSanityGC :: < Self , ImmixCopyContext < VM > > :: new ( self ) ) ;
133
- scheduler. set_finalizer ( Some ( EndOfGC ) ) ;
134
100
}
135
101
136
102
fn get_allocator_mapping ( & self ) -> & ' static EnumMap < AllocationSemantics , AllocatorSelector > {
0 commit comments