src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp
Print this page
rev 6587 : 8047820: G1 Block offset table does not need to support generic Space classes
Reviewed-by:
@@ -22,10 +22,11 @@
*
*/
#include "precompiled.hpp"
#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
+#include "gc_implementation/g1/heapRegion.hpp"
#include "memory/space.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
#include "services/memTracker.hpp"
@@ -105,23 +106,22 @@
G1BlockOffsetArray::G1BlockOffsetArray(G1BlockOffsetSharedArray* array,
MemRegion mr, bool init_to_zero) :
G1BlockOffsetTable(mr.start(), mr.end()),
_unallocated_block(_bottom),
- _array(array), _csp(NULL),
+ _array(array), _gsp(NULL),
_init_to_zero(init_to_zero) {
assert(_bottom <= _end, "arguments out of order");
if (!_init_to_zero) {
// initialize cards to point back to mr.start()
set_remainder_to_point_to_start(mr.start() + N_words, mr.end());
_array->set_offset_array(0, 0); // set first card to 0
}
}
-void G1BlockOffsetArray::set_space(Space* sp) {
- _sp = sp;
- _csp = sp->toContiguousSpace();
+void G1BlockOffsetArray::set_space(G1OffsetTableContigSpace* sp) {
+ _gsp = sp;
}
// The arguments follow the normal convention of denoting
// a right-open interval: [start, end)
void
@@ -376,11 +376,11 @@
assert(ub < _end, "tautology (see above)");
return ub;
}
// Otherwise, find the block start using the table.
HeapWord* q = block_at_or_preceding(addr, false, 0);
- HeapWord* n = q + _sp->block_size(q);
+ HeapWord* n = q + block_size(q);
return forward_to_block_containing_addr_const(q, n, addr);
}
HeapWord*
@@ -404,36 +404,22 @@
(n_index == next_index ? 0 : N_words);
assert(next_boundary <= _array->_end,
err_msg("next_boundary is beyond the end of the covered region "
" next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT,
next_boundary, _array->_end));
- if (csp() != NULL) {
- if (addr >= csp()->top()) return csp()->top();
+ if (addr >= gsp()->top()) return gsp()->top();
while (next_boundary < addr) {
while (n <= next_boundary) {
q = n;
oop obj = oop(q);
if (obj->klass_or_null() == NULL) return q;
- n += obj->size();
+ n += block_size(q);
}
assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
// [q, n) is the block that crosses the boundary.
alloc_block_work2(&next_boundary, &next_index, q, n);
}
- } else {
- while (next_boundary < addr) {
- while (n <= next_boundary) {
- q = n;
- oop obj = oop(q);
- if (obj->klass_or_null() == NULL) return q;
- n += _sp->block_size(q);
- }
- assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
- // [q, n) is the block that crosses the boundary.
- alloc_block_work2(&next_boundary, &next_index, q, n);
- }
- }
return forward_to_block_containing_addr_const(q, n, addr);
}
HeapWord* G1BlockOffsetArray::block_start_careful(const void* addr) const {
assert(_array->offset_array(0) == 0, "objects can't cross covered areas");
@@ -635,11 +621,11 @@
G1BlockOffsetArrayContigSpace::
block_start_unsafe_const(const void* addr) const {
assert(_bottom <= addr && addr < _end,
"addr must be covered by this Array");
HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1);
- HeapWord* n = q + _sp->block_size(q);
+ HeapWord* n = q + block_size(q);
return forward_to_block_containing_addr_const(q, n, addr);
}
G1BlockOffsetArrayContigSpace::
G1BlockOffsetArrayContigSpace(G1BlockOffsetSharedArray* array,