Skip to content

Commit

Permalink
8332401: G1: TestFromCardCacheIndex.java with -XX:GCCardSizeInBytes=1…
Browse files Browse the repository at this point in the history
…28 triggers underflow assertion

Reviewed-by: tschatzl, iwalulya
  • Loading branch information
albertnetymk committed May 21, 2024
1 parent 7ffc999 commit 4e169d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/parallel/objectStartArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 4e169d1

Please sign in to comment.