< prev index next >

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

Print this page
rev 52689 : 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
Summary: Consolidate code related to GC threads calculation into a single class


  44 #include "gc/g1/g1HeapTransition.hpp"
  45 #include "gc/g1/g1HeapVerifier.hpp"
  46 #include "gc/g1/g1HotCardCache.hpp"
  47 #include "gc/g1/g1MemoryPool.hpp"
  48 #include "gc/g1/g1OopClosures.inline.hpp"
  49 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  50 #include "gc/g1/g1Policy.hpp"
  51 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  52 #include "gc/g1/g1RemSet.hpp"
  53 #include "gc/g1/g1RootClosures.hpp"
  54 #include "gc/g1/g1RootProcessor.hpp"
  55 #include "gc/g1/g1SATBMarkQueueSet.hpp"
  56 #include "gc/g1/g1StringDedup.hpp"
  57 #include "gc/g1/g1ThreadLocalData.hpp"
  58 #include "gc/g1/g1YCTypes.hpp"
  59 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
  60 #include "gc/g1/heapRegion.inline.hpp"
  61 #include "gc/g1/heapRegionRemSet.hpp"
  62 #include "gc/g1/heapRegionSet.inline.hpp"
  63 #include "gc/g1/vm_operations_g1.hpp"
  64 #include "gc/shared/adaptiveSizePolicy.hpp"
  65 #include "gc/shared/gcBehaviours.hpp"
  66 #include "gc/shared/gcHeapSummary.hpp"
  67 #include "gc/shared/gcId.hpp"
  68 #include "gc/shared/gcLocker.hpp"
  69 #include "gc/shared/gcTimer.hpp"
  70 #include "gc/shared/gcTrace.hpp"
  71 #include "gc/shared/gcTraceTime.inline.hpp"
  72 #include "gc/shared/generationSpec.hpp"
  73 #include "gc/shared/isGCActiveMark.hpp"
  74 #include "gc/shared/oopStorageParState.hpp"
  75 #include "gc/shared/parallelCleaning.hpp"
  76 #include "gc/shared/preservedMarks.inline.hpp"
  77 #include "gc/shared/suspendibleThreadSet.hpp"
  78 #include "gc/shared/referenceProcessor.inline.hpp"
  79 #include "gc/shared/taskqueue.inline.hpp"
  80 #include "gc/shared/weakProcessor.inline.hpp"

  81 #include "logging/log.hpp"
  82 #include "memory/allocation.hpp"
  83 #include "memory/iterator.hpp"
  84 #include "memory/resourceArea.hpp"
  85 #include "oops/access.inline.hpp"
  86 #include "oops/compressedOops.inline.hpp"
  87 #include "oops/oop.inline.hpp"
  88 #include "runtime/atomic.hpp"
  89 #include "runtime/flags/flagSetting.hpp"
  90 #include "runtime/handles.inline.hpp"
  91 #include "runtime/init.hpp"
  92 #include "runtime/orderAccess.hpp"
  93 #include "runtime/threadSMR.hpp"
  94 #include "runtime/vmThread.hpp"
  95 #include "utilities/align.hpp"
  96 #include "utilities/globalDefinitions.hpp"
  97 #include "utilities/stack.inline.hpp"
  98 
  99 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
 100 


