diff options
Diffstat (limited to 'src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp')
-rw-r--r-- | src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp index e04ff7108..655ab698d 100644 --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp @@ -78,7 +78,9 @@ public: virtual void resize(size_t new_word_size) = 0; virtual void set_bottom(HeapWord* new_bottom) { - assert(new_bottom <= _end, "new_bottom > _end"); + assert(new_bottom <= _end, + err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")", + new_bottom, _end)); _bottom = new_bottom; resize(pointer_delta(_end, _bottom)); } @@ -134,29 +136,42 @@ private: VirtualSpace _vs; u_char* _offset_array; // byte array keeping backwards offsets + void check_index(size_t index, const char* msg) const { + assert(index < _vs.committed_size(), + err_msg("%s - " + "index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT, + msg, index, _vs.committed_size())); + } + + void check_offset(size_t offset, const char* msg) const { + assert(offset <= N_words, + err_msg("%s - " + "offset: " UINT32_FORMAT", N_words: " UINT32_FORMAT, + msg, offset, N_words)); + } + // Bounds checking accessors: // For performance these have to devolve to array accesses in product builds. u_char offset_array(size_t index) const { - assert(index < _vs.committed_size(), "index out of range"); + check_index(index, "index out of range"); return _offset_array[index]; } void set_offset_array(size_t index, u_char offset) { - assert(index < _vs.committed_size(), "index out of range"); - assert(offset <= N_words, "offset too large"); + check_index(index, "index out of range"); + check_offset(offset, "offset too large"); _offset_array[index] = offset; } void set_offset_array(size_t index, HeapWord* high, HeapWord* low) { - assert(index < _vs.committed_size(), "index out of range"); + check_index(index, "index out of range"); assert(high >= low, "addresses out of order"); - assert(pointer_delta(high, low) <= N_words, "offset too large"); + check_offset(pointer_delta(high, low), "offset too large"); _offset_array[index] = (u_char) pointer_delta(high, low); } void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { - assert(index_for(right - 1) < _vs.committed_size(), - "right address out of range"); + check_index(index_for(right - 1), "right address out of range"); assert(left < right, "Heap addresses out of order"); size_t num_cards = pointer_delta(right, left) >> LogN_words; if (UseMemSetInBOT) { @@ -171,7 +186,7 @@ private: } void set_offset_array(size_t left, size_t right, u_char offset) { - assert(right < _vs.committed_size(), "right address out of range"); + check_index(right, "right index out of range"); assert(left <= right, "indexes out of order"); size_t num_cards = right - left + 1; if (UseMemSetInBOT) { @@ -186,11 +201,10 @@ private: } void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { - assert(index < _vs.committed_size(), "index out of range"); + check_index(index, "index out of range"); assert(high >= low, "addresses out of order"); - assert(pointer_delta(high, low) <= N_words, "offset too large"); - assert(_offset_array[index] == pointer_delta(high, low), - "Wrong offset"); + check_offset(pointer_delta(high, low), "offset too large"); + assert(_offset_array[index] == pointer_delta(high, low), "Wrong offset"); } bool is_card_boundary(HeapWord* p) const; @@ -481,7 +495,6 @@ class G1BlockOffsetArrayContigSpace: public G1BlockOffsetArray { blk_start, blk_end); } - public: G1BlockOffsetArrayContigSpace(G1BlockOffsetSharedArray* array, MemRegion mr); |