RFR: 8272579: G1: remove unnecesary null check in G1ParScanThreadStateSet::flush

Stefan Johansson sjohanss at openjdk.java.net
Wed Aug 18 12:51:24 UTC 2021


On Tue, 17 Aug 2021 14:38:09 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Simple change of replacing a null-check with an assertion.
> 
> Test: hotspot_gc

src/hotspot/share/gc/g1/g1ParScanThreadState.cpp line 561:

> 559:   for (uint worker_id = 0; worker_id < _n_workers; ++worker_id) {
> 560:     G1ParScanThreadState* pss = _states[worker_id];
> 561:     assert(pss != nullptr, "must be initialized");

Is it guaranteed that all workers are initialized? As you state in the bug, they are lazily initialized, so I wonder if there are use cases where a worker would not get initialized during the collection. Something like, very little work and a lot of workers. 

If there is a guarantee here, does it hold below in `record_unused_optional_region()` as well? We are using the same construct with `continue`there.

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

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



More information about the hotspot-gc-dev mailing list