RFR: 8255534: Shenandoah: Fix CmpP optimization wrt native-LRB

Aleksey Shipilev shade at openjdk.java.net
Wed Oct 28 13:03:46 UTC 2020


On Wed, 28 Oct 2020 12:34:52 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> JDK-8254314 introduced the following code:
> 
>     if (in1->bottom_type() == TypePtr::NULL_PTR &&
>         (in1->Opcode() != Op_ShenandoahLoadReferenceBarrier || !((ShenandoahLoadReferenceBarrierNode*)in1)->is_native())) {
>       in2 = step_over_gc_barrier(in2);
>     }
> 
> However, the check for LRB and !native are the wrong way around: they should check if *in2* are not native LRB.
> 
> The bug is currently only observed in the conc-weakrefs branch, but may manifest (rarely) in mainline too. 
> 
> I am also putting in some refactoring to avoid duped code for good measure.
> 
> Testing: hotspot_gc_shenandoah (also in conc-weakrefs-branch where it manifests)

Changes requested by shade (Reviewer).

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp line 1047:

> 1045: void ShenandoahBarrierSetC2::maybe_step_over_cmpp_inputs(Node*& in1, Node*& in2) const {
> 1046:   if (in1->bottom_type() == TypePtr::NULL_PTR &&
> 1047:       (in2->Opcode() != Op_ShenandoahLoadReferenceBarrier || !((ShenandoahLoadReferenceBarrierNode*)in2)->is_native())) {

Suggestion: let's write this block like:

    // If first input is NULL, then skip the LRB barriers (except native) on the second input
    if (in1->bottom_type() == TypePtr::NULL_PTR &&
        !((in2->Opcode() == Op_ShenandoahLoadReferenceBarrier) &&
          ((ShenandoahLoadReferenceBarrierNode*)in2)->is_native()) {

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp line 1045:

> 1043: #endif
> 1044: 
> 1045: void ShenandoahBarrierSetC2::maybe_step_over_cmpp_inputs(Node*& in1, Node*& in2) const {

`Node*&` or `Node*`?

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

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


More information about the shenandoah-dev mailing list