@@ -906,14 +906,27 @@ void G1RemSet::scan_collection_set_regions(G1ParScanThreadState* pss,
906
906
}
907
907
}
908
908
909
- void G1RemSet::prepare_region_for_scan (HeapRegion* region) {
910
- uint hrm_index = region->hrm_index ();
909
+ #ifdef ASSERT
910
+ void G1RemSet::assert_scan_top_is_null (uint hrm_index) {
911
+ assert (_scan_state->scan_top (hrm_index) == NULL ,
912
+ " scan_top of region %u is unexpectedly " PTR_FORMAT,
913
+ hrm_index, p2i (_scan_state->scan_top (hrm_index)));
914
+ }
915
+ #endif
916
+
917
+ void G1RemSet::prepare_region_for_scan (HeapRegion* r) {
918
+ uint hrm_index = r->hrm_index ();
911
919
912
- if (region->is_old_or_humongous_or_archive ()) {
913
- _scan_state->set_scan_top (hrm_index, region->top ());
920
+ // Only update non-collection set old regions, others must have already been set
921
+ // to NULL (don't scan) in the initialization.
922
+ if (r->in_collection_set ()) {
923
+ assert_scan_top_is_null (hrm_index);
924
+ } else if (r->is_old_or_humongous_or_archive ()) {
925
+ _scan_state->set_scan_top (hrm_index, r->top ());
914
926
} else {
915
- assert (region->in_collection_set () || region->is_free (),
916
- " Should only be free or in the collection set at this point %s" , region->get_type_str ());
927
+ assert_scan_top_is_null (hrm_index);
928
+ assert (r->is_free (),
929
+ " Region %u should be free region but is %s" , hrm_index, r->get_type_str ());
917
930
}
918
931
}
919
932
0 commit comments