516 ClassLoaderDataGraph::always_strong_cld_do(follow_cld_closure()); 517 // Do not treat nmethods as strong roots for mark/sweep, since we can unload them. 518 //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(mark_and_push_closure())); 519 } 520 521 // Flush marking stack. 522 follow_stack(); 523 524 // Process reference objects found during marking 525 { 526 ref_processor()->setup_policy(clear_all_softrefs); 527 const ReferenceProcessorStats& stats = 528 ref_processor()->process_discovered_references( 529 is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer); 530 gc_tracer()->report_gc_reference_stats(stats); 531 } 532 533 // This is the point where the entire marking should have completed. 534 assert(_marking_stack.is_empty(), "Marking should have completed"); 535 536 // Unload classes and purge the SystemDictionary. 537 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 538 539 // Unload nmethods. 540 CodeCache::do_unloading(is_alive_closure(), purged_class); 541 542 // Prune dead klasses from subklass/sibling/implementor lists. 543 Klass::clean_weak_klass_links(is_alive_closure()); 544 545 // Delete entries for dead interned strings. 546 StringTable::unlink(is_alive_closure()); 547 548 // Clean up unreferenced symbols in symbol table. 549 SymbolTable::unlink(); 550 _gc_tracer->report_object_count_after_gc(is_alive_closure()); 551 } 552 553 554 void PSMarkSweep::mark_sweep_phase2() { 555 GCTraceTime(Trace, gc) tm("Phase 2: Compute new object addresses", _gc_timer); 556 557 // Now all live objects are marked, compute the new object addresses. 558 559 // It is not required that we traverse spaces in the same order in 560 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops 561 // tracking expects us to do so. See comment under phase4. 562 563 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 564 PSOldGen* old_gen = heap->old_gen(); 565 566 // Begin compacting into the old gen 567 PSMarkSweepDecorator::set_destination_decorator_tenured(); 568 569 // This will also compact the young gen spaces. | 516 ClassLoaderDataGraph::always_strong_cld_do(follow_cld_closure()); 517 // Do not treat nmethods as strong roots for mark/sweep, since we can unload them. 518 //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(mark_and_push_closure())); 519 } 520 521 // Flush marking stack. 522 follow_stack(); 523 524 // Process reference objects found during marking 525 { 526 ref_processor()->setup_policy(clear_all_softrefs); 527 const ReferenceProcessorStats& stats = 528 ref_processor()->process_discovered_references( 529 is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer); 530 gc_tracer()->report_gc_reference_stats(stats); 531 } 532 533 // This is the point where the entire marking should have completed. 534 assert(_marking_stack.is_empty(), "Marking should have completed"); 535 536 { 537 GCTraceTime(Debug, gc) t("Class Unloading", _gc_timer); 538 539 // Unload classes and purge the SystemDictionary. 540 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 541 542 // Unload nmethods. 543 CodeCache::do_unloading(is_alive_closure(), purged_class); 544 545 // Prune dead klasses from subklass/sibling/implementor lists. 546 Klass::clean_weak_klass_links(is_alive_closure()); 547 } 548 549 { 550 GCTraceTime(Debug, gc) t("Scrub String Table", _gc_timer); 551 // Delete entries for dead interned strings. 552 StringTable::unlink(is_alive_closure()); 553 } 554 555 { 556 GCTraceTime(Debug, gc) t("Scrub Symbol Table", _gc_timer); 557 // Clean up unreferenced symbols in symbol table. 558 SymbolTable::unlink(); 559 } 560 561 _gc_tracer->report_object_count_after_gc(is_alive_closure()); 562 } 563 564 565 void PSMarkSweep::mark_sweep_phase2() { 566 GCTraceTime(Trace, gc) tm("Phase 2: Compute new object addresses", _gc_timer); 567 568 // Now all live objects are marked, compute the new object addresses. 569 570 // It is not required that we traverse spaces in the same order in 571 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops 572 // tracking expects us to do so. See comment under phase4. 573 574 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 575 PSOldGen* old_gen = heap->old_gen(); 576 577 // Begin compacting into the old gen 578 PSMarkSweepDecorator::set_destination_decorator_tenured(); 579 580 // This will also compact the young gen spaces. |