Skip to content

Commit c6eea8a

Browse files
author
William Kemper
committed
8370667: GenShen: Only make assertions about region pinning for collected generation
Reviewed-by: xpeng, ysr
1 parent c69e0eb commit c6eea8a

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio
4545

4646

4747
// Check all pinned regions have updated status before choosing the collection set.
48-
heap->assert_pinned_region_status();
48+
heap->assert_pinned_region_status(_generation);
4949

5050
// Step 1. Build up the region candidates we care about, rejecting losers and accepting winners right away.
5151

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,11 +2419,17 @@ void ShenandoahHeap::sync_pinned_region_status() {
24192419
}
24202420

24212421
#ifdef ASSERT
2422-
void ShenandoahHeap::assert_pinned_region_status() {
2422+
void ShenandoahHeap::assert_pinned_region_status() const {
2423+
assert_pinned_region_status(global_generation());
2424+
}
2425+
2426+
void ShenandoahHeap::assert_pinned_region_status(ShenandoahGeneration* generation) const {
24232427
for (size_t i = 0; i < num_regions(); i++) {
24242428
ShenandoahHeapRegion* r = get_region(i);
2425-
assert((r->is_pinned() && r->pin_count() > 0) || (!r->is_pinned() && r->pin_count() == 0),
2426-
"Region %zu pinning status is inconsistent", i);
2429+
if (generation->contains(r)) {
2430+
assert((r->is_pinned() && r->pin_count() > 0) || (!r->is_pinned() && r->pin_count() == 0),
2431+
"Region %zu pinning status is inconsistent", i);
2432+
}
24272433
}
24282434
}
24292435
#endif

src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ class ShenandoahHeap : public CollectedHeap {
669669
void unpin_object(JavaThread* thread, oop obj) override;
670670

671671
void sync_pinned_region_status();
672-
void assert_pinned_region_status() NOT_DEBUG_RETURN;
672+
void assert_pinned_region_status() const NOT_DEBUG_RETURN;
673+
void assert_pinned_region_status(ShenandoahGeneration* generation) const NOT_DEBUG_RETURN;
673674

674675
// ---------- CDS archive support
675676

src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ void ShenandoahOldGeneration::prepare_regions_and_collection_set(bool concurrent
494494
ShenandoahFinalMarkUpdateRegionStateClosure cl(complete_marking_context());
495495

496496
parallel_heap_region_iterate(&cl);
497-
heap->assert_pinned_region_status();
497+
heap->assert_pinned_region_status(this);
498498
}
499499

500500
{

0 commit comments

Comments
 (0)