8320525: G1: G1UpdateRemSetTrackingBeforeRebuild::distribute_marked_bytes accesses partially unloaded klass
Reviewed-by: ayang, iwalulya
This commit is contained in:
parent
dc256fbc64
commit
21d361e944
@ -1131,13 +1131,10 @@ class G1UpdateRemSetTrackingBeforeRebuildTask : public WorkerTask {
|
|||||||
// Distribute the given marked bytes across the humongous object starting
|
// Distribute the given marked bytes across the humongous object starting
|
||||||
// with hr and note end of marking for these regions.
|
// with hr and note end of marking for these regions.
|
||||||
void distribute_marked_bytes(HeapRegion* hr, size_t marked_bytes) {
|
void distribute_marked_bytes(HeapRegion* hr, size_t marked_bytes) {
|
||||||
size_t const obj_size_in_words = cast_to_oop(hr->bottom())->size();
|
// Dead humongous objects (marked_bytes == 0) may have already been unloaded.
|
||||||
|
assert(marked_bytes == 0 || cast_to_oop(hr->bottom())->size() * HeapWordSize == marked_bytes,
|
||||||
// "Distributing" zero words means that we only note end of marking for these
|
|
||||||
// regions.
|
|
||||||
assert(marked_bytes == 0 || obj_size_in_words * HeapWordSize == marked_bytes,
|
|
||||||
"Marked bytes should either be 0 or the same as humongous object (%zu) but is %zu",
|
"Marked bytes should either be 0 or the same as humongous object (%zu) but is %zu",
|
||||||
obj_size_in_words * HeapWordSize, marked_bytes);
|
cast_to_oop(hr->bottom())->size() * HeapWordSize, marked_bytes);
|
||||||
|
|
||||||
auto distribute_bytes = [&] (HeapRegion* r) {
|
auto distribute_bytes = [&] (HeapRegion* r) {
|
||||||
size_t const bytes_to_add = MIN2(HeapRegion::GrainBytes, marked_bytes);
|
size_t const bytes_to_add = MIN2(HeapRegion::GrainBytes, marked_bytes);
|
||||||
@ -1148,10 +1145,6 @@ class G1UpdateRemSetTrackingBeforeRebuildTask : public WorkerTask {
|
|||||||
marked_bytes -= bytes_to_add;
|
marked_bytes -= bytes_to_add;
|
||||||
};
|
};
|
||||||
_g1h->humongous_obj_regions_iterate(hr, distribute_bytes);
|
_g1h->humongous_obj_regions_iterate(hr, distribute_bytes);
|
||||||
|
|
||||||
assert(marked_bytes == 0,
|
|
||||||
"%zu bytes left after distributing space across %zu regions",
|
|
||||||
marked_bytes, G1CollectedHeap::humongous_obj_size_in_regions(obj_size_in_words));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_marked_bytes(HeapRegion* hr) {
|
void update_marked_bytes(HeapRegion* hr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user