8309306: G1: Move is_obj_dead from HeapRegion to G1CollectedHeap
Reviewed-by: tschatzl, iwalulya
This commit is contained in:
parent
4bc6bbb23f
commit
fdaa2c4083
src/hotspot/share/gc/g1
@ -247,13 +247,19 @@ inline bool G1CollectedHeap::is_obj_filler(const oop obj) {
|
||||
}
|
||||
|
||||
inline bool G1CollectedHeap::is_obj_dead(const oop obj, const HeapRegion* hr) const {
|
||||
return hr->is_obj_dead(obj, hr->parsable_bottom());
|
||||
if (hr->is_in_parsable_area(obj)) {
|
||||
// This object is in the parsable part of the heap, live unless scrubbed.
|
||||
return is_obj_filler(obj);
|
||||
} else {
|
||||
// From Remark until a region has been concurrently scrubbed, parts of the
|
||||
// region is not guaranteed to be parsable. Use the bitmap for liveness.
|
||||
return !concurrent_mark()->mark_bitmap()->is_marked(obj);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool G1CollectedHeap::is_obj_dead(const oop obj) const {
|
||||
if (obj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
assert(obj != nullptr, "precondition");
|
||||
|
||||
return is_obj_dead(obj, heap_region_containing(obj));
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ public:
|
||||
}
|
||||
|
||||
o->oop_iterate(&isLive);
|
||||
if (_hr->obj_in_unparsable_area(o, _hr->parsable_bottom())) {
|
||||
if (!_hr->is_in_parsable_area(o)) {
|
||||
size_t obj_size = o->size();
|
||||
_live_bytes += (obj_size * HeapWordSize);
|
||||
}
|
||||
|
@ -182,10 +182,6 @@ public:
|
||||
// All allocated blocks are occupied by objects in a HeapRegion.
|
||||
bool block_is_obj(const HeapWord* p, HeapWord* pb) const;
|
||||
|
||||
// Returns whether the given object is dead based on the given parsable_bottom (pb).
|
||||
// For an object to be considered dead it must be below pb and scrubbed.
|
||||
bool is_obj_dead(oop obj, HeapWord* pb) const;
|
||||
|
||||
// Returns the object size for all valid block starts. If parsable_bottom (pb)
|
||||
// is given, calculates the block size based on that parsable_bottom, not the
|
||||
// current value of this HeapRegion.
|
||||
@ -524,9 +520,9 @@ public:
|
||||
|
||||
void record_surv_words_in_group(size_t words_survived);
|
||||
|
||||
// Determine if an object is in the parsable or the to-be-scrubbed area.
|
||||
inline static bool obj_in_parsable_area(const HeapWord* addr, HeapWord* pb);
|
||||
inline static bool obj_in_unparsable_area(oop obj, HeapWord* pb);
|
||||
// Determine if an address is in the parsable or the to-be-scrubbed area.
|
||||
inline bool is_in_parsable_area(const void* const addr) const;
|
||||
inline static bool is_in_parsable_area(const void* const addr, const void* const pb);
|
||||
|
||||
bool obj_allocated_since_marking_start(oop obj) const {
|
||||
return cast_from_oop<HeapWord*>(obj) >= top_at_mark_start();
|
||||
|
@ -109,11 +109,11 @@ inline HeapWord* HeapRegion::block_start(const void* addr, HeapWord* const pb) c
|
||||
return advance_to_block_containing_addr(addr, pb, first_block);
|
||||
}
|
||||
|
||||
inline bool HeapRegion::obj_in_unparsable_area(oop obj, HeapWord* const pb) {
|
||||
return !HeapRegion::obj_in_parsable_area(cast_from_oop<HeapWord*>(obj), pb);
|
||||
inline bool HeapRegion::is_in_parsable_area(const void* const addr) const {
|
||||
return is_in_parsable_area(addr, parsable_bottom());
|
||||
}
|
||||
|
||||
inline bool HeapRegion::obj_in_parsable_area(const HeapWord* addr, HeapWord* const pb) {
|
||||
inline bool HeapRegion::is_in_parsable_area(const void* const addr, const void* const pb) {
|
||||
return addr >= pb;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ inline bool HeapRegion::block_is_obj(const HeapWord* const p, HeapWord* const pb
|
||||
assert(p >= bottom() && p < top(), "precondition");
|
||||
assert(!is_continues_humongous(), "p must point to block-start");
|
||||
|
||||
if (obj_in_parsable_area(p, pb)) {
|
||||
if (is_in_parsable_area(p, pb)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -140,19 +140,6 @@ inline bool HeapRegion::block_is_obj(const HeapWord* const p, HeapWord* const pb
|
||||
return is_marked_in_bitmap(cast_to_oop(p));
|
||||
}
|
||||
|
||||
inline bool HeapRegion::is_obj_dead(const oop obj, HeapWord* const pb) const {
|
||||
assert(is_in_reserved(obj), "Object " PTR_FORMAT " must be in region", p2i(obj));
|
||||
|
||||
// From Remark until a region has been concurrently scrubbed, parts of the
|
||||
// region is not guaranteed to be parsable. Use the bitmap for liveness.
|
||||
if (obj_in_unparsable_area(obj, pb)) {
|
||||
return !is_marked_in_bitmap(obj);
|
||||
}
|
||||
|
||||
// This object is in the parsable part of the heap, live unless scrubbed.
|
||||
return G1CollectedHeap::is_obj_filler(obj);
|
||||
}
|
||||
|
||||
inline HeapWord* HeapRegion::next_live_in_unparsable(G1CMBitMap* const bitmap, const HeapWord* p, HeapWord* const limit) const {
|
||||
return bitmap->get_next_marked_addr(p, limit);
|
||||
}
|
||||
@ -450,7 +437,7 @@ inline HeapWord* HeapRegion::oops_on_memregion_iterate(MemRegion mr, Closure* cl
|
||||
// safepoints.
|
||||
//
|
||||
HeapWord* cur = block_start(start, pb);
|
||||
if (!obj_in_parsable_area(start, pb)) {
|
||||
if (!is_in_parsable_area(start, pb)) {
|
||||
// Limit the MemRegion to the part of the area to scan to the unparsable one as using the bitmap
|
||||
// is slower than blindly iterating the objects.
|
||||
MemRegion mr_in_unparsable(mr.start(), MIN2(mr.end(), pb));
|
||||
|
Loading…
x
Reference in New Issue
Block a user