< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 56821 : imported patch 8220310.mut.0
rev 56822 : imported patch 8220310.mut.1
rev 56823 : imported patch 8220310.mut.2
rev 56824 : imported patch 8220310.mut.3
rev 56825 : imported patch 8220310.mut.4
rev 56826 : imported patch 8220310.mut.5
rev 56830 : imported patch 8220311.sur.2
rev 56834 : imported patch 8220312.stat.2
rev 56836 : imported patch 8220312.stat.4
rev 56838 : [mq]: 8220312.stat.5


2374     print_regions_on(&ls);
2375   }
2376 }
2377 
2378 void G1CollectedHeap::print_on(outputStream* st) const {
2379   st->print(" %-20s", "garbage-first heap");
2380   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2381             capacity()/K, used_unlocked()/K);
2382   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ")",
2383             p2i(_hrm->reserved().start()),
2384             p2i(_hrm->reserved().end()));
2385   st->cr();
2386   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2387   uint young_regions = young_regions_count();
2388   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2389             (size_t) young_regions * HeapRegion::GrainBytes / K);
2390   uint survivor_regions = survivor_regions_count();
2391   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2392             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2393   st->cr();









2394   MetaspaceUtils::print_on(st);
2395 }
2396 
2397 void G1CollectedHeap::print_regions_on(outputStream* st) const {
2398   st->print_cr("Heap Regions: E=young(eden), S=young(survivor), O=old, "
2399                "HS=humongous(starts), HC=humongous(continues), "
2400                "CS=collection set, F=free, "
2401                "OA=open archive, CA=closed archive, "
2402                "TAMS=top-at-mark-start (previous, next)");
2403   PrintRegionClosure blk(st);
2404   heap_region_iterate(&blk);
2405 }
2406 
2407 void G1CollectedHeap::print_extended_on(outputStream* st) const {
2408   print_on(st);
2409 
2410   // Print the per-region information.
2411   print_regions_on(st);
2412 }
2413 


2563   }
2564 
2565   // We are at the end of the GC. Total collections has already been increased.
2566   rem_set()->print_periodic_summary_info("After GC RS summary", total_collections() - 1);
2567 
2568   // FIXME: what is this about?
2569   // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled"
2570   // is set.
2571 #if COMPILER2_OR_JVMCI
2572   assert(DerivedPointerTable::is_empty(), "derived pointer present");
2573 #endif
2574 
2575   double start = os::elapsedTime();
2576   resize_all_tlabs();
2577   phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0);
2578 
2579   MemoryService::track_memory_usage();
2580   // We have just completed a GC. Update the soft reference
2581   // policy with the new heap occupancy
2582   Universe::update_heap_info_at_gc();














2583 }
2584 
2585 HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size,
2586                                                uint gc_count_before,
2587                                                bool* succeeded,
2588                                                GCCause::Cause gc_cause) {
2589   assert_heap_not_locked_and_not_at_safepoint();
2590   VM_G1CollectForAllocation op(word_size,
2591                                gc_count_before,
2592                                gc_cause,
2593                                false, /* should_initiate_conc_mark */
2594                                policy()->max_pause_time_ms());
2595   VMThread::execute(&op);
2596 
2597   HeapWord* result = op.result();
2598   bool ret_succeeded = op.prologue_succeeded() && op.gc_succeeded();
2599   assert(result == NULL || ret_succeeded,
2600          "the result should be NULL if the VM did not succeed");
2601   *succeeded = ret_succeeded;
2602 


2872 }
2873 
2874 G1HeapVerifier::G1VerifyType G1CollectedHeap::young_collection_verify_type() const {
2875   if (collector_state()->in_initial_mark_gc()) {
2876     return G1HeapVerifier::G1VerifyConcurrentStart;
2877   } else if (collector_state()->in_young_only_phase()) {
2878     return G1HeapVerifier::G1VerifyYoungNormal;
2879   } else {
2880     return G1HeapVerifier::G1VerifyMixed;
2881   }
2882 }
2883 
2884 void G1CollectedHeap::verify_before_young_collection(G1HeapVerifier::G1VerifyType type) {
2885   if (VerifyRememberedSets) {
2886     log_info(gc, verify)("[Verifying RemSets before GC]");
2887     VerifyRegionRemSetClosure v_cl;
2888     heap_region_iterate(&v_cl);
2889   }
2890   _verifier->verify_before_gc(type);
2891   _verifier->check_bitmaps("GC Start");

2892 }
2893 
2894 void G1CollectedHeap::verify_after_young_collection(G1HeapVerifier::G1VerifyType type) {
2895   if (VerifyRememberedSets) {
2896     log_info(gc, verify)("[Verifying RemSets after GC]");
2897     VerifyRegionRemSetClosure v_cl;
2898     heap_region_iterate(&v_cl);
2899   }
2900   _verifier->verify_after_gc(type);
2901   _verifier->check_bitmaps("GC End");

2902 }
2903 
2904 void G1CollectedHeap::expand_heap_after_young_collection(){
2905   size_t expand_bytes = _heap_sizing_policy->expansion_amount();
2906   if (expand_bytes > 0) {
2907     // No need for an ergo logging here,
2908     // expansion_amount() does this when it returns a value > 0.
2909     double expand_ms;
2910     if (!expand(expand_bytes, _workers, &expand_ms)) {
2911       // We failed to expand the heap. Cannot do anything about it.
2912     }
2913     phase_times()->record_expand_heap_time(expand_ms);
2914   }
2915 }
2916 
2917 const char* G1CollectedHeap::young_gc_name() const {
2918   if (collector_state()->in_initial_mark_gc()) {
2919     return "Pause Young (Concurrent Start)";
2920   } else if (collector_state()->in_young_only_phase()) {
2921     if (collector_state()->in_young_gc_before_mixed()) {




2374     print_regions_on(&ls);
2375   }
2376 }
2377 
2378 void G1CollectedHeap::print_on(outputStream* st) const {
2379   st->print(" %-20s", "garbage-first heap");
2380   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2381             capacity()/K, used_unlocked()/K);
2382   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ")",
2383             p2i(_hrm->reserved().start()),
2384             p2i(_hrm->reserved().end()));
2385   st->cr();
2386   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2387   uint young_regions = young_regions_count();
2388   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2389             (size_t) young_regions * HeapRegion::GrainBytes / K);
2390   uint survivor_regions = survivor_regions_count();
2391   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2392             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2393   st->cr();
2394   if (_numa->is_enabled()) {
2395     uint num_nodes = _numa->num_active_nodes();
2396     st->print("  remaining free region(s) on each NUMA node: ");
2397     const int* node_ids = _numa->node_ids();
2398     for (uint node_index = 0; node_index < num_nodes; node_index++) {
2399       st->print("%d=%u ", node_ids[node_index], _hrm->num_free_regions(node_index));
2400     }
2401     st->cr();
2402   }
2403   MetaspaceUtils::print_on(st);
2404 }
2405 
2406 void G1CollectedHeap::print_regions_on(outputStream* st) const {
2407   st->print_cr("Heap Regions: E=young(eden), S=young(survivor), O=old, "
2408                "HS=humongous(starts), HC=humongous(continues), "
2409                "CS=collection set, F=free, "
2410                "OA=open archive, CA=closed archive, "
2411                "TAMS=top-at-mark-start (previous, next)");
2412   PrintRegionClosure blk(st);
2413   heap_region_iterate(&blk);
2414 }
2415 
2416 void G1CollectedHeap::print_extended_on(outputStream* st) const {
2417   print_on(st);
2418 
2419   // Print the per-region information.
2420   print_regions_on(st);
2421 }
2422 


