RFR: 8269596: Snapshot soft ref policy before marking/copying

Thomas Schatzl tschatzl at openjdk.java.net
Thu Jul 1 10:07:02 UTC 2021


On Tue, 29 Jun 2021 14:58:10 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Set up soft ref policy before marking/copying for Serial, Parallel and G1. With this change, all collectors do soft-ref policy setup in the beginning of a GC cycle.

Would it be useful to only call the soft ref policy setup via `setup_policy()` when it is (potentially) set to `true`? I.e. only during full gc, and call `setup_policy(false)` afterwards, maybe with a scope object?
This would remove the unnecessary calls with `false` as argument completely in the places where we never actually change it (e.g. for the G1 concurrent mark ref processor), and emphasize for the stw full gc collectors that they are the only ones eventually change it to "always clearing".

Also the sequence

reference_processor()->enable_discovery();
reference_processor()->setup_policy(<some value>);

should be merged into a single call as there are like five places now where both are called one after another.

In `psParallelCompact.cpp`, the `marked_for_unloading` local right after these calls could be removed too, it's unused.

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

Changes requested by tschatzl (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4624


More information about the hotspot-gc-dev mailing list