< prev index next >

src/hotspot/share/gc/cms/parNewGeneration.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


  32 #include "gc/serial/defNewGeneration.inline.hpp"
  33 #include "gc/shared/adaptiveSizePolicy.hpp"
  34 #include "gc/shared/ageTable.inline.hpp"
  35 #include "gc/shared/copyFailedInfo.hpp"
  36 #include "gc/shared/gcHeapSummary.hpp"
  37 #include "gc/shared/gcTimer.hpp"
  38 #include "gc/shared/gcTrace.hpp"
  39 #include "gc/shared/gcTraceTime.inline.hpp"
  40 #include "gc/shared/genOopClosures.inline.hpp"
  41 #include "gc/shared/generation.hpp"
  42 #include "gc/shared/plab.inline.hpp"
  43 #include "gc/shared/preservedMarks.inline.hpp"
  44 #include "gc/shared/referencePolicy.hpp"
  45 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  46 #include "gc/shared/space.hpp"
  47 #include "gc/shared/spaceDecorator.hpp"
  48 #include "gc/shared/strongRootsScope.hpp"
  49 #include "gc/shared/taskqueue.inline.hpp"
  50 #include "gc/shared/weakProcessor.hpp"
  51 #include "gc/shared/workgroup.hpp"

  52 #include "logging/log.hpp"
  53 #include "logging/logStream.hpp"
  54 #include "memory/iterator.inline.hpp"
  55 #include "memory/resourceArea.hpp"
  56 #include "oops/access.inline.hpp"
  57 #include "oops/compressedOops.inline.hpp"
  58 #include "oops/objArrayOop.hpp"
  59 #include "oops/oop.inline.hpp"
  60 #include "runtime/atomic.hpp"
  61 #include "runtime/handles.hpp"
  62 #include "runtime/handles.inline.hpp"
  63 #include "runtime/java.hpp"
  64 #include "runtime/thread.inline.hpp"
  65 #include "utilities/copy.hpp"
  66 #include "utilities/globalDefinitions.hpp"
  67 #include "utilities/stack.inline.hpp"
  68 
  69 ParScanThreadState::ParScanThreadState(Space* to_space_,
  70                                        ParNewGeneration* young_gen_,
  71                                        Generation* old_gen_,


 849     _gc_tracer.report_promotion_failed(_promotion_failed_info);
 850   }
 851   // Reset the PromotionFailureALot counters.
 852   NOT_PRODUCT(gch->reset_promotion_should_fail();)
 853 }
 854 
 855 void ParNewGeneration::collect(bool   full,
 856                                bool   clear_all_soft_refs,
 857                                size_t size,
 858                                bool   is_tlab) {
 859   assert(full || size > 0, "otherwise we don't want to collect");
 860 
 861   CMSHeap* gch = CMSHeap::heap();
 862 
 863   _gc_timer->register_gc_start();
 864 
 865   AdaptiveSizePolicy* size_policy = gch->size_policy();
 866   WorkGang* workers = gch->workers();
 867   assert(workers != NULL, "Need workgang for parallel work");
 868   uint active_workers =
 869        AdaptiveSizePolicy::calc_active_workers(workers->total_workers(),
 870                                                workers->active_workers(),
 871                                                Threads::number_of_non_daemon_threads());
 872   active_workers = workers->update_active_workers(active_workers);
 873   log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers->total_workers());
 874 
 875   _old_gen = gch->old_gen();
 876 
 877   // If the next generation is too full to accommodate worst-case promotion
 878   // from this generation, pass on collection; let the next generation
 879   // do it.
 880   if (!collection_attempt_is_safe()) {
 881     gch->set_incremental_collection_failed();  // slight lie, in that we did not even attempt one
 882     return;
 883   }
 884   assert(to()->is_empty(), "Else not collection_attempt_is_safe");
 885 
 886   _gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
 887   gch->trace_heap_before_gc(gc_tracer());
 888 
 889   init_assuming_no_promotion_failure();




  32 #include "gc/serial/defNewGeneration.inline.hpp"
  33 #include "gc/shared/adaptiveSizePolicy.hpp"
  34 #include "gc/shared/ageTable.inline.hpp"
  35 #include "gc/shared/copyFailedInfo.hpp"
  36 #include "gc/shared/gcHeapSummary.hpp"
  37 #include "gc/shared/gcTimer.hpp"
  38 #include "gc/shared/gcTrace.hpp"
  39 #include "gc/shared/gcTraceTime.inline.hpp"
  40 #include "gc/shared/genOopClosures.inline.hpp"
  41 #include "gc/shared/generation.hpp"
  42 #include "gc/shared/plab.inline.hpp"
  43 #include "gc/shared/preservedMarks.inline.hpp"
  44 #include "gc/shared/referencePolicy.hpp"
  45 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  46 #include "gc/shared/space.hpp"
  47 #include "gc/shared/spaceDecorator.hpp"
  48 #include "gc/shared/strongRootsScope.hpp"
  49 #include "gc/shared/taskqueue.inline.hpp"
  50 #include "gc/shared/weakProcessor.hpp"
  51 #include "gc/shared/workgroup.hpp"
  52 #include "gc/shared/workerPolicy.hpp"
  53 #include "logging/log.hpp"
  54 #include "logging/logStream.hpp"
  55 #include "memory/iterator.inline.hpp"
  56 #include "memory/resourceArea.hpp"
  57 #include "oops/access.inline.hpp"
  58 #include "oops/compressedOops.inline.hpp"
  59 #include "oops/objArrayOop.hpp"
  60 #include "oops/oop.inline.hpp"
  61 #include "runtime/atomic.hpp"
  62 #include "runtime/handles.hpp"
  63 #include "runtime/handles.inline.hpp"
  64 #include "runtime/java.hpp"
  65 #include "runtime/thread.inline.hpp"
  66 #include "utilities/copy.hpp"
  67 #include "utilities/globalDefinitions.hpp"
  68 #include "utilities/stack.inline.hpp"
  69 
  70 ParScanThreadState::ParScanThreadState(Space* to_space_,
  71                                        ParNewGeneration* young_gen_,
  72                                        Generation* old_gen_,


 850     _gc_tracer.report_promotion_failed(_promotion_failed_info);
 851   }
 852   // Reset the PromotionFailureALot counters.
 853   NOT_PRODUCT(gch->reset_promotion_should_fail();)
 854 }
 855 
 856 void ParNewGeneration::collect(bool   full,
 857                                bool   clear_all_soft_refs,
 858                                size_t size,
 859                                bool   is_tlab) {
 860   assert(full || size > 0, "otherwise we don't want to collect");
 861 
 862   CMSHeap* gch = CMSHeap::heap();
 863 
 864   _gc_timer->register_gc_start();
 865 
 866   AdaptiveSizePolicy* size_policy = gch->size_policy();
 867   WorkGang* workers = gch->workers();
 868   assert(workers != NULL, "Need workgang for parallel work");
 869   uint active_workers =
 870       WorkerPolicy::calc_active_workers(workers->total_workers(),
 871                                         workers->active_workers(),
 872                                         Threads::number_of_non_daemon_threads());
 873   active_workers = workers->update_active_workers(active_workers);
 874   log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers->total_workers());
 875 
 876   _old_gen = gch->old_gen();
 877 
 878   // If the next generation is too full to accommodate worst-case promotion
 879   // from this generation, pass on collection; let the next generation
 880   // do it.
 881   if (!collection_attempt_is_safe()) {
 882     gch->set_incremental_collection_failed();  // slight lie, in that we did not even attempt one
 883     return;
 884   }
 885   assert(to()->is_empty(), "Else not collection_attempt_is_safe");
 886 
 887   _gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
 888   gch->trace_heap_before_gc(gc_tracer());
 889 
 890   init_assuming_no_promotion_failure();


< prev index next >