2572   }
2573 
2574   // We are at the end of the GC. Total collections has already been increased.
2575   rem_set()->print_periodic_summary_info("After GC RS summary", total_collections() - 1);
2576 
2577   // FIXME: what is this about?
2578   // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled"
2579   // is set.
2580 #if COMPILER2_OR_JVMCI
2581   assert(DerivedPointerTable::is_empty(), "derived pointer present");
2582 #endif
2583 
2584   double start = os::elapsedTime();
2585   resize_all_tlabs();
2586   phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0);
2587 
2588   MemoryService::track_memory_usage();
2589   // We have just completed a GC. Update the soft reference
2590   // policy with the new heap occupancy
2591   Universe::update_heap_info_at_gc();
2592 
2593   // Print NUMA statistics.
2594   _numa->print_statistics();
2595 }
2596 
2597 void G1CollectedHeap::verify_numa_regions(const char* desc) {
2598   LogTarget(Trace, gc, heap, verify) lt;
2599 
2600   if (lt.is_enabled()) {
2601     LogStream ls(lt);
2602     // Iterate all heap regions to print matching between preferred numa id and actual numa id.
2603     NodeIndexCheckClosure cl(desc, _numa, &ls);
2604     heap_region_iterate(&cl);
2605   } 
2606 }
2607 
2608 HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size,
2609                                                uint gc_count_before,
2610                                                bool* succeeded,
2611                                                GCCause::Cause gc_cause) {
2612   assert_heap_not_locked_and_not_at_safepoint();
2613   VM_G1CollectForAllocation op(word_size,
2614                                gc_count_before,
2615                                gc_cause,
2616                                false, /* should_initiate_conc_mark */
2617                                policy()->max_pause_time_ms());
2618   VMThread::execute(&op);
2619 
2620   HeapWord* result = op.result();
2621   bool ret_succeeded = op.prologue_succeeded() && op.gc_succeeded();
2622   assert(result == NULL || ret_succeeded,
2623          "the result should be NULL if the VM did not succeed");
2624   *succeeded = ret_succeeded;
2625 


2895 }
2896 
2897 G1HeapVerifier::G1VerifyType G1CollectedHeap::young_collection_verify_type() const {
2898   if (collector_state()->in_initial_mark_gc()) {
2899     return G1HeapVerifier::G1VerifyConcurrentStart;
2900   } else if (collector_state()->in_young_only_phase()) {
2901     return G1HeapVerifier::G1VerifyYoungNormal;
2902   } else {
2903     return G1HeapVerifier::G1VerifyMixed;
2904   }
2905 }
2906 
2907 void G1CollectedHeap::verify_before_young_collection(G1HeapVerifier::G1VerifyType type) {
2908   if (VerifyRememberedSets) {
2909     log_info(gc, verify)("[Verifying RemSets before GC]");
2910     VerifyRegionRemSetClosure v_cl;
2911     heap_region_iterate(&v_cl);
2912   }
2913   _verifier->verify_before_gc(type);
2914   _verifier->check_bitmaps("GC Start");
2915   verify_numa_regions("GC Start");
2916 }
2917 
2918 void G1CollectedHeap::verify_after_young_collection(G1HeapVerifier::G1VerifyType type) {
2919   if (VerifyRememberedSets) {
2920     log_info(gc, verify)("[Verifying RemSets after GC]");
2921     VerifyRegionRemSetClosure v_cl;
2922     heap_region_iterate(&v_cl);
2923   }
2924   _verifier->verify_after_gc(type);
2925   _verifier->check_bitmaps("GC End");
2926   verify_numa_regions("GC End");
2927 }
2928 
2929 void G1CollectedHeap::expand_heap_after_young_collection(){
2930   size_t expand_bytes = _heap_sizing_policy->expansion_amount();
2931   if (expand_bytes > 0) {
2932     // No need for an ergo logging here,
2933     // expansion_amount() does this when it returns a value > 0.
2934     double expand_ms;
2935     if (!expand(expand_bytes, _workers, &expand_ms)) {
2936       // We failed to expand the heap. Cannot do anything about it.
2937     }
2938     phase_times()->record_expand_heap_time(expand_ms);
2939   }
2940 }
2941 
2942 const char* G1CollectedHeap::young_gc_name() const {
2943   if (collector_state()->in_initial_mark_gc()) {
2944     return "Pause Young (Concurrent Start)";
2945   } else if (collector_state()->in_young_only_phase()) {
2946     if (collector_state()->in_young_gc_before_mixed()) {


< prev index next >