RFR: 8277394: Remove the use of safepoint_workers in reference processor

Albert Mingkun Yang ayang at openjdk.java.net
Tue Dec 14 12:17:09 UTC 2021


On Fri, 19 Nov 2021 09:37:44 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Simple change of passing workers to the reference processor constructor.
>> 
>> Test: hotspot_gc
>
> src/hotspot/share/gc/shared/referenceProcessor.hpp line 257:
> 
>> 255: 
>> 256:   // Workers to process the discovered non-strong references.
>> 257:   WorkerThreads* _workers;
> 
> Rather than adding a WorkerThreads member at construction time, it seems better to me to add an argument to ReferenceProcessor::run_task.

When a ref-processor is instantiated, the caller specifies #worker to use for ref-processing. Since #workers and the worker-pool are related, I think it's conceptually cleaner that they are set in the same place.

Using the arg approach would mean that an extra arg has to be passed through `run_task` <- (`process_soft_weak_final_refs` | `process_final_keep_alive` | `process_phantom_refs`) <- `process_discovered_references`; this seems harder to follow where `workers` comes from.

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

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



More information about the hotspot-gc-dev mailing list