Skip to content

Commit 8316309

Browse files
author
John Cuthbertson
committed
8007772: G1: assert(!hr->isHumongous() || mr.start() == hr->bottom()) failed: the start of HeapRegion and MemRegion should be consistent for humongous regions
In do_marking_step(), we should always give up current region after scanning the object, if the region is humongous. Reviewed-by: brutisso, jwilhelm, tamao
1 parent 4841066 commit 8316309

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4062,27 +4062,36 @@ void CMTask::do_marking_step(double time_target_ms,
40624062
if (_cm->verbose_low()) {
40634063
gclog_or_tty->print_cr("[%u] we're scanning part "
40644064
"["PTR_FORMAT", "PTR_FORMAT") "
4065-
"of region "PTR_FORMAT,
4066-
_worker_id, _finger, _region_limit, _curr_region);
4065+
"of region "HR_FORMAT,
4066+
_worker_id, _finger, _region_limit,
4067+
HR_FORMAT_PARAMS(_curr_region));
40674068
}
40684069

4069-
HeapRegion* hr = _g1h->heap_region_containing(mr.start());
4070-
assert(!hr->isHumongous() || mr.start() == hr->bottom(),
4071-
"the start of HeapRegion and MemRegion should be consistent for humongous regions");
4070+
assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(),
4071+
"humongous regions should go around loop once only");
40724072

4073-
// The special case of the bitmap of a humongous region with its first
4074-
// bit NOT marked should be avoided from (wasteful) iterating.
4075-
// Note that the alternative case of the bitmap of a humongous region
4076-
// with its first bit marked is handled properly in the iterate() routine.
4077-
// Then, let's iterate over the bitmap of the part of the region that is
4078-
// left.
4073+
// Some special cases:
4074+
// If the memory region is empty, we can just give up the region.
4075+
// If the current region is humongous then we only need to check
4076+
// the bitmap for the bit associated with the start of the object,
4077+
// scan the object if it's live, and give up the region.
4078+
// Otherwise, let's iterate over the bitmap of the part of the region
4079+
// that is left.
40794080
// If the iteration is successful, give up the region.
4080-
// Also note that the case of the bitmap of a humongous region with its
4081-
// first bit NOT marked is considered "successful", leveraging the fact
4082-
// that the entire bitmap consists of all 0's in such case.
4083-
if (mr.is_empty() ||
4084-
(hr != NULL && hr->isHumongous() && !_nextMarkBitMap->isMarked(mr.start())) ||
4085-
_nextMarkBitMap->iterate(&bitmap_closure, mr)) {
4081+
if (mr.is_empty()) {
4082+
giveup_current_region();
4083+
regular_clock_call();
4084+
} else if (_curr_region->isHumongous() && mr.start() == _curr_region->bottom()) {
4085+
if (_nextMarkBitMap->isMarked(mr.start())) {
4086+
// The object is marked - apply the closure
4087+
BitMap::idx_t offset = _nextMarkBitMap->heapWordToOffset(mr.start());
4088+
bitmap_closure.do_bit(offset);
4089+
}
4090+
// Even if this task aborted while scanning the humongous object
4091+
// we can (and should) give up the current region.
4092+
giveup_current_region();
4093+
regular_clock_call();
4094+
} else if (_nextMarkBitMap->iterate(&bitmap_closure, mr)) {
40864095
giveup_current_region();
40874096
regular_clock_call();
40884097
} else {

0 commit comments

Comments
 (0)