RFR (XS): C2: Missing matrix update for getAndSet intrinsic

Roman Kennke rkennke at redhat.com
Tue Mar 14 12:55:21 UTC 2017


Am 14.03.2017 um 13:05 schrieb Aleksey Shipilev:
> Hi,
>
> getAndSet jcstress tests like
> tests.atomicity.varHandles.fields.GetAndSetTest.GetAndSetString are failing with
> +ShenandoahMatrix.
>
> The failure goes like this: for current barrier set, can_move_pre_barrier is
> true. Which moves the pre_barrier *after* the store, which then misses newval,
> because pre_barrier is called with NULL!
>
> The easiest fix is to avoid moving pre_barriers when matrix update is in order:
>   http://cr.openjdk.java.net/~shade/shenandoah/matrix-getandset/webrev.01/
>
> I failed to create a standalone reproducer, but jcstress seems happy now.
>
> Testing: hotspot_gc_shenandoah, offending jcstress tests
>
> Thanks,
> -Aleksey
>
It might be better to simply call it with newval != NULL. I suspect that
blocking can_move_pre_barrier() might prevent some optimizations, for
example, getAndSet() pre-barrier doesn't actually need to load the
pre-value when executed after the fact. And it also affects other
intrinsics than getAndSet(). IIRC from my i-u work (where I also changed
all the pre-barriers to get called with newval != NULL), there is an
asserts in the g1 pre-barrier code that will complain when do_load ==
false and newval != NULL, but otherwise it should have no negative effect.

Roman



More information about the shenandoah-dev mailing list