Skip to content
Permalink
Browse files
8273476: G1: refine G1CollectedHeap::par_iterate_regions_array_part_from
Reviewed-by: ayang, tschatzl
  • Loading branch information
Hamlin Li committed Sep 9, 2021
1 parent 00e059d commit 9690df7fb9843bdc4775a34d94b2ca81f40aea0a
@@ -2326,12 +2326,11 @@ void G1CollectedHeap::collection_set_iterate_increment_from(HeapRegionClosure *c
_collection_set.iterate_incremental_part_from(cl, hr_claimer, worker_id);
}

void G1CollectedHeap::par_iterate_regions_array_part_from(HeapRegionClosure* cl,
HeapRegionClaimer* hr_claimer,
const uint* regions,
size_t offset,
size_t length,
uint worker_id) const {
void G1CollectedHeap::par_iterate_regions_array(HeapRegionClosure* cl,
HeapRegionClaimer* hr_claimer,
const uint regions[],
size_t length,
uint worker_id) const {
assert_at_safepoint();
if (length == 0) {
return;
@@ -2342,7 +2341,7 @@ void G1CollectedHeap::par_iterate_regions_array_part_from(HeapRegionClosure* cl,
size_t cur_pos = start_pos;

do {
uint region_idx = regions[cur_pos + offset];
uint region_idx = regions[cur_pos];
if (hr_claimer == NULL || hr_claimer->claim_region(region_idx)) {
HeapRegion* r = region_at(region_idx);
bool result = cl->do_heap_region(r);
@@ -1139,15 +1139,14 @@ class G1CollectedHeap : public CollectedHeap {
collection_set_iterate_increment_from(blk, NULL, worker_id);
}
void collection_set_iterate_increment_from(HeapRegionClosure *blk, HeapRegionClaimer* hr_claimer, uint worker_id);
// Iterate part of an array of region indexes given by offset and length, applying
// Iterate over the array of region indexes, uint regions[length], applying
// the given HeapRegionClosure on each region. The worker_id will determine where
// in the part to start the iteration to allow for more efficient parallel iteration.
void par_iterate_regions_array_part_from(HeapRegionClosure* cl,
HeapRegionClaimer* hr_claimer,
const uint* regions,
size_t offset,
size_t length,
uint worker_id) const;
// to start the iteration to allow for more efficient parallel iteration.
void par_iterate_regions_array(HeapRegionClosure* cl,
HeapRegionClaimer* hr_claimer,
const uint regions[],
size_t length,
uint worker_id) const;

// Returns the HeapRegion that contains addr. addr must not be NULL.
template <class T>
@@ -232,7 +232,11 @@ void G1CollectionSet::iterate_part_from(HeapRegionClosure* cl,
size_t offset,
size_t length,
uint worker_id) const {
_g1h->par_iterate_regions_array_part_from(cl, hr_claimer, _collection_set_regions, offset, length, worker_id);
_g1h->par_iterate_regions_array(cl,
hr_claimer,
&_collection_set_regions[offset],
length,
worker_id);
}

void G1CollectionSet::update_young_region_prediction(HeapRegion* hr,
@@ -49,12 +49,11 @@ void G1EvacFailureRegions::initialize(uint max_regions) {
void G1EvacFailureRegions::par_iterate(HeapRegionClosure* closure,
HeapRegionClaimer* _hrclaimer,
uint worker_id) {
G1CollectedHeap::heap()->par_iterate_regions_array_part_from(closure,
_hrclaimer,
_evac_failure_regions,
0,
Atomic::load(&_evac_failure_regions_cur_length),
worker_id);
G1CollectedHeap::heap()->par_iterate_regions_array(closure,
_hrclaimer,
_evac_failure_regions,
Atomic::load(&_evac_failure_regions_cur_length),
worker_id);
}

void G1EvacFailureRegions::reset() {

1 comment on commit 9690df7

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 9690df7 Sep 9, 2021

Please sign in to comment.