RFR: 8304716: Clean up G1Policy::calc_max_old_cset_length()

Albert Mingkun Yang ayang at openjdk.org
Wed Mar 22 18:31:11 UTC 2023


On Wed, 22 Mar 2023 16:48:52 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   please review this simplification of `G1Policy::calc_max_old_cset_length()`. It does not seem important to be clever here.
> 
> Depends on #13147.
> 
> Testing: gha
> 
> Thanks,
>   Thomas

Marked as reviewed by ayang (Reviewer).

src/hotspot/share/gc/g1/g1Policy.cpp line 1404:

> 1402:   // of them are available.
> 1403:   // Round up to be conservative.
> 1404:   return (uint)ceil((double)_g1h->num_regions() * (size_t)G1OldCSetRegionThresholdPercent / 100);

The type cast made this line unnecessarily harder to parse. Maybe break into multiple ones? Sth like:


double ratio = ...
double result = ceil(...)
return (uint) result;

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

PR Review: https://git.openjdk.org/jdk/pull/13148#pullrequestreview-1353237863
PR Review Comment: https://git.openjdk.org/jdk/pull/13148#discussion_r1145247361


More information about the hotspot-gc-dev mailing list