changeset 24193:15af9b4ac654

Merge
author asaha
date Fri, 24 Feb 2017 09:14:18 -0800
parents 4649a1517487 (current diff) 59ad72c0e133 (diff)
children fd5901f4b951
files .hgtags
diffstat 3 files changed, 63 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Feb 07 11:16:47 2017 -0800
+++ b/.hgtags	Fri Feb 24 09:14:18 2017 -0800
@@ -952,4 +952,6 @@
 dab1d597165207e14b6886b1823c1e990bc776a3 jdk8u131-b04
 c965fc1aa840a0903709ad69aa0e2100330ccd84 jdk8u131-b05
 6e4cfbc7534f83902692132efb61683528c04a59 jdk8u131-b06
+5b3cb4fbdbc7bdeb7c78a8703c3084ce068f6691 jdk8u131-b07
+db221c0a423e776bec5c3198d11d3f26827bd786 jdk8u131-b08
 692bc6b674dcab72453de08ee9da0856a7e41c0f jdk8u141-b00
--- a/src/share/vm/opto/loopnode.cpp	Tue Feb 07 11:16:47 2017 -0800
+++ b/src/share/vm/opto/loopnode.cpp	Fri Feb 24 09:14:18 2017 -0800
@@ -278,8 +278,16 @@
     return false;
 
   // Allow funny placement of Safepoint
-  if (back_control->Opcode() == Op_SafePoint)
+  if (back_control->Opcode() == Op_SafePoint) {
+    if (UseCountedLoopSafepoints) {
+      // Leaving the safepoint on the backedge and creating a
+      // CountedLoop will confuse optimizations. We can't move the
+      // safepoint around because its jvm state wouldn't match a new
+      // location. Give up on that loop.
+      return false;
+    }
     back_control = back_control->in(TypeFunc::Control);
+  }
 
   // Controlling test for loop
   Node *iftrue = back_control;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java	Fri Feb 24 09:14:18 2017 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8161147
+ * @summary Safepoint on backedge breaks UseCountedLoopSafepoints
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge
+ *
+ */
+
+public class TestCountedLoopSafepointBackedge {
+    static void test(int[] arr, int inc) {
+        int i = 0;
+        for (;;) {
+            for (int j = 0; j < 10; j++);
+            arr[i] = i;
+            i++;
+            if (i >= 100) {
+                break;
+            }
+            for (int j = 0; j < 10; j++);
+        }
+    }
+
+    static public void main(String[] args) {
+        int[] arr = new int[100];
+        for (int i = 0; i < 20000; i++) {
+             test(arr, 1);
+        }
+    }
+}