author | stsmirno |
Mon, 17 Oct 2016 18:54:12 -0400 | |
changeset 41705 | 332239c052cc |
parent 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
29344
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
1 |
/* |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
4 |
* |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
8 |
* |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
13 |
* accompanied this code). |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
14 |
* |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
18 |
* |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
21 |
* questions. |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
22 |
*/ |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
23 |
|
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
24 |
/** |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
25 |
* @test |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
26 |
* @bug 8073184 |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
27 |
* @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
28 |
* |
40059 | 29 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp |
30 |
* -XX:CompileCommand=compileonly,compiler.loopopts.TestCastIINoLoopLimitCheck::m |
|
31 |
* compiler.loopopts.TestCastIINoLoopLimitCheck |
|
29344
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
32 |
*/ |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
33 |
|
40059 | 34 |
package compiler.loopopts; |
37287
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
35 |
/* |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
36 |
* The test was originally run with |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
37 |
* |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
38 |
* -XX:+UnlockDiagnosticVMOptions -XX:-LoopLimitCheck |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
39 |
* |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
40 |
* to trigger a problem with code guarded with !LoopLimitCheck. |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
41 |
* JDK-8072422 has removed that code but kept the test because the |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
42 |
* test generates an interesting graph shape. |
c2660335bf81
8072422: Cleanup: Remove some unused flags/code in loop optimizations
zmajo
parents:
34254
diff
changeset
|
43 |
*/ |
29344
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
44 |
public class TestCastIINoLoopLimitCheck { |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
45 |
|
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
46 |
static void m(int i, int index, char[] buf) { |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
47 |
while (i >= 65536) { |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
48 |
i = i / 100; |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
49 |
buf [--index] = 0; |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
50 |
buf [--index] = 1; |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
51 |
} |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
52 |
} |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
53 |
|
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
54 |
static public void main(String[] args) { |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
55 |
m(0, 0, null); |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
56 |
} |
49ad0989c84f
8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff
changeset
|
57 |
} |