RFR: 8364767: G1: Remove use of CollectedHeap::_soft_ref_policy

Thomas Schatzl tschatzl at openjdk.org
Wed Aug 6 08:14:04 UTC 2025


On Tue, 5 Aug 2025 18:18:34 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Use gc-cause checking in `VM_G1CollectFull` to decide soft-ref policy.
> 
> Test: tier1-3

The other comment may be handled separately.

src/hotspot/share/gc/g1/g1VMOperations.cpp line 54:

> 52:   GCCauseSetter x(g1h, _gc_cause);
> 53:   bool clear_all_soft_refs = _gc_cause == GCCause::_metadata_GC_clear_soft_refs ||
> 54:                              _gc_cause == GCCause::_wb_full_gc;

Now that three collectors use this, it might be useful to factor this out as a helper function in `CollectedHeap` and use it.

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

Marked as reviewed by tschatzl (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26648#pullrequestreview-3091140646
PR Review Comment: https://git.openjdk.org/jdk/pull/26648#discussion_r2256297755


More information about the hotspot-dev mailing list