< prev index next >
src/share/vm/gc/g1/heapRegion.cpp
Print this page
*** 151,161 ****
guarantee(CardsPerRegion == 0, "we should only set it once");
CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
}
void HeapRegion::reset_after_compaction() {
! G1OffsetTableContigSpace::reset_after_compaction();
// After a compaction the mark bitmap is invalid, so we must
// treat all objects as being inside the unmarked area.
zero_marked_bytes();
init_top_at_mark_start();
}
--- 151,161 ----
guarantee(CardsPerRegion == 0, "we should only set it once");
CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
}
void HeapRegion::reset_after_compaction() {
! G1ContiguousSpace::reset_after_compaction();
// After a compaction the mark bitmap is invalid, so we must
// treat all objects as being inside the unmarked area.
zero_marked_bytes();
init_top_at_mark_start();
}
*** 181,191 ****
hrrs->clear();
}
}
zero_marked_bytes();
- _offsets.resize(HeapRegion::GrainWords);
init_top_at_mark_start();
if (clear_space) clear(SpaceDecorator::Mangle);
}
void HeapRegion::par_clear() {
--- 181,190 ----
*** 217,227 ****
assert(top() == bottom(), "should be empty");
_type.set_starts_humongous();
_humongous_start_region = this;
! _offsets.set_for_starts_humongous(obj_top, fill_size);
}
void HeapRegion::set_continues_humongous(HeapRegion* first_hr) {
assert(!is_humongous(), "sanity / pre-condition");
assert(top() == bottom(), "should be empty");
--- 216,226 ----
assert(top() == bottom(), "should be empty");
_type.set_starts_humongous();
_humongous_start_region = this;
! _bot_part.set_for_starts_humongous(obj_top, fill_size);
}
void HeapRegion::set_continues_humongous(HeapRegion* first_hr) {
assert(!is_humongous(), "sanity / pre-condition");
assert(top() == bottom(), "should be empty");
*** 237,249 ****
assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
_humongous_start_region = NULL;
}
HeapRegion::HeapRegion(uint hrm_index,
! G1BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) :
! G1OffsetTableContigSpace(sharedOffsetArray, mr),
_hrm_index(hrm_index),
_allocation_context(AllocationContext::system()),
_humongous_start_region(NULL),
_next_in_special_set(NULL),
_evacuation_failed(false),
--- 236,248 ----
assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
_humongous_start_region = NULL;
}
HeapRegion::HeapRegion(uint hrm_index,
! G1BlockOffsetTable* bot,
MemRegion mr) :
! G1ContiguousSpace(bot),
_hrm_index(hrm_index),
_allocation_context(AllocationContext::system()),
_humongous_start_region(NULL),
_next_in_special_set(NULL),
_evacuation_failed(false),
*** 255,273 ****
#endif // ASSERT
_young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1),
_rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
_predicted_bytes_to_copy(0)
{
! _rem_set = new HeapRegionRemSet(sharedOffsetArray, this);
initialize(mr);
}
void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
assert(_rem_set->is_empty(), "Remembered set must be empty");
! G1OffsetTableContigSpace::initialize(mr, clear_space, mangle_space);
hr_clear(false /*par*/, false /*clear_space*/);
set_top(bottom());
record_timestamp();
}
--- 254,272 ----
#endif // ASSERT
_young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1),
_rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
_predicted_bytes_to_copy(0)
{
! _rem_set = new HeapRegionRemSet(bot, this);
initialize(mr);
}
void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
assert(_rem_set->is_empty(), "Remembered set must be empty");
! G1ContiguousSpace::initialize(mr, clear_space, mangle_space);
hr_clear(false /*par*/, false /*clear_space*/);
set_top(bottom());
record_timestamp();
}
*** 771,781 ****
prev_p = p;
p += obj_size;
}
if (!is_young() && !is_empty()) {
! _offsets.verify();
}
if (is_region_humongous) {
oop obj = oop(this->humongous_start_region()->bottom());
if ((HeapWord*)obj > bottom() || (HeapWord*)obj + obj->size() < bottom()) {
--- 770,780 ----
prev_p = p;
p += obj_size;
}
if (!is_young() && !is_empty()) {
! _bot_part.verify();
}
if (is_region_humongous) {
oop obj = oop(this->humongous_start_region()->bottom());
if ((HeapWord*)obj > bottom() || (HeapWord*)obj + obj->size() < bottom()) {
*** 795,805 ****
// range [top, end). BOT look-ups in this range should yield
// top. No point in doing that if top == end (there's nothing there).
if (p < the_end) {
// Look up top
HeapWord* addr_1 = p;
! HeapWord* b_start_1 = _offsets.block_start_const(addr_1);
if (b_start_1 != p) {
log_info(gc, verify)("BOT look up for top: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_1), p2i(b_start_1), p2i(p));
*failures = true;
--- 794,804 ----
// range [top, end). BOT look-ups in this range should yield
// top. No point in doing that if top == end (there's nothing there).
if (p < the_end) {
// Look up top
HeapWord* addr_1 = p;
! HeapWord* b_start_1 = _bot_part.block_start_const(addr_1);
if (b_start_1 != p) {
log_info(gc, verify)("BOT look up for top: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_1), p2i(b_start_1), p2i(p));
*failures = true;
*** 807,817 ****
}
// Look up top + 1
HeapWord* addr_2 = p + 1;
if (addr_2 < the_end) {
! HeapWord* b_start_2 = _offsets.block_start_const(addr_2);
if (b_start_2 != p) {
log_info(gc, verify)("BOT look up for top + 1: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_2), p2i(b_start_2), p2i(p));
*failures = true;
--- 806,816 ----
}
// Look up top + 1
HeapWord* addr_2 = p + 1;
if (addr_2 < the_end) {
! HeapWord* b_start_2 = _bot_part.block_start_const(addr_2);
if (b_start_2 != p) {
log_info(gc, verify)("BOT look up for top + 1: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_2), p2i(b_start_2), p2i(p));
*failures = true;
*** 821,831 ****
// Look up an address between top and end
size_t diff = pointer_delta(the_end, p) / 2;
HeapWord* addr_3 = p + diff;
if (addr_3 < the_end) {
! HeapWord* b_start_3 = _offsets.block_start_const(addr_3);
if (b_start_3 != p) {
log_info(gc, verify)("BOT look up for top + diff: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_3), p2i(b_start_3), p2i(p));
*failures = true;
--- 820,830 ----
// Look up an address between top and end
size_t diff = pointer_delta(the_end, p) / 2;
HeapWord* addr_3 = p + diff;
if (addr_3 < the_end) {
! HeapWord* b_start_3 = _bot_part.block_start_const(addr_3);
if (b_start_3 != p) {
log_info(gc, verify)("BOT look up for top + diff: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_3), p2i(b_start_3), p2i(p));
*failures = true;
*** 833,843 ****
}
}
// Look up end - 1
HeapWord* addr_4 = the_end - 1;
! HeapWord* b_start_4 = _offsets.block_start_const(addr_4);
if (b_start_4 != p) {
log_info(gc, verify)("BOT look up for end - 1: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_4), p2i(b_start_4), p2i(p));
*failures = true;
--- 832,842 ----
}
}
// Look up end - 1
HeapWord* addr_4 = the_end - 1;
! HeapWord* b_start_4 = _bot_part.block_start_const(addr_4);
if (b_start_4 != p) {
log_info(gc, verify)("BOT look up for end - 1: " PTR_FORMAT " "
" yielded " PTR_FORMAT ", expecting " PTR_FORMAT,
p2i(addr_4), p2i(b_start_4), p2i(p));
*failures = true;
*** 858,913 ****
}
// G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go
// away eventually.
! void G1OffsetTableContigSpace::clear(bool mangle_space) {
set_top(bottom());
_scan_top = bottom();
CompactibleSpace::clear(mangle_space);
reset_bot();
}
- void G1OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) {
- Space::set_bottom(new_bottom);
- _offsets.set_bottom(new_bottom);
- }
-
- void G1OffsetTableContigSpace::set_end(HeapWord* new_end) {
- assert(new_end == _bottom + HeapRegion::GrainWords, "set_end should only ever be set to _bottom + HeapRegion::GrainWords");
- Space::set_end(new_end);
- _offsets.resize(new_end - bottom());
- }
-
#ifndef PRODUCT
! void G1OffsetTableContigSpace::mangle_unused_area() {
mangle_unused_area_complete();
}
! void G1OffsetTableContigSpace::mangle_unused_area_complete() {
SpaceMangler::mangle_region(MemRegion(top(), end()));
}
#endif
! void G1OffsetTableContigSpace::print() const {
print_short();
tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
INTPTR_FORMAT ", " INTPTR_FORMAT ")",
! p2i(bottom()), p2i(top()), p2i(_offsets.threshold()), p2i(end()));
}
! HeapWord* G1OffsetTableContigSpace::initialize_threshold() {
! return _offsets.initialize_threshold();
}
! HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start,
HeapWord* end) {
! _offsets.alloc_block(start, end);
! return _offsets.threshold();
}
! HeapWord* G1OffsetTableContigSpace::scan_top() const {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
HeapWord* local_top = top();
OrderAccess::loadload();
const unsigned local_time_stamp = _gc_time_stamp;
assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant");
--- 857,901 ----
}
// G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go
// away eventually.
! void G1ContiguousSpace::clear(bool mangle_space) {
set_top(bottom());
_scan_top = bottom();
CompactibleSpace::clear(mangle_space);
reset_bot();
}
#ifndef PRODUCT
! void G1ContiguousSpace::mangle_unused_area() {
mangle_unused_area_complete();
}
! void G1ContiguousSpace::mangle_unused_area_complete() {
SpaceMangler::mangle_region(MemRegion(top(), end()));
}
#endif
! void G1ContiguousSpace::print() const {
print_short();
tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
INTPTR_FORMAT ", " INTPTR_FORMAT ")",
! p2i(bottom()), p2i(top()), p2i(_bot_part.threshold()), p2i(end()));
}
! HeapWord* G1ContiguousSpace::initialize_threshold() {
! return _bot_part.initialize_threshold();
}
! HeapWord* G1ContiguousSpace::cross_threshold(HeapWord* start,
HeapWord* end) {
! _bot_part.alloc_block(start, end);
! return _bot_part.threshold();
}
! HeapWord* G1ContiguousSpace::scan_top() const {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
HeapWord* local_top = top();
OrderAccess::loadload();
const unsigned local_time_stamp = _gc_time_stamp;
assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant");
*** 916,926 ****
} else {
return _scan_top;
}
}
! void G1OffsetTableContigSpace::record_timestamp() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp();
if (_gc_time_stamp < curr_gc_time_stamp) {
// Setting the time stamp here tells concurrent readers to look at
--- 904,914 ----
} else {
return _scan_top;
}
}
! void G1ContiguousSpace::record_timestamp() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp();
if (_gc_time_stamp < curr_gc_time_stamp) {
// Setting the time stamp here tells concurrent readers to look at
*** 933,973 ****
_gc_time_stamp = curr_gc_time_stamp;
}
}
! void G1OffsetTableContigSpace::record_retained_region() {
// scan_top is the maximum address where it's safe for the next gc to
// scan this region.
_scan_top = top();
}
! void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) {
object_iterate(blk);
}
! void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
HeapWord* p = bottom();
while (p < top()) {
if (block_is_obj(p)) {
blk->do_object(oop(p));
}
p += block_size(p);
}
}
! G1OffsetTableContigSpace::
! G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
! MemRegion mr) :
! _offsets(sharedOffsetArray, mr),
_par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
_gc_time_stamp(0)
{
- _offsets.set_space(this);
}
! void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
CompactibleSpace::initialize(mr, clear_space, mangle_space);
_top = bottom();
_scan_top = bottom();
set_saved_mark_word(NULL);
reset_bot();
--- 921,958 ----
_gc_time_stamp = curr_gc_time_stamp;
}
}
! void G1ContiguousSpace::record_retained_region() {
// scan_top is the maximum address where it's safe for the next gc to
// scan this region.
_scan_top = top();
}
! void G1ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
object_iterate(blk);
}
! void G1ContiguousSpace::object_iterate(ObjectClosure* blk) {
HeapWord* p = bottom();
while (p < top()) {
if (block_is_obj(p)) {
blk->do_object(oop(p));
}
p += block_size(p);
}
}
! G1ContiguousSpace::G1ContiguousSpace(G1BlockOffsetTable* bot) :
! _bot_part(bot, this),
_par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
_gc_time_stamp(0)
{
}
! void G1ContiguousSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
CompactibleSpace::initialize(mr, clear_space, mangle_space);
_top = bottom();
_scan_top = bottom();
set_saved_mark_word(NULL);
reset_bot();
< prev index next >