src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp

changeset 6987
9441d22e429a
parent 6680
78bbf4d43a14
child 6990
1526a938e670
     1.1 --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Wed Jun 25 10:55:10 2014 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Wed Jun 25 16:53:13 2014 +0200
     1.3 @@ -26,6 +26,7 @@
     1.4  #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
     1.5  
     1.6  #include "gc_implementation/g1/g1BlockOffsetTable.hpp"
     1.7 +#include "gc_implementation/g1/heapRegion.hpp"
     1.8  #include "memory/space.hpp"
     1.9  
    1.10  inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
    1.11 @@ -69,6 +70,11 @@
    1.12    return result;
    1.13  }
    1.14  
    1.15 +inline size_t
    1.16 +G1BlockOffsetArray::block_size(const HeapWord* p) const {
    1.17 +  return gsp()->block_size(p);
    1.18 +}
    1.19 +
    1.20  inline HeapWord*
    1.21  G1BlockOffsetArray::block_at_or_preceding(const void* addr,
    1.22                                            bool has_max_index,
    1.23 @@ -88,7 +94,7 @@
    1.24      // to go back by.
    1.25      size_t n_cards_back = BlockOffsetArray::entry_to_cards_back(offset);
    1.26      q -= (N_words * n_cards_back);
    1.27 -    assert(q >= _sp->bottom(), "Went below bottom!");
    1.28 +    assert(q >= gsp()->bottom(), "Went below bottom!");
    1.29      index -= n_cards_back;
    1.30      offset = _array->offset_array(index);
    1.31    }
    1.32 @@ -101,21 +107,12 @@
    1.33  G1BlockOffsetArray::
    1.34  forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n,
    1.35                                         const void* addr) const {
    1.36 -  if (csp() != NULL) {
    1.37 -    if (addr >= csp()->top()) return csp()->top();
    1.38 -    while (n <= addr) {
    1.39 -      q = n;
    1.40 -      oop obj = oop(q);
    1.41 -      if (obj->klass_or_null() == NULL) return q;
    1.42 -      n += obj->size();
    1.43 -    }
    1.44 -  } else {
    1.45 -    while (n <= addr) {
    1.46 -      q = n;
    1.47 -      oop obj = oop(q);
    1.48 -      if (obj->klass_or_null() == NULL) return q;
    1.49 -      n += _sp->block_size(q);
    1.50 -    }
    1.51 +  if (addr >= gsp()->top()) return gsp()->top();
    1.52 +  while (n <= addr) {
    1.53 +    q = n;
    1.54 +    oop obj = oop(q);
    1.55 +    if (obj->klass_or_null() == NULL) return q;
    1.56 +    n += obj->size();
    1.57    }
    1.58    assert(q <= n, "wrong order for q and addr");
    1.59    assert(addr < n, "wrong order for addr and n");
    1.60 @@ -126,7 +123,7 @@
    1.61  G1BlockOffsetArray::forward_to_block_containing_addr(HeapWord* q,
    1.62                                                       const void* addr) {
    1.63    if (oop(q)->klass_or_null() == NULL) return q;
    1.64 -  HeapWord* n = q + _sp->block_size(q);
    1.65 +  HeapWord* n = q + block_size(q);
    1.66    // In the normal case, where the query "addr" is a card boundary, and the
    1.67    // offset table chunks are the same size as cards, the block starting at
    1.68    // "q" will contain addr, so the test below will fail, and we'll fall

mercurial