Skip to content

Commit 9690df7

Browse files
author
Hamlin Li
committed
8273476: G1: refine G1CollectedHeap::par_iterate_regions_array_part_from
Reviewed-by: ayang, tschatzl
1 parent 00e059d commit 9690df7

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,12 +2326,11 @@ void G1CollectedHeap::collection_set_iterate_increment_from(HeapRegionClosure *c
23262326
_collection_set.iterate_incremental_part_from(cl, hr_claimer, worker_id);
23272327
}
23282328

2329-
void G1CollectedHeap::par_iterate_regions_array_part_from(HeapRegionClosure* cl,
2330-
HeapRegionClaimer* hr_claimer,
2331-
const uint* regions,
2332-
size_t offset,
2333-
size_t length,
2334-
uint worker_id) const {
2329+
void G1CollectedHeap::par_iterate_regions_array(HeapRegionClosure* cl,
2330+
HeapRegionClaimer* hr_claimer,
2331+
const uint regions[],
2332+
size_t length,
2333+
uint worker_id) const {
23352334
assert_at_safepoint();
23362335
if (length == 0) {
23372336
return;
@@ -2342,7 +2341,7 @@ void G1CollectedHeap::par_iterate_regions_array_part_from(HeapRegionClosure* cl,
23422341
size_t cur_pos = start_pos;
23432342

23442343
do {
2345-
uint region_idx = regions[cur_pos + offset];
2344+
uint region_idx = regions[cur_pos];
23462345
if (hr_claimer == NULL || hr_claimer->claim_region(region_idx)) {
23472346
HeapRegion* r = region_at(region_idx);
23482347
bool result = cl->do_heap_region(r);

src/hotspot/share/gc/g1/g1CollectedHeap.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,15 +1139,14 @@ class G1CollectedHeap : public CollectedHeap {
11391139
collection_set_iterate_increment_from(blk, NULL, worker_id);
11401140
}
11411141
void collection_set_iterate_increment_from(HeapRegionClosure *blk, HeapRegionClaimer* hr_claimer, uint worker_id);
1142-
// Iterate part of an array of region indexes given by offset and length, applying
1142+
// Iterate over the array of region indexes, uint regions[length], applying
11431143
// the given HeapRegionClosure on each region. The worker_id will determine where
1144-
// in the part to start the iteration to allow for more efficient parallel iteration.
1145-
void par_iterate_regions_array_part_from(HeapRegionClosure* cl,
1146-
HeapRegionClaimer* hr_claimer,
1147-
const uint* regions,
1148-
size_t offset,
1149-
size_t length,
1150-
uint worker_id) const;
1144+
// to start the iteration to allow for more efficient parallel iteration.
1145+
void par_iterate_regions_array(HeapRegionClosure* cl,
1146+
HeapRegionClaimer* hr_claimer,
1147+
const uint regions[],
1148+
size_t length,
1149+
uint worker_id) const;
11511150

11521151
// Returns the HeapRegion that contains addr. addr must not be NULL.
11531152
template <class T>

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ void G1CollectionSet::iterate_part_from(HeapRegionClosure* cl,
232232
size_t offset,
233233
size_t length,
234234
uint worker_id) const {
235-
_g1h->par_iterate_regions_array_part_from(cl, hr_claimer, _collection_set_regions, offset, length, worker_id);
235+
_g1h->par_iterate_regions_array(cl,
236+
hr_claimer,
237+
&_collection_set_regions[offset],
238+
length,
239+
worker_id);
236240
}
237241

238242
void G1CollectionSet::update_young_region_prediction(HeapRegion* hr,

src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ void G1EvacFailureRegions::initialize(uint max_regions) {
4949
void G1EvacFailureRegions::par_iterate(HeapRegionClosure* closure,
5050
HeapRegionClaimer* _hrclaimer,
5151
uint worker_id) {
52-
G1CollectedHeap::heap()->par_iterate_regions_array_part_from(closure,
53-
_hrclaimer,
54-
_evac_failure_regions,
55-
0,
56-
Atomic::load(&_evac_failure_regions_cur_length),
57-
worker_id);
52+
G1CollectedHeap::heap()->par_iterate_regions_array(closure,
53+
_hrclaimer,
54+
_evac_failure_regions,
55+
Atomic::load(&_evac_failure_regions_cur_length),
56+
worker_id);
5857
}
5958

6059
void G1EvacFailureRegions::reset() {

0 commit comments

Comments
 (0)