src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page




 874     abandon_cur_alloc_region();
 875     assert(_cur_alloc_region == NULL, "Invariant.");
 876     g1_rem_set()->as_HRInto_G1RemSet()->cleanupHRRS();
 877     tear_down_region_lists();
 878     set_used_regions_to_need_zero_fill();
 879     if (g1_policy()->in_young_gc_mode()) {
 880       empty_young_list();
 881       g1_policy()->set_full_young_gcs(true);
 882     }
 883 
 884     // Temporarily make reference _discovery_ single threaded (non-MT).
 885     ReferenceProcessorMTMutator rp_disc_ser(ref_processor(), false);
 886 
 887     // Temporarily make refs discovery atomic
 888     ReferenceProcessorAtomicMutator rp_disc_atomic(ref_processor(), true);
 889 
 890     // Temporarily clear _is_alive_non_header
 891     ReferenceProcessorIsAliveMutator rp_is_alive_null(ref_processor(), NULL);
 892 
 893     ref_processor()->enable_discovery();

 894 
 895     // Do collection work
 896     {
 897       HandleMark hm;  // Discard invalid handles created during gc
 898       G1MarkSweep::invoke_at_safepoint(ref_processor(), clear_all_soft_refs);
 899     }
 900     // Because freeing humongous regions may have added some unclean
 901     // regions, it is necessary to tear down again before rebuilding.
 902     tear_down_region_lists();
 903     rebuild_region_lists();
 904 
 905     _summary_bytes_used = recalculate_used();
 906 
 907     ref_processor()->enqueue_discovered_references();
 908 
 909     COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
 910 
 911     if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) {
 912       HandleMark hm;  // Discard invalid handles created during verification
 913       gclog_or_tty->print(" VerifyAfterGC:");


2446   { // Call to jvmpi::post_class_unload_events must occur outside of active GC
2447     IsGCActiveMark x;
2448 
2449     gc_prologue(false);
2450     increment_total_collections();
2451 
2452 #if G1_REM_SET_LOGGING
2453     gclog_or_tty->print_cr("\nJust chose CS, heap:");
2454     print();
2455 #endif
2456 
2457     if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) {
2458       HandleMark hm;  // Discard invalid handles created during verification
2459       prepare_for_verify();
2460       gclog_or_tty->print(" VerifyBeforeGC:");
2461       Universe::verify(false);
2462     }
2463 
2464     COMPILER2_PRESENT(DerivedPointerTable::clear());
2465 
2466     // We want to turn off ref discovere, if necessary, and turn it back on
2467     // on again later if we do.
2468     bool was_enabled = ref_processor()->discovery_enabled();
2469     if (was_enabled) ref_processor()->disable_discovery();
2470 
2471     // Forget the current alloc region (we might even choose it to be part
2472     // of the collection set!).
2473     abandon_cur_alloc_region();
2474 
2475     // The elapsed time induced by the start time below deliberately elides
2476     // the possible verification above.
2477     double start_time_sec = os::elapsedTime();
2478     GCOverheadReporter::recordSTWStart(start_time_sec);
2479     size_t start_used_bytes = used();
2480     if (!G1ConcMark) {
2481       do_sync_mark();
2482     }
2483 
2484     g1_policy()->record_collection_pause_start(start_time_sec,
2485                                                start_used_bytes);
2486 




 874     abandon_cur_alloc_region();
 875     assert(_cur_alloc_region == NULL, "Invariant.");
 876     g1_rem_set()->as_HRInto_G1RemSet()->cleanupHRRS();
 877     tear_down_region_lists();
 878     set_used_regions_to_need_zero_fill();
 879     if (g1_policy()->in_young_gc_mode()) {
 880       empty_young_list();
 881       g1_policy()->set_full_young_gcs(true);
 882     }
 883 
 884     // Temporarily make reference _discovery_ single threaded (non-MT).
 885     ReferenceProcessorMTMutator rp_disc_ser(ref_processor(), false);
 886 
 887     // Temporarily make refs discovery atomic
 888     ReferenceProcessorAtomicMutator rp_disc_atomic(ref_processor(), true);
 889 
 890     // Temporarily clear _is_alive_non_header
 891     ReferenceProcessorIsAliveMutator rp_is_alive_null(ref_processor(), NULL);
 892 
 893     ref_processor()->enable_discovery();
 894     ref_processor()->snap_policy(clear_all_soft_refs);
 895 
 896     // Do collection work
 897     {
 898       HandleMark hm;  // Discard invalid handles created during gc
 899       G1MarkSweep::invoke_at_safepoint(ref_processor(), clear_all_soft_refs);
 900     }
 901     // Because freeing humongous regions may have added some unclean
 902     // regions, it is necessary to tear down again before rebuilding.
 903     tear_down_region_lists();
 904     rebuild_region_lists();
 905 
 906     _summary_bytes_used = recalculate_used();
 907 
 908     ref_processor()->enqueue_discovered_references();
 909 
 910     COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
 911 
 912     if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) {
 913       HandleMark hm;  // Discard invalid handles created during verification
 914       gclog_or_tty->print(" VerifyAfterGC:");


2447   { // Call to jvmpi::post_class_unload_events must occur outside of active GC
2448     IsGCActiveMark x;
2449 
2450     gc_prologue(false);
2451     increment_total_collections();
2452 
2453 #if G1_REM_SET_LOGGING
2454     gclog_or_tty->print_cr("\nJust chose CS, heap:");
2455     print();
2456 #endif
2457 
2458     if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) {
2459       HandleMark hm;  // Discard invalid handles created during verification
2460       prepare_for_verify();
2461       gclog_or_tty->print(" VerifyBeforeGC:");
2462       Universe::verify(false);
2463     }
2464 
2465     COMPILER2_PRESENT(DerivedPointerTable::clear());
2466 
2467     // We want to turn off ref discovery, if necessary, and turn it back on
2468     // on again later if we do.
2469     bool was_enabled = ref_processor()->discovery_enabled();
2470     if (was_enabled) ref_processor()->disable_discovery();
2471 
2472     // Forget the current alloc region (we might even choose it to be part
2473     // of the collection set!).
2474     abandon_cur_alloc_region();
2475 
2476     // The elapsed time induced by the start time below deliberately elides
2477     // the possible verification above.
2478     double start_time_sec = os::elapsedTime();
2479     GCOverheadReporter::recordSTWStart(start_time_sec);
2480     size_t start_used_bytes = used();
2481     if (!G1ConcMark) {
2482       do_sync_mark();
2483     }
2484 
2485     g1_policy()->record_collection_pause_start(start_time_sec,
2486                                                start_used_bytes);
2487