8370667: GenShen: Only make assertions about region pinning for collected generation

Reviewed-by: xpeng, ysr
This commit is contained in:
William Kemper 2025-10-30 21:10:01 +00:00
parent c69e0eb2f9
commit c6eea8acf6
4 changed files with 13 additions and 6 deletions

View File

@ -45,7 +45,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio
// Check all pinned regions have updated status before choosing the collection set.
heap->assert_pinned_region_status();
heap->assert_pinned_region_status(_generation);
// Step 1. Build up the region candidates we care about, rejecting losers and accepting winners right away.

View File

@ -2419,11 +2419,17 @@ void ShenandoahHeap::sync_pinned_region_status() {
}
#ifdef ASSERT
void ShenandoahHeap::assert_pinned_region_status() {
void ShenandoahHeap::assert_pinned_region_status() const {
assert_pinned_region_status(global_generation());
}
void ShenandoahHeap::assert_pinned_region_status(ShenandoahGeneration* generation) const {
for (size_t i = 0; i < num_regions(); i++) {
ShenandoahHeapRegion* r = get_region(i);
assert((r->is_pinned() && r->pin_count() > 0) || (!r->is_pinned() && r->pin_count() == 0),
"Region %zu pinning status is inconsistent", i);
if (generation->contains(r)) {
assert((r->is_pinned() && r->pin_count() > 0) || (!r->is_pinned() && r->pin_count() == 0),
"Region %zu pinning status is inconsistent", i);
}
}
}
#endif

View File

@ -669,7 +669,8 @@ public:
void unpin_object(JavaThread* thread, oop obj) override;
void sync_pinned_region_status();
void assert_pinned_region_status() NOT_DEBUG_RETURN;
void assert_pinned_region_status() const NOT_DEBUG_RETURN;
void assert_pinned_region_status(ShenandoahGeneration* generation) const NOT_DEBUG_RETURN;
// ---------- CDS archive support

View File

@ -494,7 +494,7 @@ void ShenandoahOldGeneration::prepare_regions_and_collection_set(bool concurrent
ShenandoahFinalMarkUpdateRegionStateClosure cl(complete_marking_context());
parallel_heap_region_iterate(&cl);
heap->assert_pinned_region_status();
heap->assert_pinned_region_status(this);
}
{