RFR: 8231672: Simplify the reference processing parallelization framework

Leo Korinth lkorinth at openjdk.java.net
Thu Mar 4 13:49:47 UTC 2021


On Thu, 4 Mar 2021 08:58:47 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> With the change of parallel gc to use the same workgang implementation that other gcs uses, it is possible to remove the abstraction used to hide different worker thread management implementations (TaskExecutor).
>> 
>> At the same time as removing the TaskExecutor, also remove part of the special casing (mostly code duplication), for single threaded execution. 
>> 
>> I consider the new method `prepare_run_task` that modifies the state of the context a step backwards from what was. However, I think removing the Executor with its proxy-tasks and removing separate code paths for serial execution makes the change worth this step back. We also removes ~270 lines of code.
>> 
>> Some comments:
>> 1) I use references in some places where they can replace pointers. I could go much further here, but I did not want to bloat the pull request, maybe later change all closures to be references as well? Should I create enhancements for this?
>> 
>> 2) I added an enum class ThreadModel instead of using a boolean, this could also be used in many more places. I dislike sending lots of bools with a comment like `true /* _is_mt */`. It also adds type safety if a method takes many bools. However, with this limited change, and not many hard-coded bools, it feels a bit overkill and I am willing to remove the enum, what do you think?
>> 
>> Testing:
>> hotspot_gc  and tier 1-3 has passed earlier versions before minor cleanups. I intend to re-run tests after review changes.
>
> src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 1534:
> 
>> 1532:     active_workers = clamp(active_workers, 1u, _max_num_tasks);
>> 1533: 
>> 1534:     // reference processing context.
> 
> Initial capitalization.

I just remove the comment, it only add noise.

> src/hotspot/share/gc/g1/g1FullCollector.cpp line 232:
> 
>> 230: }
>> 231: 
>> 232: class G1FullRefProcClosureContext : public AbstractClosureContext {
> 
> Please add "GC" after "Full" because this naming begs the question what a "partial" context would look like.

I will do that.

> src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 1494:
> 
>> 1492:     return ::new (&_keep_alive[index(worker_id, _tm)]) G1CMKeepAliveAndDrainClosure(&_cm, _cm.task(index(worker_id, _tm)), _tm == ThreadModel::Single );
>> 1493:   }
>> 1494:   VoidClosure* complete_gc(uint worker_id)    {
> 
> Inconsistent spacing between methods, sometimes there is a newline, sometimes not. I would prefer the additional newline. This is also the case in the other file.

I will do that.

> src/hotspot/share/gc/parallel/psParallelCompact.cpp line 2125:
> 
>> 2123:     return ::new (&_keep_alive[worker_id]) PCMarkAndPushClosure(cm);
>> 2124:   }
>> 2125:   VoidClosure* complete_gc(uint worker_id) {
> 
> Newline between method definitions.

I will do that.

> src/hotspot/share/gc/g1/g1FullCollector.cpp line 246:
> 
>> 244:     FREE_C_HEAP_ARRAY(G1FullKeepAliveClosure, _keep_alive);
>> 245:   }
>> 246:   BoolObjectClosure* is_alive(uint worker_id) {
> 
> Newlines between definitions.

I will do that.

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

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



More information about the hotspot-gc-dev mailing list