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.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/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/align.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;
2159 // Need new claim bits when tracing through and adjusting pointers.
2160 ClassLoaderDataGraph::clear_claimed_marks();
2161
2162 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2163 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2164
2165 // General strong roots.
2166 Universe::oops_do(&oop_closure);
2167 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2168 Threads::oops_do(&oop_closure, NULL);
2169 ObjectSynchronizer::oops_do(&oop_closure);
2170 Management::oops_do(&oop_closure);
2171 JvmtiExport::oops_do(&oop_closure);
2172 SystemDictionary::oops_do(&oop_closure);
2173 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2174
2175 // Now adjust pointers in remaining weak roots. (All of which should
2176 // have been cleared if they pointed to non-surviving objects.)
2177 // Global (weak) JNI handles
2178 JNIHandles::weak_oops_do(&oop_closure);
2179
2180 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2181 CodeCache::blobs_do(&adjust_from_blobs);
2182 AOTLoader::oops_do(&oop_closure);
2183 StringTable::oops_do(&oop_closure);
2184 ref_processor()->weak_oops_do(&oop_closure);
2185 // Roots were visited so references into the young gen in roots
2186 // may have been scanned. Process them also.
2187 // Should the reference processor have a span that excludes
2188 // young gen objects?
2189 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2190 }
2191
2192 // Helper class to print 8 region numbers per line and then print the total at the end.
2193 class FillableRegionLogger : public StackObj {
2194 private:
2195 Log(gc, compaction) log;
2196 static const int LineLength = 8;
2197 size_t _regions[LineLength];
2198 int _next_index;
|
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.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/heapMonitoring.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/align.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;
2160 // Need new claim bits when tracing through and adjusting pointers.
2161 ClassLoaderDataGraph::clear_claimed_marks();
2162
2163 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2164 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2165
2166 // General strong roots.
2167 Universe::oops_do(&oop_closure);
2168 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2169 Threads::oops_do(&oop_closure, NULL);
2170 ObjectSynchronizer::oops_do(&oop_closure);
2171 Management::oops_do(&oop_closure);
2172 JvmtiExport::oops_do(&oop_closure);
2173 SystemDictionary::oops_do(&oop_closure);
2174 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2175
2176 // Now adjust pointers in remaining weak roots. (All of which should
2177 // have been cleared if they pointed to non-surviving objects.)
2178 // Global (weak) JNI handles
2179 JNIHandles::weak_oops_do(&oop_closure);
2180 HeapMonitoring::weak_oops_do(&oop_closure);
2181
2182 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2183 CodeCache::blobs_do(&adjust_from_blobs);
2184 AOTLoader::oops_do(&oop_closure);
2185 StringTable::oops_do(&oop_closure);
2186 ref_processor()->weak_oops_do(&oop_closure);
2187 // Roots were visited so references into the young gen in roots
2188 // may have been scanned. Process them also.
2189 // Should the reference processor have a span that excludes
2190 // young gen objects?
2191 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2192 }
2193
2194 // Helper class to print 8 region numbers per line and then print the total at the end.
2195 class FillableRegionLogger : public StackObj {
2196 private:
2197 Log(gc, compaction) log;
2198 static const int LineLength = 8;
2199 size_t _regions[LineLength];
2200 int _next_index;
|