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

src/share/vm/gc/parallel/psParallelCompact.cpp

Print this page
rev 29186 : Review changes 2


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"

  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/symbolTable.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "gc/parallel/gcTaskManager.hpp"
  31 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
  32 #include "gc/parallel/pcTasks.hpp"
  33 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
  34 #include "gc/parallel/psCompactionManager.inline.hpp"
  35 #include "gc/parallel/psMarkSweep.hpp"
  36 #include "gc/parallel/psMarkSweepDecorator.hpp"
  37 #include "gc/parallel/psOldGen.hpp"
  38 #include "gc/parallel/psParallelCompact.inline.hpp"
  39 #include "gc/parallel/psPromotionManager.inline.hpp"
  40 #include "gc/parallel/psScavenge.hpp"
  41 #include "gc/parallel/psYoungGen.hpp"
  42 #include "gc/shared/gcCause.hpp"
  43 #include "gc/shared/gcHeapSummary.hpp"
  44 #include "gc/shared/gcId.hpp"
  45 #include "gc/shared/gcLocker.inline.hpp"
  46 #include "gc/shared/gcTimer.hpp"
  47 #include "gc/shared/gcTrace.hpp"
  48 #include "gc/shared/gcTraceTime.inline.hpp"
  49 #include "gc/shared/isGCActiveMark.hpp"
  50 #include "gc/shared/referencePolicy.hpp"
  51 #include "gc/shared/referenceProcessor.hpp"
  52 #include "gc/shared/spaceDecorator.hpp"
  53 #include "logging/log.hpp"
  54 #include "memory/resourceArea.hpp"
  55 #include "oops/instanceKlass.inline.hpp"
  56 #include "oops/instanceMirrorKlass.inline.hpp"
  57 #include "oops/methodData.hpp"
  58 #include "oops/objArrayKlass.inline.hpp"
  59 #include "oops/oop.inline.hpp"
  60 #include "aot/aotLoader.hpp"
  61 #include "runtime/atomic.hpp"
  62 #include "runtime/fprofiler.hpp"
  63 #include "runtime/safepoint.hpp"
  64 #include "runtime/vmThread.hpp"
  65 #include "services/management.hpp"
  66 #include "services/memTracker.hpp"
  67 #include "services/memoryService.hpp"
  68 #include "utilities/events.hpp"
  69 #include "utilities/stack.inline.hpp"
  70 
  71 #include <math.h>
  72 
  73 // All sizes are in HeapWords.
  74 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
  75 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
  76 const size_t ParallelCompactData::RegionSizeBytes =
  77   RegionSize << LogHeapWordSize;
  78 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
  79 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
  80 const size_t ParallelCompactData::RegionAddrMask       = ~RegionAddrOffsetMask;


