2108 // This is the point where the entire marking should have completed.
2109 assert(cm->marking_stacks_empty(), "Marking should have completed");
2110
2111 // Follow system dictionary roots and unload classes.
2112 bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
2113
2114 // Unload nmethods.
2115 CodeCache::do_unloading(is_alive_closure(), purged_class);
2116
2117 // Prune dead klasses from subklass/sibling/implementor lists.
2118 Klass::clean_weak_klass_links(is_alive_closure());
2119
2120 // Delete entries for dead interned strings.
2121 StringTable::unlink(is_alive_closure());
2122
2123 // Clean up unreferenced symbols in symbol table.
2124 SymbolTable::unlink();
2125 _gc_tracer.report_object_count_after_gc(is_alive_closure());
2126 }
2127
2128 // This should be moved to the shared markSweep code!
2129 class PSAlwaysTrueClosure: public BoolObjectClosure {
2130 public:
2131 bool do_object_b(oop p) { return true; }
2132 };
2133 static PSAlwaysTrueClosure always_true;
2134
2135 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
2136 // Adjust the pointers to reflect the new locations
2137 GCTraceTime(Trace, gc, phases) tm("Adjust Roots", &_gc_timer);
2138
2139 // Need new claim bits when tracing through and adjusting pointers.
2140 ClassLoaderDataGraph::clear_claimed_marks();
2141
2142 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2143 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2144
2145 // General strong roots.
2146 Universe::oops_do(&oop_closure);
2147 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2148 CLDToOopClosure adjust_from_cld(&oop_closure);
2149 Threads::oops_do(&oop_closure, &adjust_from_cld, NULL);
2150 ObjectSynchronizer::oops_do(&oop_closure);
2151 FlatProfiler::oops_do(&oop_closure);
2152 Management::oops_do(&oop_closure);
2153 JvmtiExport::oops_do(&oop_closure);
2154 SystemDictionary::oops_do(&oop_closure);
2155 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2156
2157 // Now adjust pointers in remaining weak roots. (All of which should
2158 // have been cleared if they pointed to non-surviving objects.)
2159 // Global (weak) JNI handles
2160 JNIHandles::weak_oops_do(&always_true, &oop_closure);
2161
2162 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2163 CodeCache::blobs_do(&adjust_from_blobs);
2164 StringTable::oops_do(&oop_closure);
2165 ref_processor()->weak_oops_do(&oop_closure);
2166 // Roots were visited so references into the young gen in roots
2167 // may have been scanned. Process them also.
2168 // Should the reference processor have a span that excludes
2169 // young gen objects?
2170 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2171 }
2172
2173 // Helper class to print 8 region numbers per line and then print the total at the end.
2174 class FillableRegionLogger : public StackObj {
2175 private:
2176 LogHandle(gc, compaction) log;
2177 static const int LineLength = 8;
2178 size_t _regions[LineLength];
2179 int _next_index;
2180 bool _enabled;
|
2108 // This is the point where the entire marking should have completed.
2109 assert(cm->marking_stacks_empty(), "Marking should have completed");
2110
2111 // Follow system dictionary roots and unload classes.
2112 bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
2113
2114 // Unload nmethods.
2115 CodeCache::do_unloading(is_alive_closure(), purged_class);
2116
2117 // Prune dead klasses from subklass/sibling/implementor lists.
2118 Klass::clean_weak_klass_links(is_alive_closure());
2119
2120 // Delete entries for dead interned strings.
2121 StringTable::unlink(is_alive_closure());
2122
2123 // Clean up unreferenced symbols in symbol table.
2124 SymbolTable::unlink();
2125 _gc_tracer.report_object_count_after_gc(is_alive_closure());
2126 }
2127
2128 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
2129 // Adjust the pointers to reflect the new locations
2130 GCTraceTime(Trace, gc, phases) tm("Adjust Roots", &_gc_timer);
2131
2132 // Need new claim bits when tracing through and adjusting pointers.
2133 ClassLoaderDataGraph::clear_claimed_marks();
2134
2135 PSParallelCompact::AdjustPointerClosure oop_closure(cm);
2136 PSParallelCompact::AdjustKlassClosure klass_closure(cm);
2137
2138 // General strong roots.
2139 Universe::oops_do(&oop_closure);
2140 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
2141 CLDToOopClosure adjust_from_cld(&oop_closure);
2142 Threads::oops_do(&oop_closure, &adjust_from_cld, NULL);
2143 ObjectSynchronizer::oops_do(&oop_closure);
2144 FlatProfiler::oops_do(&oop_closure);
2145 Management::oops_do(&oop_closure);
2146 JvmtiExport::oops_do(&oop_closure);
2147 SystemDictionary::oops_do(&oop_closure);
2148 ClassLoaderDataGraph::oops_do(&oop_closure, &klass_closure, true);
2149
2150 // Now adjust pointers in remaining weak roots. (All of which should
2151 // have been cleared if they pointed to non-surviving objects.)
2152 // Global (weak) JNI handles
2153 JNIHandles::weak_oops_do(&oop_closure);
2154
2155 CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
2156 CodeCache::blobs_do(&adjust_from_blobs);
2157 StringTable::oops_do(&oop_closure);
2158 ref_processor()->weak_oops_do(&oop_closure);
2159 // Roots were visited so references into the young gen in roots
2160 // may have been scanned. Process them also.
2161 // Should the reference processor have a span that excludes
2162 // young gen objects?
2163 PSScavenge::reference_processor()->weak_oops_do(&oop_closure);
2164 }
2165
2166 // Helper class to print 8 region numbers per line and then print the total at the end.
2167 class FillableRegionLogger : public StackObj {
2168 private:
2169 LogHandle(gc, compaction) log;
2170 static const int LineLength = 8;
2171 size_t _regions[LineLength];
2172 int _next_index;
2173 bool _enabled;
|