@@ -756,7 +756,7 @@ impl<VM: VMBinding, DPE: ProcessEdgesWork<VM = VM>, PPE: ProcessEdgesWork<VM = V
756
756
crate :: memory_manager:: add_work_packet (
757
757
self . mmtk ,
758
758
WorkBucketStage :: PinningRootsTrace ,
759
- ProcessRootNode :: < VM , PPE , DPE > :: new ( nodes, WorkBucketStage :: Closure ) ,
759
+ ProcessRootNodes :: < VM , PPE , DPE > :: new ( nodes, WorkBucketStage :: Closure ) ,
760
760
) ;
761
761
}
762
762
@@ -765,7 +765,7 @@ impl<VM: VMBinding, DPE: ProcessEdgesWork<VM = VM>, PPE: ProcessEdgesWork<VM = V
765
765
crate :: memory_manager:: add_work_packet (
766
766
self . mmtk ,
767
767
WorkBucketStage :: TPinningClosure ,
768
- ProcessRootNode :: < VM , PPE , PPE > :: new ( nodes, WorkBucketStage :: TPinningClosure ) ,
768
+ ProcessRootNodes :: < VM , PPE , PPE > :: new ( nodes, WorkBucketStage :: TPinningClosure ) ,
769
769
) ;
770
770
}
771
771
}
@@ -1071,7 +1071,7 @@ impl<E: ProcessEdgesWork, P: Plan<VM = E::VM> + PlanTraceObject<E::VM>> GCWork<E
1071
1071
/// - If `O2OPE` may move objects, then this `ProcessRootsNode<VM, R2OPE, O2OPE>` work packet
1072
1072
/// will only pin the objects in `roots` (because `R2OPE` must not move objects anyway), but
1073
1073
/// not their descendents.
1074
- pub ( crate ) struct ProcessRootNode <
1074
+ pub ( crate ) struct ProcessRootNodes <
1075
1075
VM : VMBinding ,
1076
1076
R2OPE : ProcessEdgesWork < VM = VM > ,
1077
1077
O2OPE : ProcessEdgesWork < VM = VM > ,
@@ -1082,7 +1082,7 @@ pub(crate) struct ProcessRootNode<
1082
1082
}
1083
1083
1084
1084
impl < VM : VMBinding , R2OPE : ProcessEdgesWork < VM = VM > , O2OPE : ProcessEdgesWork < VM = VM > >
1085
- ProcessRootNode < VM , R2OPE , O2OPE >
1085
+ ProcessRootNodes < VM , R2OPE , O2OPE >
1086
1086
{
1087
1087
pub fn new ( nodes : Vec < ObjectReference > , bucket : WorkBucketStage ) -> Self {
1088
1088
Self {
@@ -1094,10 +1094,10 @@ impl<VM: VMBinding, R2OPE: ProcessEdgesWork<VM = VM>, O2OPE: ProcessEdgesWork<VM
1094
1094
}
1095
1095
1096
1096
impl < VM : VMBinding , R2OPE : ProcessEdgesWork < VM = VM > , O2OPE : ProcessEdgesWork < VM = VM > > GCWork < VM >
1097
- for ProcessRootNode < VM , R2OPE , O2OPE >
1097
+ for ProcessRootNodes < VM , R2OPE , O2OPE >
1098
1098
{
1099
1099
fn do_work ( & mut self , worker : & mut GCWorker < VM > , mmtk : & ' static MMTK < VM > ) {
1100
- trace ! ( "ProcessRootNode " ) ;
1100
+ trace ! ( "ProcessRootNodes " ) ;
1101
1101
1102
1102
#[ cfg( feature = "sanity" ) ]
1103
1103
{
@@ -1109,15 +1109,17 @@ impl<VM: VMBinding, R2OPE: ProcessEdgesWork<VM = VM>, O2OPE: ProcessEdgesWork<VM
1109
1109
}
1110
1110
}
1111
1111
1112
+ let num_roots = self . roots . len ( ) ;
1113
+
1112
1114
// This step conceptually traces the edges from root slots to the objects they point to.
1113
1115
// However, VMs that deliver root objects instead of root slots are incapable of updating
1114
1116
// root slots. Therefore, we call `trace_object` on those objects, and assert the GC
1115
1117
// doesn't move those objects because we cannot store the updated references back to the
1116
1118
// slots.
1117
1119
//
1118
- // The `scanned_root_objects ` variable will hold those root objects which are traced for the
1120
+ // The `root_objects_to_scan ` variable will hold those root objects which are traced for the
1119
1121
// first time. We will create a work packet for scanning those roots.
1120
- let scanned_root_objects = {
1122
+ let root_objects_to_scan = {
1121
1123
// We create an instance of E to use its `trace_object` method and its object queue.
1122
1124
let mut process_edges_work =
1123
1125
R2OPE :: new ( vec ! [ ] , true , mmtk, WorkBucketStage :: PinningRootsTrace ) ;
@@ -1137,11 +1139,16 @@ impl<VM: VMBinding, R2OPE: ProcessEdgesWork<VM = VM>, O2OPE: ProcessEdgesWork<VM
1137
1139
process_edges_work. nodes . take ( )
1138
1140
} ;
1139
1141
1140
- let process_edges_work = O2OPE :: new ( vec ! [ ] , false , mmtk, self . bucket ) ;
1141
- let work = process_edges_work. create_scan_work ( scanned_root_objects) ;
1142
- crate :: memory_manager:: add_work_packet ( mmtk, self . bucket , work) ;
1142
+ let num_enqueued_nodes = root_objects_to_scan. len ( ) ;
1143
+ probe ! ( mmtk, process_root_nodes, num_roots, num_enqueued_nodes) ;
1144
+
1145
+ if !root_objects_to_scan. is_empty ( ) {
1146
+ let process_edges_work = O2OPE :: new ( vec ! [ ] , false , mmtk, self . bucket ) ;
1147
+ let work = process_edges_work. create_scan_work ( root_objects_to_scan) ;
1148
+ crate :: memory_manager:: add_work_packet ( mmtk, self . bucket , work) ;
1149
+ }
1143
1150
1144
- trace ! ( "ProcessRootNode End" ) ;
1151
+ trace ! ( "ProcessRootNodes End" ) ;
1145
1152
}
1146
1153
}
1147
1154
0 commit comments