142 rp->process_discovered_references(&GenMarkSweep::is_alive, |
142 rp->process_discovered_references(&GenMarkSweep::is_alive, |
143 &GenMarkSweep::keep_alive, |
143 &GenMarkSweep::keep_alive, |
144 &GenMarkSweep::follow_stack_closure, |
144 &GenMarkSweep::follow_stack_closure, |
145 NULL); |
145 NULL); |
146 |
146 |
147 // Follow system dictionary roots and unload classes |
147 |
|
148 // This is the point where the entire marking should have completed. |
|
149 assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed"); |
|
150 |
|
151 // Unload classes and purge the SystemDictionary. |
148 bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); |
152 bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); |
149 assert(GenMarkSweep::_marking_stack.is_empty(), |
153 |
150 "stack should be empty by now"); |
154 // Unload nmethods. |
151 |
|
152 // Follow code cache roots (has to be done after system dictionary, |
|
153 // assumes all live klasses are marked) |
|
154 CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); |
155 CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); |
155 GenMarkSweep::follow_stack(); |
156 |
156 |
157 // Prune dead klasses from subklass/sibling/implementor lists. |
157 // Update subklass/sibling/implementor links of live klasses |
|
158 Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); |
158 Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); |
159 assert(GenMarkSweep::_marking_stack.is_empty(), |
159 |
160 "stack should be empty by now"); |
160 // Delete entries for dead interned strings. |
161 |
|
162 // Visit interned string tables and delete unmarked oops |
|
163 StringTable::unlink(&GenMarkSweep::is_alive); |
161 StringTable::unlink(&GenMarkSweep::is_alive); |
|
162 |
164 // Clean up unreferenced symbols in symbol table. |
163 // Clean up unreferenced symbols in symbol table. |
165 SymbolTable::unlink(); |
164 SymbolTable::unlink(); |
166 |
|
167 assert(GenMarkSweep::_marking_stack.is_empty(), |
|
168 "stack should be empty by now"); |
|
169 |
165 |
170 if (VerifyDuringGC) { |
166 if (VerifyDuringGC) { |
171 HandleMark hm; // handle scope |
167 HandleMark hm; // handle scope |
172 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); |
168 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); |
173 Universe::heap()->prepare_for_verify(); |
169 Universe::heap()->prepare_for_verify(); |