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

Guoxiong Li gli at openjdk.org
Tue Jun 6 16:26:44 UTC 2023


On Tue, 6 Jun 2023 13:32:49 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> 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.
>
>> I don't see other places to set it to true in Serial GC
> 
> `set_should_clear_all_soft_refs(true)` in `WB_FullGC`.

The `WB_FullGC` is just test code. I have several problems. If the test code wants the GC to clear all soft references (`set_should_clear_all_soft_refs(true)` in `WB_FullGC`), why do we set it to `false` again? If we have a reason to set it to `false` again, why do other GCs not set it (Why is `SoftRefGenPolicy` only used at Serial GC?).

> // 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.

>From the comment, the intent of the method `SoftRefGenPolicy::cleared_all_soft_refs` is letting the next GC re-clear the soft reference if **near gc overhear limit**. But the Serial GC has no gc overhear limit check now. So I still think it is just a leftover of CMS.

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

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


More information about the hotspot-gc-dev mailing list