8272235: G1: update outdated code root fixup

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Albert Mingkun Yang 2021-08-16 09:40:56 +00:00
parent 5db36cedc9
commit 69cc588fce
4 changed files with 19 additions and 12 deletions

@ -3713,14 +3713,16 @@ void G1CollectedHeap::evacuate_initial_collection_set(G1ParScanThreadStateSet* p
num_workers,
has_optional_evacuation_work);
task_time = run_task_timed(&g1_par_task);
// Closing the inner scope will execute the destructor for the G1RootProcessor object.
// To extract its code root fixup time we measure total time of this scope and
// subtract from the time the WorkGang task took.
// Closing the inner scope will execute the destructor for the
// G1RootProcessor object. By subtracting the WorkGang task from the total
// time of this scope, we get the "NMethod List Cleanup" time. This list is
// constructed during "STW two-phase nmethod root processing", see more in
// nmethod.hpp
}
Tickspan total_processing = Ticks::now() - start_processing;
p->record_initial_evac_time(task_time.seconds() * 1000.0);
p->record_or_add_code_root_fixup_time((total_processing - task_time).seconds() * 1000.0);
p->record_or_add_nmethod_list_cleanup_time((total_processing - task_time).seconds() * 1000.0);
rem_set()->complete_evac_phase(has_optional_evacuation_work);
}
@ -3745,6 +3747,7 @@ public:
};
void G1CollectedHeap::evacuate_next_optional_regions(G1ParScanThreadStateSet* per_thread_states) {
// To access the protected constructor/destructor
class G1MarkScope : public MarkScope { };
Tickspan task_time;
@ -3754,12 +3757,12 @@ void G1CollectedHeap::evacuate_next_optional_regions(G1ParScanThreadStateSet* pe
G1MarkScope code_mark_scope;
G1EvacuateOptionalRegionsTask task(per_thread_states, _task_queues, workers()->active_workers());
task_time = run_task_timed(&task);
// See comment in evacuate_collection_set() for the reason of the scope.
// See comment in evacuate_initial_collection_set() for the reason of the scope.
}
Tickspan total_processing = Ticks::now() - start_processing;
G1GCPhaseTimes* p = phase_times();
p->record_or_add_code_root_fixup_time((total_processing - task_time).seconds() * 1000.0);
p->record_or_add_nmethod_list_cleanup_time((total_processing - task_time).seconds() * 1000.0);
}
void G1CollectedHeap::evacuate_optional_collection_set(G1ParScanThreadStateSet* per_thread_states) {

@ -154,7 +154,7 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) :
void G1GCPhaseTimes::reset() {
_cur_collection_initial_evac_time_ms = 0.0;
_cur_optional_evac_time_ms = 0.0;
_cur_collection_code_root_fixup_time_ms = 0.0;
_cur_collection_nmethod_list_cleanup_time_ms = 0.0;
_cur_merge_heap_roots_time_ms = 0.0;
_cur_optional_merge_heap_roots_time_ms = 0.0;
_cur_prepare_merge_heap_roots_time_ms = 0.0;
@ -448,7 +448,7 @@ double G1GCPhaseTimes::print_evacuate_initial_collection_set() const {
}
double G1GCPhaseTimes::print_post_evacuate_collection_set() const {
const double sum_ms = _cur_collection_code_root_fixup_time_ms +
const double sum_ms = _cur_collection_nmethod_list_cleanup_time_ms +
_recorded_preserve_cm_referents_time_ms +
_cur_ref_proc_time_ms +
(_weak_phase_times.total_time_sec() * MILLIUNITS) +
@ -461,7 +461,7 @@ double G1GCPhaseTimes::print_post_evacuate_collection_set() const {
info_time("Post Evacuate Collection Set", sum_ms);
debug_time("Code Roots Fixup", _cur_collection_code_root_fixup_time_ms);
debug_time("NMethod List Cleanup", _cur_collection_nmethod_list_cleanup_time_ms);
debug_time_for_reference("Reference Processing", _cur_ref_proc_time_ms);
_ref_phase_times.print_all_references(2, false);

@ -154,7 +154,7 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
double _cur_collection_initial_evac_time_ms;
double _cur_optional_evac_time_ms;
double _cur_collection_code_root_fixup_time_ms;
double _cur_collection_nmethod_list_cleanup_time_ms;
double _cur_merge_heap_roots_time_ms;
double _cur_optional_merge_heap_roots_time_ms;
@ -283,8 +283,8 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
_cur_optional_evac_time_ms += ms;
}
void record_or_add_code_root_fixup_time(double ms) {
_cur_collection_code_root_fixup_time_ms += ms;
void record_or_add_nmethod_list_cleanup_time(double ms) {
_cur_collection_nmethod_list_cleanup_time_ms += ms;
}
void record_merge_heap_roots_time(double ms) {

@ -156,6 +156,10 @@ public class TestGCLogMessages {
// TLAB handling
new LogMessageWithLevel("Prepare TLABs", Level.DEBUG),
new LogMessageWithLevel("Resize TLABs", Level.DEBUG),
// NMethod List Cleanup
new LogMessageWithLevel("NMethod List Cleanup", Level.DEBUG),
// Reference Processing
new LogMessageWithLevel("Reference Processing", Level.DEBUG),
// VM internal reference processing