Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 838:0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
Summary: Changing the behavior of -XX:+PrintHeapAtGC for G1 from printing lengthy, per-region information to instead printing a concise summary.
Reviewed-by: ysr, apetrusenko, jcoomes
author | tonyp |
---|---|
date | Tue, 07 Jul 2009 14:23:00 -0400 |
parents | 830ca2573896 |
children | df6caf649ff7 |
comparison
equal
deleted
inserted
replaced
832:e7d5557ad624 | 838:0316eac49d5a |
---|---|
900 | 900 |
901 void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs, | 901 void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs, |
902 size_t word_size) { | 902 size_t word_size) { |
903 ResourceMark rm; | 903 ResourceMark rm; |
904 | 904 |
905 if (PrintHeapAtGC) { | |
906 Universe::print_heap_before_gc(); | |
907 } | |
908 | |
905 if (full && DisableExplicitGC) { | 909 if (full && DisableExplicitGC) { |
906 gclog_or_tty->print("\n\n\nDisabling Explicit GC\n\n\n"); | 910 gclog_or_tty->print("\n\n\nDisabling Explicit GC\n\n\n"); |
907 return; | 911 return; |
908 } | 912 } |
909 | 913 |
925 double start = os::elapsedTime(); | 929 double start = os::elapsedTime(); |
926 GCOverheadReporter::recordSTWStart(start); | 930 GCOverheadReporter::recordSTWStart(start); |
927 g1_policy()->record_full_collection_start(); | 931 g1_policy()->record_full_collection_start(); |
928 | 932 |
929 gc_prologue(true); | 933 gc_prologue(true); |
930 increment_total_collections(); | 934 increment_total_collections(true /* full gc */); |
931 | 935 |
932 size_t g1h_prev_used = used(); | 936 size_t g1h_prev_used = used(); |
933 assert(used() == recalculate_used(), "Should be equal"); | 937 assert(used() == recalculate_used(), "Should be equal"); |
934 | 938 |
935 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { | 939 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { |
1063 | 1067 |
1064 if (g1_policy()->in_young_gc_mode()) { | 1068 if (g1_policy()->in_young_gc_mode()) { |
1065 _young_list->reset_sampled_info(); | 1069 _young_list->reset_sampled_info(); |
1066 assert( check_young_list_empty(false, false), | 1070 assert( check_young_list_empty(false, false), |
1067 "young list should be empty at this point"); | 1071 "young list should be empty at this point"); |
1072 } | |
1073 | |
1074 if (PrintHeapAtGC) { | |
1075 Universe::print_heap_after_gc(); | |
1068 } | 1076 } |
1069 } | 1077 } |
1070 | 1078 |
1071 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) { | 1079 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) { |
1072 do_collection(true, clear_all_soft_refs, 0); | 1080 do_collection(true, clear_all_soft_refs, 0); |
2323 r->print_on(_st); | 2331 r->print_on(_st); |
2324 return false; | 2332 return false; |
2325 } | 2333 } |
2326 }; | 2334 }; |
2327 | 2335 |
2328 void G1CollectedHeap::print() const { print_on(gclog_or_tty); } | 2336 void G1CollectedHeap::print() const { print_on(tty); } |
2329 | 2337 |
2330 void G1CollectedHeap::print_on(outputStream* st) const { | 2338 void G1CollectedHeap::print_on(outputStream* st) const { |
2339 print_on(st, PrintHeapAtGCExtended); | |
2340 } | |
2341 | |
2342 void G1CollectedHeap::print_on(outputStream* st, bool extended) const { | |
2343 st->print(" %-20s", "garbage-first heap"); | |
2344 st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", | |
2345 capacity()/K, used()/K); | |
2346 st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", | |
2347 _g1_storage.low_boundary(), | |
2348 _g1_storage.high(), | |
2349 _g1_storage.high_boundary()); | |
2350 st->cr(); | |
2351 st->print(" region size " SIZE_FORMAT "K, ", | |
2352 HeapRegion::GrainBytes/K); | |
2353 size_t young_regions = _young_list->length(); | |
2354 st->print(SIZE_FORMAT " young (" SIZE_FORMAT "K), ", | |
2355 young_regions, young_regions * HeapRegion::GrainBytes / K); | |
2356 size_t survivor_regions = g1_policy()->recorded_survivor_regions(); | |
2357 st->print(SIZE_FORMAT " survivors (" SIZE_FORMAT "K)", | |
2358 survivor_regions, survivor_regions * HeapRegion::GrainBytes / K); | |
2359 st->cr(); | |
2360 perm()->as_gen()->print_on(st); | |
2361 if (extended) { | |
2362 print_on_extended(st); | |
2363 } | |
2364 } | |
2365 | |
2366 void G1CollectedHeap::print_on_extended(outputStream* st) const { | |
2331 PrintRegionClosure blk(st); | 2367 PrintRegionClosure blk(st); |
2332 _hrs->iterate(&blk); | 2368 _hrs->iterate(&blk); |
2333 } | 2369 } |
2334 | 2370 |
2335 class PrintOnThreadsClosure : public ThreadClosure { | 2371 class PrintOnThreadsClosure : public ThreadClosure { |
2406 "not a garbage-first heap"); | 2442 "not a garbage-first heap"); |
2407 return _g1h; | 2443 return _g1h; |
2408 } | 2444 } |
2409 | 2445 |
2410 void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { | 2446 void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { |
2411 if (PrintHeapAtGC){ | |
2412 gclog_or_tty->print_cr(" {Heap before GC collections=%d:", total_collections()); | |
2413 Universe::print(); | |
2414 } | |
2415 assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); | 2447 assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); |
2416 // Call allocation profiler | 2448 // Call allocation profiler |
2417 AllocationProfiler::iterate_since_last_gc(); | 2449 AllocationProfiler::iterate_since_last_gc(); |
2418 // Fill TLAB's and such | 2450 // Fill TLAB's and such |
2419 ensure_parsability(true); | 2451 ensure_parsability(true); |
2423 // FIXME: what is this about? | 2455 // FIXME: what is this about? |
2424 // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled" | 2456 // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled" |
2425 // is set. | 2457 // is set. |
2426 COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), | 2458 COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), |
2427 "derived pointer present")); | 2459 "derived pointer present")); |
2428 | |
2429 if (PrintHeapAtGC){ | |
2430 gclog_or_tty->print_cr(" Heap after GC collections=%d:", total_collections()); | |
2431 Universe::print(); | |
2432 gclog_or_tty->print("} "); | |
2433 } | |
2434 } | 2460 } |
2435 | 2461 |
2436 void G1CollectedHeap::do_collection_pause() { | 2462 void G1CollectedHeap::do_collection_pause() { |
2437 // Read the GC count while holding the Heap_lock | 2463 // Read the GC count while holding the Heap_lock |
2438 // we need to do this _before_ wait_for_cleanup_complete(), to | 2464 // we need to do this _before_ wait_for_cleanup_complete(), to |
2557 | 2583 |
2558 // </NEW PREDICTION> | 2584 // </NEW PREDICTION> |
2559 | 2585 |
2560 void | 2586 void |
2561 G1CollectedHeap::do_collection_pause_at_safepoint() { | 2587 G1CollectedHeap::do_collection_pause_at_safepoint() { |
2562 char verbose_str[128]; | 2588 if (PrintHeapAtGC) { |
2563 sprintf(verbose_str, "GC pause "); | 2589 Universe::print_heap_before_gc(); |
2564 if (g1_policy()->in_young_gc_mode()) { | 2590 } |
2565 if (g1_policy()->full_young_gcs()) | 2591 |
2566 strcat(verbose_str, "(young)"); | 2592 { |
2567 else | 2593 char verbose_str[128]; |
2568 strcat(verbose_str, "(partial)"); | 2594 sprintf(verbose_str, "GC pause "); |
2569 } | 2595 if (g1_policy()->in_young_gc_mode()) { |
2570 if (g1_policy()->should_initiate_conc_mark()) | 2596 if (g1_policy()->full_young_gcs()) |
2571 strcat(verbose_str, " (initial-mark)"); | 2597 strcat(verbose_str, "(young)"); |
2572 | 2598 else |
2573 GCCauseSetter x(this, GCCause::_g1_inc_collection_pause); | 2599 strcat(verbose_str, "(partial)"); |
2574 | 2600 } |
2575 // if PrintGCDetails is on, we'll print long statistics information | 2601 if (g1_policy()->should_initiate_conc_mark()) |
2576 // in the collector policy code, so let's not print this as the output | 2602 strcat(verbose_str, " (initial-mark)"); |
2577 // is messy if we do. | 2603 |
2578 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); | 2604 GCCauseSetter x(this, GCCause::_g1_inc_collection_pause); |
2579 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); | 2605 |
2580 TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty); | 2606 // if PrintGCDetails is on, we'll print long statistics information |
2581 | 2607 // in the collector policy code, so let's not print this as the output |
2582 ResourceMark rm; | 2608 // is messy if we do. |
2583 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); | 2609 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); |
2584 assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread"); | 2610 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); |
2585 guarantee(!is_gc_active(), "collection is not reentrant"); | 2611 TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty); |
2586 assert(regions_accounted_for(), "Region leakage!"); | 2612 |
2587 | 2613 ResourceMark rm; |
2588 increment_gc_time_stamp(); | 2614 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); |
2589 | 2615 assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread"); |
2590 if (g1_policy()->in_young_gc_mode()) { | 2616 guarantee(!is_gc_active(), "collection is not reentrant"); |
2591 assert(check_young_list_well_formed(), | 2617 assert(regions_accounted_for(), "Region leakage!"); |
2592 "young list should be well formed"); | 2618 |
2593 } | 2619 increment_gc_time_stamp(); |
2594 | 2620 |
2595 if (GC_locker::is_active()) { | 2621 if (g1_policy()->in_young_gc_mode()) { |
2596 return; // GC is disabled (e.g. JNI GetXXXCritical operation) | 2622 assert(check_young_list_well_formed(), |
2597 } | 2623 "young list should be well formed"); |
2598 | 2624 } |
2599 bool abandoned = false; | 2625 |
2600 { // Call to jvmpi::post_class_unload_events must occur outside of active GC | 2626 if (GC_locker::is_active()) { |
2601 IsGCActiveMark x; | 2627 return; // GC is disabled (e.g. JNI GetXXXCritical operation) |
2602 | 2628 } |
2603 gc_prologue(false); | 2629 |
2604 increment_total_collections(); | 2630 bool abandoned = false; |
2631 { // Call to jvmpi::post_class_unload_events must occur outside of active GC | |
2632 IsGCActiveMark x; | |
2633 | |
2634 gc_prologue(false); | |
2635 increment_total_collections(false /* full gc */); | |
2605 | 2636 |
2606 #if G1_REM_SET_LOGGING | 2637 #if G1_REM_SET_LOGGING |
2607 gclog_or_tty->print_cr("\nJust chose CS, heap:"); | 2638 gclog_or_tty->print_cr("\nJust chose CS, heap:"); |
2608 print(); | |
2609 #endif | |
2610 | |
2611 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { | |
2612 HandleMark hm; // Discard invalid handles created during verification | |
2613 prepare_for_verify(); | |
2614 gclog_or_tty->print(" VerifyBeforeGC:"); | |
2615 Universe::verify(false); | |
2616 } | |
2617 | |
2618 COMPILER2_PRESENT(DerivedPointerTable::clear()); | |
2619 | |
2620 // We want to turn off ref discovery, if necessary, and turn it back on | |
2621 // on again later if we do. | |
2622 bool was_enabled = ref_processor()->discovery_enabled(); | |
2623 if (was_enabled) ref_processor()->disable_discovery(); | |
2624 | |
2625 // Forget the current alloc region (we might even choose it to be part | |
2626 // of the collection set!). | |
2627 abandon_cur_alloc_region(); | |
2628 | |
2629 // The elapsed time induced by the start time below deliberately elides | |
2630 // the possible verification above. | |
2631 double start_time_sec = os::elapsedTime(); | |
2632 GCOverheadReporter::recordSTWStart(start_time_sec); | |
2633 size_t start_used_bytes = used(); | |
2634 if (!G1ConcMark) { | |
2635 do_sync_mark(); | |
2636 } | |
2637 | |
2638 g1_policy()->record_collection_pause_start(start_time_sec, | |
2639 start_used_bytes); | |
2640 | |
2641 guarantee(_in_cset_fast_test == NULL, "invariant"); | |
2642 guarantee(_in_cset_fast_test_base == NULL, "invariant"); | |
2643 _in_cset_fast_test_length = max_regions(); | |
2644 _in_cset_fast_test_base = | |
2645 NEW_C_HEAP_ARRAY(bool, _in_cset_fast_test_length); | |
2646 memset(_in_cset_fast_test_base, false, | |
2647 _in_cset_fast_test_length * sizeof(bool)); | |
2648 // We're biasing _in_cset_fast_test to avoid subtracting the | |
2649 // beginning of the heap every time we want to index; basically | |
2650 // it's the same with what we do with the card table. | |
2651 _in_cset_fast_test = _in_cset_fast_test_base - | |
2652 ((size_t) _g1_reserved.start() >> HeapRegion::LogOfHRGrainBytes); | |
2653 | |
2654 #if SCAN_ONLY_VERBOSE | |
2655 _young_list->print(); | |
2656 #endif // SCAN_ONLY_VERBOSE | |
2657 | |
2658 if (g1_policy()->should_initiate_conc_mark()) { | |
2659 concurrent_mark()->checkpointRootsInitialPre(); | |
2660 } | |
2661 save_marks(); | |
2662 | |
2663 // We must do this before any possible evacuation that should propagate | |
2664 // marks. | |
2665 if (mark_in_progress()) { | |
2666 double start_time_sec = os::elapsedTime(); | |
2667 | |
2668 _cm->drainAllSATBBuffers(); | |
2669 double finish_mark_ms = (os::elapsedTime() - start_time_sec) * 1000.0; | |
2670 g1_policy()->record_satb_drain_time(finish_mark_ms); | |
2671 | |
2672 } | |
2673 // Record the number of elements currently on the mark stack, so we | |
2674 // only iterate over these. (Since evacuation may add to the mark | |
2675 // stack, doing more exposes race conditions.) If no mark is in | |
2676 // progress, this will be zero. | |
2677 _cm->set_oops_do_bound(); | |
2678 | |
2679 assert(regions_accounted_for(), "Region leakage."); | |
2680 | |
2681 if (mark_in_progress()) | |
2682 concurrent_mark()->newCSet(); | |
2683 | |
2684 // Now choose the CS. | |
2685 g1_policy()->choose_collection_set(); | |
2686 | |
2687 // We may abandon a pause if we find no region that will fit in the MMU | |
2688 // pause. | |
2689 bool abandoned = (g1_policy()->collection_set() == NULL); | |
2690 | |
2691 // Nothing to do if we were unable to choose a collection set. | |
2692 if (!abandoned) { | |
2693 #if G1_REM_SET_LOGGING | |
2694 gclog_or_tty->print_cr("\nAfter pause, heap:"); | |
2695 print(); | 2639 print(); |
2696 #endif | 2640 #endif |
2697 | 2641 |
2698 setup_surviving_young_words(); | 2642 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { |
2699 | 2643 HandleMark hm; // Discard invalid handles created during verification |
2700 // Set up the gc allocation regions. | 2644 prepare_for_verify(); |
2701 get_gc_alloc_regions(); | 2645 gclog_or_tty->print(" VerifyBeforeGC:"); |
2702 | 2646 Universe::verify(false); |
2703 // Actually do the work... | 2647 } |
2704 evacuate_collection_set(); | 2648 |
2705 free_collection_set(g1_policy()->collection_set()); | 2649 COMPILER2_PRESENT(DerivedPointerTable::clear()); |
2706 g1_policy()->clear_collection_set(); | 2650 |
2707 | 2651 // We want to turn off ref discovery, if necessary, and turn it back on |
2708 FREE_C_HEAP_ARRAY(bool, _in_cset_fast_test_base); | 2652 // on again later if we do. |
2709 // this is more for peace of mind; we're nulling them here and | 2653 bool was_enabled = ref_processor()->discovery_enabled(); |
2710 // we're expecting them to be null at the beginning of the next GC | 2654 if (was_enabled) ref_processor()->disable_discovery(); |
2711 _in_cset_fast_test = NULL; | 2655 |
2712 _in_cset_fast_test_base = NULL; | 2656 // Forget the current alloc region (we might even choose it to be part |
2713 | 2657 // of the collection set!). |
2714 release_gc_alloc_regions(false /* totally */); | 2658 abandon_cur_alloc_region(); |
2715 | 2659 |
2716 cleanup_surviving_young_words(); | 2660 // The elapsed time induced by the start time below deliberately elides |
2717 | 2661 // the possible verification above. |
2718 if (g1_policy()->in_young_gc_mode()) { | 2662 double start_time_sec = os::elapsedTime(); |
2719 _young_list->reset_sampled_info(); | 2663 GCOverheadReporter::recordSTWStart(start_time_sec); |
2720 assert(check_young_list_empty(true), | 2664 size_t start_used_bytes = used(); |
2721 "young list should be empty"); | 2665 if (!G1ConcMark) { |
2666 do_sync_mark(); | |
2667 } | |
2668 | |
2669 g1_policy()->record_collection_pause_start(start_time_sec, | |
2670 start_used_bytes); | |
2671 | |
2672 guarantee(_in_cset_fast_test == NULL, "invariant"); | |
2673 guarantee(_in_cset_fast_test_base == NULL, "invariant"); | |
2674 _in_cset_fast_test_length = max_regions(); | |
2675 _in_cset_fast_test_base = | |
2676 NEW_C_HEAP_ARRAY(bool, _in_cset_fast_test_length); | |
2677 memset(_in_cset_fast_test_base, false, | |
2678 _in_cset_fast_test_length * sizeof(bool)); | |
2679 // We're biasing _in_cset_fast_test to avoid subtracting the | |
2680 // beginning of the heap every time we want to index; basically | |
2681 // it's the same with what we do with the card table. | |
2682 _in_cset_fast_test = _in_cset_fast_test_base - | |
2683 ((size_t) _g1_reserved.start() >> HeapRegion::LogOfHRGrainBytes); | |
2722 | 2684 |
2723 #if SCAN_ONLY_VERBOSE | 2685 #if SCAN_ONLY_VERBOSE |
2724 _young_list->print(); | 2686 _young_list->print(); |
2725 #endif // SCAN_ONLY_VERBOSE | 2687 #endif // SCAN_ONLY_VERBOSE |
2726 | 2688 |
2727 g1_policy()->record_survivor_regions(_young_list->survivor_length(), | 2689 if (g1_policy()->should_initiate_conc_mark()) { |
2728 _young_list->first_survivor_region(), | 2690 concurrent_mark()->checkpointRootsInitialPre(); |
2729 _young_list->last_survivor_region()); | |
2730 _young_list->reset_auxilary_lists(); | |
2731 } | 2691 } |
2732 } else { | 2692 save_marks(); |
2733 COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); | 2693 |
2734 } | 2694 // We must do this before any possible evacuation that should propagate |
2735 | 2695 // marks. |
2736 if (evacuation_failed()) { | 2696 if (mark_in_progress()) { |
2737 _summary_bytes_used = recalculate_used(); | 2697 double start_time_sec = os::elapsedTime(); |
2738 } else { | 2698 |
2739 // The "used" of the the collection set have already been subtracted | 2699 _cm->drainAllSATBBuffers(); |
2740 // when they were freed. Add in the bytes evacuated. | 2700 double finish_mark_ms = (os::elapsedTime() - start_time_sec) * 1000.0; |
2741 _summary_bytes_used += g1_policy()->bytes_in_to_space(); | 2701 g1_policy()->record_satb_drain_time(finish_mark_ms); |
2742 } | 2702 } |
2743 | 2703 // Record the number of elements currently on the mark stack, so we |
2744 if (g1_policy()->in_young_gc_mode() && | 2704 // only iterate over these. (Since evacuation may add to the mark |
2745 g1_policy()->should_initiate_conc_mark()) { | 2705 // stack, doing more exposes race conditions.) If no mark is in |
2746 concurrent_mark()->checkpointRootsInitialPost(); | 2706 // progress, this will be zero. |
2747 set_marking_started(); | 2707 _cm->set_oops_do_bound(); |
2748 doConcurrentMark(); | 2708 |
2749 } | 2709 assert(regions_accounted_for(), "Region leakage."); |
2710 | |
2711 if (mark_in_progress()) | |
2712 concurrent_mark()->newCSet(); | |
2713 | |
2714 // Now choose the CS. | |
2715 g1_policy()->choose_collection_set(); | |
2716 | |
2717 // We may abandon a pause if we find no region that will fit in the MMU | |
2718 // pause. | |
2719 bool abandoned = (g1_policy()->collection_set() == NULL); | |
2720 | |
2721 // Nothing to do if we were unable to choose a collection set. | |
2722 if (!abandoned) { | |
2723 #if G1_REM_SET_LOGGING | |
2724 gclog_or_tty->print_cr("\nAfter pause, heap:"); | |
2725 print(); | |
2726 #endif | |
2727 | |
2728 setup_surviving_young_words(); | |
2729 | |
2730 // Set up the gc allocation regions. | |
2731 get_gc_alloc_regions(); | |
2732 | |
2733 // Actually do the work... | |
2734 evacuate_collection_set(); | |
2735 free_collection_set(g1_policy()->collection_set()); | |
2736 g1_policy()->clear_collection_set(); | |
2737 | |
2738 FREE_C_HEAP_ARRAY(bool, _in_cset_fast_test_base); | |
2739 // this is more for peace of mind; we're nulling them here and | |
2740 // we're expecting them to be null at the beginning of the next GC | |
2741 _in_cset_fast_test = NULL; | |
2742 _in_cset_fast_test_base = NULL; | |
2743 | |
2744 release_gc_alloc_regions(false /* totally */); | |
2745 | |
2746 cleanup_surviving_young_words(); | |
2747 | |
2748 if (g1_policy()->in_young_gc_mode()) { | |
2749 _young_list->reset_sampled_info(); | |
2750 assert(check_young_list_empty(true), | |
2751 "young list should be empty"); | |
2750 | 2752 |
2751 #if SCAN_ONLY_VERBOSE | 2753 #if SCAN_ONLY_VERBOSE |
2752 _young_list->print(); | 2754 _young_list->print(); |
2753 #endif // SCAN_ONLY_VERBOSE | 2755 #endif // SCAN_ONLY_VERBOSE |
2754 | 2756 |
2755 double end_time_sec = os::elapsedTime(); | 2757 g1_policy()->record_survivor_regions(_young_list->survivor_length(), |
2756 double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; | 2758 _young_list->first_survivor_region(), |
2757 g1_policy()->record_pause_time_ms(pause_time_ms); | 2759 _young_list->last_survivor_region()); |
2758 GCOverheadReporter::recordSTWEnd(end_time_sec); | 2760 _young_list->reset_auxilary_lists(); |
2759 g1_policy()->record_collection_pause_end(abandoned); | 2761 } |
2760 | 2762 } else { |
2761 assert(regions_accounted_for(), "Region leakage."); | 2763 COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); |
2762 | |
2763 if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) { | |
2764 HandleMark hm; // Discard invalid handles created during verification | |
2765 gclog_or_tty->print(" VerifyAfterGC:"); | |
2766 prepare_for_verify(); | |
2767 Universe::verify(false); | |
2768 } | |
2769 | |
2770 if (was_enabled) ref_processor()->enable_discovery(); | |
2771 | |
2772 { | |
2773 size_t expand_bytes = g1_policy()->expansion_amount(); | |
2774 if (expand_bytes > 0) { | |
2775 size_t bytes_before = capacity(); | |
2776 expand(expand_bytes); | |
2777 } | 2764 } |
2778 } | 2765 |
2779 | 2766 if (evacuation_failed()) { |
2780 if (mark_in_progress()) { | 2767 _summary_bytes_used = recalculate_used(); |
2781 concurrent_mark()->update_g1_committed(); | 2768 } else { |
2782 } | 2769 // The "used" of the the collection set have already been subtracted |
2770 // when they were freed. Add in the bytes evacuated. | |
2771 _summary_bytes_used += g1_policy()->bytes_in_to_space(); | |
2772 } | |
2773 | |
2774 if (g1_policy()->in_young_gc_mode() && | |
2775 g1_policy()->should_initiate_conc_mark()) { | |
2776 concurrent_mark()->checkpointRootsInitialPost(); | |
2777 set_marking_started(); | |
2778 doConcurrentMark(); | |
2779 } | |
2780 | |
2781 #if SCAN_ONLY_VERBOSE | |
2782 _young_list->print(); | |
2783 #endif // SCAN_ONLY_VERBOSE | |
2784 | |
2785 double end_time_sec = os::elapsedTime(); | |
2786 double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; | |
2787 g1_policy()->record_pause_time_ms(pause_time_ms); | |
2788 GCOverheadReporter::recordSTWEnd(end_time_sec); | |
2789 g1_policy()->record_collection_pause_end(abandoned); | |
2790 | |
2791 assert(regions_accounted_for(), "Region leakage."); | |
2792 | |
2793 if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) { | |
2794 HandleMark hm; // Discard invalid handles created during verification | |
2795 gclog_or_tty->print(" VerifyAfterGC:"); | |
2796 prepare_for_verify(); | |
2797 Universe::verify(false); | |
2798 } | |
2799 | |
2800 if (was_enabled) ref_processor()->enable_discovery(); | |
2801 | |
2802 { | |
2803 size_t expand_bytes = g1_policy()->expansion_amount(); | |
2804 if (expand_bytes > 0) { | |
2805 size_t bytes_before = capacity(); | |
2806 expand(expand_bytes); | |
2807 } | |
2808 } | |
2809 | |
2810 if (mark_in_progress()) { | |
2811 concurrent_mark()->update_g1_committed(); | |
2812 } | |
2783 | 2813 |
2784 #ifdef TRACESPINNING | 2814 #ifdef TRACESPINNING |
2785 ParallelTaskTerminator::print_termination_counts(); | 2815 ParallelTaskTerminator::print_termination_counts(); |
2786 #endif | 2816 #endif |
2787 | 2817 |
2788 gc_epilogue(false); | 2818 gc_epilogue(false); |
2789 } | 2819 } |
2790 | 2820 |
2791 assert(verify_region_lists(), "Bad region lists."); | 2821 assert(verify_region_lists(), "Bad region lists."); |
2792 | 2822 |
2793 if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) { | 2823 if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) { |
2794 gclog_or_tty->print_cr("Stopping after GC #%d", ExitAfterGCNum); | 2824 gclog_or_tty->print_cr("Stopping after GC #%d", ExitAfterGCNum); |
2795 print_tracing_info(); | 2825 print_tracing_info(); |
2796 vm_exit(-1); | 2826 vm_exit(-1); |
2827 } | |
2828 } | |
2829 | |
2830 if (PrintHeapAtGC) { | |
2831 Universe::print_heap_after_gc(); | |
2797 } | 2832 } |
2798 } | 2833 } |
2799 | 2834 |
2800 void G1CollectedHeap::set_gc_alloc_region(int purpose, HeapRegion* r) { | 2835 void G1CollectedHeap::set_gc_alloc_region(int purpose, HeapRegion* r) { |
2801 assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose"); | 2836 assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose"); |
5355 "Postconditions of loop.") | 5390 "Postconditions of loop.") |
5356 while (pop_free_region_list_locked() != NULL) ; | 5391 while (pop_free_region_list_locked() != NULL) ; |
5357 assert(_free_region_list == NULL, "Postcondition of loop."); | 5392 assert(_free_region_list == NULL, "Postcondition of loop."); |
5358 if (_free_region_list_size != 0) { | 5393 if (_free_region_list_size != 0) { |
5359 gclog_or_tty->print_cr("Size is %d.", _free_region_list_size); | 5394 gclog_or_tty->print_cr("Size is %d.", _free_region_list_size); |
5360 print(); | 5395 print_on(gclog_or_tty, true /* extended */); |
5361 } | 5396 } |
5362 assert(_free_region_list_size == 0, "Postconditions of loop."); | 5397 assert(_free_region_list_size == 0, "Postconditions of loop."); |
5363 } | 5398 } |
5364 | 5399 |
5365 | 5400 |