changeset 57622:63b524b16e22 lworld

8233124: [lworld] TestBasicFunctionality::test12 fails due to invalid field values after deoptimization
author thartmann
date Tue, 29 Oct 2019 16:55:48 +0100
parents b5a15c0a51ba
children 9ef39f5ef8c4
files src/hotspot/share/opto/macro.cpp test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBasicFunctionality.java
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/macro.cpp	Mon Oct 28 13:18:30 2019 +0100
+++ b/src/hotspot/share/opto/macro.cpp	Tue Oct 29 16:55:48 2019 +0100
@@ -716,7 +716,7 @@
         }
       } else if (use->is_ValueType() && use->isa_ValueType()->get_oop() == res) {
         // ok to eliminate
-      } else if (use->is_Store()) {
+      } else if (use->Opcode() == Op_StoreX && use->in(MemNode::Address) == res) {
         // store to mark work
       } else if (use->Opcode() != Op_CastP2X) { // CastP2X is used by card mark
         if (use->is_Phi()) {
--- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBasicFunctionality.java	Mon Oct 28 13:18:30 2019 +0100
+++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBasicFunctionality.java	Tue Oct 29 16:55:48 2019 +0100
@@ -887,4 +887,23 @@
         int result = test39();
         Asserts.assertEQ(result, 1552);
     }
+
+    // Test scalar replacement of value type array containing value type with oop fields
+    @Test()
+    public long test40(boolean b) {
+        MyValue1[] va = {MyValue1.createWithFieldsInline(rI, rL)};
+        long result = 0;
+        for (int i = 0; i < 1000; ++i) {
+            if (!b) {
+                result = va[0].hash();
+            }
+        }
+        return result;
+    }
+
+    @DontCompile
+    public void test40_verifier(boolean warmup) {
+        long result = test40(warmup);
+        Asserts.assertEQ(result, warmup ? 0 : hash());
+    }
 }