RFR: 8303467: Serial: Refactor reference processor [v2]
Albert Mingkun Yang
ayang at openjdk.org
Fri Mar 3 16:07:38 UTC 2023
On Fri, 3 Mar 2023 15:06:25 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> src/hotspot/share/gc/serial/markSweep.cpp line 246:
>>
>>> 244: MarkSweep::_string_dedup_requests = new StringDedup::Requests();
>>> 245:
>>> 246: static AlwaysTrueClosure always_true;
>>
>> Please put this static into the class as static class member; it's very hard to track if statics are put into random places.
>> Why we can use `AlwaysTrueClosure` here should probably be documented.
>> The reference processor for `MarkSweep` can also be a static, as well as `MarkAndPushClosure` initialized statically with that reference processor.
>
>> Please put this static into the class as static class member; it's very hard to track if statics are put into random places.
>
> This refers to the `AlwaysTrueClosure`.
>
>>Why we can use `AlwaysTrueClosure` here should probably be documented.
>
> Something like: "Mark&Sweep collection covers the whole heap so all objects should be subject to discovery"
>
>>The reference processor for `MarkSweep` can also be a static, as well as `MarkAndPushClosure` initialized statically with that reference processor.
>
> Here I ommitted the important part: `_ref_processor` does not need to be a reference/pointer any more and we can get rid of the new/delete (I think).
Directly embedding `ReferenceProcessor` as a field doesn't work, because its constructor uses static variables (e.g. `_default_soft_ref_policy`) that are lazily initialized.
-------------
PR: https://git.openjdk.org/jdk/pull/12809
More information about the hotspot-gc-dev
mailing list