diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAllocator.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAllocator.cpp index 81abe1dd375..fceb813c07e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAllocator.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAllocator.cpp @@ -86,6 +86,7 @@ public: default: assert(false, "won't happen"); } + _free_set->partitions()->assert_bounds(true); } } }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp index f3cd01a71c7..b5b3dd86b91 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp @@ -1200,6 +1200,8 @@ void ShenandoahConcurrentGC::op_final_update_refs() { heap->verifier()->verify_roots_in_to_space(_generation); } + heap->free_set()->release_alloc_regions_under_lock(); + // If we are running in generational mode and this is an aging cycle, this will also age active // regions that haven't been used for allocation. heap->update_heap_region_states(true /*concurrent*/); @@ -1222,8 +1224,6 @@ void ShenandoahConcurrentGC::op_final_update_refs() { Universe::verify(); } - heap->free_set()->release_alloc_regions_under_lock(); - heap->rebuild_free_set(true /*concurrent*/); { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp index 6d019c646fa..dfd9397016a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp @@ -428,6 +428,8 @@ void ShenandoahDegenGC::op_update_roots() { update_roots(false /*full_gc*/); + heap->free_set()->release_alloc_regions_under_lock(); + heap->update_heap_region_states(false /*concurrent*/); if (ShenandoahVerify) { @@ -438,7 +440,6 @@ void ShenandoahDegenGC::op_update_roots() { Universe::verify(); } - heap->free_set()->release_alloc_regions_under_lock(); heap->rebuild_free_set(false /*concurrent*/); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp index 4d510840aa1..6b1155ae8e5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp @@ -851,7 +851,7 @@ public: return _old_collector_allocator; } - inline void release_alloc_regions() { + void release_alloc_regions() { mutator_allocator()->release_alloc_regions(); collector_allocator()->release_alloc_regions(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp index 987b0ee0fb5..e90a19bc51c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp @@ -1118,7 +1118,6 @@ void ShenandoahFullGC::phase5_epilog() { size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old; ShenandoahFreeSet* free_set = heap->free_set(); { - free_set->collector_allocator()->release_alloc_regions(); free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old); // We also do not expand old generation size following Full GC because we have scrambled age populations and // no longer have objects separated by age into distinct regions. diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp index 41ebacbe0eb..df901dbee20 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp @@ -591,6 +591,7 @@ public: current_atomic_top = prior_atomic_top; } assert(top() == current_atomic_top, "Value of _atomic_top must have synced to _top"); + assert(!is_atomic_alloc_region(), "Must not"); } inline bool is_atomic_alloc_region() const {