@@ -302,7 +302,7 @@ impl<E: ProcessEdgesWork> ProcessEdgesWorkTracer<E> {
302
302
fn flush ( & mut self ) {
303
303
let next_nodes = self . process_edges_work . pop_nodes ( ) ;
304
304
assert ! ( !next_nodes. is_empty( ) ) ;
305
- let work_packet = self . process_edges_work . create_scan_work ( next_nodes, false ) ;
305
+ let work_packet = self . process_edges_work . create_scan_work ( next_nodes) ;
306
306
let worker = self . process_edges_work . worker ( ) ;
307
307
worker. scheduler ( ) . work_buckets [ self . stage ] . add ( work_packet) ;
308
308
}
@@ -647,18 +647,14 @@ pub trait ProcessEdgesWork:
647
647
///
648
648
/// `roots` indicates if we are creating a packet for root scanning. It is only true when this
649
649
/// method is called to handle `RootsWorkFactory::create_process_pinning_roots_work`.
650
- fn create_scan_work (
651
- & self ,
652
- nodes : Vec < ObjectReference > ,
653
- roots : bool ,
654
- ) -> Self :: ScanObjectsWorkType ;
650
+ fn create_scan_work ( & self , nodes : Vec < ObjectReference > ) -> Self :: ScanObjectsWorkType ;
655
651
656
652
/// Flush the nodes in ProcessEdgesBase, and create a ScanObjects work packet for it. If the node set is empty,
657
653
/// this method will simply return with no work packet created.
658
654
fn flush ( & mut self ) {
659
655
let nodes = self . pop_nodes ( ) ;
660
656
if !nodes. is_empty ( ) {
661
- self . start_or_dispatch_scan_work ( self . create_scan_work ( nodes, false ) ) ;
657
+ self . start_or_dispatch_scan_work ( self . create_scan_work ( nodes) ) ;
662
658
}
663
659
}
664
660
@@ -738,8 +734,8 @@ impl<VM: VMBinding> ProcessEdgesWork for SFTProcessEdges<VM> {
738
734
sft. sft_trace_object ( & mut self . base . nodes , object, worker)
739
735
}
740
736
741
- fn create_scan_work ( & self , nodes : Vec < ObjectReference > , roots : bool ) -> ScanObjects < Self > {
742
- ScanObjects :: < Self > :: new ( nodes, false , roots , self . bucket )
737
+ fn create_scan_work ( & self , nodes : Vec < ObjectReference > ) -> ScanObjects < Self > {
738
+ ScanObjects :: < Self > :: new ( nodes, false , self . bucket )
743
739
}
744
740
}
745
741
pub ( crate ) struct ProcessEdgesWorkRootsWorkFactory <
@@ -821,10 +817,6 @@ pub trait ScanObjectsWork<VM: VMBinding>: GCWork<VM> + Sized {
821
817
/// The associated ProcessEdgesWork for processing the edges of the objects in this packet.
822
818
type E : ProcessEdgesWork < VM = VM > ;
823
819
824
- /// Return true if the objects in this packet are pointed by roots, in which case we need to
825
- /// call trace_object on them.
826
- fn roots ( & self ) -> bool ;
827
-
828
820
/// Called after each object is scanned.
829
821
fn post_scan_object ( & self , object : ObjectReference ) ;
830
822
@@ -842,7 +834,6 @@ pub trait ScanObjectsWork<VM: VMBinding>: GCWork<VM> + Sized {
842
834
_mmtk : & ' static MMTK < <Self :: E as ProcessEdgesWork >:: VM > ,
843
835
) {
844
836
let tls = worker. tls ;
845
- debug_assert ! ( !self . roots( ) ) ;
846
837
847
838
// Scan the nodes in the buffer.
848
839
let objects_to_scan = buffer;
@@ -914,22 +905,15 @@ pub struct ScanObjects<Edges: ProcessEdgesWork> {
914
905
buffer : Vec < ObjectReference > ,
915
906
#[ allow( unused) ]
916
907
concurrent : bool ,
917
- roots : bool ,
918
908
phantom : PhantomData < Edges > ,
919
909
bucket : WorkBucketStage ,
920
910
}
921
911
922
912
impl < Edges : ProcessEdgesWork > ScanObjects < Edges > {
923
- pub fn new (
924
- buffer : Vec < ObjectReference > ,
925
- concurrent : bool ,
926
- roots : bool ,
927
- bucket : WorkBucketStage ,
928
- ) -> Self {
913
+ pub fn new ( buffer : Vec < ObjectReference > , concurrent : bool , bucket : WorkBucketStage ) -> Self {
929
914
Self {
930
915
buffer,
931
916
concurrent,
932
- roots,
933
917
phantom : PhantomData ,
934
918
bucket,
935
919
}
@@ -939,10 +923,6 @@ impl<Edges: ProcessEdgesWork> ScanObjects<Edges> {
939
923
impl < VM : VMBinding , E : ProcessEdgesWork < VM = VM > > ScanObjectsWork < VM > for ScanObjects < E > {
940
924
type E = E ;
941
925
942
- fn roots ( & self ) -> bool {
943
- self . roots
944
- }
945
-
946
926
fn get_bucket ( & self ) -> WorkBucketStage {
947
927
self . bucket
948
928
}
@@ -952,7 +932,7 @@ impl<VM: VMBinding, E: ProcessEdgesWork<VM = VM>> ScanObjectsWork<VM> for ScanOb
952
932
}
953
933
954
934
fn make_another ( & self , buffer : Vec < ObjectReference > ) -> Self {
955
- Self :: new ( buffer, self . concurrent , false , self . bucket )
935
+ Self :: new ( buffer, self . concurrent , self . bucket )
956
936
}
957
937
}
958
938
@@ -997,12 +977,8 @@ impl<VM: VMBinding, P: PlanTraceObject<VM> + Plan<VM = VM>, const KIND: TraceKin
997
977
Self { plan, base }
998
978
}
999
979
1000
- fn create_scan_work (
1001
- & self ,
1002
- nodes : Vec < ObjectReference > ,
1003
- roots : bool ,
1004
- ) -> Self :: ScanObjectsWorkType {
1005
- PlanScanObjects :: < Self , P > :: new ( self . plan , nodes, false , roots, self . bucket )
980
+ fn create_scan_work ( & self , nodes : Vec < ObjectReference > ) -> Self :: ScanObjectsWorkType {
981
+ PlanScanObjects :: < Self , P > :: new ( self . plan , nodes, false , self . bucket )
1006
982
}
1007
983
1008
984
fn trace_object ( & mut self , object : ObjectReference ) -> ObjectReference {
@@ -1051,7 +1027,6 @@ pub struct PlanScanObjects<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceO
1051
1027
buffer : Vec < ObjectReference > ,
1052
1028
#[ allow( dead_code) ]
1053
1029
concurrent : bool ,
1054
- roots : bool ,
1055
1030
phantom : PhantomData < E > ,
1056
1031
bucket : WorkBucketStage ,
1057
1032
}
@@ -1061,14 +1036,12 @@ impl<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceObject<E::VM>> PlanScan
1061
1036
plan : & ' static P ,
1062
1037
buffer : Vec < ObjectReference > ,
1063
1038
concurrent : bool ,
1064
- roots : bool ,
1065
1039
bucket : WorkBucketStage ,
1066
1040
) -> Self {
1067
1041
Self {
1068
1042
plan,
1069
1043
buffer,
1070
1044
concurrent,
1071
- roots,
1072
1045
phantom : PhantomData ,
1073
1046
bucket,
1074
1047
}
@@ -1080,10 +1053,6 @@ impl<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceObject<E::VM>> ScanObje
1080
1053
{
1081
1054
type E = E ;
1082
1055
1083
- fn roots ( & self ) -> bool {
1084
- self . roots
1085
- }
1086
-
1087
1056
fn get_bucket ( & self ) -> WorkBucketStage {
1088
1057
self . bucket
1089
1058
}
@@ -1093,7 +1062,7 @@ impl<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceObject<E::VM>> ScanObje
1093
1062
}
1094
1063
1095
1064
fn make_another ( & self , buffer : Vec < ObjectReference > ) -> Self {
1096
- Self :: new ( self . plan , buffer, self . concurrent , false , self . bucket )
1065
+ Self :: new ( self . plan , buffer, self . concurrent , self . bucket )
1097
1066
}
1098
1067
}
1099
1068
@@ -1111,7 +1080,11 @@ impl<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceObject<E::VM>> GCWork<E
1111
1080
/// but creates the work to scan these objects using E. This is necessary to guarantee that these objects do not move
1112
1081
/// (`I` should trace them without moving) as we do not have the information about the edges pointing to them.
1113
1082
1114
- struct ProcessRootNode < VM : VMBinding , I : ProcessEdgesWork < VM = VM > , E : ProcessEdgesWork < VM = VM > > {
1083
+ pub ( crate ) struct ProcessRootNode <
1084
+ VM : VMBinding ,
1085
+ I : ProcessEdgesWork < VM = VM > ,
1086
+ E : ProcessEdgesWork < VM = VM > ,
1087
+ > {
1115
1088
phantom : PhantomData < ( VM , I , E ) > ,
1116
1089
roots : Vec < ObjectReference > ,
1117
1090
bucket : WorkBucketStage ,
@@ -1175,7 +1148,7 @@ impl<VM: VMBinding, I: ProcessEdgesWork<VM = VM>, E: ProcessEdgesWork<VM = VM>>
1175
1148
} ;
1176
1149
1177
1150
let process_edges_work = E :: new ( vec ! [ ] , false , mmtk, self . bucket ) ;
1178
- let work = process_edges_work. create_scan_work ( scanned_root_objects, false ) ;
1151
+ let work = process_edges_work. create_scan_work ( scanned_root_objects) ;
1179
1152
crate :: memory_manager:: add_work_packet ( mmtk, self . bucket , work) ;
1180
1153
1181
1154
trace ! ( "ProcessRootNode End" ) ;
@@ -1220,11 +1193,7 @@ impl<VM: VMBinding> ProcessEdgesWork for UnsupportedProcessEdges<VM> {
1220
1193
panic ! ( "unsupported!" )
1221
1194
}
1222
1195
1223
- fn create_scan_work (
1224
- & self ,
1225
- _nodes : Vec < ObjectReference > ,
1226
- _roots : bool ,
1227
- ) -> Self :: ScanObjectsWorkType {
1196
+ fn create_scan_work ( & self , _nodes : Vec < ObjectReference > ) -> Self :: ScanObjectsWorkType {
1228
1197
panic ! ( "unsupported!" )
1229
1198
}
1230
1199
}
0 commit comments