7194633: G1: Assertion and guarantee failures in block offset table

Add detailed error messages to assertions and guarantees in G1's block offset table.

Reviewed-by: ysr, brutisso
This commit is contained in:
John Cuthbertson 2012-11-27 14:11:37 -08:00
parent 57204d9f34
commit c00c803b89
4 changed files with 76 additions and 30 deletions

View file

@ -790,7 +790,9 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
// Very general, slow implementation.
HeapWord* ContiguousSpace::block_start_const(const void* p) const {
assert(MemRegion(bottom(), end()).contains(p), "p not in space");
assert(MemRegion(bottom(), end()).contains(p),
err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
p, bottom(), end()));
if (p >= top()) {
return top();
} else {
@ -800,19 +802,27 @@ HeapWord* ContiguousSpace::block_start_const(const void* p) const {
last = cur;
cur += oop(cur)->size();
}
assert(oop(last)->is_oop(), "Should be an object start");
assert(oop(last)->is_oop(),
err_msg(PTR_FORMAT " should be an object start", last));
return last;
}
}
size_t ContiguousSpace::block_size(const HeapWord* p) const {
assert(MemRegion(bottom(), end()).contains(p), "p not in space");
assert(MemRegion(bottom(), end()).contains(p),
err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
p, bottom(), end()));
HeapWord* current_top = top();
assert(p <= current_top, "p is not a block start");
assert(p == current_top || oop(p)->is_oop(), "p is not a block start");
if (p < current_top)
assert(p <= current_top,
err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
p, current_top));
assert(p == current_top || oop(p)->is_oop(),
err_msg("p (" PTR_FORMAT ") is not a block start - "
"current_top: " PTR_FORMAT ", is_oop: %s",
p, current_top, BOOL_TO_STR(oop(p)->is_oop())));
if (p < current_top) {
return oop(p)->size();
else {
} else {
assert(p == current_top, "just checking");
return pointer_delta(end(), (HeapWord*) p);
}