2167   PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2168 
2169   // General strong roots.
2170   Universe::oops_do(&oop_closure);
2171   JNIHandles::oops_do(&oop_closure);   // Global (strong) JNI handles
2172   Threads::oops_do(&oop_closure, NULL);
2173   ObjectSynchronizer::oops_do(&oop_closure);
2174   FlatProfiler::oops_do(&oop_closure);
2175   Management::oops_do(&oop_closure);
2176   JvmtiExport::oops_do(&oop_closure);
2177   SystemDictionary::oops_do(&oop_closure);
2178   ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2179 
2180   // Now adjust pointers in remaining weak roots.  (All of which should
2181   // have been cleared if they pointed to non-surviving objects.)
2182   // Global (weak) JNI handles
2183   JNIHandles::weak_oops_do(&oop_closure);
2184 
2185   CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2186   CodeCache::blobs_do(&adjust_from_blobs);
2187   if (UseAOT) {
2188     AOTLoader::oops_do(&oop_closure);
2189   }
2190   StringTable::oops_do(&oop_closure);
2191   ref_processor()->weak_oops_do(&oop_closure);
2192   // Roots were visited so references into the young gen in roots
2193   // may have been scanned.  Process them also.
2194   // Should the reference processor have a span that excludes
2195   // young gen objects?
2196   PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2197 }
2198 
2199 // Helper class to print 8 region numbers per line and then print the total at the end.
2200 class FillableRegionLogger : public StackObj {
2201 private:
2202   Log(gc, compaction) log;
2203   static const int LineLength = 8;
2204   size_t _regions[LineLength];
2205   int _next_index;
2206   bool _enabled;
2207   size_t _total_regions;
2208 public:
2209   FillableRegionLogger() : _next_index(0), _total_regions(0), _enabled(log_develop_is_enabled(Trace, gc, compaction)) { }




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "aot/aotLoader.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/symbolTable.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/parallel/gcTaskManager.hpp"
  32 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
  33 #include "gc/parallel/pcTasks.hpp"
  34 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
  35 #include "gc/parallel/psCompactionManager.inline.hpp"
  36 #include "gc/parallel/psMarkSweep.hpp"
  37 #include "gc/parallel/psMarkSweepDecorator.hpp"
  38 #include "gc/parallel/psOldGen.hpp"
  39 #include "gc/parallel/psParallelCompact.inline.hpp"
  40 #include "gc/parallel/psPromotionManager.inline.hpp"
  41 #include "gc/parallel/psScavenge.hpp"
  42 #include "gc/parallel/psYoungGen.hpp"
  43 #include "gc/shared/gcCause.hpp"
  44 #include "gc/shared/gcHeapSummary.hpp"
  45 #include "gc/shared/gcId.hpp"
  46 #include "gc/shared/gcLocker.inline.hpp"
  47 #include "gc/shared/gcTimer.hpp"
  48 #include "gc/shared/gcTrace.hpp"
  49 #include "gc/shared/gcTraceTime.inline.hpp"
  50 #include "gc/shared/isGCActiveMark.hpp"
  51 #include "gc/shared/referencePolicy.hpp"
  52 #include "gc/shared/referenceProcessor.hpp"
  53 #include "gc/shared/spaceDecorator.hpp"
  54 #include "logging/log.hpp"
  55 #include "memory/resourceArea.hpp"
  56 #include "oops/instanceKlass.inline.hpp"
  57 #include "oops/instanceMirrorKlass.inline.hpp"
  58 #include "oops/methodData.hpp"
  59 #include "oops/objArrayKlass.inline.hpp"
  60 #include "oops/oop.inline.hpp"

  61 #include "runtime/atomic.hpp"
  62 #include "runtime/fprofiler.hpp"
  63 #include "runtime/safepoint.hpp"
  64 #include "runtime/vmThread.hpp"
  65 #include "services/management.hpp"
  66 #include "services/memTracker.hpp"
  67 #include "services/memoryService.hpp"
  68 #include "utilities/events.hpp"
  69 #include "utilities/stack.inline.hpp"
  70 
  71 #include <math.h>
  72 
  73 // All sizes are in HeapWords.
  74 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
  75 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
  76 const size_t ParallelCompactData::RegionSizeBytes =
  77   RegionSize << LogHeapWordSize;
  78 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
  79 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
  80 const size_t ParallelCompactData::RegionAddrMask       = ~RegionAddrOffsetMask;


2167   PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2168 
2169   // General strong roots.
2170   Universe::oops_do(&oop_closure);
2171   JNIHandles::oops_do(&oop_closure);   // Global (strong) JNI handles
2172   Threads::oops_do(&oop_closure, NULL);
2173   ObjectSynchronizer::oops_do(&oop_closure);
2174   FlatProfiler::oops_do(&oop_closure);
2175   Management::oops_do(&oop_closure);
2176   JvmtiExport::oops_do(&oop_closure);
2177   SystemDictionary::oops_do(&oop_closure);
2178   ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2179 
2180   // Now adjust pointers in remaining weak roots.  (All of which should
2181   // have been cleared if they pointed to non-surviving objects.)
2182   // Global (weak) JNI handles
2183   JNIHandles::weak_oops_do(&oop_closure);
2184 
2185   CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2186   CodeCache::blobs_do(&adjust_from_blobs);

2187   AOTLoader::oops_do(&oop_closure);

2188   StringTable::oops_do(&oop_closure);
2189   ref_processor()->weak_oops_do(&oop_closure);
2190   // Roots were visited so references into the young gen in roots
2191   // may have been scanned.  Process them also.
2192   // Should the reference processor have a span that excludes
2193   // young gen objects?
2194   PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2195 }
2196 
2197 // Helper class to print 8 region numbers per line and then print the total at the end.
2198 class FillableRegionLogger : public StackObj {
2199 private:
2200   Log(gc, compaction) log;
2201   static const int LineLength = 8;
2202   size_t _regions[LineLength];
2203   int _next_index;
2204   bool _enabled;
2205   size_t _total_regions;
2206 public:
2207   FillableRegionLogger() : _next_index(0), _total_regions(0), _enabled(log_develop_is_enabled(Trace, gc, compaction)) { }


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