Skip to content

Commit 21d361e

Browse files
author
Thomas Schatzl
committed
8320525: G1: G1UpdateRemSetTrackingBeforeRebuild::distribute_marked_bytes accesses partially unloaded klass
Reviewed-by: ayang, iwalulya
1 parent dc256fb commit 21d361e

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
@@ -1131,13 +1131,10 @@ class G1UpdateRemSetTrackingBeforeRebuildTask : public WorkerTask {
11311131
// Distribute the given marked bytes across the humongous object starting
11321132
// with hr and note end of marking for these regions.
11331133
void distribute_marked_bytes(HeapRegion* hr, size_t marked_bytes) {
1134-
size_t const obj_size_in_words = cast_to_oop(hr->bottom())->size();
1135-
1136-
// "Distributing" zero words means that we only note end of marking for these
1137-
// regions.
1138-
assert(marked_bytes == 0 || obj_size_in_words * HeapWordSize == marked_bytes,
1134+
// Dead humongous objects (marked_bytes == 0) may have already been unloaded.
1135+
assert(marked_bytes == 0 || cast_to_oop(hr->bottom())->size() * HeapWordSize == marked_bytes,
11391136
"Marked bytes should either be 0 or the same as humongous object (%zu) but is %zu",
1140-
obj_size_in_words * HeapWordSize, marked_bytes);
1137+
cast_to_oop(hr->bottom())->size() * HeapWordSize, marked_bytes);
11411138

11421139
auto distribute_bytes = [&] (HeapRegion* r) {
11431140
size_t const bytes_to_add = MIN2(HeapRegion::GrainBytes, marked_bytes);
@@ -1148,10 +1145,6 @@ class G1UpdateRemSetTrackingBeforeRebuildTask : public WorkerTask {
11481145
marked_bytes -= bytes_to_add;
11491146
};
11501147
_g1h->humongous_obj_regions_iterate(hr, distribute_bytes);
1151-
1152-
assert(marked_bytes == 0,
1153-
"%zu bytes left after distributing space across %zu regions",
1154-
marked_bytes, G1CollectedHeap::humongous_obj_size_in_regions(obj_size_in_words));
11551148
}
11561149

11571150
void update_marked_bytes(HeapRegion* hr) {

0 commit comments

Comments
 (0)