src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp
Print this page
rev 6587 : 8047820: G1 Block offset table does not need to support generic Space classes
Reviewed-by:
@@ -24,10 +24,11 @@
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
#include "gc_implementation/g1/g1BlockOffsetTable.hpp"
+#include "gc_implementation/g1/heapRegion.hpp"
#include "memory/space.hpp"
inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
if (addr >= _bottom && addr < _end) {
return block_start_unsafe(addr);
@@ -67,10 +68,15 @@
PTR_FORMAT,
p2i(result), p2i(_reserved.start()), p2i(_reserved.end())));
return result;
}
+inline size_t
+G1BlockOffsetArray::block_size(const HeapWord* p) const {
+ return gsp()->block_size(p);
+}
+
inline HeapWord*
G1BlockOffsetArray::block_at_or_preceding(const void* addr,
bool has_max_index,
size_t max_index) const {
assert(_array->offset_array(0) == 0, "objects can't cross covered areas");
@@ -86,11 +92,11 @@
while (offset >= N_words) {
// The excess of the offset from N_words indicates a power of Base
// to go back by.
size_t n_cards_back = BlockOffsetArray::entry_to_cards_back(offset);
q -= (N_words * n_cards_back);
- assert(q >= _sp->bottom(), "Went below bottom!");
+ assert(q >= gsp()->bottom(), "Went below bottom!");
index -= n_cards_back;
offset = _array->offset_array(index);
}
assert(offset < N_words, "offset too large");
q -= offset;
@@ -99,36 +105,27 @@
inline HeapWord*
G1BlockOffsetArray::
forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n,
const void* addr) const {
- if (csp() != NULL) {
- if (addr >= csp()->top()) return csp()->top();
+ if (addr >= gsp()->top()) return gsp()->top();
while (n <= addr) {
q = n;
oop obj = oop(q);
if (obj->klass_or_null() == NULL) return q;
- n += obj->size();
- }
- } else {
- while (n <= addr) {
- q = n;
- oop obj = oop(q);
- if (obj->klass_or_null() == NULL) return q;
- n += _sp->block_size(q);
- }
+ n += block_size(q);
}
assert(q <= n, "wrong order for q and addr");
assert(addr < n, "wrong order for addr and n");
return q;
}
inline HeapWord*
G1BlockOffsetArray::forward_to_block_containing_addr(HeapWord* q,
const void* addr) {
if (oop(q)->klass_or_null() == NULL) return q;
- HeapWord* n = q + _sp->block_size(q);
+ HeapWord* n = q + block_size(q);
// In the normal case, where the query "addr" is a card boundary, and the
// offset table chunks are the same size as cards, the block starting at
// "q" will contain addr, so the test below will fail, and we'll fall
// through quickly.
if (n <= addr) {