8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions

Reviewed-by: drwhite, tschatzl
This commit is contained in:
Mikael Gerdin 2016-04-11 09:49:10 +02:00
parent 89282b0c72
commit 19cd9b20e8
2 changed files with 17 additions and 7 deletions

View File

@ -206,8 +206,14 @@ public:
return 0;
}
if (hr->is_humongous()) {
mark_card_bitmap_range(start, hr->top());
return pointer_delta(hr->top(), start, 1);
HeapRegion* start_region = hr->humongous_start_region();
if (mark_bitmap->isMarked(start_region->bottom())) {
mark_card_bitmap_range(start, hr->top());
return pointer_delta(hr->top(), start, 1);
} else {
// Humongous start object was actually dead.
return 0;
}
}
assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),

View File

@ -2946,13 +2946,17 @@ class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
: rset->is_empty();
}
bool is_typeArray_region(HeapRegion* region) const {
return oop(region->bottom())->is_typeArray();
}
bool humongous_region_is_candidate(G1CollectedHeap* heap, HeapRegion* region) const {
assert(region->is_starts_humongous(), "Must start a humongous object");
oop obj = oop(region->bottom());
// Dead objects cannot be eager reclaim candidates. Due to class
// unloading it is unsafe to query their classes so we return early.
if (heap->is_obj_dead(obj, region)) {
return false;
}
// Candidate selection must satisfy the following constraints
// while concurrent marking is in progress:
//
@ -2989,7 +2993,7 @@ class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
// important use case for eager reclaim, and this special handling
// may reduce needed headroom.
return is_typeArray_region(region) && is_remset_small(region);
return obj->is_typeArray() && is_remset_small(region);
}
public: