src/hotspot/share/gc/parallel/psParallelCompact.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/psParallelCompact.cpp

Print this page




  37 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
  38 #include "gc/parallel/psCompactionManager.inline.hpp"
  39 #include "gc/parallel/psOldGen.hpp"
  40 #include "gc/parallel/psParallelCompact.inline.hpp"
  41 #include "gc/parallel/psPromotionManager.inline.hpp"
  42 #include "gc/parallel/psScavenge.hpp"
  43 #include "gc/parallel/psYoungGen.hpp"
  44 #include "gc/shared/gcCause.hpp"
  45 #include "gc/shared/gcHeapSummary.hpp"
  46 #include "gc/shared/gcId.hpp"
  47 #include "gc/shared/gcLocker.hpp"
  48 #include "gc/shared/gcTimer.hpp"
  49 #include "gc/shared/gcTrace.hpp"
  50 #include "gc/shared/gcTraceTime.inline.hpp"
  51 #include "gc/shared/isGCActiveMark.hpp"
  52 #include "gc/shared/referencePolicy.hpp"
  53 #include "gc/shared/referenceProcessor.hpp"
  54 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  55 #include "gc/shared/spaceDecorator.hpp"
  56 #include "gc/shared/weakProcessor.hpp"
  57 #if INCLUDE_JVMCI
  58 #include "jvmci/jvmci.hpp"
  59 #endif
  60 #include "logging/log.hpp"
  61 #include "memory/iterator.inline.hpp"
  62 #include "memory/resourceArea.hpp"
  63 #include "oops/access.inline.hpp"
  64 #include "oops/instanceClassLoaderKlass.inline.hpp"
  65 #include "oops/instanceKlass.inline.hpp"
  66 #include "oops/instanceMirrorKlass.inline.hpp"
  67 #include "oops/methodData.hpp"
  68 #include "oops/objArrayKlass.inline.hpp"
  69 #include "oops/oop.inline.hpp"
  70 #include "runtime/atomic.hpp"
  71 #include "runtime/handles.inline.hpp"
  72 #include "runtime/safepoint.hpp"
  73 #include "runtime/vmThread.hpp"
  74 #include "services/management.hpp"
  75 #include "services/memTracker.hpp"
  76 #include "services/memoryService.hpp"
  77 #include "utilities/align.hpp"
  78 #include "utilities/debug.hpp"
  79 #include "utilities/events.hpp"
  80 #include "utilities/formatBuffer.hpp"
  81 #include "utilities/macros.hpp"
  82 #include "utilities/stack.inline.hpp"



  83 
  84 #include <math.h>
  85 
  86 // All sizes are in HeapWords.
  87 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
  88 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
  89 const size_t ParallelCompactData::RegionSizeBytes =
  90   RegionSize << LogHeapWordSize;
  91 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
  92 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
  93 const size_t ParallelCompactData::RegionAddrMask       = ~RegionAddrOffsetMask;
  94 
  95 const size_t ParallelCompactData::Log2BlockSize   = 7; // 128 words
  96 const size_t ParallelCompactData::BlockSize       = (size_t)1 << Log2BlockSize;
  97 const size_t ParallelCompactData::BlockSizeBytes  =
  98   BlockSize << LogHeapWordSize;
  99 const size_t ParallelCompactData::BlockSizeOffsetMask = BlockSize - 1;
 100 const size_t ParallelCompactData::BlockAddrOffsetMask = BlockSizeBytes - 1;
 101 const size_t ParallelCompactData::BlockAddrMask       = ~BlockAddrOffsetMask;
 102 


