src/hotspot/share/gc/parallel/psMarkSweep.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/hotspot/share/gc/parallel

src/hotspot/share/gc/parallel/psMarkSweep.cpp

Print this page




  33 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
  34 #include "gc/parallel/psMarkSweep.hpp"
  35 #include "gc/parallel/psMarkSweepDecorator.hpp"
  36 #include "gc/parallel/psOldGen.hpp"
  37 #include "gc/parallel/psScavenge.hpp"
  38 #include "gc/parallel/psYoungGen.hpp"
  39 #include "gc/serial/markSweep.hpp"
  40 #include "gc/shared/gcCause.hpp"
  41 #include "gc/shared/gcHeapSummary.hpp"
  42 #include "gc/shared/gcId.hpp"
  43 #include "gc/shared/gcLocker.hpp"
  44 #include "gc/shared/gcTimer.hpp"
  45 #include "gc/shared/gcTrace.hpp"
  46 #include "gc/shared/gcTraceTime.inline.hpp"
  47 #include "gc/shared/isGCActiveMark.hpp"
  48 #include "gc/shared/referencePolicy.hpp"
  49 #include "gc/shared/referenceProcessor.hpp"
  50 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  51 #include "gc/shared/spaceDecorator.hpp"
  52 #include "gc/shared/weakProcessor.hpp"
  53 #if INCLUDE_JVMCI
  54 #include "jvmci/jvmci.hpp"
  55 #endif
  56 #include "logging/log.hpp"
  57 #include "oops/oop.inline.hpp"
  58 #include "runtime/biasedLocking.hpp"
  59 #include "runtime/flags/flagSetting.hpp"
  60 #include "runtime/handles.inline.hpp"
  61 #include "runtime/safepoint.hpp"
  62 #include "runtime/vmThread.hpp"
  63 #include "services/management.hpp"
  64 #include "services/memoryService.hpp"
  65 #include "utilities/align.hpp"
  66 #include "utilities/events.hpp"
  67 #include "utilities/stack.inline.hpp"



  68 
  69 elapsedTimer        PSMarkSweep::_accumulated_time;
  70 jlong               PSMarkSweep::_time_of_last_gc   = 0;
  71 CollectorCounters*  PSMarkSweep::_counters = NULL;
  72 
  73 SpanSubjectToDiscoveryClosure PSMarkSweep::_span_based_discoverer;
  74 
  75 void PSMarkSweep::initialize() {
  76   _span_based_discoverer.set_span(ParallelScavengeHeap::heap()->reserved_region());
  77   set_ref_processor(new ReferenceProcessor(&_span_based_discoverer));     // a vanilla ref proc
  78   _counters = new CollectorCounters("Serial full collection pauses", 1);
  79   MarkSweep::initialize();
  80 }
  81 
  82 // This method contains all heap specific policy for invoking mark sweep.
  83 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
  84 // the heap. It will do nothing further. If we need to bail out for policy
  85 // reasons, scavenge before full gc, or any other specialized behavior, it
  86 // needs to be added here.
  87 //


 549   // This is the point where the entire marking should have completed.
 550   assert(_marking_stack.is_empty(), "Marking should have completed");
 551 
 552   {
 553     GCTraceTime(Debug, gc, phases) t("Weak Processing", _gc_timer);
 554     WeakProcessor::weak_oops_do(is_alive_closure(), &do_nothing_cl);
 555   }
 556 
 557   {
 558     GCTraceTime(Debug, gc, phases) t("Class Unloading", _gc_timer);
 559 
 560     // Unload classes and purge the SystemDictionary.
 561     bool purged_class = SystemDictionary::do_unloading(_gc_timer);
 562 
 563     // Unload nmethods.
 564     CodeCache::do_unloading(is_alive_closure(), purged_class);
 565 
 566     // Prune dead klasses from subklass/sibling/implementor lists.
 567     Klass::clean_weak_klass_links(purged_class);
 568 
 569 #if INCLUDE_JVMCI
 570     // Clean JVMCI metadata handles.
 571     JVMCI::do_unloading(is_alive_closure(), purged_class);
 572 #endif
 573   }
 574 
 575   _gc_tracer->report_object_count_after_gc(is_alive_closure());
 576 }
 577 
 578 
 579 void PSMarkSweep::mark_sweep_phase2() {
 580   GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", _gc_timer);
 581 
 582   // Now all live objects are marked, compute the new object addresses.
 583 
 584   // It is not required that we traverse spaces in the same order in
 585   // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
 586   // tracking expects us to do so. See comment under phase4.
 587 
 588   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 589   PSOldGen* old_gen = heap->old_gen();
 590 
 591   // Begin compacting into the old gen
 592   PSMarkSweepDecorator::set_destination_decorator_tenured();




  33 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
  34 #include "gc/parallel/psMarkSweep.hpp"
  35 #include "gc/parallel/psMarkSweepDecorator.hpp"
  36 #include "gc/parallel/psOldGen.hpp"
  37 #include "gc/parallel/psScavenge.hpp"
  38 #include "gc/parallel/psYoungGen.hpp"
  39 #include "gc/serial/markSweep.hpp"
  40 #include "gc/shared/gcCause.hpp"
  41 #include "gc/shared/gcHeapSummary.hpp"
  42 #include "gc/shared/gcId.hpp"
  43 #include "gc/shared/gcLocker.hpp"
  44 #include "gc/shared/gcTimer.hpp"
  45 #include "gc/shared/gcTrace.hpp"
  46 #include "gc/shared/gcTraceTime.inline.hpp"
  47 #include "gc/shared/isGCActiveMark.hpp"
  48 #include "gc/shared/referencePolicy.hpp"
  49 #include "gc/shared/referenceProcessor.hpp"
  50 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  51 #include "gc/shared/spaceDecorator.hpp"
  52 #include "gc/shared/weakProcessor.hpp"



  53 #include "logging/log.hpp"
  54 #include "oops/oop.inline.hpp"
  55 #include "runtime/biasedLocking.hpp"
  56 #include "runtime/flags/flagSetting.hpp"
  57 #include "runtime/handles.inline.hpp"
  58 #include "runtime/safepoint.hpp"
  59 #include "runtime/vmThread.hpp"
  60 #include "services/management.hpp"
  61 #include "services/memoryService.hpp"
  62 #include "utilities/align.hpp"
  63 #include "utilities/events.hpp"
  64 #include "utilities/stack.inline.hpp"
  65 #if INCLUDE_JVMCI
  66 #include "jvmci/jvmci.hpp"
  67 #endif
  68 
  69 elapsedTimer        PSMarkSweep::_accumulated_time;
  70 jlong               PSMarkSweep::_time_of_last_gc   = 0;
  71 CollectorCounters*  PSMarkSweep::_counters = NULL;
  72 
  73 SpanSubjectToDiscoveryClosure PSMarkSweep::_span_based_discoverer;
  74 
  75 void PSMarkSweep::initialize() {
  76   _span_based_discoverer.set_span(ParallelScavengeHeap::heap()->reserved_region());
  77   set_ref_processor(new ReferenceProcessor(&_span_based_discoverer));     // a vanilla ref proc
  78   _counters = new CollectorCounters("Serial full collection pauses", 1);
  79   MarkSweep::initialize();
  80 }
  81 
  82 // This method contains all heap specific policy for invoking mark sweep.
  83 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
  84 // the heap. It will do nothing further. If we need to bail out for policy
  85 // reasons, scavenge before full gc, or any other specialized behavior, it
  86 // needs to be added here.
  87 //


 549   // This is the point where the entire marking should have completed.
 550   assert(_marking_stack.is_empty(), "Marking should have completed");
 551 
 552   {
 553     GCTraceTime(Debug, gc, phases) t("Weak Processing", _gc_timer);
 554     WeakProcessor::weak_oops_do(is_alive_closure(), &do_nothing_cl);
 555   }
 556 
 557   {
 558     GCTraceTime(Debug, gc, phases) t("Class Unloading", _gc_timer);
 559 
 560     // Unload classes and purge the SystemDictionary.
 561     bool purged_class = SystemDictionary::do_unloading(_gc_timer);
 562 
 563     // Unload nmethods.
 564     CodeCache::do_unloading(is_alive_closure(), purged_class);
 565 
 566     // Prune dead klasses from subklass/sibling/implementor lists.
 567     Klass::clean_weak_klass_links(purged_class);
 568 

 569     // Clean JVMCI metadata handles.
 570     JVMCI_ONLY(JVMCI::do_unloading(is_alive_closure(), purged_class));

 571   }
 572 
 573   _gc_tracer->report_object_count_after_gc(is_alive_closure());
 574 }
 575 
 576 
 577 void PSMarkSweep::mark_sweep_phase2() {
 578   GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", _gc_timer);
 579 
 580   // Now all live objects are marked, compute the new object addresses.
 581 
 582   // It is not required that we traverse spaces in the same order in
 583   // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
 584   // tracking expects us to do so. See comment under phase4.
 585 
 586   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 587   PSOldGen* old_gen = heap->old_gen();
 588 
 589   // Begin compacting into the old gen
 590   PSMarkSweepDecorator::set_destination_decorator_tenured();


src/hotspot/share/gc/parallel/psMarkSweep.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File