RFR: 8314629: Generational ZGC: Clearing All SoftReferences log line lacks GCId
Guoxiong Li
gli at openjdk.org
Fri Dec 29 04:36:50 UTC 2023
On Thu, 28 Dec 2023 17:08:05 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
> I think I would prefer if the function that sets the soft ref policy just didn't log anything, and we put the logging statement separately where we want it instead. That way I think we can get the log we want without having to change the behaviour. What do you think?
If we don't log in the method `ZReferenceProcessor::set_soft_reference_policy` and delay the log to a later stage, such as refenrence processing stage, it is hard to get the information about whether we should clear all the soft references. What we can do is judge whether the field `ZReferenceProcessor::_soft_reference_policy` is `AlwaysClearPolicy` or not. Such judgement looks much like RTTI [1] which is disabled in hotspot. In order to obey the dev rule, we can add a virtual method, may named `kind`, to the class `ReferencePolicy` and its subclasses which can avoid RTTI and can judge their types (just like the method `CollectedHeap::kind`). Is my understanding right? If so, it seems not worth to add such method only in order to output one line log.
[1] https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md#rtti-runtime-type-information
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17196#issuecomment-1871721687
More information about the hotspot-gc-dev
mailing list