Fri, 24 Feb 2017 09:04:04 -0800
Merge
.hgtags | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Tue Feb 07 15:30:33 2017 -0800 1.2 +++ b/.hgtags Fri Feb 24 09:04:04 2017 -0800 1.3 @@ -956,3 +956,5 @@ 1.4 dab1d597165207e14b6886b1823c1e990bc776a3 jdk8u131-b04 1.5 c965fc1aa840a0903709ad69aa0e2100330ccd84 jdk8u131-b05 1.6 6e4cfbc7534f83902692132efb61683528c04a59 jdk8u131-b06 1.7 +5b3cb4fbdbc7bdeb7c78a8703c3084ce068f6691 jdk8u131-b07 1.8 +db221c0a423e776bec5c3198d11d3f26827bd786 jdk8u131-b08
2.1 --- a/src/share/vm/opto/loopnode.cpp Tue Feb 07 15:30:33 2017 -0800 2.2 +++ b/src/share/vm/opto/loopnode.cpp Fri Feb 24 09:04:04 2017 -0800 2.3 @@ -278,8 +278,16 @@ 2.4 return false; 2.5 2.6 // Allow funny placement of Safepoint 2.7 - if (back_control->Opcode() == Op_SafePoint) 2.8 + if (back_control->Opcode() == Op_SafePoint) { 2.9 + if (UseCountedLoopSafepoints) { 2.10 + // Leaving the safepoint on the backedge and creating a 2.11 + // CountedLoop will confuse optimizations. We can't move the 2.12 + // safepoint around because its jvm state wouldn't match a new 2.13 + // location. Give up on that loop. 2.14 + return false; 2.15 + } 2.16 back_control = back_control->in(TypeFunc::Control); 2.17 + } 2.18 2.19 // Controlling test for loop 2.20 Node *iftrue = back_control;
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java Fri Feb 24 09:04:04 2017 -0800 3.3 @@ -0,0 +1,52 @@ 3.4 +/* 3.5 + * Copyright (c) 2016, Red Hat, Inc. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/** 3.28 + * @test 3.29 + * @bug 8161147 3.30 + * @summary Safepoint on backedge breaks UseCountedLoopSafepoints 3.31 + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge 3.32 + * 3.33 + */ 3.34 + 3.35 +public class TestCountedLoopSafepointBackedge { 3.36 + static void test(int[] arr, int inc) { 3.37 + int i = 0; 3.38 + for (;;) { 3.39 + for (int j = 0; j < 10; j++); 3.40 + arr[i] = i; 3.41 + i++; 3.42 + if (i >= 100) { 3.43 + break; 3.44 + } 3.45 + for (int j = 0; j < 10; j++); 3.46 + } 3.47 + } 3.48 + 3.49 + static public void main(String[] args) { 3.50 + int[] arr = new int[100]; 3.51 + for (int i = 0; i < 20000; i++) { 3.52 + test(arr, 1); 3.53 + } 3.54 + } 3.55 +}