RFR: Refix ShenandoahPurgeSATBTask

Roman Kennke rkennke at openjdk.java.net
Mon Apr 12 15:38:55 UTC 2021


On Tue, 23 Mar 2021 17:45:17 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> My early fix was incomplete and incorrect.
> 
> 1) ShenandoahPurgeSATBTask needs to change thread claim token for iterating threads in parallel, this was missing in early change.
> 2) Threads::threads_do() -> Threads::possibly_parallel_threads_do() was incorrect, the later version only iterates Java and VM threads. This part of changes are reverted.
> 3) A minor change: declaring _trashed_oops as volatile as it is a shared variable.

Looks good, only a minor thing about shared access to _trashed_oops.

src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp line 99:

> 97: 
> 98: public:
> 99:   volatile size_t _trashed_oops;

If it the intention is to make shared access to the field safe, then C++ volatile does not (fully) achieve this. You also need to use Atomic::inc() and similar to change/read it.

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

Marked as reviewed by rkennke (Reviewer).

PR: https://git.openjdk.java.net/shenandoah/pull/25


More information about the shenandoah-dev mailing list