changeset 56265:a3238d454e63 lworld

8230761: [lworld] C2 compilation fails with assert(reg < CHUNK_SIZE) failed
author thartmann
date Mon, 09 Sep 2019 14:59:26 +0200
parents 8bd3c0a77be7
children 665a49692ce0
files src/hotspot/share/opto/matcher.cpp test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java
diffstat 2 files changed, 58 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/matcher.cpp	Sun Sep 08 12:02:55 2019 +0000
+++ b/src/hotspot/share/opto/matcher.cpp	Mon Sep 09 14:59:26 2019 +0200
@@ -507,7 +507,7 @@
 
   // Check if the method has a reserved entry in the argument stack area that
   // should not be used for spilling because it may hold the return address.
-  if (C->method() != NULL && C->method()->has_scalarized_args()) {
+  if (!C->is_osr_compilation() && C->method() != NULL && C->method()->has_scalarized_args()) {
     ExtendedSignature sig_cc = ExtendedSignature(C->method()->get_sig_cc(), SigEntryFilter());
     for (int off = 0; !sig_cc.at_end(); ) {
       BasicType bt = (*sig_cc)._bt;
--- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java	Sun Sep 08 12:02:55 2019 +0000
+++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java	Mon Sep 09 14:59:26 2019 +0200
@@ -200,4 +200,61 @@
     public void test6_verifier(boolean warmup) {
         test6();
     }
+
+    // Similar to test6 but with more fields and reserved stack entry
+    static inline class Test7Value1 {
+        public int i1 = rI;
+        public int i2 = rI;
+        public int i3 = rI;
+        public int i4 = rI;
+        public int i5 = rI;
+        public int i6 = rI;
+    }
+
+    static inline class Test7Value2 {
+        public int i1 = rI;
+        public int i2 = rI;
+        public int i3 = rI;
+        public int i4 = rI;
+        public int i5 = rI;
+        public int i6 = rI;
+        public int i7 = rI;
+        public int i8 = rI;
+        public int i9 = rI;
+        public int i10 = rI;
+        public int i11 = rI;
+        public int i12 = rI;
+        public int i13 = rI;
+        public int i14 = rI;
+        public int i15 = rI;
+        public int i16 = rI;
+        public int i17 = rI;
+        public int i18 = rI;
+        public int i19 = rI;
+        public int i20 = rI;
+        public int i21 = rI;
+
+        public Test7Value1 vt = new Test7Value1();
+
+        public int test(String[] args) {
+            int res = 0;
+            for (int i = 1; i < 20_000; ++i) {
+                res -= i;
+            }
+            return res;
+        }
+    }
+
+    @Test() @Warmup(0) @OSRCompileOnly
+    public void test7() {
+        Test7Value2 tmp = new Test7Value2();
+        for (int i = 0; i < 10; ++i) {
+            tmp.test(null);
+        }
+    }
+
+    @DontCompile
+    public void test7_verifier(boolean warmup) {
+        test7();
+    }
 }