RFR: 8337642: Serial: Remove redundant counter update in DefNewGeneration::gc_epilogue

Albert Mingkun Yang ayang at openjdk.org
Mon Aug 5 08:04:30 UTC 2024


On Fri, 2 Aug 2024 07:41:14 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> so that would run counter to the intent of such generic API about handling

One can view `GCPolicyCounters` as a plain data-structure with only getters. The only two non-getter methods are the empty `update_counters` and the unused `kind`. If both are removed, `GCPolicyCounters` doesn't expose any action-related APIs any more.

> one can be sure that everything is fine as long as you call that update method,

That's a false sense of security. The two actual vars, `_tenuring_threshold` and `_desired_survivor_size`, that requires updating, are updated in two diff places in Serial and G1, after and before young-gc. IOW, diff GCs differ enough so that not exposing an `update` API, i.e. treating `GCPolicyCounters` as plain-old-data, offers more flexibility, IMO.

> Is the single empty call that much of a (performance) issue?

It's more about removing effectively dead code to simplify the logic.

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

PR Comment: https://git.openjdk.org/jdk/pull/20416#issuecomment-2268424338


More information about the hotspot-gc-dev mailing list