Print this page
rev 3849 : 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:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp
          +++ new/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp
↓ open down ↓ 41 lines elided ↑ open up ↑
  42   42      return block_start_unsafe_const(addr);
  43   43    } else {
  44   44      return NULL;
  45   45    }
  46   46  }
  47   47  
  48   48  inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const {
  49   49    char* pc = (char*)p;
  50   50    assert(pc >= (char*)_reserved.start() &&
  51   51           pc <  (char*)_reserved.end(),
  52      -         "p not in range.");
       52 +         err_msg("p ("PTR_FORMAT") not in reserved ["PTR_FORMAT", "PTR_FORMAT")",
       53 +                 p, (char*)_reserved.start(), (char*)_reserved.end()));
  53   54    size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
  54   55    size_t result = delta >> LogN;
  55      -  assert(result < _vs.committed_size(), "bad index from address");
       56 +  check_index(result, "bad index from address");
  56   57    return result;
  57   58  }
  58   59  
  59   60  inline HeapWord*
  60   61  G1BlockOffsetSharedArray::address_for_index(size_t index) const {
  61      -  assert(index < _vs.committed_size(), "bad index");
       62 +  check_index(index, "index out of range");
  62   63    HeapWord* result = _reserved.start() + (index << LogN_words);
  63   64    assert(result >= _reserved.start() && result < _reserved.end(),
  64   65           err_msg("bad address from index result " PTR_FORMAT
  65   66                   " _reserved.start() " PTR_FORMAT " _reserved.end() "
  66   67                   PTR_FORMAT,
  67   68                   result, _reserved.start(), _reserved.end()));
  68   69    return result;
  69   70  }
  70   71  
  71   72  inline HeapWord*
↓ open down ↓ 93 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX