44 #include "gc/shared/gcCause.hpp"
45 #include "gc/shared/gcHeapSummary.hpp"
46 #include "gc/shared/gcId.hpp"
47 #include "gc/shared/gcLocker.inline.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/spaceDecorator.hpp"
55 #include "logging/log.hpp"
56 #include "memory/resourceArea.hpp"
57 #include "oops/instanceKlass.inline.hpp"
58 #include "oops/instanceMirrorKlass.inline.hpp"
59 #include "oops/methodData.hpp"
60 #include "oops/objArrayKlass.inline.hpp"
61 #include "oops/oop.inline.hpp"
62 #include "runtime/atomic.hpp"
63 #include "runtime/fprofiler.hpp"
64 #include "runtime/safepoint.hpp"
65 #include "runtime/vmThread.hpp"
66 #include "services/management.hpp"
67 #include "services/memTracker.hpp"
68 #include "services/memoryService.hpp"
69 #include "utilities/debug.hpp"
70 #include "utilities/events.hpp"
71 #include "utilities/formatBuffer.hpp"
72 #include "utilities/stack.inline.hpp"
73
74 #include <math.h>
75
76 // All sizes are in HeapWords.
77 const size_t ParallelCompactData::Log2RegionSize = 16; // 64K words
78 const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize;
79 const size_t ParallelCompactData::RegionSizeBytes =
80 RegionSize << LogHeapWordSize;
81 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
82 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
83 const size_t ParallelCompactData::RegionAddrMask = ~RegionAddrOffsetMask;
2154 ClassLoaderDataGraph::clear_claimed_marks();
2155
2156 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2157 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2158
2159 // General strong roots.
2160 Universe::oops_do(&oop_closure);
2161 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2162 Threads::oops_do(&oop_closure, NULL);
2163 ObjectSynchronizer::oops_do(&oop_closure);
2164 FlatProfiler::oops_do(&oop_closure);
2165 Management::oops_do(&oop_closure);
2166 JvmtiExport::oops_do(&oop_closure);
2167 SystemDictionary::oops_do(&oop_closure);
2168 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2169
2170 // Now adjust pointers in remaining weak roots. (All of which should
2171 // have been cleared if they pointed to non-surviving objects.)
2172 // Global (weak) JNI handles
2173 JNIHandles::weak_oops_do(&oop_closure);
2174
2175 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2176 CodeCache::blobs_do(&adjust_from_blobs);
2177 AOTLoader::oops_do(&oop_closure);
2178 StringTable::oops_do(&oop_closure);
2179 ref_processor()->weak_oops_do(&oop_closure);
2180 // Roots were visited so references into the young gen in roots
2181 // may have been scanned. Process them also.
2182 // Should the reference processor have a span that excludes
2183 // young gen objects?
2184 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2185 }
2186
2187 // Helper class to print 8 region numbers per line and then print the total at the end.
2188 class FillableRegionLogger : public StackObj {
2189 private:
2190 Log(gc, compaction) log;
2191 static const int LineLength = 8;
2192 size_t _regions[LineLength];
2193 int _next_index;
|
44 #include "gc/shared/gcCause.hpp"
45 #include "gc/shared/gcHeapSummary.hpp"
46 #include "gc/shared/gcId.hpp"
47 #include "gc/shared/gcLocker.inline.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/spaceDecorator.hpp"
55 #include "logging/log.hpp"
56 #include "memory/resourceArea.hpp"
57 #include "oops/instanceKlass.inline.hpp"
58 #include "oops/instanceMirrorKlass.inline.hpp"
59 #include "oops/methodData.hpp"
60 #include "oops/objArrayKlass.inline.hpp"
61 #include "oops/oop.inline.hpp"
62 #include "runtime/atomic.hpp"
63 #include "runtime/fprofiler.hpp"
64 #include "runtime/heapMonitoring.hpp"
65 #include "runtime/safepoint.hpp"
66 #include "runtime/vmThread.hpp"
67 #include "services/management.hpp"
68 #include "services/memTracker.hpp"
69 #include "services/memoryService.hpp"
70 #include "utilities/debug.hpp"
71 #include "utilities/events.hpp"
72 #include "utilities/formatBuffer.hpp"
73 #include "utilities/stack.inline.hpp"
74
75 #include <math.h>
76
77 // All sizes are in HeapWords.
78 const size_t ParallelCompactData::Log2RegionSize = 16; // 64K words
79 const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize;
80 const size_t ParallelCompactData::RegionSizeBytes =
81 RegionSize << LogHeapWordSize;
82 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
83 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
84 const size_t ParallelCompactData::RegionAddrMask = ~RegionAddrOffsetMask;
2155 ClassLoaderDataGraph::clear_claimed_marks();
2156
2157 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2158 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2159
2160 // General strong roots.
2161 Universe::oops_do(&oop_closure);
2162 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2163 Threads::oops_do(&oop_closure, NULL);
2164 ObjectSynchronizer::oops_do(&oop_closure);
2165 FlatProfiler::oops_do(&oop_closure);
2166 Management::oops_do(&oop_closure);
2167 JvmtiExport::oops_do(&oop_closure);
2168 SystemDictionary::oops_do(&oop_closure);
2169 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2170
2171 // Now adjust pointers in remaining weak roots. (All of which should
2172 // have been cleared if they pointed to non-surviving objects.)
2173 // Global (weak) JNI handles
2174 JNIHandles::weak_oops_do(&oop_closure);
2175 HeapMonitoring::weak_oops_do(&oop_closure);
2176
2177 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2178 CodeCache::blobs_do(&adjust_from_blobs);
2179 AOTLoader::oops_do(&oop_closure);
2180 StringTable::oops_do(&oop_closure);
2181 ref_processor()->weak_oops_do(&oop_closure);
2182 // Roots were visited so references into the young gen in roots
2183 // may have been scanned. Process them also.
2184 // Should the reference processor have a span that excludes
2185 // young gen objects?
2186 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2187 }
2188
2189 // Helper class to print 8 region numbers per line and then print the total at the end.
2190 class FillableRegionLogger : public StackObj {
2191 private:
2192 Log(gc, compaction) log;
2193 static const int LineLength = 8;
2194 size_t _regions[LineLength];
2195 int _next_index;
|