RFR: 8255070: Shenandoah: use single thread for concurrent CLD liveness test

Roman Kennke rkennke at openjdk.java.net
Wed Oct 21 12:55:20 UTC 2020


On Tue, 20 Oct 2020 23:48:58 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> Since the concurrent liveness test does not touch any oops, there is no point to use multi-thread for the task, they just duplicate the work.
> 
> Also, multi-thread version requires to acquire ClassLoaderGraph_lock early, which is deadlock prone.

Also, I'd change the commit message to begin uppercase after Shenandoah: "Use..."

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp line 112:

> 110:       ClassLoaderDataGraph::always_strong_cld_do(clds);
> 111:     }
> 112:   } else if (_semaphore.try_acquire()) {

It looks to me that we do:
if (_semaphore.try_acquire()) {

in both branches now. Can this be reshaped to do try_acquire() and claim_all() outermost?

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp line 134:

> 132:       ClassLoaderDataGraph::cld_do(clds);
> 133:     }
> 134:   } else if (_semaphore.try_acquire()) {

Same as above. Also, the only difference to above is cld_do() vs always_strong_cld_do(), with *lots* of identical boilerplate. Can this be refactored into a generic method that takes the final target method as argument?

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

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



More information about the hotspot-gc-dev mailing list