Skip to content
Permalink
Browse files
8276842: G1: Only calculate size in bytes from words when needed
Reviewed-by: tschatzl, ayang
  • Loading branch information
Hamlin Li committed Nov 10, 2021
1 parent c8b0ee6 commit c1e41fe38bbbae12e1f73d2cd63c7afffc19475b
Showing 1 changed file with 4 additions and 4 deletions.
@@ -41,7 +41,7 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
G1CollectedHeap* _g1h;
G1ConcurrentMark* _cm;
HeapRegion* _hr;
size_t _marked_bytes;
size_t _marked_words;
bool _during_concurrent_start;
uint _worker_id;
HeapWord* _last_forwarded_object_end;
@@ -53,12 +53,12 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
_g1h(G1CollectedHeap::heap()),
_cm(_g1h->concurrent_mark()),
_hr(hr),
_marked_bytes(0),
_marked_words(0),
_during_concurrent_start(during_concurrent_start),
_worker_id(worker_id),
_last_forwarded_object_end(hr->bottom()) { }

size_t marked_bytes() { return _marked_bytes; }
size_t marked_bytes() { return _marked_words * HeapWordSize; }

// Iterate over the live objects in the region to find self-forwarded objects
// that need to be kept live. We need to update the remembered sets of these
@@ -96,7 +96,7 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
}
size_t obj_size = obj->size();

_marked_bytes += (obj_size * HeapWordSize);
_marked_words += obj_size;
PreservedMarks::init_forwarded_mark(obj);

HeapWord* obj_end = obj_addr + obj_size;

1 comment on commit c1e41fe

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on c1e41fe Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.