Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 3867:ff53346271fe
6814390: G1: remove the concept of non-generational G1
Summary: Removed the possibility to turn off generational mode for G1.
Reviewed-by: johnc, ysr, tonyp
author | brutisso |
---|---|
date | Fri, 19 Aug 2011 09:30:59 +0200 |
parents | f44782f04dd4 |
children | 7f776886a215 |
comparison
equal
deleted
inserted
replaced
3866:7c29742c41b4 | 3867:ff53346271fe |
---|---|
1261 // after this full GC. | 1261 // after this full GC. |
1262 abandon_collection_set(g1_policy()->inc_cset_head()); | 1262 abandon_collection_set(g1_policy()->inc_cset_head()); |
1263 g1_policy()->clear_incremental_cset(); | 1263 g1_policy()->clear_incremental_cset(); |
1264 g1_policy()->stop_incremental_cset_building(); | 1264 g1_policy()->stop_incremental_cset_building(); |
1265 | 1265 |
1266 if (g1_policy()->in_young_gc_mode()) { | 1266 empty_young_list(); |
1267 empty_young_list(); | 1267 g1_policy()->set_full_young_gcs(true); |
1268 g1_policy()->set_full_young_gcs(true); | |
1269 } | |
1270 | 1268 |
1271 // See the comment in G1CollectedHeap::ref_processing_init() about | 1269 // See the comment in G1CollectedHeap::ref_processing_init() about |
1272 // how reference processing currently works in G1. | 1270 // how reference processing currently works in G1. |
1273 | 1271 |
1274 // Temporarily make reference _discovery_ single threaded (non-MT). | 1272 // Temporarily make reference _discovery_ single threaded (non-MT). |
1385 JavaThread::dirty_card_queue_set().abandon_logs(); | 1383 JavaThread::dirty_card_queue_set().abandon_logs(); |
1386 assert(!G1DeferredRSUpdate | 1384 assert(!G1DeferredRSUpdate |
1387 || (G1DeferredRSUpdate && (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any"); | 1385 || (G1DeferredRSUpdate && (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any"); |
1388 } | 1386 } |
1389 | 1387 |
1390 if (g1_policy()->in_young_gc_mode()) { | 1388 _young_list->reset_sampled_info(); |
1391 _young_list->reset_sampled_info(); | 1389 // At this point there should be no regions in the |
1392 // At this point there should be no regions in the | 1390 // entire heap tagged as young. |
1393 // entire heap tagged as young. | 1391 assert( check_young_list_empty(true /* check_heap */), |
1394 assert( check_young_list_empty(true /* check_heap */), | 1392 "young list should be empty at this point"); |
1395 "young list should be empty at this point"); | |
1396 } | |
1397 | 1393 |
1398 // Update the number of full collections that have been completed. | 1394 // Update the number of full collections that have been completed. |
1399 increment_full_collections_completed(false /* concurrent */); | 1395 increment_full_collections_completed(false /* concurrent */); |
1400 | 1396 |
1401 _hrs.verify_optional(); | 1397 _hrs.verify_optional(); |
3159 _cmThread->set_started(); | 3155 _cmThread->set_started(); |
3160 CGC_lock->notify(); | 3156 CGC_lock->notify(); |
3161 } | 3157 } |
3162 } | 3158 } |
3163 | 3159 |
3164 void G1CollectedHeap::do_sync_mark() { | |
3165 _cm->checkpointRootsInitial(); | |
3166 _cm->markFromRoots(); | |
3167 _cm->checkpointRootsFinal(false); | |
3168 } | |
3169 | |
3170 // <NEW PREDICTION> | 3160 // <NEW PREDICTION> |
3171 | 3161 |
3172 double G1CollectedHeap::predict_region_elapsed_time_ms(HeapRegion *hr, | 3162 double G1CollectedHeap::predict_region_elapsed_time_ms(HeapRegion *hr, |
3173 bool young) { | 3163 bool young) { |
3174 return _g1_policy->predict_region_elapsed_time_ms(hr, young); | 3164 return _g1_policy->predict_region_elapsed_time_ms(hr, young); |
3315 // for the duration of this pause. | 3305 // for the duration of this pause. |
3316 g1_policy()->decide_on_conc_mark_initiation(); | 3306 g1_policy()->decide_on_conc_mark_initiation(); |
3317 | 3307 |
3318 char verbose_str[128]; | 3308 char verbose_str[128]; |
3319 sprintf(verbose_str, "GC pause "); | 3309 sprintf(verbose_str, "GC pause "); |
3320 if (g1_policy()->in_young_gc_mode()) { | 3310 if (g1_policy()->full_young_gcs()) { |
3321 if (g1_policy()->full_young_gcs()) | 3311 strcat(verbose_str, "(young)"); |
3322 strcat(verbose_str, "(young)"); | 3312 } else { |
3323 else | 3313 strcat(verbose_str, "(partial)"); |
3324 strcat(verbose_str, "(partial)"); | |
3325 } | 3314 } |
3326 if (g1_policy()->during_initial_mark_pause()) { | 3315 if (g1_policy()->during_initial_mark_pause()) { |
3327 strcat(verbose_str, " (initial-mark)"); | 3316 strcat(verbose_str, " (initial-mark)"); |
3328 // We are about to start a marking cycle, so we increment the | 3317 // We are about to start a marking cycle, so we increment the |
3329 // full collection counter. | 3318 // full collection counter. |
3348 // get entries from the secondary_free_list. | 3337 // get entries from the secondary_free_list. |
3349 if (!G1StressConcRegionFreeing) { | 3338 if (!G1StressConcRegionFreeing) { |
3350 append_secondary_free_list_if_not_empty_with_lock(); | 3339 append_secondary_free_list_if_not_empty_with_lock(); |
3351 } | 3340 } |
3352 | 3341 |
3353 if (g1_policy()->in_young_gc_mode()) { | 3342 assert(check_young_list_well_formed(), |
3354 assert(check_young_list_well_formed(), | 3343 "young list should be well formed"); |
3355 "young list should be well formed"); | |
3356 } | |
3357 | 3344 |
3358 { // Call to jvmpi::post_class_unload_events must occur outside of active GC | 3345 { // Call to jvmpi::post_class_unload_events must occur outside of active GC |
3359 IsGCActiveMark x; | 3346 IsGCActiveMark x; |
3360 | 3347 |
3361 gc_prologue(false); | 3348 gc_prologue(false); |
3492 // Clear the _cset_fast_test bitmap in anticipation of adding | 3479 // Clear the _cset_fast_test bitmap in anticipation of adding |
3493 // regions to the incremental collection set for the next | 3480 // regions to the incremental collection set for the next |
3494 // evacuation pause. | 3481 // evacuation pause. |
3495 clear_cset_fast_test(); | 3482 clear_cset_fast_test(); |
3496 | 3483 |
3497 if (g1_policy()->in_young_gc_mode()) { | 3484 _young_list->reset_sampled_info(); |
3498 _young_list->reset_sampled_info(); | 3485 |
3499 | 3486 // Don't check the whole heap at this point as the |
3500 // Don't check the whole heap at this point as the | 3487 // GC alloc regions from this pause have been tagged |
3501 // GC alloc regions from this pause have been tagged | 3488 // as survivors and moved on to the survivor list. |
3502 // as survivors and moved on to the survivor list. | 3489 // Survivor regions will fail the !is_young() check. |
3503 // Survivor regions will fail the !is_young() check. | 3490 assert(check_young_list_empty(false /* check_heap */), |
3504 assert(check_young_list_empty(false /* check_heap */), | 3491 "young list should be empty"); |
3505 "young list should be empty"); | |
3506 | 3492 |
3507 #if YOUNG_LIST_VERBOSE | 3493 #if YOUNG_LIST_VERBOSE |
3508 gclog_or_tty->print_cr("Before recording survivors.\nYoung List:"); | 3494 gclog_or_tty->print_cr("Before recording survivors.\nYoung List:"); |
3509 _young_list->print(); | 3495 _young_list->print(); |
3510 #endif // YOUNG_LIST_VERBOSE | 3496 #endif // YOUNG_LIST_VERBOSE |
3511 | 3497 |
3512 g1_policy()->record_survivor_regions(_young_list->survivor_length(), | 3498 g1_policy()->record_survivor_regions(_young_list->survivor_length(), |
3513 _young_list->first_survivor_region(), | 3499 _young_list->first_survivor_region(), |
3514 _young_list->last_survivor_region()); | 3500 _young_list->last_survivor_region()); |
3515 | 3501 |
3516 _young_list->reset_auxilary_lists(); | 3502 _young_list->reset_auxilary_lists(); |
3517 } | |
3518 | 3503 |
3519 if (evacuation_failed()) { | 3504 if (evacuation_failed()) { |
3520 _summary_bytes_used = recalculate_used(); | 3505 _summary_bytes_used = recalculate_used(); |
3521 } else { | 3506 } else { |
3522 // The "used" of the the collection set have already been subtracted | 3507 // The "used" of the the collection set have already been subtracted |
3523 // when they were freed. Add in the bytes evacuated. | 3508 // when they were freed. Add in the bytes evacuated. |
3524 _summary_bytes_used += g1_policy()->bytes_copied_during_gc(); | 3509 _summary_bytes_used += g1_policy()->bytes_copied_during_gc(); |
3525 } | 3510 } |
3526 | 3511 |
3527 if (g1_policy()->in_young_gc_mode() && | 3512 if (g1_policy()->during_initial_mark_pause()) { |
3528 g1_policy()->during_initial_mark_pause()) { | |
3529 concurrent_mark()->checkpointRootsInitialPost(); | 3513 concurrent_mark()->checkpointRootsInitialPost(); |
3530 set_marking_started(); | 3514 set_marking_started(); |
3531 // CAUTION: after the doConcurrentMark() call below, | 3515 // CAUTION: after the doConcurrentMark() call below, |
3532 // the concurrent marking thread(s) could be running | 3516 // the concurrent marking thread(s) could be running |
3533 // concurrently with us. Make sure that anything after | 3517 // concurrently with us. Make sure that anything after |
5089 } | 5073 } |
5090 | 5074 |
5091 void G1CollectedHeap::empty_young_list() { | 5075 void G1CollectedHeap::empty_young_list() { |
5092 assert(heap_lock_held_for_gc(), | 5076 assert(heap_lock_held_for_gc(), |
5093 "the heap lock should already be held by or for this thread"); | 5077 "the heap lock should already be held by or for this thread"); |
5094 assert(g1_policy()->in_young_gc_mode(), "should be in young GC mode"); | |
5095 | 5078 |
5096 _young_list->empty_list(); | 5079 _young_list->empty_list(); |
5097 } | 5080 } |
5098 | 5081 |
5099 // Done at the start of full GC. | 5082 // Done at the start of full GC. |