2883     GCTraceCPUTime tcpu;
2884 
2885     G1HeapVerifier::G1VerifyType verify_type;
2886     FormatBuffer<> gc_string("Pause Young ");
2887     if (collector_state()->in_initial_mark_gc()) {
2888       gc_string.append("(Concurrent Start)");
2889       verify_type = G1HeapVerifier::G1VerifyConcurrentStart;
2890     } else if (collector_state()->in_young_only_phase()) {
2891       if (collector_state()->in_young_gc_before_mixed()) {
2892         gc_string.append("(Prepare Mixed)");
2893       } else {
2894         gc_string.append("(Normal)");
2895       }
2896       verify_type = G1HeapVerifier::G1VerifyYoungNormal;
2897     } else {
2898       gc_string.append("(Mixed)");
2899       verify_type = G1HeapVerifier::G1VerifyMixed;
2900     }
2901     GCTraceTime(Info, gc) tm(gc_string, NULL, gc_cause(), true);
2902 
2903     uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
2904                                                                   workers()->active_workers(),
2905                                                                   Threads::number_of_non_daemon_threads());
2906     active_workers = workers()->update_active_workers(active_workers);
2907     log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->total_workers());
2908 
2909     G1MonitoringScope ms(g1mm(),
2910                          false /* full_gc */,
2911                          collector_state()->yc_type() == Mixed /* all_memory_pools_affected */);
2912 
2913     G1HeapTransition heap_transition(this);
2914     size_t heap_used_bytes_before_gc = used();
2915 
2916     // Don't dynamically change the number of GC threads this early.  A value of
2917     // 0 is used to indicate serial work.  When parallel work is done,
2918     // it will be set.
2919 
2920     { // Call to jvmpi::post_class_unload_events must occur outside of active GC
2921       IsGCActiveMark x;
2922 
2923       gc_prologue(false);




  44 #include "gc/g1/g1HeapTransition.hpp"
  45 #include "gc/g1/g1HeapVerifier.hpp"
  46 #include "gc/g1/g1HotCardCache.hpp"
  47 #include "gc/g1/g1MemoryPool.hpp"
  48 #include "gc/g1/g1OopClosures.inline.hpp"
  49 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  50 #include "gc/g1/g1Policy.hpp"
  51 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  52 #include "gc/g1/g1RemSet.hpp"
  53 #include "gc/g1/g1RootClosures.hpp"
  54 #include "gc/g1/g1RootProcessor.hpp"
  55 #include "gc/g1/g1SATBMarkQueueSet.hpp"
  56 #include "gc/g1/g1StringDedup.hpp"
  57 #include "gc/g1/g1ThreadLocalData.hpp"
  58 #include "gc/g1/g1YCTypes.hpp"
  59 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
  60 #include "gc/g1/heapRegion.inline.hpp"
  61 #include "gc/g1/heapRegionRemSet.hpp"
  62 #include "gc/g1/heapRegionSet.inline.hpp"
  63 #include "gc/g1/vm_operations_g1.hpp"

  64 #include "gc/shared/gcBehaviours.hpp"
  65 #include "gc/shared/gcHeapSummary.hpp"
  66 #include "gc/shared/gcId.hpp"
  67 #include "gc/shared/gcLocker.hpp"
  68 #include "gc/shared/gcTimer.hpp"
  69 #include "gc/shared/gcTrace.hpp"
  70 #include "gc/shared/gcTraceTime.inline.hpp"
  71 #include "gc/shared/generationSpec.hpp"
  72 #include "gc/shared/isGCActiveMark.hpp"
  73 #include "gc/shared/oopStorageParState.hpp"
  74 #include "gc/shared/parallelCleaning.hpp"
  75 #include "gc/shared/preservedMarks.inline.hpp"
  76 #include "gc/shared/suspendibleThreadSet.hpp"
  77 #include "gc/shared/referenceProcessor.inline.hpp"
  78 #include "gc/shared/taskqueue.inline.hpp"
  79 #include "gc/shared/weakProcessor.inline.hpp"
  80 #include "gc/shared/workerPolicy.hpp"
  81 #include "logging/log.hpp"
  82 #include "memory/allocation.hpp"
  83 #include "memory/iterator.hpp"
  84 #include "memory/resourceArea.hpp"
  85 #include "oops/access.inline.hpp"
  86 #include "oops/compressedOops.inline.hpp"
  87 #include "oops/oop.inline.hpp"
  88 #include "runtime/atomic.hpp"
  89 #include "runtime/flags/flagSetting.hpp"
  90 #include "runtime/handles.inline.hpp"
  91 #include "runtime/init.hpp"
  92 #include "runtime/orderAccess.hpp"
  93 #include "runtime/threadSMR.hpp"
  94 #include "runtime/vmThread.hpp"
  95 #include "utilities/align.hpp"
  96 #include "utilities/globalDefinitions.hpp"
  97 #include "utilities/stack.inline.hpp"
  98 
  99 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
 100 


2883     GCTraceCPUTime tcpu;
2884 
2885     G1HeapVerifier::G1VerifyType verify_type;
2886     FormatBuffer<> gc_string("Pause Young ");
2887     if (collector_state()->in_initial_mark_gc()) {
2888       gc_string.append("(Concurrent Start)");
2889       verify_type = G1HeapVerifier::G1VerifyConcurrentStart;
2890     } else if (collector_state()->in_young_only_phase()) {
2891       if (collector_state()->in_young_gc_before_mixed()) {
2892         gc_string.append("(Prepare Mixed)");
2893       } else {
2894         gc_string.append("(Normal)");
2895       }
2896       verify_type = G1HeapVerifier::G1VerifyYoungNormal;
2897     } else {
2898       gc_string.append("(Mixed)");
2899       verify_type = G1HeapVerifier::G1VerifyMixed;
2900     }
2901     GCTraceTime(Info, gc) tm(gc_string, NULL, gc_cause(), true);
2902 
2903     uint active_workers = WorkerPolicy::calc_active_workers(workers()->total_workers(),
2904                                                             workers()->active_workers(),
2905                                                             Threads::number_of_non_daemon_threads());
2906     active_workers = workers()->update_active_workers(active_workers);
2907     log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->total_workers());
2908 
2909     G1MonitoringScope ms(g1mm(),
2910                          false /* full_gc */,
2911                          collector_state()->yc_type() == Mixed /* all_memory_pools_affected */);
2912 
2913     G1HeapTransition heap_transition(this);
2914     size_t heap_used_bytes_before_gc = used();
2915 
2916     // Don't dynamically change the number of GC threads this early.  A value of
2917     // 0 is used to indicate serial work.  When parallel work is done,
2918     // it will be set.
2919 
2920     { // Call to jvmpi::post_class_unload_events must occur outside of active GC
2921       IsGCActiveMark x;
2922 
2923       gc_prologue(false);


< prev index next >