2163   // This is the point where the entire marking should have completed.
2164   assert(cm->marking_stacks_empty(), "Marking should have completed");
2165 
2166   {
2167     GCTraceTime(Debug, gc, phases) tm("Weak Processing", &_gc_timer);
2168     WeakProcessor::weak_oops_do(is_alive_closure(), &do_nothing_cl);
2169   }
2170 
2171   {
2172     GCTraceTime(Debug, gc, phases) tm_m("Class Unloading", &_gc_timer);
2173 
2174     // Follow system dictionary roots and unload classes.
2175     bool purged_class = SystemDictionary::do_unloading(&_gc_timer);
2176 
2177     // Unload nmethods.
2178     CodeCache::do_unloading(is_alive_closure(), purged_class);
2179 
2180     // Prune dead klasses from subklass/sibling/implementor lists.
2181     Klass::clean_weak_klass_links(purged_class);
2182 
2183 #if INCLUDE_JVMCI
2184     // Clean JVMCI metadata handles.
2185     JVMCI::do_unloading(is_alive_closure(), purged_class);
2186 #endif
2187   }
2188 
2189   _gc_tracer.report_object_count_after_gc(is_alive_closure());
2190 }
2191 
2192 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
2193   // Adjust the pointers to reflect the new locations
2194   GCTraceTime(Info, gc, phases) tm("Adjust Roots", &_gc_timer);
2195 
2196   // Need new claim bits when tracing through and adjusting pointers.
2197   ClassLoaderDataGraph::clear_claimed_marks();
2198 
2199   PCAdjustPointerClosure oop_closure(cm);
2200 
2201   // General strong roots.
2202   Universe::oops_do(&oop_closure);
2203   JNIHandles::oops_do(&oop_closure);   // Global (strong) JNI handles
2204   Threads::oops_do(&oop_closure, NULL);
2205   ObjectSynchronizer::oops_do(&oop_closure);
2206   Management::oops_do(&oop_closure);




  37 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
  38 #include "gc/parallel/psCompactionManager.inline.hpp"
  39 #include "gc/parallel/psOldGen.hpp"
  40 #include "gc/parallel/psParallelCompact.inline.hpp"
  41 #include "gc/parallel/psPromotionManager.inline.hpp"
  42 #include "gc/parallel/psScavenge.hpp"
  43 #include "gc/parallel/psYoungGen.hpp"
  44 #include "gc/shared/gcCause.hpp"
  45 #include "gc/shared/gcHeapSummary.hpp"
  46 #include "gc/shared/gcId.hpp"
  47 #include "gc/shared/gcLocker.hpp"
  48 #include "gc/shared/gcTimer.hpp"
  49 #include "gc/shared/gcTrace.hpp"
  50 #include "gc/shared/gcTraceTime.inline.hpp"
  51 #include "gc/shared/isGCActiveMark.hpp"
  52 #include "gc/shared/referencePolicy.hpp"
  53 #include "gc/shared/referenceProcessor.hpp"
  54 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  55 #include "gc/shared/spaceDecorator.hpp"
  56 #include "gc/shared/weakProcessor.hpp"



  57 #include "logging/log.hpp"
  58 #include "memory/iterator.inline.hpp"
  59 #include "memory/resourceArea.hpp"
  60 #include "oops/access.inline.hpp"
  61 #include "oops/instanceClassLoaderKlass.inline.hpp"
  62 #include "oops/instanceKlass.inline.hpp"
  63 #include "oops/instanceMirrorKlass.inline.hpp"
  64 #include "oops/methodData.hpp"
  65 #include "oops/objArrayKlass.inline.hpp"
  66 #include "oops/oop.inline.hpp"
  67 #include "runtime/atomic.hpp"
  68 #include "runtime/handles.inline.hpp"
  69 #include "runtime/safepoint.hpp"
  70 #include "runtime/vmThread.hpp"
  71 #include "services/management.hpp"
  72 #include "services/memTracker.hpp"
  73 #include "services/memoryService.hpp"
  74 #include "utilities/align.hpp"
  75 #include "utilities/debug.hpp"
  76 #include "utilities/events.hpp"
  77 #include "utilities/formatBuffer.hpp"
  78 #include "utilities/macros.hpp"
  79 #include "utilities/stack.inline.hpp"
  80 #if INCLUDE_JVMCI
  81 #include "jvmci/jvmci.hpp"
  82 #endif
  83 
  84 #include <math.h>
  85 
  86 // All sizes are in HeapWords.
  87 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
  88 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
  89 const size_t ParallelCompactData::RegionSizeBytes =
  90   RegionSize << LogHeapWordSize;
  91 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
  92 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
  93 const size_t ParallelCompactData::RegionAddrMask       = ~RegionAddrOffsetMask;
  94 
  95 const size_t ParallelCompactData::Log2BlockSize   = 7; // 128 words
  96 const size_t ParallelCompactData::BlockSize       = (size_t)1 << Log2BlockSize;
  97 const size_t ParallelCompactData::BlockSizeBytes  =
  98   BlockSize << LogHeapWordSize;
  99 const size_t ParallelCompactData::BlockSizeOffsetMask = BlockSize - 1;
 100 const size_t ParallelCompactData::BlockAddrOffsetMask = BlockSizeBytes - 1;
 101 const size_t ParallelCompactData::BlockAddrMask       = ~BlockAddrOffsetMask;
 102 


2163   // This is the point where the entire marking should have completed.
2164   assert(cm->marking_stacks_empty(), "Marking should have completed");
2165 
2166   {
2167     GCTraceTime(Debug, gc, phases) tm("Weak Processing", &_gc_timer);
2168     WeakProcessor::weak_oops_do(is_alive_closure(), &do_nothing_cl);
2169   }
2170 
2171   {
2172     GCTraceTime(Debug, gc, phases) tm_m("Class Unloading", &_gc_timer);
2173 
2174     // Follow system dictionary roots and unload classes.
2175     bool purged_class = SystemDictionary::do_unloading(&_gc_timer);
2176 
2177     // Unload nmethods.
2178     CodeCache::do_unloading(is_alive_closure(), purged_class);
2179 
2180     // Prune dead klasses from subklass/sibling/implementor lists.
2181     Klass::clean_weak_klass_links(purged_class);
2182 

2183     // Clean JVMCI metadata handles.
2184     JVMCI_ONLY(JVMCI::do_unloading(is_alive_closure(), purged_class));

2185   }
2186 
2187   _gc_tracer.report_object_count_after_gc(is_alive_closure());
2188 }
2189 
2190 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
2191   // Adjust the pointers to reflect the new locations
2192   GCTraceTime(Info, gc, phases) tm("Adjust Roots", &_gc_timer);
2193 
2194   // Need new claim bits when tracing through and adjusting pointers.
2195   ClassLoaderDataGraph::clear_claimed_marks();
2196 
2197   PCAdjustPointerClosure oop_closure(cm);
2198 
2199   // General strong roots.
2200   Universe::oops_do(&oop_closure);
2201   JNIHandles::oops_do(&oop_closure);   // Global (strong) JNI handles
2202   Threads::oops_do(&oop_closure, NULL);
2203   ObjectSynchronizer::oops_do(&oop_closure);
2204   Management::oops_do(&oop_closure);


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