src/hotspot/share/gc/parallel/psScavenge.cpp
changeset 57773 5cbc3bd9fdfd
parent 57772 2410b04f074f
child 57777 90ead0febf56
equal deleted inserted replaced
57772:2410b04f074f 57773:5cbc3bd9fdfd
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "aot/aotLoader.hpp"
    26 #include "aot/aotLoader.hpp"
    27 #include "classfile/classLoaderDataGraph.hpp"
    27 #include "classfile/classLoaderDataGraph.hpp"
    28 #include "classfile/stringTable.hpp"
    28 #include "classfile/stringTable.hpp"
    29 #include "code/codeCache.hpp"
    29 #include "code/codeCache.hpp"
    30 #include "gc/parallel/gcTaskManager.hpp"
       
    31 #include "gc/parallel/parallelScavengeHeap.hpp"
    30 #include "gc/parallel/parallelScavengeHeap.hpp"
    32 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
    31 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
    33 #include "gc/parallel/psClosure.inline.hpp"
    32 #include "gc/parallel/psClosure.inline.hpp"
    34 #include "gc/parallel/psCompactionManager.hpp"
    33 #include "gc/parallel/psCompactionManager.hpp"
    35 #include "gc/parallel/psMarkSweepProxy.hpp"
    34 #include "gc/parallel/psMarkSweepProxy.hpp"
   498       WorkerPolicy::calc_active_workers(ParallelScavengeHeap::heap()->workers().total_workers(),
   497       WorkerPolicy::calc_active_workers(ParallelScavengeHeap::heap()->workers().total_workers(),
   499                                         ParallelScavengeHeap::heap()->workers().active_workers(),
   498                                         ParallelScavengeHeap::heap()->workers().active_workers(),
   500                                         Threads::number_of_non_daemon_threads());
   499                                         Threads::number_of_non_daemon_threads());
   501     ParallelScavengeHeap::heap()->workers().update_active_workers(active_workers);
   500     ParallelScavengeHeap::heap()->workers().update_active_workers(active_workers);
   502 
   501 
   503     // Release all previously held resources
       
   504     gc_task_manager()->release_all_resources();
       
   505 
       
   506     // Set the number of GC threads to be used in this collection
       
   507     gc_task_manager()->set_active_gang();
       
   508     gc_task_manager()->task_idle_workers();
       
   509 
       
   510     assert(active_workers == gc_task_manager()->active_workers(), "sanity, taskmanager and workgang ought to agree");
       
   511 
       
   512     PSPromotionManager::pre_scavenge();
   502     PSPromotionManager::pre_scavenge();
   513 
   503 
   514     // We'll use the promotion manager again later.
   504     // We'll use the promotion manager again later.
   515     PSPromotionManager* promotion_manager = PSPromotionManager::vm_thread_promotion_manager();
   505     PSPromotionManager* promotion_manager = PSPromotionManager::vm_thread_promotion_manager();
   516     {
   506     {
   726     heap->print_heap_change(pre_gc_values);
   716     heap->print_heap_change(pre_gc_values);
   727 
   717 
   728     // Track memory usage and detect low memory
   718     // Track memory usage and detect low memory
   729     MemoryService::track_memory_usage();
   719     MemoryService::track_memory_usage();
   730     heap->update_counters();
   720     heap->update_counters();
   731 
       
   732     gc_task_manager()->release_idle_workers();
       
   733   }
   721   }
   734 
   722 
   735   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
   723   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
   736     HandleMark hm;  // Discard invalid handles created during verification
   724     HandleMark hm;  // Discard invalid handles created during verification
   737     Universe::verify("After GC");
   725     Universe::verify("After GC");
   743   scavenge_exit.update();
   731   scavenge_exit.update();
   744 
   732 
   745   log_debug(gc, task, time)("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " " JLONG_FORMAT,
   733   log_debug(gc, task, time)("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " " JLONG_FORMAT,
   746                             scavenge_entry.ticks(), scavenge_midpoint.ticks(),
   734                             scavenge_entry.ticks(), scavenge_midpoint.ticks(),
   747                             scavenge_exit.ticks());
   735                             scavenge_exit.ticks());
   748   gc_task_manager()->print_task_time_stamps();
       
   749 
   736 
   750 #ifdef TRACESPINNING
   737 #ifdef TRACESPINNING
   751   ParallelTaskTerminator::print_termination_counts();
   738   ParallelTaskTerminator::print_termination_counts();
   752 #endif
   739 #endif
   753 
   740 
   819     if (UsePerfData) {
   806     if (UsePerfData) {
   820       counters->update_scavenge_skipped(promoted_too_large);
   807       counters->update_scavenge_skipped(promoted_too_large);
   821     }
   808     }
   822   }
   809   }
   823   return result;
   810   return result;
   824 }
       
   825 
       
   826   // Used to add tasks
       
   827 GCTaskManager* const PSScavenge::gc_task_manager() {
       
   828   assert(ParallelScavengeHeap::gc_task_manager() != NULL,
       
   829    "shouldn't return NULL");
       
   830   return ParallelScavengeHeap::gc_task_manager();
       
   831 }
   811 }
   832 
   812 
   833 // Adaptive size policy support.  When the young generation/old generation
   813 // Adaptive size policy support.  When the young generation/old generation
   834 // boundary moves, _young_generation_boundary must be reset
   814 // boundary moves, _young_generation_boundary must be reset
   835 void PSScavenge::set_young_generation_boundary(HeapWord* v) {
   815 void PSScavenge::set_young_generation_boundary(HeapWord* v) {