changeset 56226:397e474bdb8d lworld

8227452: [lworld][c1] jdk/valhalla/valuetypes/ValueArray.java fails with -Xcomp
author iklam
date Thu, 18 Jul 2019 23:12:11 -0700
parents 45f2f8d86692
children 383439861abd
files src/hotspot/share/c1/c1_Instruction.cpp test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java
diffstat 2 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/c1/c1_Instruction.cpp	Thu Jul 18 13:00:32 2019 -0700
+++ b/src/hotspot/share/c1/c1_Instruction.cpp	Thu Jul 18 23:12:11 2019 -0700
@@ -306,8 +306,12 @@
 
 ciType* NewObjectArray::exact_type() const {
   ciKlass* element_klass = klass();
-  if (is_never_null() && element_klass->is_valuetype() && element_klass->as_value_klass()->flatten_array()) {
-    return ciValueArrayKlass::make(element_klass);
+  if (is_never_null() && element_klass->is_valuetype()) {
+    if (element_klass->as_value_klass()->flatten_array()) {
+      return ciValueArrayKlass::make(element_klass);
+    } else {
+      return ciObjArrayKlass::make(element_klass, /*never_null =*/true);
+    }
   } else {
     return ciObjArrayKlass::make(element_klass);
   }
--- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java	Thu Jul 18 13:00:32 2019 -0700
+++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java	Thu Jul 18 23:12:11 2019 -0700
@@ -1826,4 +1826,29 @@
         MyValue1 v = MyValue1.createWithFieldsInline(rI, rL);
         Asserts.assertEQ(test78(v, 1), v.hash());
     }
+
+
+    @Test
+    public boolean test79() {
+        boolean b = true;
+
+        MyValue1[] qArray = new MyValue1[0];
+        MyValue1?[] lArray = new MyValue1?[0];
+
+        b = b && (qArray instanceof MyValue1[]);
+        b = b && (lArray instanceof MyValue1?[]);
+
+        MyValue1[][] qArray2 = new MyValue1[0][0];
+        MyValue1?[][] lArray2 = new MyValue1?[0][0];
+
+        b = b && (qArray2 instanceof MyValue1[][]);
+        b = b && (lArray2 instanceof MyValue1?[][]);
+
+        return b;
+    }
+
+    @DontCompile
+    public void test79_verifier(boolean warmup) {
+        Asserts.assertEQ(test79(), true);
+    }
 }