8073115: assert(_covered_region.contains(p)) needs better error messages

Changed to print out related values

Reviewed-by: jwilhelm, brutisso, stefank
This commit is contained in:
Sangheon Kim 2015-02-16 08:38:23 -08:00
parent 4913ad5d7d
commit 14916eab46
2 changed files with 12 additions and 4 deletions

View File

@ -126,7 +126,9 @@ void ObjectStartArray::reset() {
bool ObjectStartArray::object_starts_in_range(HeapWord* start_addr,
HeapWord* end_addr) const {
assert(start_addr <= end_addr, "range is wrong");
assert(start_addr <= end_addr,
err_msg("Range is wrong. start_addr (" PTR_FORMAT ") is after end_addr (" PTR_FORMAT ")",
p2i(start_addr), p2i(end_addr)));
if (start_addr > end_addr) {
return false;
}

View File

@ -119,8 +119,13 @@ class ObjectStartArray : public CHeapObj<mtGC> {
MemRegion covered_region() { return _covered_region; }
#define assert_covered_region_contains(addr) \
assert(_covered_region.contains(addr), \
err_msg(#addr " (" PTR_FORMAT ") is not in covered region [" PTR_FORMAT ", " PTR_FORMAT "]", \
p2i(addr), p2i(_covered_region.start()), p2i(_covered_region.end())))
void allocate_block(HeapWord* p) {
assert(_covered_region.contains(p), "Must be in covered region");
assert_covered_region_contains(p);
jbyte* block = block_for_addr(p);
HeapWord* block_base = addr_for_block(block);
size_t offset = pointer_delta(p, block_base, sizeof(HeapWord*));
@ -135,7 +140,7 @@ class ObjectStartArray : public CHeapObj<mtGC> {
// object in that block. Scroll backwards by one, and the first
// object hit should be at the beginning of the block
HeapWord* object_start(HeapWord* addr) const {
assert(_covered_region.contains(addr), "Must be in covered region");
assert_covered_region_contains(addr);
jbyte* block = block_for_addr(addr);
HeapWord* scroll_forward = offset_addr_for_block(block--);
while (scroll_forward > addr) {
@ -153,13 +158,14 @@ class ObjectStartArray : public CHeapObj<mtGC> {
}
bool is_block_allocated(HeapWord* addr) {
assert(_covered_region.contains(addr), "Must be in covered region");
assert_covered_region_contains(addr);
jbyte* block = block_for_addr(addr);
if (*block == clean_block)
return false;
return true;
}
#undef assert_covered_region_contains
// Return true if an object starts in the range of heap addresses.
// If an object starts at an address corresponding to