comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 8039:5e401ef52ec0

8007772: G1: assert(!hr->isHumongous() || mr.start() == hr->bottom()) failed: the start of HeapRegion and MemRegion should be consistent for humongous regions Summary: 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
author johnc
date Mon, 11 Feb 2013 15:24:48 -0800
parents bce1ac447f6b
children 47bc9800972c 9def4075da6d
comparison
equal deleted inserted replaced
8038:ad747ee9d0b1 8039:5e401ef52ec0
4060 MemRegion mr = MemRegion(_finger, _region_limit); 4060 MemRegion mr = MemRegion(_finger, _region_limit);
4061 4061
4062 if (_cm->verbose_low()) { 4062 if (_cm->verbose_low()) {
4063 gclog_or_tty->print_cr("[%u] we're scanning part " 4063 gclog_or_tty->print_cr("[%u] we're scanning part "
4064 "["PTR_FORMAT", "PTR_FORMAT") " 4064 "["PTR_FORMAT", "PTR_FORMAT") "
4065 "of region "PTR_FORMAT, 4065 "of region "HR_FORMAT,
4066 _worker_id, _finger, _region_limit, _curr_region); 4066 _worker_id, _finger, _region_limit,
4067 HR_FORMAT_PARAMS(_curr_region));
4067 } 4068 }
4068 4069
4069 HeapRegion* hr = _g1h->heap_region_containing(mr.start()); 4070 assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(),
4070 assert(!hr->isHumongous() || mr.start() == hr->bottom(), 4071 "humongous regions should go around loop once only");
4071 "the start of HeapRegion and MemRegion should be consistent for humongous regions"); 4072
4072 4073 // Some special cases:
4073 // The special case of the bitmap of a humongous region with its first 4074 // If the memory region is empty, we can just give up the region.
4074 // bit NOT marked should be avoided from (wasteful) iterating. 4075 // If the current region is humongous then we only need to check
4075 // Note that the alternative case of the bitmap of a humongous region 4076 // the bitmap for the bit associated with the start of the object,
4076 // with its first bit marked is handled properly in the iterate() routine. 4077 // scan the object if it's live, and give up the region.
4077 // Then, let's iterate over the bitmap of the part of the region that is 4078 // Otherwise, let's iterate over the bitmap of the part of the region
4078 // left. 4079 // that is left.
4079 // If the iteration is successful, give up the region. 4080 // 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 if (mr.is_empty()) {
4081 // first bit NOT marked is considered "successful", leveraging the fact 4082 giveup_current_region();
4082 // that the entire bitmap consists of all 0's in such case. 4083 regular_clock_call();
4083 if (mr.is_empty() || 4084 } else if (_curr_region->isHumongous() && mr.start() == _curr_region->bottom()) {
4084 (hr != NULL && hr->isHumongous() && !_nextMarkBitMap->isMarked(mr.start())) || 4085 if (_nextMarkBitMap->isMarked(mr.start())) {
4085 _nextMarkBitMap->iterate(&bitmap_closure, mr)) { 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)) {
4086 giveup_current_region(); 4095 giveup_current_region();
4087 regular_clock_call(); 4096 regular_clock_call();
4088 } else { 4097 } else {
4089 assert(has_aborted(), "currently the only way to do so"); 4098 assert(has_aborted(), "currently the only way to do so");
4090 // The only way to abort the bitmap iteration is to return 4099 // The only way to abort the bitmap iteration is to return