< prev index next >

src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp

Print this page




  36 #include "gc_implementation/shared/gcHeapSummary.hpp"
  37 #include "gc_implementation/shared/gcTimer.hpp"
  38 #include "gc_implementation/shared/gcTrace.hpp"
  39 #include "gc_implementation/shared/gcTraceTime.hpp"
  40 #include "gc_implementation/shared/isGCActiveMark.hpp"
  41 #include "gc_implementation/shared/markSweep.hpp"
  42 #include "gc_implementation/shared/spaceDecorator.hpp"
  43 #include "gc_interface/gcCause.hpp"
  44 #include "memory/gcLocker.inline.hpp"
  45 #include "memory/referencePolicy.hpp"
  46 #include "memory/referenceProcessor.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "runtime/biasedLocking.hpp"
  49 #include "runtime/fprofiler.hpp"
  50 #include "runtime/safepoint.hpp"
  51 #include "runtime/vmThread.hpp"
  52 #include "services/management.hpp"
  53 #include "services/memoryService.hpp"
  54 #include "utilities/events.hpp"
  55 #include "utilities/stack.inline.hpp"



  56 
  57 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  58 
  59 elapsedTimer        PSMarkSweep::_accumulated_time;
  60 jlong               PSMarkSweep::_time_of_last_gc   = 0;
  61 CollectorCounters*  PSMarkSweep::_counters = NULL;
  62 
  63 void PSMarkSweep::initialize() {
  64   MemRegion mr = Universe::heap()->reserved_region();
  65   _ref_processor = new ReferenceProcessor(mr);     // a vanilla ref proc
  66   _counters = new CollectorCounters("PSMarkSweep", 1);
  67 }
  68 
  69 // This method contains all heap specific policy for invoking mark sweep.
  70 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
  71 // the heap. It will do nothing further. If we need to bail out for policy
  72 // reasons, scavenge before full gc, or any other specialized behavior, it
  73 // needs to be added here.
  74 //
  75 // Note that this method should only be called from the vm_thread while


 607 
 608   // Need to clear claim bits before the tracing starts.
 609   ClassLoaderDataGraph::clear_claimed_marks();
 610 
 611   // General strong roots.
 612   Universe::oops_do(adjust_pointer_closure());
 613   JNIHandles::oops_do(adjust_pointer_closure());   // Global (strong) JNI handles
 614   CLDToOopClosure adjust_from_cld(adjust_pointer_closure());
 615   Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL);
 616   ObjectSynchronizer::oops_do(adjust_pointer_closure());
 617   FlatProfiler::oops_do(adjust_pointer_closure());
 618   Management::oops_do(adjust_pointer_closure());
 619   JvmtiExport::oops_do(adjust_pointer_closure());
 620   SystemDictionary::oops_do(adjust_pointer_closure());
 621   ClassLoaderDataGraph::cld_do(adjust_cld_closure());
 622 
 623   // Now adjust pointers in remaining weak roots.  (All of which should
 624   // have been cleared if they pointed to non-surviving objects.)
 625   // Global (weak) JNI handles
 626   JNIHandles::weak_oops_do(adjust_pointer_closure());

 627 
 628   CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations);
 629   CodeCache::blobs_do(&adjust_from_blobs);
 630   StringTable::oops_do(adjust_pointer_closure());
 631   ref_processor()->weak_oops_do(adjust_pointer_closure());
 632   PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure());
 633 
 634   adjust_marks();
 635 
 636   young_gen->adjust_pointers();
 637   old_gen->adjust_pointers();
 638 }
 639 
 640 void PSMarkSweep::mark_sweep_phase4() {
 641   EventMark m("4 compact heap");
 642   GCTraceTime tm("phase 4", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id());
 643   trace("4");
 644 
 645   // All pointers are now adjusted, move objects accordingly
 646 




  36 #include "gc_implementation/shared/gcHeapSummary.hpp"
  37 #include "gc_implementation/shared/gcTimer.hpp"
  38 #include "gc_implementation/shared/gcTrace.hpp"
  39 #include "gc_implementation/shared/gcTraceTime.hpp"
  40 #include "gc_implementation/shared/isGCActiveMark.hpp"
  41 #include "gc_implementation/shared/markSweep.hpp"
  42 #include "gc_implementation/shared/spaceDecorator.hpp"
  43 #include "gc_interface/gcCause.hpp"
  44 #include "memory/gcLocker.inline.hpp"
  45 #include "memory/referencePolicy.hpp"
  46 #include "memory/referenceProcessor.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "runtime/biasedLocking.hpp"
  49 #include "runtime/fprofiler.hpp"
  50 #include "runtime/safepoint.hpp"
  51 #include "runtime/vmThread.hpp"
  52 #include "services/management.hpp"
  53 #include "services/memoryService.hpp"
  54 #include "utilities/events.hpp"
  55 #include "utilities/stack.inline.hpp"
  56 #if INCLUDE_JFR
  57 #include "jfr/jfr.hpp"
  58 #endif // INCLUDE_JFR
  59 
  60 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  61 
  62 elapsedTimer        PSMarkSweep::_accumulated_time;
  63 jlong               PSMarkSweep::_time_of_last_gc   = 0;
  64 CollectorCounters*  PSMarkSweep::_counters = NULL;
  65 
  66 void PSMarkSweep::initialize() {
  67   MemRegion mr = Universe::heap()->reserved_region();
  68   _ref_processor = new ReferenceProcessor(mr);     // a vanilla ref proc
  69   _counters = new CollectorCounters("PSMarkSweep", 1);
  70 }
  71 
  72 // This method contains all heap specific policy for invoking mark sweep.
  73 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
  74 // the heap. It will do nothing further. If we need to bail out for policy
  75 // reasons, scavenge before full gc, or any other specialized behavior, it
  76 // needs to be added here.
  77 //
  78 // Note that this method should only be called from the vm_thread while


 610 
 611   // Need to clear claim bits before the tracing starts.
 612   ClassLoaderDataGraph::clear_claimed_marks();
 613 
 614   // General strong roots.
 615   Universe::oops_do(adjust_pointer_closure());
 616   JNIHandles::oops_do(adjust_pointer_closure());   // Global (strong) JNI handles
 617   CLDToOopClosure adjust_from_cld(adjust_pointer_closure());
 618   Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL);
 619   ObjectSynchronizer::oops_do(adjust_pointer_closure());
 620   FlatProfiler::oops_do(adjust_pointer_closure());
 621   Management::oops_do(adjust_pointer_closure());
 622   JvmtiExport::oops_do(adjust_pointer_closure());
 623   SystemDictionary::oops_do(adjust_pointer_closure());
 624   ClassLoaderDataGraph::cld_do(adjust_cld_closure());
 625 
 626   // Now adjust pointers in remaining weak roots.  (All of which should
 627   // have been cleared if they pointed to non-surviving objects.)
 628   // Global (weak) JNI handles
 629   JNIHandles::weak_oops_do(adjust_pointer_closure());
 630   JFR_ONLY(Jfr::weak_oops_do(adjust_pointer_closure()));
 631 
 632   CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations);
 633   CodeCache::blobs_do(&adjust_from_blobs);
 634   StringTable::oops_do(adjust_pointer_closure());
 635   ref_processor()->weak_oops_do(adjust_pointer_closure());
 636   PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure());
 637 
 638   adjust_marks();
 639 
 640   young_gen->adjust_pointers();
 641   old_gen->adjust_pointers();
 642 }
 643 
 644 void PSMarkSweep::mark_sweep_phase4() {
 645   EventMark m("4 compact heap");
 646   GCTraceTime tm("phase 4", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id());
 647   trace("4");
 648 
 649   // All pointers are now adjusted, move objects accordingly
 650 


< prev index next >