@@ -611,23 +611,24 @@ void G1RemSet::scan_collection_set_code_roots(G1ParScanThreadState* pss,
611611 G1GCPhaseTimes::GCParPhases coderoots_phase,
612612 G1GCPhaseTimes::GCParPhases objcopy_phase) {
613613 EventGCPhaseParallel event;
614-
615614 Tickspan code_root_scan_time;
616615 Tickspan code_root_trim_partially_time;
617- G1EvacPhaseWithTrimTimeTracker timer (pss, code_root_scan_time, code_root_trim_partially_time);
618616
619617 G1GCPhaseTimes* p = _g1h->phase_times ();
618+ {
619+ G1EvacPhaseWithTrimTimeTracker timer (pss, code_root_scan_time, code_root_trim_partially_time);
620620
621- G1ScanCodeRootsClosure cl (_scan_state, pss, worker_id);
622- // Code roots work distribution occurs inside the iteration method. So scan all collection
623- // set regions for all threads.
624- _g1h->collection_set_iterate_increment_from (&cl, worker_id);
621+ G1ScanCodeRootsClosure cl (_scan_state, pss, worker_id);
622+ // Code roots work distribution occurs inside the iteration method. So scan all collection
623+ // set regions for all threads.
624+ _g1h->collection_set_iterate_increment_from (&cl, worker_id);
625+
626+ p->record_or_add_thread_work_item (coderoots_phase, worker_id, cl.code_roots_scanned (), G1GCPhaseTimes::CodeRootsScannedNMethods);
627+ }
625628
626629 p->record_or_add_time_secs (coderoots_phase, worker_id, code_root_scan_time.seconds ());
627630 p->add_time_secs (objcopy_phase, worker_id, code_root_trim_partially_time.seconds ());
628631
629- p->record_or_add_thread_work_item (coderoots_phase, worker_id, cl.code_roots_scanned (), G1GCPhaseTimes::CodeRootsScannedNMethods);
630-
631632 event.commit (GCId::current (), worker_id, G1GCPhaseTimes::phase_name (coderoots_phase));
632633}
633634
0 commit comments