Skip to content

Commit aa7718d

Browse files
committed
8372110: GenShen: Fix erroneous assert
Reviewed-by: ysr
1 parent b3acc48 commit aa7718d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ HeapWord* ShenandoahCardCluster::first_object_start(const size_t card_index, con
250250

251251
HeapWord* right = MIN2(region->top(), end_range_of_interest);
252252
HeapWord* end_of_search_next = MIN2(right, tams);
253+
// Since end_range_of_interest may not align on a card boundary, last_relevant_card_index is conservative. Not all of the
254+
// memory within the last relevant card's span is < right.
253255
size_t last_relevant_card_index;
254256
if (end_range_of_interest == _end_of_heap) {
255257
last_relevant_card_index = _rs->card_index_for_addr(end_range_of_interest - 1);
@@ -352,9 +354,8 @@ HeapWord* ShenandoahCardCluster::first_object_start(const size_t card_index, con
352354
return nullptr;
353355
}
354356
} while (!starts_object(following_card_index));
355-
assert(_rs->addr_for_card_index(following_card_index) + get_first_start(following_card_index),
356-
"Result must precede right");
357-
return _rs->addr_for_card_index(following_card_index) + get_first_start(following_card_index);
357+
HeapWord* result_candidate = _rs->addr_for_card_index(following_card_index) + get_first_start(following_card_index);
358+
return (result_candidate >= right)? nullptr: result_candidate;
358359
}
359360
}
360361
}

0 commit comments

Comments
 (0)