2416 // This is the point where the entire marking should have completed. 2417 assert(cm->marking_stacks_empty(), "Marking should have completed"); 2418 2419 // Follow system dictionary roots and unload classes. 2420 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 2421 2422 // Unload nmethods. 2423 CodeCache::do_unloading(is_alive_closure(), purged_class); 2424 2425 // Prune dead klasses from subklass/sibling/implementor lists. 2426 Klass::clean_weak_klass_links(is_alive_closure()); 2427 2428 // Delete entries for dead interned strings. 2429 StringTable::unlink(is_alive_closure()); 2430 2431 // Clean up unreferenced symbols in symbol table. 2432 SymbolTable::unlink(); 2433 _gc_tracer.report_object_count_after_gc(is_alive_closure()); 2434 } 2435 2436 void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) { 2437 ClassLoaderData* cld = klass->class_loader_data(); 2438 // The actual processing of the klass is done when we 2439 // traverse the list of Klasses in the class loader data. 2440 PSParallelCompact::follow_class_loader(cm, cld); 2441 } 2442 2443 void PSParallelCompact::adjust_klass(ParCompactionManager* cm, Klass* klass) { 2444 ClassLoaderData* cld = klass->class_loader_data(); 2445 // The actual processing of the klass is done when we 2446 // traverse the list of Klasses in the class loader data. 2447 PSParallelCompact::adjust_class_loader(cm, cld); 2448 } 2449 2450 void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, 2451 ClassLoaderData* cld) { 2452 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); 2453 PSParallelCompact::FollowKlassClosure follow_klass_closure(&mark_and_push_closure); 2454 2455 cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); 2456 } 2457 2458 void PSParallelCompact::adjust_class_loader(ParCompactionManager* cm, 2459 ClassLoaderData* cld) { 2460 cld->oops_do(PSParallelCompact::adjust_pointer_closure(), 2461 PSParallelCompact::adjust_klass_closure(), 2462 true); 2463 } 2464 2465 // This should be moved to the shared markSweep code! 2466 class PSAlwaysTrueClosure: public BoolObjectClosure { 2467 public: 2468 bool do_object_b(oop p) { return true; } 2469 }; 2470 static PSAlwaysTrueClosure always_true; 2471 2472 void PSParallelCompact::adjust_roots() { 2473 // Adjust the pointers to reflect the new locations 2474 GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer); 2475 2476 // Need new claim bits when tracing through and adjusting pointers. 2477 ClassLoaderDataGraph::clear_claimed_marks(); 2478 2479 // General strong roots. 2480 Universe::oops_do(adjust_pointer_closure()); 2481 JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles 2482 CLDToOopClosure adjust_from_cld(adjust_pointer_closure()); | 2416 // This is the point where the entire marking should have completed. 2417 assert(cm->marking_stacks_empty(), "Marking should have completed"); 2418 2419 // Follow system dictionary roots and unload classes. 2420 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 2421 2422 // Unload nmethods. 2423 CodeCache::do_unloading(is_alive_closure(), purged_class); 2424 2425 // Prune dead klasses from subklass/sibling/implementor lists. 2426 Klass::clean_weak_klass_links(is_alive_closure()); 2427 2428 // Delete entries for dead interned strings. 2429 StringTable::unlink(is_alive_closure()); 2430 2431 // Clean up unreferenced symbols in symbol table. 2432 SymbolTable::unlink(); 2433 _gc_tracer.report_object_count_after_gc(is_alive_closure()); 2434 } 2435 2436 void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, 2437 ClassLoaderData* cld) { 2438 PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); 2439 PSParallelCompact::FollowKlassClosure follow_klass_closure(&mark_and_push_closure); 2440 2441 cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); 2442 } 2443 2444 // This should be moved to the shared markSweep code! 2445 class PSAlwaysTrueClosure: public BoolObjectClosure { 2446 public: 2447 bool do_object_b(oop p) { return true; } 2448 }; 2449 static PSAlwaysTrueClosure always_true; 2450 2451 void PSParallelCompact::adjust_roots() { 2452 // Adjust the pointers to reflect the new locations 2453 GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer); 2454 2455 // Need new claim bits when tracing through and adjusting pointers. 2456 ClassLoaderDataGraph::clear_claimed_marks(); 2457 2458 // General strong roots. 2459 Universe::oops_do(adjust_pointer_closure()); 2460 JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles 2461 CLDToOopClosure adjust_from_cld(adjust_pointer_closure()); |