496 GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", _gc_timer); 497 498 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 499 500 // Need to clear claim bits before the tracing starts. 501 ClassLoaderDataGraph::clear_claimed_marks(); 502 503 // General strong roots. 504 { 505 ParallelScavengeHeap::ParStrongRootsScope psrs; 506 Universe::oops_do(mark_and_push_closure()); 507 JNIHandles::oops_do(mark_and_push_closure()); // Global (strong) JNI handles 508 MarkingCodeBlobClosure each_active_code_blob(mark_and_push_closure(), !CodeBlobToOopClosure::FixRelocations); 509 Threads::oops_do(mark_and_push_closure(), &each_active_code_blob); 510 ObjectSynchronizer::oops_do(mark_and_push_closure()); 511 FlatProfiler::oops_do(mark_and_push_closure()); 512 Management::oops_do(mark_and_push_closure()); 513 JvmtiExport::oops_do(mark_and_push_closure()); 514 SystemDictionary::always_strong_oops_do(mark_and_push_closure()); 515 ClassLoaderDataGraph::always_strong_cld_do(follow_cld_closure()); 516 // Do not treat nmethods as strong roots for mark/sweep, since we can unload them. 517 //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(mark_and_push_closure())); 518 } 519 520 // Flush marking stack. 521 follow_stack(); 522 523 // Process reference objects found during marking 524 { 525 GCTraceTime(Debug, gc, phases) t("Reference Processing", _gc_timer); 526 527 ref_processor()->setup_policy(clear_all_softrefs); 528 const ReferenceProcessorStats& stats = 529 ref_processor()->process_discovered_references( 530 is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer); 531 gc_tracer()->report_gc_reference_stats(stats); 532 } 533 534 // This is the point where the entire marking should have completed. 535 assert(_marking_stack.is_empty(), "Marking should have completed"); 536 537 { 538 GCTraceTime(Debug, gc, phases) t("Class Unloading", _gc_timer); 539 540 // Unload classes and purge the SystemDictionary. 541 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 542 543 // Unload nmethods. 544 CodeCache::do_unloading(is_alive_closure(), purged_class); 545 546 // Prune dead klasses from subklass/sibling/implementor lists. 547 Klass::clean_weak_klass_links(is_alive_closure()); 548 } 549 550 { 551 GCTraceTime(Debug, gc, phases) t("Scrub String Table", _gc_timer); 552 // Delete entries for dead interned strings. 553 StringTable::unlink(is_alive_closure()); 554 } 555 556 { 557 GCTraceTime(Debug, gc, phases) t("Scrub Symbol Table", _gc_timer); | 496 GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", _gc_timer); 497 498 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 499 500 // Need to clear claim bits before the tracing starts. 501 ClassLoaderDataGraph::clear_claimed_marks(); 502 503 // General strong roots. 504 { 505 ParallelScavengeHeap::ParStrongRootsScope psrs; 506 Universe::oops_do(mark_and_push_closure()); 507 JNIHandles::oops_do(mark_and_push_closure()); // Global (strong) JNI handles 508 MarkingCodeBlobClosure each_active_code_blob(mark_and_push_closure(), !CodeBlobToOopClosure::FixRelocations); 509 Threads::oops_do(mark_and_push_closure(), &each_active_code_blob); 510 ObjectSynchronizer::oops_do(mark_and_push_closure()); 511 FlatProfiler::oops_do(mark_and_push_closure()); 512 Management::oops_do(mark_and_push_closure()); 513 JvmtiExport::oops_do(mark_and_push_closure()); 514 SystemDictionary::always_strong_oops_do(mark_and_push_closure()); 515 ClassLoaderDataGraph::always_strong_cld_do(follow_cld_closure()); 516 // Treat nmethods as strong roots for mark/sweep if we don't intend to unload them. 517 if (!ClassUnloading) { 518 CodeBlobToOopClosure cl(mark_and_push_closure(), false); 519 CodeCache::scavenge_root_nmethods_do(&cl); 520 } 521 } 522 523 // Flush marking stack. 524 follow_stack(); 525 526 // Process reference objects found during marking 527 { 528 GCTraceTime(Debug, gc, phases) t("Reference Processing", _gc_timer); 529 530 ref_processor()->setup_policy(clear_all_softrefs); 531 const ReferenceProcessorStats& stats = 532 ref_processor()->process_discovered_references( 533 is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer); 534 gc_tracer()->report_gc_reference_stats(stats); 535 } 536 537 // This is the point where the entire marking should have completed. 538 assert(_marking_stack.is_empty(), "Marking should have completed"); 539 540 if (ClassUnloading) { 541 GCTraceTime(Debug, gc, phases) t("Class Unloading", _gc_timer); 542 543 // Unload classes and purge the SystemDictionary. 544 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 545 546 // Unload nmethods. 547 CodeCache::do_unloading(is_alive_closure(), purged_class); 548 549 // Prune dead klasses from subklass/sibling/implementor lists. 550 Klass::clean_weak_klass_links(is_alive_closure()); 551 } 552 553 { 554 GCTraceTime(Debug, gc, phases) t("Scrub String Table", _gc_timer); 555 // Delete entries for dead interned strings. 556 StringTable::unlink(is_alive_closure()); 557 } 558 559 { 560 GCTraceTime(Debug, gc, phases) t("Scrub Symbol Table", _gc_timer); |