5631 if (g1_policy()->during_initial_mark_pause()) { 5632 ClassLoaderDataGraph::clear_claimed_marks(); 5633 } 5634 5635 // The individual threads will set their evac-failure closures. 5636 if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr(); 5637 // These tasks use ShareHeap::_process_strong_tasks 5638 assert(UseDynamicNumberOfGCThreads || 5639 workers()->active_workers() == workers()->total_workers(), 5640 "If not dynamic should be using all the workers"); 5641 workers()->run_task(&g1_par_task); 5642 end_par_time_sec = os::elapsedTime(); 5643 5644 // Closing the inner scope will execute the destructor 5645 // for the StrongRootsScope object. We record the current 5646 // elapsed time before closing the scope so that time 5647 // taken for the SRS destructor is NOT included in the 5648 // reported parallel time. 5649 } 5650 5651 double par_time_ms = (end_par_time_sec - start_par_time_sec) * 1000.0; 5652 g1_policy()->phase_times()->record_par_time(par_time_ms); 5653 5654 double code_root_fixup_time_ms = 5655 (os::elapsedTime() - end_par_time_sec) * 1000.0; 5656 g1_policy()->phase_times()->record_code_root_fixup_time(code_root_fixup_time_ms); 5657 5658 set_par_threads(0); 5659 5660 // Process any discovered reference objects - we have 5661 // to do this _before_ we retire the GC alloc regions 5662 // as we may have to copy some 'reachable' referent 5663 // objects (and their reachable sub-graphs) that were 5664 // not copied during the pause. 5665 process_discovered_references(n_workers); 5666 5667 if (G1StringDedup::is_enabled()) { 5668 G1STWIsAliveClosure is_alive(this); 5669 G1KeepAliveClosure keep_alive(this); 5670 G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive); 5671 } 5672 5673 _allocator->release_gc_alloc_regions(n_workers, evacuation_info); 5674 g1_rem_set()->cleanup_after_oops_into_collection_set_do(); 5675 5676 // Reset and re-enable the hot card cache. 5677 // Note the counts for the cards in the regions in the 5678 // collection set are reset when the collection set is freed. 5679 hot_card_cache->reset_hot_cache(); 5680 hot_card_cache->set_use_cache(true); 5681 5682 purge_code_root_memory(); 5683 5684 finalize_for_evac_failure(); 5685 5686 if (evacuation_failed()) { 5687 remove_self_forwarding_pointers(); 5688 5689 // Reset the G1EvacuationFailureALot counters and flags 5690 // Note: the values are reset only when an actual | 5631 if (g1_policy()->during_initial_mark_pause()) { 5632 ClassLoaderDataGraph::clear_claimed_marks(); 5633 } 5634 5635 // The individual threads will set their evac-failure closures. 5636 if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr(); 5637 // These tasks use ShareHeap::_process_strong_tasks 5638 assert(UseDynamicNumberOfGCThreads || 5639 workers()->active_workers() == workers()->total_workers(), 5640 "If not dynamic should be using all the workers"); 5641 workers()->run_task(&g1_par_task); 5642 end_par_time_sec = os::elapsedTime(); 5643 5644 // Closing the inner scope will execute the destructor 5645 // for the StrongRootsScope object. We record the current 5646 // elapsed time before closing the scope so that time 5647 // taken for the SRS destructor is NOT included in the 5648 // reported parallel time. 5649 } 5650 5651 G1GCPhaseTimes* phase_times = g1_policy()->phase_times(); 5652 5653 double par_time_ms = (end_par_time_sec - start_par_time_sec) * 1000.0; 5654 phase_times->record_par_time(par_time_ms); 5655 5656 double code_root_fixup_time_ms = 5657 (os::elapsedTime() - end_par_time_sec) * 1000.0; 5658 phase_times->record_code_root_fixup_time(code_root_fixup_time_ms); 5659 5660 set_par_threads(0); 5661 5662 // Process any discovered reference objects - we have 5663 // to do this _before_ we retire the GC alloc regions 5664 // as we may have to copy some 'reachable' referent 5665 // objects (and their reachable sub-graphs) that were 5666 // not copied during the pause. 5667 process_discovered_references(n_workers); 5668 5669 if (G1StringDedup::is_enabled()) { 5670 double fixup_start = os::elapsedTime(); 5671 5672 G1STWIsAliveClosure is_alive(this); 5673 G1KeepAliveClosure keep_alive(this); 5674 G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive, true, phase_times); 5675 5676 double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; 5677 phase_times->record_string_dedup_fixup_time(fixup_time_ms); 5678 } 5679 5680 _allocator->release_gc_alloc_regions(n_workers, evacuation_info); 5681 g1_rem_set()->cleanup_after_oops_into_collection_set_do(); 5682 5683 // Reset and re-enable the hot card cache. 5684 // Note the counts for the cards in the regions in the 5685 // collection set are reset when the collection set is freed. 5686 hot_card_cache->reset_hot_cache(); 5687 hot_card_cache->set_use_cache(true); 5688 5689 purge_code_root_memory(); 5690 5691 finalize_for_evac_failure(); 5692 5693 if (evacuation_failed()) { 5694 remove_self_forwarding_pointers(); 5695 5696 // Reset the G1EvacuationFailureALot counters and flags 5697 // Note: the values are reset only when an actual |