RFR: 8328626: GenShen: Combine old generation surplus/deficit fields into a single balance field [v2]

William Kemper wkemper at openjdk.org
Mon Mar 25 17:16:52 UTC 2024


On Sat, 23 Mar 2024 02:10:59 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> William Kemper has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fix zero build
>>  - Fix comments
>
> src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp line 242:
> 
>> 240:     // curtailed if the budget is restricted.
>> 241:     old_region_deficit = MIN2(old_region_deficit, max_old_region_xfer);
>> 242:     old_generation()->set_region_balance(0 - checked_cast<ssize_t>(old_region_deficit));
> 
> The code in the if and the else branches is highly isomorphic. I have the feeling you may be able to fold them together, but I am not sure how clean it will be. Also if you start with `ssize_t` for some of the operands that feed into the surplus calculation (or balance if you will, but we can call it surplus wit the understanding that a negative surplus is a deficit), then you may be able to avoid some of the later casts and the signing of unsigned quantities, including the `(cast)x`, `-(cast)x` or `0-(cast)x`constructs above.

I agree the code in the branches is similar, but the APIs we have for managing capacity for a generation will ultimately make us chose old or young for the source or destination of the transfer based on whether `old_region_balance` is positive or negative.

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

PR Review Comment: https://git.openjdk.org/shenandoah/pull/410#discussion_r1537941830


More information about the shenandoah-dev mailing list