38
38
#include " utilities/globalDefinitions.hpp"
39
39
#include " utilities/quickSort.hpp"
40
40
41
- uint G1CollectionSet::selected_groups_cur_length () const {
41
+ uint G1CollectionSet::groups_cur_length () const {
42
42
assert (_inc_build_state == CSetBuildType::Inactive, " must be" );
43
- return _collection_set_groups .length ();
43
+ return _groups .length ();
44
44
}
45
45
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 ;
48
48
}
49
49
50
50
G1CollectorState* G1CollectionSet::collector_state () const {
@@ -59,21 +59,21 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) :
59
59
_g1h(g1h),
60
60
_policy(policy),
61
61
_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(),
67
66
_eden_region_length(0 ),
68
67
_survivor_region_length(0 ),
69
68
_initial_old_region_length(0 ),
70
69
_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 ) {
73
73
}
74
74
75
75
G1CollectionSet::~G1CollectionSet () {
76
- FREE_C_HEAP_ARRAY (uint, _collection_set_regions );
76
+ FREE_C_HEAP_ARRAY (uint, _regions );
77
77
abandon_all_candidates ();
78
78
}
79
79
@@ -84,18 +84,18 @@ void G1CollectionSet::init_region_lengths(uint eden_cset_region_length,
84
84
_eden_region_length = eden_cset_region_length;
85
85
_survivor_region_length = survivor_cset_region_length;
86
86
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 );
89
89
90
90
_initial_old_region_length = 0 ;
91
91
assert (_optional_groups.length () == 0 , " Should not have any optional groups yet" );
92
92
_optional_groups.clear ();
93
93
}
94
94
95
95
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);
99
99
100
100
_candidates.initialize (max_region_length);
101
101
}
@@ -105,14 +105,14 @@ void G1CollectionSet::abandon_all_candidates() {
105
105
_initial_old_region_length = 0 ;
106
106
}
107
107
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 ();
110
110
}
111
111
112
112
void G1CollectionSet::add_old_region (G1HeapRegion* hr) {
113
113
assert_at_safepoint_on_vm_thread ();
114
114
115
- assert (_inc_build_state == Active,
115
+ assert (_inc_build_state == CSetBuildType:: Active,
116
116
" Precondition, actively building cset or adding optional later on" );
117
117
assert (hr->is_old (), " the region should be old" );
118
118
@@ -121,46 +121,46 @@ void G1CollectionSet::add_old_region(G1HeapRegion* hr) {
121
121
assert (!hr->in_collection_set (), " should not already be in the collection set" );
122
122
_g1h->register_old_region_with_region_attr (hr);
123
123
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 ();
126
126
_initial_old_region_length++;
127
127
128
128
_g1h->old_set_remove (hr);
129
129
}
130
130
131
131
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." );
134
134
assert (_optional_groups.length () == 0 , " Collection set optional gorups must be empty before starting a new collection set." );
135
135
136
136
continue_incremental_building ();
137
137
}
138
138
139
139
void G1CollectionSet::continue_incremental_building () {
140
- assert (_inc_build_state == Inactive, " Precondition" );
140
+ assert (_inc_build_state == CSetBuildType:: Inactive, " Precondition" );
141
141
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 ();
144
144
145
145
_inc_build_state = CSetBuildType::Active;
146
146
}
147
147
148
148
void G1CollectionSet::stop_incremental_building () {
149
- _inc_build_state = Inactive;
149
+ _inc_build_state = CSetBuildType:: Inactive;
150
150
}
151
151
152
152
void G1CollectionSet::clear () {
153
153
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 ();
156
156
}
157
157
158
158
void G1CollectionSet::iterate (G1HeapRegionClosure* cl) const {
159
- size_t len = _collection_set_cur_length ;
159
+ size_t len = _regions_cur_length ;
160
160
OrderAccess::loadload ();
161
161
162
162
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]);
164
164
bool result = cl->do_heap_region (r);
165
165
if (result) {
166
166
cl->set_incomplete ();
@@ -187,7 +187,7 @@ void G1CollectionSet::iterate_optional(G1HeapRegionClosure* cl) const {
187
187
void G1CollectionSet::iterate_incremental_part_from (G1HeapRegionClosure* cl,
188
188
G1HeapRegionClaimer* hr_claimer,
189
189
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);
191
191
}
192
192
193
193
void G1CollectionSet::iterate_part_from (G1HeapRegionClosure* cl,
@@ -197,29 +197,29 @@ void G1CollectionSet::iterate_part_from(G1HeapRegionClosure* cl,
197
197
uint worker_id) const {
198
198
_g1h->par_iterate_regions_array (cl,
199
199
hr_claimer,
200
- &_collection_set_regions [offset],
200
+ &_regions [offset],
201
201
length,
202
202
worker_id);
203
203
}
204
204
205
205
void G1CollectionSet::add_young_region_common (G1HeapRegion* hr) {
206
206
assert (hr->is_young (), " invariant" );
207
- assert (_inc_build_state == Active, " Precondition" );
207
+ assert (_inc_build_state == CSetBuildType:: Active, " Precondition" );
208
208
209
209
assert (!hr->in_collection_set (), " invariant" );
210
210
_g1h->register_young_region_with_region_attr (hr);
211
211
212
212
// 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 );
216
216
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 ();
219
219
// Concurrent readers must observe the store of the value in the array before an
220
220
// update to the length field.
221
221
OrderAccess::storestore ();
222
- _collection_set_cur_length ++;
222
+ _regions_cur_length ++;
223
223
}
224
224
225
225
void G1CollectionSet::add_survivor_regions (G1HeapRegion* hr) {
@@ -301,7 +301,7 @@ void G1CollectionSet::print(outputStream* st) {
301
301
// pinned by JNI) to allow faster future evacuation. We already "paid" for this work
302
302
// when sizing the young generation.
303
303
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" );
305
305
assert (SafepointSynchronize::is_at_safepoint (), " should be at a safepoint" );
306
306
307
307
Ticks start_time = Ticks::now ();
@@ -626,7 +626,8 @@ double G1CollectionSet::select_candidates_from_optional_groups(double time_remai
626
626
selected.append (group);
627
627
}
628
628
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);
630
631
// Remove selected groups from candidate list.
631
632
if (num_groups_selected > 0 ) {
632
633
_optional_groups.remove (&selected);
@@ -635,7 +636,7 @@ double G1CollectionSet::select_candidates_from_optional_groups(double time_remai
635
636
return total_prediction_ms;
636
637
}
637
638
638
- uint G1CollectionSet::select_optional_collection_set_regions (double time_remaining_ms) {
639
+ uint G1CollectionSet::select_optional_groups (double time_remaining_ms) {
639
640
uint optional_regions_count = num_optional_regions ();
640
641
assert (optional_regions_count > 0 ,
641
642
" Should only be called when there are optional regions" );
@@ -670,7 +671,7 @@ void G1CollectionSet::add_group_to_collection_set(G1CSetCandidateGroup* gr) {
670
671
assert (r->rem_set ()->is_complete (), " must be" );
671
672
add_region_to_collection_set (r);
672
673
}
673
- _collection_set_groups .append (gr);
674
+ _groups .append (gr);
674
675
}
675
676
676
677
void G1CollectionSet::add_region_to_collection_set (G1HeapRegion* r) {
@@ -680,20 +681,20 @@ void G1CollectionSet::add_region_to_collection_set(G1HeapRegion* r) {
680
681
}
681
682
682
683
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" );
685
686
686
687
double time_remaining_ms = finalize_young_part (target_pause_time_ms, survivor);
687
688
finalize_old_part (time_remaining_ms);
688
689
689
690
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);
691
692
}
692
693
693
694
bool G1CollectionSet::finalize_optional_for_evacuation (double remaining_pause_time) {
694
695
continue_incremental_building ();
695
696
696
- uint num_regions_selected = select_optional_collection_set_regions (remaining_pause_time);
697
+ uint num_regions_selected = select_optional_groups (remaining_pause_time);
697
698
698
699
stop_incremental_building ();
699
700
@@ -756,7 +757,7 @@ class G1VerifyYoungCSetIndicesClosure : public G1HeapRegionClosure {
756
757
void G1CollectionSet::verify_young_cset_indices () const {
757
758
assert_at_safepoint_on_vm_thread ();
758
759
759
- G1VerifyYoungCSetIndicesClosure cl (_collection_set_cur_length );
760
+ G1VerifyYoungCSetIndicesClosure cl (_regions_cur_length );
760
761
iterate(&cl);
761
762
}
762
763
#endif
0 commit comments