RFR: 8376839: GenShen: Improve performance of evacuations into the old generation

William Kemper wkemper at openjdk.org
Mon Feb 2 17:26:14 UTC 2026


On Sat, 31 Jan 2026 00:52:29 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> When GenShen evacuates an object into the old generation, it also dirties the card for that object and updates the offsets of the first and last object in the card. In many cases, the same card may dirtied repeatedly and the object starts updated unnecessarily. We can reduce the total amount of work by moving these operations into a separate phase of the cycle which allows them to be batched.
>
> src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp line 223:
> 
>> 221:       }
>> 222: 
>> 223:       current_card_index = object_card_index;
> 
> IIUC, I believe current_card_index corresponds to previous_offset and previous_address in the next iteration of this loop.  For clarity in naming of variables, would it make sense to call this "previous_card_index"?

Yes, will do.

> src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp line 234:
> 
>> 232: 
>> 233:     const oop obj = cast_to_oop(address);
>> 234:     address += obj->oop_iterate_size(&make_cards_dirty);
> 
> It feels to me like this code will still redundantly mark a card dirty for as many objects as touch this card.  Wouldn't it be faster to have a single call outside this loop to mark all cards dirty in the range from address to end?

I tested that configuration, but the results may have been distorted by my instrumentation. I will rerun that comparison without so much instrumentation.

> src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp line 238:
> 
>> 236: 
>> 237:   // Register the last object seen in this range.
>> 238:   set_last_start(current_card_index, previous_offset);
> 
> It seems this statement should only be executed if previous_address != nullptr

That is correct, will fix.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29511#discussion_r2755450701
PR Review Comment: https://git.openjdk.org/jdk/pull/29511#discussion_r2755448659
PR Review Comment: https://git.openjdk.org/jdk/pull/29511#discussion_r2755451417


More information about the shenandoah-dev mailing list