Skip to content
Browse files

8235119: Incomplete initialization of scan_top values results in out-…

…of-bounds scanning of regions

Reviewed-by: kbarrett, tschatzl, sangheki
  • Loading branch information
kstefanj committed Dec 20, 2019
1 parent ffdf1de commit 8d00c5aa0d93c45cc77c513f0caa7b98badbd5f9
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/hotspot/share/gc/g1/g1RemSet.cpp
@@ -305,6 +305,15 @@ class G1RemSetScanState : public CHeapObj<mtGC> {

void prepare() {
// Reset the claim and clear scan top for all regions, including
// regions currently not available or free. Since regions might
// become used during the collection these values must be valid
// for those regions as well.
for (size_t i = 0; i < _max_regions; i++) {

_all_dirty_regions = new G1DirtyRegions(_max_regions);
_next_dirty_regions = new G1DirtyRegions(_max_regions);
@@ -885,15 +894,13 @@ void G1RemSet::scan_collection_set_regions(G1ParScanThreadState* pss,
void G1RemSet::prepare_region_for_scan(HeapRegion* region) {
uint hrm_index = region->hrm_index();

if (region->in_collection_set()) {
// Young regions had their card table marked as young at their allocation;
// we need to make sure that these marks are cleared at the end of GC, *but*
// they should not be scanned for cards.
// So directly add them to the "all_dirty_regions".
// Same for regions in the (initial) collection set: they may contain cards from
// the log buffers, make sure they are cleaned.
} else if (region->is_old_or_humongous_or_archive()) {
_scan_state->set_scan_top(hrm_index, region->top());

0 comments on commit 8d00c5a

Please sign in to comment.
You can’t perform that action at this time.