272 csr = next; |
272 csr = next; |
273 } |
273 } |
274 } |
274 } |
275 #endif // !PRODUCT |
275 #endif // !PRODUCT |
276 |
276 |
277 double G1CollectionSet::finalize_young_part(double target_pause_time_ms) { |
277 double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) { |
278 double young_start_time_sec = os::elapsedTime(); |
278 double young_start_time_sec = os::elapsedTime(); |
279 |
279 |
280 YoungList* young_list = _g1->young_list(); |
|
281 finalize_incremental_building(); |
280 finalize_incremental_building(); |
282 |
281 |
283 guarantee(target_pause_time_ms > 0.0, |
282 guarantee(target_pause_time_ms > 0.0, |
284 "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms); |
283 "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms); |
285 guarantee(_head == NULL, "Precondition"); |
284 guarantee(_head == NULL, "Precondition"); |
295 |
294 |
296 // The young list is laid with the survivor regions from the previous |
295 // The young list is laid with the survivor regions from the previous |
297 // pause are appended to the RHS of the young list, i.e. |
296 // pause are appended to the RHS of the young list, i.e. |
298 // [Newly Young Regions ++ Survivors from last pause]. |
297 // [Newly Young Regions ++ Survivors from last pause]. |
299 |
298 |
300 uint survivor_region_length = young_list->survivor_length(); |
299 uint survivor_region_length = survivors->length(); |
301 uint eden_region_length = young_list->eden_length(); |
300 uint eden_region_length = _g1->eden_regions_count(); |
302 init_region_lengths(eden_region_length, survivor_region_length); |
301 init_region_lengths(eden_region_length, survivor_region_length); |
303 |
302 |
304 const GrowableArray<HeapRegion*>* survivor_regions = _g1->young_list()->survivor_regions(); |
|
305 for (GrowableArrayIterator<HeapRegion*> it = survivor_regions->begin(); |
|
306 it != survivor_regions->end(); |
|
307 ++it) { |
|
308 HeapRegion* hr = *it; |
|
309 assert(hr->is_survivor(), "badly formed young list"); |
|
310 // There is a convention that all the young regions in the CSet |
|
311 // are tagged as "eden", so we do this for the survivors here. We |
|
312 // use the special set_eden_pre_gc() as it doesn't check that the |
|
313 // region is free (which is not the case here). |
|
314 hr->set_eden_pre_gc(); |
|
315 } |
|
316 |
|
317 verify_young_cset_indices(); |
303 verify_young_cset_indices(); |
318 |
304 |
319 // Clear the fields that point to the survivor list - they are all young now. |
305 // Clear the fields that point to the survivor list - they are all young now. |
320 young_list->clear_survivors(); |
306 survivors->convert_to_eden(); |
321 |
307 |
322 _head = _inc_head; |
308 _head = _inc_head; |
323 _bytes_used_before = _inc_bytes_used_before; |
309 _bytes_used_before = _inc_bytes_used_before; |
324 time_remaining_ms = MAX2(time_remaining_ms - _inc_predicted_elapsed_time_ms, 0.0); |
310 time_remaining_ms = MAX2(time_remaining_ms - _inc_predicted_elapsed_time_ms, 0.0); |
325 |
311 |