747
748 if (ShenandoahVerify) {
749 heap->verifier()->verify_roots_no_forwarded(_generation);
750 }
751
752 if (!heap->cancelled_gc()) {
753 _mark.finish_mark();
754 assert(!heap->cancelled_gc(), "STW mark cannot OOM");
755
756 // Notify JVMTI that the tagmap table will need cleaning.
757 JvmtiTagMap::set_needs_cleaning();
758
759 // The collection set is chosen by prepare_regions_and_collection_set(). Additionally, certain parameters have been
760 // established to govern the evacuation efforts that are about to begin. Refer to comments on reserve members in
761 // ShenandoahGeneration and ShenandoahOldGeneration for more detail.
762 _generation->prepare_regions_and_collection_set(true /*concurrent*/);
763
764 // Has to be done after cset selection
765 heap->prepare_concurrent_roots();
766
767 if (!heap->collection_set()->is_empty()) {
768 LogTarget(Debug, gc, cset) lt;
769 if (lt.is_enabled()) {
770 ResourceMark rm;
771 LogStream ls(lt);
772 heap->collection_set()->print_on(&ls);
773 }
774
775 if (ShenandoahVerify) {
776 ShenandoahTimingsTracker v(ShenandoahPhaseTimings::final_mark_verify);
777 heap->verifier()->verify_before_evacuation(_generation);
778 }
779
780 heap->set_evacuation_in_progress(true);
781 // From here on, we need to update references.
782 heap->set_has_forwarded_objects(true);
783
784 // Arm nmethods/stack for concurrent processing
785 ShenandoahCodeRoots::arm_nmethods_for_evac();
786 ShenandoahStackWatermark::change_epoch_id();
787
1200 heap->set_has_forwarded_objects(false);
1201
1202 if (heap->mode()->is_generational() && heap->is_concurrent_old_mark_in_progress()) {
1203 // Aging_cycle is only relevant during evacuation cycle for individual objects and during final mark for
1204 // entire regions. Both of these relevant operations occur before final update refs.
1205 ShenandoahGenerationalHeap::heap()->set_aging_cycle(false);
1206 }
1207
1208 if (ShenandoahVerify) {
1209 ShenandoahTimingsTracker v(ShenandoahPhaseTimings::final_update_refs_verify);
1210 heap->verifier()->verify_after_update_refs(_generation);
1211 }
1212
1213 if (VerifyAfterGC) {
1214 Universe::verify();
1215 }
1216
1217 heap->rebuild_free_set(true /*concurrent*/);
1218 _generation->heuristics()->start_idle_span();
1219
1220 {
1221 ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::final_update_refs_propagate_gc_state);
1222 heap->propagate_gc_state_to_all_threads();
1223 }
1224 }
1225
1226 bool ShenandoahConcurrentGC::entry_final_roots() {
1227 ShenandoahHeap* const heap = ShenandoahHeap::heap();
1228 TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
1229
1230
1231 const char* msg = conc_final_roots_event_message();
1232 ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_final_roots);
1233 EventMark em("%s", msg);
1234 ShenandoahWorkerScope scope(heap->workers(),
1235 ShenandoahWorkerPolicy::calc_workers_for_conc_evac(),
1236 msg);
1237
1238 if (heap->mode()->is_generational()) {
1239 if (!complete_abbreviated_cycle()) {
|
747
748 if (ShenandoahVerify) {
749 heap->verifier()->verify_roots_no_forwarded(_generation);
750 }
751
752 if (!heap->cancelled_gc()) {
753 _mark.finish_mark();
754 assert(!heap->cancelled_gc(), "STW mark cannot OOM");
755
756 // Notify JVMTI that the tagmap table will need cleaning.
757 JvmtiTagMap::set_needs_cleaning();
758
759 // The collection set is chosen by prepare_regions_and_collection_set(). Additionally, certain parameters have been
760 // established to govern the evacuation efforts that are about to begin. Refer to comments on reserve members in
761 // ShenandoahGeneration and ShenandoahOldGeneration for more detail.
762 _generation->prepare_regions_and_collection_set(true /*concurrent*/);
763
764 // Has to be done after cset selection
765 heap->prepare_concurrent_roots();
766
767 // ShenandoahGCStateCheckHotpatch: we need full cycle to patch barriers back to idle.
768 // final-roots is pauseless, so there is no way to arm barriers.
769 if (ShenandoahGCStateCheckHotpatch || !heap->collection_set()->is_empty()) {
770 LogTarget(Debug, gc, cset) lt;
771 if (lt.is_enabled()) {
772 ResourceMark rm;
773 LogStream ls(lt);
774 heap->collection_set()->print_on(&ls);
775 }
776
777 if (ShenandoahVerify) {
778 ShenandoahTimingsTracker v(ShenandoahPhaseTimings::final_mark_verify);
779 heap->verifier()->verify_before_evacuation(_generation);
780 }
781
782 heap->set_evacuation_in_progress(true);
783 // From here on, we need to update references.
784 heap->set_has_forwarded_objects(true);
785
786 // Arm nmethods/stack for concurrent processing
787 ShenandoahCodeRoots::arm_nmethods_for_evac();
788 ShenandoahStackWatermark::change_epoch_id();
789
1202 heap->set_has_forwarded_objects(false);
1203
1204 if (heap->mode()->is_generational() && heap->is_concurrent_old_mark_in_progress()) {
1205 // Aging_cycle is only relevant during evacuation cycle for individual objects and during final mark for
1206 // entire regions. Both of these relevant operations occur before final update refs.
1207 ShenandoahGenerationalHeap::heap()->set_aging_cycle(false);
1208 }
1209
1210 if (ShenandoahVerify) {
1211 ShenandoahTimingsTracker v(ShenandoahPhaseTimings::final_update_refs_verify);
1212 heap->verifier()->verify_after_update_refs(_generation);
1213 }
1214
1215 if (VerifyAfterGC) {
1216 Universe::verify();
1217 }
1218
1219 heap->rebuild_free_set(true /*concurrent*/);
1220 _generation->heuristics()->start_idle_span();
1221
1222 if (ShenandoahGCStateCheckHotpatch) {
1223 // Final pause: update GC barriers to idle state.
1224 ShenandoahCodeRoots::arm_nmethods();
1225 }
1226
1227 {
1228 ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::final_update_refs_propagate_gc_state);
1229 heap->propagate_gc_state_to_all_threads();
1230 }
1231 }
1232
1233 bool ShenandoahConcurrentGC::entry_final_roots() {
1234 ShenandoahHeap* const heap = ShenandoahHeap::heap();
1235 TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
1236
1237
1238 const char* msg = conc_final_roots_event_message();
1239 ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_final_roots);
1240 EventMark em("%s", msg);
1241 ShenandoahWorkerScope scope(heap->workers(),
1242 ShenandoahWorkerPolicy::calc_workers_for_conc_evac(),
1243 msg);
1244
1245 if (heap->mode()->is_generational()) {
1246 if (!complete_abbreviated_cycle()) {
|