Skip to content

Commit 02fe095

Browse files
author
Thomas Schatzl
committed
8364934: G1: Rename members of G1CollectionSet
Reviewed-by: ayang, kbarrett
1 parent a3fd424 commit 02fe095

File tree

7 files changed

+107
-96
lines changed

7 files changed

+107
-96
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3159,5 +3159,5 @@ void G1CollectedHeap::finish_codecache_marking_cycle() {
31593159
void G1CollectedHeap::prepare_group_cardsets_for_scan() {
31603160
young_regions_cardset()->reset_table_scanner_for_groups();
31613161

3162-
collection_set()->prepare_groups_for_scan();
3162+
collection_set()->prepare_for_scan();
31633163
}

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

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
#include "utilities/globalDefinitions.hpp"
3939
#include "utilities/quickSort.hpp"
4040

41-
uint G1CollectionSet::selected_groups_cur_length() const {
41+
uint G1CollectionSet::groups_cur_length() const {
4242
assert(_inc_build_state == CSetBuildType::Inactive, "must be");
43-
return _collection_set_groups.length();
43+
return _groups.length();
4444
}
4545

46-
uint G1CollectionSet::collection_groups_increment_length() const {
47-
return selected_groups_cur_length() - _selected_groups_inc_part_start;
46+
uint G1CollectionSet::groups_increment_length() const {
47+
return groups_cur_length() - _groups_inc_part_start;
4848
}
4949

5050
G1CollectorState* G1CollectionSet::collector_state() const {
@@ -59,21 +59,21 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) :
5959
_g1h(g1h),
6060
_policy(policy),
6161
_candidates(),
62-
_collection_set_regions(nullptr),
63-
_collection_set_cur_length(0),
64-
_collection_set_max_length(0),
65-
_collection_set_groups(),
66-
_selected_groups_inc_part_start(0),
62+
_regions(nullptr),
63+
_regions_max_length(0),
64+
_regions_cur_length(0),
65+
_groups(),
6766
_eden_region_length(0),
6867
_survivor_region_length(0),
6968
_initial_old_region_length(0),
7069
_optional_groups(),
71-
_inc_build_state(Inactive),
72-
_inc_part_start(0) {
70+
_inc_build_state(CSetBuildType::Inactive),
71+
_regions_inc_part_start(0),
72+
_groups_inc_part_start(0) {
7373
}
7474

7575
G1CollectionSet::~G1CollectionSet() {
76-
FREE_C_HEAP_ARRAY(uint, _collection_set_regions);
76+
FREE_C_HEAP_ARRAY(uint, _regions);
7777
abandon_all_candidates();
7878
}
7979

@@ -84,18 +84,18 @@ void G1CollectionSet::init_region_lengths(uint eden_cset_region_length,
8484
_eden_region_length = eden_cset_region_length;
8585
_survivor_region_length = survivor_cset_region_length;
8686

87-
assert((size_t)young_region_length() == _collection_set_cur_length,
88-
"Young region length %u should match collection set length %u", young_region_length(), _collection_set_cur_length);
87+
assert((size_t)young_region_length() == _regions_cur_length,
88+
"Young region length %u should match collection set length %u", young_region_length(), _regions_cur_length);
8989

9090
_initial_old_region_length = 0;
9191
assert(_optional_groups.length() == 0, "Should not have any optional groups yet");
9292
_optional_groups.clear();
9393
}
9494

9595
void G1CollectionSet::initialize(uint max_region_length) {
96-
guarantee(_collection_set_regions == nullptr, "Must only initialize once.");
97-
_collection_set_max_length = max_region_length;
98-
_collection_set_regions = NEW_C_HEAP_ARRAY(uint, max_region_length, mtGC);
96+
guarantee(_regions == nullptr, "Must only initialize once.");
97+
_regions_max_length = max_region_length;
98+
_regions = NEW_C_HEAP_ARRAY(uint, max_region_length, mtGC);
9999

100100
_candidates.initialize(max_region_length);
101101
}
@@ -105,14 +105,14 @@ void G1CollectionSet::abandon_all_candidates() {
105105
_initial_old_region_length = 0;
106106
}
107107

108-
void G1CollectionSet::prepare_groups_for_scan () {
109-
collection_set_groups()->prepare_for_scan();
108+
void G1CollectionSet::prepare_for_scan () {
109+
groups()->prepare_for_scan();
110110
}
111111

112112
void G1CollectionSet::add_old_region(G1HeapRegion* hr) {
113113
assert_at_safepoint_on_vm_thread();
114114

115-
assert(_inc_build_state == Active,
115+
assert(_inc_build_state == CSetBuildType::Active,
116116
"Precondition, actively building cset or adding optional later on");
117117
assert(hr->is_old(), "the region should be old");
118118

@@ -121,46 +121,46 @@ void G1CollectionSet::add_old_region(G1HeapRegion* hr) {
121121
assert(!hr->in_collection_set(), "should not already be in the collection set");
122122
_g1h->register_old_region_with_region_attr(hr);
123123

124-
assert(_collection_set_cur_length < _collection_set_max_length, "Collection set now larger than maximum size.");
125-
_collection_set_regions[_collection_set_cur_length++] = hr->hrm_index();
124+
assert(_regions_cur_length < _regions_max_length, "Collection set now larger than maximum size.");
125+
_regions[_regions_cur_length++] = hr->hrm_index();
126126
_initial_old_region_length++;
127127

128128
_g1h->old_set_remove(hr);
129129
}
130130

131131
void G1CollectionSet::start_incremental_building() {
132-
assert(_collection_set_cur_length == 0, "Collection set must be empty before starting a new collection set.");
133-
assert(selected_groups_cur_length() == 0, "Collection set groups must be empty before starting a new collection set.");
132+
assert(_regions_cur_length == 0, "Collection set must be empty before starting a new collection set.");
133+
assert(groups_cur_length() == 0, "Collection set groups must be empty before starting a new collection set.");
134134
assert(_optional_groups.length() == 0, "Collection set optional gorups must be empty before starting a new collection set.");
135135

136136
continue_incremental_building();
137137
}
138138

139139
void G1CollectionSet::continue_incremental_building() {
140-
assert(_inc_build_state == Inactive, "Precondition");
140+
assert(_inc_build_state == CSetBuildType::Inactive, "Precondition");
141141

142-
_inc_part_start = _collection_set_cur_length;
143-
_selected_groups_inc_part_start = selected_groups_cur_length();
142+
_regions_inc_part_start = _regions_cur_length;
143+
_groups_inc_part_start = groups_cur_length();
144144

145145
_inc_build_state = CSetBuildType::Active;
146146
}
147147

148148
void G1CollectionSet::stop_incremental_building() {
149-
_inc_build_state = Inactive;
149+
_inc_build_state = CSetBuildType::Inactive;
150150
}
151151

152152
void G1CollectionSet::clear() {
153153
assert_at_safepoint_on_vm_thread();
154-
_collection_set_cur_length = 0;
155-
_collection_set_groups.clear();
154+
_regions_cur_length = 0;
155+
_groups.clear();
156156
}
157157

158158
void G1CollectionSet::iterate(G1HeapRegionClosure* cl) const {
159-
size_t len = _collection_set_cur_length;
159+
size_t len = _regions_cur_length;
160160
OrderAccess::loadload();
161161

162162
for (uint i = 0; i < len; i++) {
163-
G1HeapRegion* r = _g1h->region_at(_collection_set_regions[i]);
163+
G1HeapRegion* r = _g1h->region_at(_regions[i]);
164164
bool result = cl->do_heap_region(r);
165165
if (result) {
166166
cl->set_incomplete();
@@ -187,7 +187,7 @@ void G1CollectionSet::iterate_optional(G1HeapRegionClosure* cl) const {
187187
void G1CollectionSet::iterate_incremental_part_from(G1HeapRegionClosure* cl,
188188
G1HeapRegionClaimer* hr_claimer,
189189
uint worker_id) const {
190-
iterate_part_from(cl, hr_claimer, _inc_part_start, increment_length(), worker_id);
190+
iterate_part_from(cl, hr_claimer, _regions_inc_part_start, regions_cur_length(), worker_id);
191191
}
192192

193193
void G1CollectionSet::iterate_part_from(G1HeapRegionClosure* cl,
@@ -197,29 +197,29 @@ void G1CollectionSet::iterate_part_from(G1HeapRegionClosure* cl,
197197
uint worker_id) const {
198198
_g1h->par_iterate_regions_array(cl,
199199
hr_claimer,
200-
&_collection_set_regions[offset],
200+
&_regions[offset],
201201
length,
202202
worker_id);
203203
}
204204

205205
void G1CollectionSet::add_young_region_common(G1HeapRegion* hr) {
206206
assert(hr->is_young(), "invariant");
207-
assert(_inc_build_state == Active, "Precondition");
207+
assert(_inc_build_state == CSetBuildType::Active, "Precondition");
208208

209209
assert(!hr->in_collection_set(), "invariant");
210210
_g1h->register_young_region_with_region_attr(hr);
211211

212212
// We use UINT_MAX as "invalid" marker in verification.
213-
assert(_collection_set_cur_length < (UINT_MAX - 1),
214-
"Collection set is too large with %u entries", _collection_set_cur_length);
215-
hr->set_young_index_in_cset(_collection_set_cur_length + 1);
213+
assert(_regions_cur_length < (UINT_MAX - 1),
214+
"Collection set is too large with %u entries", _regions_cur_length);
215+
hr->set_young_index_in_cset(_regions_cur_length + 1);
216216

217-
assert(_collection_set_cur_length < _collection_set_max_length, "Collection set larger than maximum allowed.");
218-
_collection_set_regions[_collection_set_cur_length] = hr->hrm_index();
217+
assert(_regions_cur_length < _regions_max_length, "Collection set larger than maximum allowed.");
218+
_regions[_regions_cur_length] = hr->hrm_index();
219219
// Concurrent readers must observe the store of the value in the array before an
220220
// update to the length field.
221221
OrderAccess::storestore();
222-
_collection_set_cur_length++;
222+
_regions_cur_length++;
223223
}
224224

225225
void G1CollectionSet::add_survivor_regions(G1HeapRegion* hr) {
@@ -301,7 +301,7 @@ void G1CollectionSet::print(outputStream* st) {
301301
// pinned by JNI) to allow faster future evacuation. We already "paid" for this work
302302
// when sizing the young generation.
303303
double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) {
304-
assert(_inc_build_state == Active, "Precondition");
304+
assert(_inc_build_state == CSetBuildType::Active, "Precondition");
305305
assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
306306

307307
Ticks start_time = Ticks::now();
@@ -626,7 +626,8 @@ double G1CollectionSet::select_candidates_from_optional_groups(double time_remai
626626
selected.append(group);
627627
}
628628

629-
log_debug(gc, ergo, cset) ("Completed with groups, selected %u", num_regions_selected);
629+
log_debug(gc, ergo, cset)("Completed with groups, selected %u region in %u groups",
630+
num_regions_selected, num_groups_selected);
630631
// Remove selected groups from candidate list.
631632
if (num_groups_selected > 0) {
632633
_optional_groups.remove(&selected);
@@ -635,7 +636,7 @@ double G1CollectionSet::select_candidates_from_optional_groups(double time_remai
635636
return total_prediction_ms;
636637
}
637638

638-
uint G1CollectionSet::select_optional_collection_set_regions(double time_remaining_ms) {
639+
uint G1CollectionSet::select_optional_groups(double time_remaining_ms) {
639640
uint optional_regions_count = num_optional_regions();
640641
assert(optional_regions_count > 0,
641642
"Should only be called when there are optional regions");
@@ -670,7 +671,7 @@ void G1CollectionSet::add_group_to_collection_set(G1CSetCandidateGroup* gr) {
670671
assert(r->rem_set()->is_complete(), "must be");
671672
add_region_to_collection_set(r);
672673
}
673-
_collection_set_groups.append(gr);
674+
_groups.append(gr);
674675
}
675676

676677
void G1CollectionSet::add_region_to_collection_set(G1HeapRegion* r) {
@@ -680,20 +681,20 @@ void G1CollectionSet::add_region_to_collection_set(G1HeapRegion* r) {
680681
}
681682

682683
void G1CollectionSet::finalize_initial_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor) {
683-
assert(_inc_part_start == 0, "must be");
684-
assert(_selected_groups_inc_part_start == 0, "must be");
684+
assert(_regions_inc_part_start == 0, "must be");
685+
assert(_groups_inc_part_start == 0, "must be");
685686

686687
double time_remaining_ms = finalize_young_part(target_pause_time_ms, survivor);
687688
finalize_old_part(time_remaining_ms);
688689

689690
stop_incremental_building();
690-
QuickSort::sort(_collection_set_regions, _collection_set_cur_length, compare_region_idx);
691+
QuickSort::sort(_regions, _regions_cur_length, compare_region_idx);
691692
}
692693

693694
bool G1CollectionSet::finalize_optional_for_evacuation(double remaining_pause_time) {
694695
continue_incremental_building();
695696

696-
uint num_regions_selected = select_optional_collection_set_regions(remaining_pause_time);
697+
uint num_regions_selected = select_optional_groups(remaining_pause_time);
697698

698699
stop_incremental_building();
699700

@@ -756,7 +757,7 @@ class G1VerifyYoungCSetIndicesClosure : public G1HeapRegionClosure {
756757
void G1CollectionSet::verify_young_cset_indices() const {
757758
assert_at_safepoint_on_vm_thread();
758759

759-
G1VerifyYoungCSetIndicesClosure cl(_collection_set_cur_length);
760+
G1VerifyYoungCSetIndicesClosure cl(_regions_cur_length);
760761
iterate(&cl);
761762
}
762763
#endif

0 commit comments

Comments
 (0)