RFR: 8335493: ClearedAllSoftRefs::~ClearedAllSoftRefs should reset SoftRefPolicy::_should_clear_all_soft_refs

Liang Mao lmao at openjdk.org
Wed Jul 3 10:33:20 UTC 2024


On Wed, 3 Jul 2024 10:18:01 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> In `PSParallelCompact::invoke_no_policy`, the structure is essentially:
> 
> ```
> {
>   ClearedAllSoftRefs ...
>   check_gc_overhead_limit; // set-to-true
> }
> ```
> 
> The destructor (as in this PR) would cancel out the clear-soft-ref in the upcoming GCs.
> 
> > the sucessful full gc
> 
> When does "unsuccessful" full-gc occur?

Thanks, I see. Do you think reset should_clear_all_soft_refs in constructor of ClearedAllSoftRefs is a better way?


   ClearedAllSoftRefs(bool clear_all_soft_refs, SoftRefPolicy* soft_ref_policy) :
     _clear_all_soft_refs(clear_all_soft_refs),
-    _soft_ref_policy(soft_ref_policy) {}
+    _soft_ref_policy(soft_ref_policy) {
+    if (_clear_all_soft_refs) {
+      _soft_ref_policy->set_should_clear_all_soft_refs(false);
+    }
+  }

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

PR Comment: https://git.openjdk.org/jdk/pull/19982#issuecomment-2205740827


More information about the hotspot-gc-dev mailing list