44 assert(hr->get_next_young_region() == NULL, "cause it should!"); |
44 assert(hr->get_next_young_region() == NULL, "cause it should!"); |
45 |
45 |
46 hr->set_next_young_region(_head); |
46 hr->set_next_young_region(_head); |
47 _head = hr; |
47 _head = hr; |
48 |
48 |
49 _g1h->g1_policy()->set_region_eden(hr, (int) _length); |
49 _g1h->g1_policy()->set_region_eden(hr); |
50 ++_length; |
50 ++_length; |
51 } |
51 } |
52 |
52 |
53 void YoungList::add_survivor_region(HeapRegion* hr) { |
53 void YoungList::add_survivor_region(HeapRegion* hr) { |
54 assert(hr->is_survivor(), "should be flagged as survivor region"); |
54 assert(hr->is_survivor(), "should be flagged as survivor region"); |
143 |
143 |
144 // Add survivor regions to SurvRateGroup. |
144 // Add survivor regions to SurvRateGroup. |
145 _g1h->g1_policy()->note_start_adding_survivor_regions(); |
145 _g1h->g1_policy()->note_start_adding_survivor_regions(); |
146 _g1h->g1_policy()->finished_recalculating_age_indexes(true /* is_survivors */); |
146 _g1h->g1_policy()->finished_recalculating_age_indexes(true /* is_survivors */); |
147 |
147 |
148 int young_index_in_cset = 0; |
|
149 for (HeapRegion* curr = _survivor_head; |
148 for (HeapRegion* curr = _survivor_head; |
150 curr != NULL; |
149 curr != NULL; |
151 curr = curr->get_next_young_region()) { |
150 curr = curr->get_next_young_region()) { |
152 _g1h->g1_policy()->set_region_survivor(curr, young_index_in_cset); |
151 _g1h->g1_policy()->set_region_survivor(curr); |
153 |
152 |
154 // The region is a non-empty survivor so let's add it to |
153 // The region is a non-empty survivor so let's add it to |
155 // the incremental collection set for the next evacuation |
154 // the incremental collection set for the next evacuation |
156 // pause. |
155 // pause. |
157 _g1h->collection_set()->add_survivor_regions(curr); |
156 _g1h->collection_set()->add_survivor_regions(curr); |
158 young_index_in_cset += 1; |
|
159 } |
157 } |
160 assert((uint) young_index_in_cset == _survivor_length, "post-condition"); |
|
161 _g1h->g1_policy()->note_stop_adding_survivor_regions(); |
158 _g1h->g1_policy()->note_stop_adding_survivor_regions(); |
162 |
159 |
163 _head = _survivor_head; |
160 _head = _survivor_head; |
164 _length = _survivor_length; |
161 _length = _survivor_length; |
165 if (_survivor_head != NULL) { |
162 if (_survivor_head != NULL) { |