# HG changeset patch # User shade # Date 1571338571 -7200 # Node ID 92e7d617897ebd495aa0bf02755508e4d05a67d6 # Parent 0cc52a55fce4ff0fd5a37a958b63b1714f2f64f4 8232573: Shenandoah: cleanup and add more logging for in-pause phases Reviewed-by: rkennke diff -r 0cc52a55fce4 -r 92e7d617897e src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Thu Oct 17 20:56:04 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Thu Oct 17 20:56:11 2019 +0200 @@ -1493,31 +1493,36 @@ stop_concurrent_marking(); + // All allocations past TAMS are implicitly live, adjust the region data. + // Bitmaps/TAMS are swapped at this point, so we need to poll complete bitmap. { ShenandoahGCPhase phase(ShenandoahPhaseTimings::complete_liveness); - - // All allocations past TAMS are implicitly live, adjust the region data. - // Bitmaps/TAMS are swapped at this point, so we need to poll complete bitmap. ShenandoahCompleteLivenessClosure cl; parallel_heap_region_iterate(&cl); } + // Force the threads to reacquire their TLABs outside the collection set. + { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::retire_tlabs); + make_parsable(true); + } + + // Trash the collection set left over from previous cycle, if any. + { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::trash_cset); + trash_cset_regions(); + } + { - ShenandoahGCPhase prepare_evac(ShenandoahPhaseTimings::prepare_evac); - - make_parsable(true); - - trash_cset_regions(); - - { - ShenandoahHeapLocker locker(lock()); - _collection_set->clear(); - _free_set->clear(); - - heuristics()->choose_collection_set(_collection_set); - - _free_set->rebuild(); - } + ShenandoahGCPhase phase(ShenandoahPhaseTimings::prepare_evac); + + ShenandoahHeapLocker locker(lock()); + _collection_set->clear(); + _free_set->clear(); + + heuristics()->choose_collection_set(_collection_set); + + _free_set->rebuild(); } // If collection set has candidates, start evacuation. @@ -1580,7 +1585,10 @@ set_evacuation_in_progress(false); - retire_and_reset_gclabs(); + { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_evac_retire_gclabs); + retire_and_reset_gclabs(); + } if (ShenandoahVerify) { verifier()->verify_after_evacuation(); @@ -2234,7 +2242,10 @@ set_evacuation_in_progress(false); - retire_and_reset_gclabs(); + { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_update_refs_retire_gclabs); + retire_and_reset_gclabs(); + } if (ShenandoahVerify) { if (!is_degenerated_gc_in_progress()) { @@ -2244,15 +2255,20 @@ } set_update_refs_in_progress(true); - make_parsable(true); - for (uint i = 0; i < num_regions(); i++) { - ShenandoahHeapRegion* r = get_region(i); - r->set_concurrent_iteration_safe_limit(r->top()); + + { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_update_refs_prepare); + + make_parsable(true); + for (uint i = 0; i < num_regions(); i++) { + ShenandoahHeapRegion* r = get_region(i); + r->set_concurrent_iteration_safe_limit(r->top()); + } + + // Reset iterator. + _update_refs_iterator.reset(); } - // Reset iterator. - _update_refs_iterator.reset(); - if (ShenandoahPacing) { pacer()->setup_for_updaterefs(); } @@ -2263,7 +2279,7 @@ // Check if there is left-over work, and finish it if (_update_refs_iterator.has_next()) { - ShenandoahGCPhase final_work(ShenandoahPhaseTimings::final_update_refs_finish_work); + ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_update_refs_finish_work); // Finish updating references where we left off. clear_cancelled_gc(); @@ -2292,9 +2308,11 @@ verifier()->verify_roots_in_to_space(); } - ShenandoahGCPhase final_update_refs(ShenandoahPhaseTimings::final_update_refs_recycle); - - trash_cset_regions(); + { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_update_refs_trash_cset); + trash_cset_regions(); + } + set_has_forwarded_objects(false); set_update_refs_in_progress(false); diff -r 0cc52a55fce4 -r 92e7d617897e src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Thu Oct 17 20:56:04 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Thu Oct 17 20:56:11 2019 +0200 @@ -100,8 +100,9 @@ f(purge_par, " Parallel Cleanup") \ f(purge_cldg, " CLDG") \ f(complete_liveness, " Complete Liveness") \ + f(retire_tlabs, " Retire TLABs") \ + f(trash_cset, " Trash CSet") \ f(prepare_evac, " Prepare Evacuation") \ - f(recycle_regions, " Recycle regions") \ \ /* Per-thread timer block, should have "roots" counters in consistent order */ \ f(init_evac, " Initial Evacuation") \ @@ -127,9 +128,12 @@ \ f(final_evac_gross, "Pause Final Evac (G)") \ f(final_evac, "Pause Final Evac (N)") \ + f(final_evac_retire_gclabs, " Retire GCLABs") \ \ f(init_update_refs_gross, "Pause Init Update Refs (G)") \ f(init_update_refs, "Pause Init Update Refs (N)") \ + f(init_update_refs_retire_gclabs, " Retire GCLABs") \ + f(init_update_refs_prepare, " Prepare") \ \ f(final_update_refs_gross, "Pause Final Update Refs (G)") \ f(final_update_refs, "Pause Final Update Refs (N)") \ @@ -157,7 +161,7 @@ f(final_update_refs_string_dedup_queue_roots, " UR: Dedup Queue Roots") \ f(final_update_refs_finish_queues, " UR: Finish Queues") \ \ - f(final_update_refs_recycle, " Recycle") \ + f(final_update_refs_trash_cset, " Trash CSet") \ \ f(degen_gc_gross, "Pause Degenerated GC (G)") \ f(degen_gc, "Pause Degenerated GC (N)") \