Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions src/hotspot/share/gc/g1/g1HeapRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,23 +787,13 @@ void G1HeapRegion::fill_range_with_dead_objects(HeapWord* start, HeapWord* end)
// possible that there is a pinned object that is not any more referenced by
// Java code (only by native).
//
// In this case we must not zap contents of such an array but we can overwrite
// the header; since only pinned typearrays are allowed, this fits nicely with
// putting filler arrays into the dead range as the object header sizes match and
// no user data is overwritten.
// In this case we should not zap, because that would overwrite
// user-observable data. Memory corresponding to obj-header is safe to
// change, since it's not directly user-observable.
//
// In particular String Deduplication might change the reference to the character
// array of the j.l.String after native code obtained a raw reference to it (via
// GetStringCritical()).
CollectedHeap::fill_with_objects(start, range_size, !has_pinned_objects());
HeapWord* current = start;
do {
// Update the BOT if the a threshold is crossed.
size_t obj_size = cast_to_oop(current)->size();
update_bot_for_block(current, current + obj_size);

// Advance to the next object.
current += obj_size;
guarantee(current <= end, "Should never go past end");
} while (current != end);
CollectedHeap::fill_with_object(start, range_size, !has_pinned_objects());
update_bot_for_block(start, start + range_size);
}