8332401: G1: TestFromCardCacheIndex.java with -XX:GCCardSizeInBytes=128 triggers underflow assertion

Reviewed-by: tschatzl, iwalulya
This commit is contained in:
Albert Mingkun Yang 2024-05-21 08:34:00 +00:00
parent 7ffc9997bd
commit 4e169d1ed7
3 changed files with 6 additions and 3 deletions

View File

@ -62,7 +62,8 @@ inline uint8_t* G1BlockOffsetTable::entry_for_addr(const void* const p) const {
}
inline HeapWord* G1BlockOffsetTable::addr_for_entry(const uint8_t* const p) const {
size_t delta = pointer_delta(p, _offset_base, sizeof(uint8_t));
// _offset_base can be "negative", so can't use pointer_delta().
size_t delta = p - _offset_base;
HeapWord* result = (HeapWord*) (delta << CardTable::card_shift());
assert(_reserved.contains(result),
"out of bounds accessor from block offset table");

View File

@ -57,7 +57,8 @@ class ObjectStartArray : public CHeapObj<mtGC> {
// Mapping from object start array entry to address of first word
HeapWord* addr_for_entry(const uint8_t* const p) const {
size_t delta = pointer_delta(p, _offset_base, sizeof(uint8_t));
// _offset_base can be "negative", so can't use pointer_delta().
size_t delta = p - _offset_base;
HeapWord* result = (HeapWord*) (delta << CardTable::card_shift());
assert(_covered_region.contains(result),
"out of bounds accessor from card marking array");

View File

@ -35,7 +35,8 @@ inline uint8_t* SerialBlockOffsetTable::entry_for_addr(const void* const p) cons
}
inline HeapWord* SerialBlockOffsetTable::addr_for_entry(const uint8_t* const p) const {
size_t delta = pointer_delta(p, _offset_base, sizeof(uint8_t));
// _offset_base can be "negative", so can't use pointer_delta().
size_t delta = p - _offset_base;
HeapWord* result = (HeapWord*) (delta << CardTable::card_shift());
assert(_reserved.contains(result),
"out of bounds accessor from block offset array");