[8u] RFR: JDK-8141551: C2 can not handle returns with incompatible interface arrays

Shafi Ahmad shafi.s.ahmad at oracle.com
Mon Apr 18 14:23:26 UTC 2016


Thanks Volker for looking into it. I have run jprt test but haven't verify whether this test is executed under jprt or not. Should I verify whether this test is picked up by jprt run or not?
 
This change is done on top of the fix of https://bugs.openjdk.java.net/browse/JDK-8055530. For this I have already sent other RFR http://mail.openjdk.java.net/pipermail/hotspot-dev/2016-April/022714.html.

shafi at shafi-ahmad:~/Java/jdk8/jdk8u-dev/hotspot$ hg import y
applying y
patching file src/share/vm/opto/parse1.cpp
Hunk #2 FAILED at 2148
1 out of 2 hunks FAILED -- saving rejects to file src/share/vm/opto/parse1.cpp.rej
abort: patch failed to apply

shafi at shafi-ahmad:~/Java/jdk8/jdk8u-dev/hotspot$ cat src/share/vm/opto/parse1.cpp.rej
--- parse1.cpp
+++ parse1.cpp
@@ -2144,15 +2149,24 @@
     // here.
     Node* phi = _exits.argument(0);
     const TypeInstPtr *tr = phi->bottom_type()->isa_instptr();
-    if( tr && tr->klass()->is_loaded() &&
-        tr->klass()->is_interface() ) {
+    if (tr && tr->klass()->is_loaded() &&
+        tr->klass()->is_interface()) {
       const TypeInstPtr *tp = value->bottom_type()->isa_instptr();
       if (tp && tp->klass()->is_loaded() &&
           !tp->klass()->is_interface()) {
         // sharpen the type eagerly; this eases certain assert checking
         if (tp->higher_equal(TypeInstPtr::NOTNULL))
           tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr();
-        value = _gvn.transform(new CheckCastPPNode(0,value,tr));
+        value = _gvn.transform(new CheckCastPPNode(0, value, tr));
+      }
+    } else {
+      // Also handle returns of oop-arrays to an arrays-of-interface return
+      const TypeInstPtr* phi_tip;
+      const TypeInstPtr* val_tip;
+      Type::get_arrays_base_elements(phi->bottom_type(), value->bottom_type(), &phi_tip, &val_tip);
+      if (phi_tip != NULL && phi_tip->is_loaded() && phi_tip->klass()->is_interface() &&
+          val_tip != NULL && val_tip->is_loaded() && !val_tip->klass()->is_interface()) {
+        value = _gvn.transform(new CheckCastPPNode(0, value, phi->bottom_type()));
       }
     }
     phi->add_req(value);

Also I was getting compilation error due to line " value = _gvn.transform(new CheckCastPPNode(0, value, tr));" So I have changed it to "value = _gvn.transform(new (C) CheckCastPPNode(0, value, tr));"

Similar change is done for line " value = _gvn.transform(new CheckCastPPNode(0, value, phi->bottom_type()));".


Regards,
Shafi  

-----Original Message-----
From: Volker Simonis [mailto:volker.simonis at gmail.com] 
Sent: Monday, April 18, 2016 6:09 PM
To: Shafi Ahmad
Cc: HotSpot Open Source Developers
Subject: Re: [8u] RFR: JDK-8141551: C2 can not handle returns with incompatible interface arrays

Hi Shafi,

please not that I'm not a formal jdk8u reviewer.

The change to the source files looks good. Where did the change not applied cleanly?

I'm only a little worried about the test because it uses the '@modules' tag. But if it runs and executed fine with jdk8u it's fine.

Thanks for backporting this to jdk8,
Volker


On Mon, Apr 18, 2016 at 12:26 PM, Shafi Ahmad <shafi.s.ahmad at oracle.com> wrote:
> Hi,
>
>
>
> Please review the backport of bug: "JDK-8141551: C2 can not handle returns with incompatible interface arrays" to jdk8u.
>
> Please note the backport is not clean.
>
>
>
> Webrev: http://cr.openjdk.java.net/~rpatil/8141551/webrev.00/
>
> Jdk9 bug: https://bugs.openjdk.java.net/browse/JDK-8141551
>
> Original patch pushed to jdk9: 
> http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/b425a78e8512
>
>
>
> Test:  Run jprt.
>
>
>
> Regards,
>
> Shafi
>
>


More information about the hotspot-dev mailing list