Skip to content

Commit dd0f81f

Browse files
committed
8377678: G1: Heap Dumping crashes with -UseClassUnloading
Reviewed-by: iwalulya, rkennke
1 parent 76fd33a commit dd0f81f

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

src/hotspot/share/gc/g1/heapRegion.inline.hpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ inline bool HeapRegion::is_obj_dead_with_size(const oop obj, const G1CMBitMap* c
125125
assert(!is_humongous(), "Humongous objects not handled here");
126126
bool obj_is_dead = is_obj_dead(obj, prev_bitmap);
127127

128-
if (ClassUnloading && obj_is_dead) {
128+
if (obj_is_dead) {
129129
assert(!block_is_obj(addr), "must be");
130130
*size = block_size_using_bitmap(addr, prev_bitmap);
131131
} else {
@@ -142,25 +142,10 @@ inline bool HeapRegion::block_is_obj(const HeapWord* p) const {
142142
assert(is_continues_humongous(), "This case can only happen for humongous regions");
143143
return (p == humongous_start_region()->bottom());
144144
}
145-
// When class unloading is enabled it is not safe to only consider top() to conclude if the
146-
// given pointer is a valid object. The situation can occur both for class unloading in a
147-
// Full GC and during a concurrent cycle.
148-
// During a Full GC regions can be excluded from compaction due to high live ratio, and
149-
// because of this there can be stale objects for unloaded classes left in these regions.
150-
// During a concurrent cycle class unloading is done after marking is complete and objects
151-
// for the unloaded classes will be stale until the regions are collected.
152-
if (ClassUnloading) {
153-
return !g1h->is_obj_dead(cast_to_oop(p), this);
154-
}
155-
return p < top();
145+
return !g1h->is_obj_dead(cast_to_oop(p), this);
156146
}
157147

158148
inline size_t HeapRegion::block_size_using_bitmap(const HeapWord* addr, const G1CMBitMap* const prev_bitmap) const {
159-
assert(ClassUnloading,
160-
"All blocks should be objects if class unloading isn't used, so this method should not be called. "
161-
"HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") "
162-
"addr: " PTR_FORMAT,
163-
p2i(bottom()), p2i(top()), p2i(end()), p2i(addr));
164149

165150
// Old regions' dead objects may have dead classes
166151
// We need to find the next live object using the bitmap

0 commit comments

Comments
 (0)