RFR: 8309403: Serial: Remove the useless adaptive size policy in GenCollectedHeap

Guoxiong Li gli at openjdk.org
Mon Jun 5 21:05:00 UTC 2023


On Mon, 5 Jun 2023 11:07:11 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Hi all,
>> 
>> This patch removes the useless code related to the `AdaptiveSizePolicy` in `GenCollectedHeap`.
>> As a result, the `SoftRefGenPolicy` is unnecessary too, use `SoftRefPolicy` instead.
>> 
>> Thanks for the review.
>> 
>> Best Regards,
>> -- Guoxiong
>
> src/hotspot/share/gc/shared/softRefGenPolicy.cpp line 36:
> 
>> 34:   AdaptiveSizePolicy* size_policy = GenCollectedHeap::heap()->size_policy();
>> 35:   if (size_policy != nullptr) {
>> 36:     set_should_clear_all_soft_refs(size_policy->gc_overhead_limit_near());
> 
> Why is this call removed? I'd expect `set_should_clear_all_soft_refs(false);` here.

The default value of `_should_clear_all_soft_refs` is `false` and I don't see other places to set it to `true` in Serial GC. And from the comment, I think it is a leftover of CMS.

>  // If near gc overhear limit, continue to clear SoftRefs.  SoftRefs may
>  // have been cleared in the last collection but if the gc overhear
>  // limit continues to be near, SoftRefs should still be cleared.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14296#discussion_r1218590519


More information about the hotspot-gc-dev mailing list