Mercurial > hg > truffle
comparison src/share/vm/memory/space.cpp @ 7181:2fc0334f613a
7194633: G1: Assertion and guarantee failures in block offset table
Summary: Add detailed error messages to assertions and guarantees in G1's block offset table.
Reviewed-by: ysr, brutisso
author | johnc |
---|---|
date | Tue, 27 Nov 2012 14:11:37 -0800 |
parents | da91efe96a93 |
children | b735136e0d82 |
comparison
equal
deleted
inserted
replaced
7180:f34d701e952e | 7181:2fc0334f613a |
---|---|
788 | 788 |
789 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN | 789 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN |
790 | 790 |
791 // Very general, slow implementation. | 791 // Very general, slow implementation. |
792 HeapWord* ContiguousSpace::block_start_const(const void* p) const { | 792 HeapWord* ContiguousSpace::block_start_const(const void* p) const { |
793 assert(MemRegion(bottom(), end()).contains(p), "p not in space"); | 793 assert(MemRegion(bottom(), end()).contains(p), |
794 err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", | |
795 p, bottom(), end())); | |
794 if (p >= top()) { | 796 if (p >= top()) { |
795 return top(); | 797 return top(); |
796 } else { | 798 } else { |
797 HeapWord* last = bottom(); | 799 HeapWord* last = bottom(); |
798 HeapWord* cur = last; | 800 HeapWord* cur = last; |
799 while (cur <= p) { | 801 while (cur <= p) { |
800 last = cur; | 802 last = cur; |
801 cur += oop(cur)->size(); | 803 cur += oop(cur)->size(); |
802 } | 804 } |
803 assert(oop(last)->is_oop(), "Should be an object start"); | 805 assert(oop(last)->is_oop(), |
806 err_msg(PTR_FORMAT " should be an object start", last)); | |
804 return last; | 807 return last; |
805 } | 808 } |
806 } | 809 } |
807 | 810 |
808 size_t ContiguousSpace::block_size(const HeapWord* p) const { | 811 size_t ContiguousSpace::block_size(const HeapWord* p) const { |
809 assert(MemRegion(bottom(), end()).contains(p), "p not in space"); | 812 assert(MemRegion(bottom(), end()).contains(p), |
813 err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", | |
814 p, bottom(), end())); | |
810 HeapWord* current_top = top(); | 815 HeapWord* current_top = top(); |
811 assert(p <= current_top, "p is not a block start"); | 816 assert(p <= current_top, |
812 assert(p == current_top || oop(p)->is_oop(), "p is not a block start"); | 817 err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, |
813 if (p < current_top) | 818 p, current_top)); |
819 assert(p == current_top || oop(p)->is_oop(), | |
820 err_msg("p (" PTR_FORMAT ") is not a block start - " | |
821 "current_top: " PTR_FORMAT ", is_oop: %s", | |
822 p, current_top, BOOL_TO_STR(oop(p)->is_oop()))); | |
823 if (p < current_top) { | |
814 return oop(p)->size(); | 824 return oop(p)->size(); |
815 else { | 825 } else { |
816 assert(p == current_top, "just checking"); | 826 assert(p == current_top, "just checking"); |
817 return pointer_delta(end(), (HeapWord*) p); | 827 return pointer_delta(end(), (HeapWord*) p); |
818 } | 828 } |
819 } | 829 } |
820 | 830 |