Skip to content

Commit bb046b7

Browse files
committed
8320525: G1: G1UpdateRemSetTrackingBeforeRebuild::distribute_marked_bytes accesses partially unloaded klass
Backport-of: 21d361e944a599e82e5ed93aa81ad485b4601843
1 parent ffdde9c commit bb046b7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,13 +1121,10 @@ class G1UpdateRemSetTrackingBeforeRebuildTask : public WorkerTask {
11211121
// Distribute the given marked bytes across the humongous object starting
11221122
// with hr and note end of marking for these regions.
11231123
void distribute_marked_bytes(HeapRegion* hr, size_t marked_bytes) {
1124-
size_t const obj_size_in_words = cast_to_oop(hr->bottom())->size();
1125-
1126-
// "Distributing" zero words means that we only note end of marking for these
1127-
// regions.
1128-
assert(marked_bytes == 0 || obj_size_in_words * HeapWordSize == marked_bytes,
1124+
// Dead humongous objects (marked_bytes == 0) may have already been unloaded.
1125+
assert(marked_bytes == 0 || cast_to_oop(hr->bottom())->size() * HeapWordSize == marked_bytes,
11291126
"Marked bytes should either be 0 or the same as humongous object (%zu) but is %zu",
1130-
obj_size_in_words * HeapWordSize, marked_bytes);
1127+
cast_to_oop(hr->bottom())->size() * HeapWordSize, marked_bytes);
11311128

11321129
auto distribute_bytes = [&] (HeapRegion* r) {
11331130
size_t const bytes_to_add = MIN2(HeapRegion::GrainBytes, marked_bytes);
@@ -1138,10 +1135,6 @@ class G1UpdateRemSetTrackingBeforeRebuildTask : public WorkerTask {
11381135
marked_bytes -= bytes_to_add;
11391136
};
11401137
_g1h->humongous_obj_regions_iterate(hr, distribute_bytes);
1141-
1142-
assert(marked_bytes == 0,
1143-
"%zu bytes left after distributing space across %zu regions",
1144-
marked_bytes, G1CollectedHeap::humongous_obj_size_in_regions(obj_size_in_words));
11451138
}
11461139

11471140
void update_marked_bytes(HeapRegion* hr) {

0 commit comments

Comments
 (0)