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;
81
82 const size_t ParallelCompactData::Log2BlockSize = 7; // 128 words
2151 ClassLoaderDataGraph::clear_claimed_marks();
2152
2153 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2154 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2155
2156 // General strong roots.
2157 Universe::oops_do(&oop_closure);
2158 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2159 Threads::oops_do(&oop_closure, NULL);
2160 ObjectSynchronizer::oops_do(&oop_closure);
2161 FlatProfiler::oops_do(&oop_closure);
2162 Management::oops_do(&oop_closure);
2163 JvmtiExport::oops_do(&oop_closure);
2164 SystemDictionary::oops_do(&oop_closure);
2165 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2166
2167 // Now adjust pointers in remaining weak roots. (All of which should
2168 // have been cleared if they pointed to non-surviving objects.)
2169 // Global (weak) JNI handles
2170 JNIHandles::weak_oops_do(&oop_closure);
2171
2172 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2173 CodeCache::blobs_do(&adjust_from_blobs);
2174 AOTLoader::oops_do(&oop_closure);
2175 StringTable::oops_do(&oop_closure);
2176 ref_processor()->weak_oops_do(&oop_closure);
2177 // Roots were visited so references into the young gen in roots
2178 // may have been scanned. Process them also.
2179 // Should the reference processor have a span that excludes
2180 // young gen objects?
2181 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2182 }
2183
2184 // Helper class to print 8 region numbers per line and then print the total at the end.
2185 class FillableRegionLogger : public StackObj {
2186 private:
2187 Log(gc, compaction) log;
2188 static const int LineLength = 8;
2189 size_t _regions[LineLength];
2190 int _next_index;
|
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/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/events.hpp"
70 #include "utilities/stack.inline.hpp"
71
72 #include <math.h>
73
74 // All sizes are in HeapWords.
75 const size_t ParallelCompactData::Log2RegionSize = 16; // 64K words
76 const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize;
77 const size_t ParallelCompactData::RegionSizeBytes =
78 RegionSize << LogHeapWordSize;
79 const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1;
80 const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1;
81 const size_t ParallelCompactData::RegionAddrMask = ~RegionAddrOffsetMask;
82
83 const size_t ParallelCompactData::Log2BlockSize = 7; // 128 words
2152 ClassLoaderDataGraph::clear_claimed_marks();
2153
2154 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2155 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2156
2157 // General strong roots.
2158 Universe::oops_do(&oop_closure);
2159 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2160 Threads::oops_do(&oop_closure, NULL);
2161 ObjectSynchronizer::oops_do(&oop_closure);
2162 FlatProfiler::oops_do(&oop_closure);
2163 Management::oops_do(&oop_closure);
2164 JvmtiExport::oops_do(&oop_closure);
2165 SystemDictionary::oops_do(&oop_closure);
2166 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2167
2168 // Now adjust pointers in remaining weak roots. (All of which should
2169 // have been cleared if they pointed to non-surviving objects.)
2170 // Global (weak) JNI handles
2171 JNIHandles::weak_oops_do(&oop_closure);
2172
2173 HeapMonitoring::do_weak_oops(&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;
|