# HG changeset patch # User Tom Rodriguez # Date 1429849107 25200 # Node ID 2daf39328194ecf2921494b029da68cb9ef706b1 # Parent 0cf5897db25a2d85d8c1db457c4f2fe35e4f92b2 Better error reporting for missing card marks diff -r 0cf5897db25a -r 2daf39328194 src/share/vm/memory/cardTableRS.cpp --- a/src/share/vm/memory/cardTableRS.cpp Wed Apr 22 16:42:05 2015 -0700 +++ b/src/share/vm/memory/cardTableRS.cpp Thu Apr 23 21:18:27 2015 -0700 @@ -352,15 +352,22 @@ "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", p2i(jp), p2i(_begin), p2i(_end))); oop obj = oopDesc::load_decode_heap_oop(p); - guarantee(obj == NULL || (HeapWord*)obj >= _boundary, - err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on " - "clean card crosses boundary" PTR_FORMAT, - p2i((HeapWord*)obj), p2i(jp), p2i(_boundary))); + if (!(obj == NULL || (HeapWord*)obj >= _boundary)) { + tty->print_cr("pointer " PTR_FORMAT " at " PTR_FORMAT " on " + "clean card crosses boundary" PTR_FORMAT, + p2i((HeapWord*)obj), p2i(jp), p2i(_boundary)); +#ifndef PRODUCT + obj->print(); +#endif + had_error = true; + } } public: + bool had_error; + VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) : - _boundary(b), _begin(begin), _end(end) { + _boundary(b), _begin(begin), _end(end), had_error(false) { assert(b <= begin, err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT, p2i(b), p2i(begin))); @@ -400,6 +407,7 @@ // We don't need to do young-gen spaces. if (s->end() <= gen_boundary) return; MemRegion used = s->used_region(); + bool had_error = false; jbyte* cur_entry = byte_for(used.start()); jbyte* limit = byte_after(used.last()); @@ -438,6 +446,13 @@ for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) { if (s->block_is_obj(cur) && s->obj_is_alive(cur)) { oop(cur)->oop_iterate_no_header(&verify_blk, mr); + had_error |= verify_blk.had_error; + if (verify_blk.had_error) { + verify_blk.had_error = false; +#ifndef PRODUCT + oop(cur)->print(); +#endif + } } } } @@ -598,6 +613,7 @@ cur_entry++; } } + guarantee(!had_error, "Card table errors found"); } void CardTableRS::verify() {