RFR: 8265759: Shenandoah: Avoid race for referent in assert

Aleksey Shipilev shade at openjdk.java.net
Thu Apr 22 16:39:23 UTC 2021


On Thu, 22 Apr 2021 15:17:25 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> There is an assert is ShenandoahReferenceProcessor::drop() which is racy: when referent is concurrently cleaned it may enter mark-bit-map with NULL even though we just checked that the referent is not NULL.
> 
> Testing:
>  - [x] hotspot_gc_shenandoah

Looks good! Minor nit:

src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp line 392:

> 390:   oop referent = reference_referent<T>(reference);
> 391:   assert(referent == NULL ||
> 392:          ShenandoahHeap::heap()->marking_context()->is_marked(referent), "only drop references with alive referents");

I would prefer it to be line-broken like this: 

assert(referent == NULL || ShenandoahHeap::heap()->marking_context()->is_marked(referent), 
       "only drop references with alive referents");

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

Marked as reviewed by shade (Reviewer).

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



More information about the hotspot-gc-dev mailing list