RFR: 8290357: Drop HeapRegion::marked_bytes()

Thomas Schatzl tschatzl at openjdk.org
Fri Jul 15 11:15:39 UTC 2022


On Fri, 15 Jul 2022 11:06:27 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   please review this removal of the `HeapRegion::_marked_bytes` member that records the bytes marked below tams in the recent mark as it is not really interesting in the removed places. I added comments to give reasons for this removal in the particular places for your review.
> 
> Testing: jtreg gc/g1, gha
> 
> Thanks,
>   Thomas

src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp line 90:

> 88: 
> 89:     void assert_marked_words(HeapRegion* hr) {
> 90:       assert((_marked_words * HeapWordSize) == hr->marked_bytes(),

This use is for verification/debugging only and has been suggested to remove (the `_marked_words` member) here during review of the single bitmap change.

src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp line 76:

> 74:                                   BOOL_TO_STR(selected_for_rebuild),
> 75:                                   live_bytes,
> 76:                                   r->marked_bytes(),

At this point (scrubbing start) `marked_bytes()` contain the amount of marked bytes in the _previous_ marking. This is not particularly interesting to see; `live_bytes` contains the current marked bytes below tams and is printed.

src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp line 441:

> 439: 
> 440:   void account_failed_region(HeapRegion* r) {
> 441:     size_t used_words = r->marked_bytes() / HeapWordSize;

At this point, for evacuation failure regions, `marked_bytes() == live_bytes()` so it can be replaced without any change.

src/hotspot/share/prims/whitebox.cpp line 607:

> 605:   bool do_heap_region(HeapRegion* r) {
> 606:     if (r->is_old()) {
> 607:       size_t prev_live = r->marked_bytes();

I do not think this has ever been intended (this is the marked bytes below TAMS, not including bytes between TAMS and top()), and for a lower estimate of amount of bytes reclaimed, `live_bytes()` is as good or better.

-------------

PR: https://git.openjdk.org/jdk/pull/9511


More information about the hotspot-dev mailing list