提交 d6d212dd 编写于 作者: A apetrusenko

6921317: (partial) G1: assert(top() == bottom() || zfs == Allocated,"Region...

6921317: (partial) G1: assert(top() == bottom() || zfs == Allocated,"Region must be empty, or we must be setting it to
Summary: Extended the failing assertion with the new message format to get more data.
Reviewed-by: tonyp
上级 63d78389
...@@ -471,21 +471,23 @@ HeapRegion* G1CollectedHeap::newAllocRegion_work(size_t word_size, ...@@ -471,21 +471,23 @@ HeapRegion* G1CollectedHeap::newAllocRegion_work(size_t word_size,
res->zero_fill_state() == HeapRegion::Allocated)), res->zero_fill_state() == HeapRegion::Allocated)),
"Alloc Regions must be zero filled (and non-H)"); "Alloc Regions must be zero filled (and non-H)");
} }
if (res != NULL && res->is_empty()) _free_regions--; if (res != NULL) {
assert(res == NULL || if (res->is_empty()) {
(!res->isHumongous() && _free_regions--;
(!zero_filled || }
res->zero_fill_state() == HeapRegion::Allocated)), assert(!res->isHumongous() &&
"Non-young alloc Regions must be zero filled (and non-H)"); (!zero_filled || res->zero_fill_state() == HeapRegion::Allocated),
err_msg("Non-young alloc Regions must be zero filled (and non-H):"
if (G1PrintHeapRegions) { " res->isHumongous()=%d, zero_filled=%d, res->zero_fill_state()=%d",
if (res != NULL) { res->isHumongous(), zero_filled, res->zero_fill_state()));
assert(!res->is_on_unclean_list(),
"Alloc Regions must not be on the unclean list");
if (G1PrintHeapRegions) {
gclog_or_tty->print_cr("new alloc region %d:["PTR_FORMAT", "PTR_FORMAT"], " gclog_or_tty->print_cr("new alloc region %d:["PTR_FORMAT", "PTR_FORMAT"], "
"top "PTR_FORMAT, "top "PTR_FORMAT,
res->hrs_index(), res->bottom(), res->end(), res->top()); res->hrs_index(), res->bottom(), res->end(), res->top());
} }
} }
return res; return res;
} }
...@@ -4600,6 +4602,15 @@ void G1CollectedHeap::wait_for_cleanup_complete_locked() { ...@@ -4600,6 +4602,15 @@ void G1CollectedHeap::wait_for_cleanup_complete_locked() {
void void
G1CollectedHeap::put_region_on_unclean_list_locked(HeapRegion* r) { G1CollectedHeap::put_region_on_unclean_list_locked(HeapRegion* r) {
assert(ZF_mon->owned_by_self(), "precondition."); assert(ZF_mon->owned_by_self(), "precondition.");
#ifdef ASSERT
if (r->is_gc_alloc_region()) {
ResourceMark rm;
stringStream region_str;
print_on(&region_str);
assert(!r->is_gc_alloc_region(), err_msg("Unexpected GC allocation region: %s",
region_str.as_string()));
}
#endif
_unclean_region_list.insert_before_head(r); _unclean_region_list.insert_before_head(r);
} }
......
...@@ -554,11 +554,19 @@ HeapWord* HeapRegion::allocate(size_t size) { ...@@ -554,11 +554,19 @@ HeapWord* HeapRegion::allocate(size_t size) {
#endif #endif
void HeapRegion::set_zero_fill_state_work(ZeroFillState zfs) { void HeapRegion::set_zero_fill_state_work(ZeroFillState zfs) {
assert(top() == bottom() || zfs == Allocated,
"Region must be empty, or we must be setting it to allocated.");
assert(ZF_mon->owned_by_self() || assert(ZF_mon->owned_by_self() ||
Universe::heap()->is_gc_active(), Universe::heap()->is_gc_active(),
"Must hold the lock or be a full GC to modify."); "Must hold the lock or be a full GC to modify.");
#ifdef ASSERT
if (top() != bottom() && zfs != Allocated) {
ResourceMark rm;
stringStream region_str;
print_on(&region_str);
assert(top() == bottom() || zfs == Allocated,
err_msg("Region must be empty, or we must be setting it to allocated. "
"_zfs=%d, zfs=%d, region: %s", _zfs, zfs, region_str.as_string()));
}
#endif
_zfs = zfs; _zfs = zfs;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册