|
1 /* |
|
2 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 8231565 |
|
27 * @summary Node estimate for loop rotate is not correct/sufficient: |
|
28 * assert(delta <= 2 * required) failed: Bad node estimate ... |
|
29 * |
|
30 * @requires !vm.graal.enabled |
|
31 * |
|
32 * @run main/othervm -XX:PartialPeelNewPhiDelta=5 LoopRotateBadNodeBudget |
|
33 * @run main/othervm -Xbatch -XX:PartialPeelNewPhiDelta=5 LoopRotateBadNodeBudget |
|
34 * |
|
35 * @run main/othervm LoopRotateBadNodeBudget |
|
36 * @run main/othervm -Xbatch LoopRotateBadNodeBudget |
|
37 * |
|
38 * NOTE: Test-case seldom manifesting the problem on fast machines. |
|
39 */ |
|
40 |
|
41 public class LoopRotateBadNodeBudget { |
|
42 |
|
43 int h; |
|
44 float j(int a, int b) { |
|
45 double d = 0.19881; |
|
46 int c, e[] = new int[9]; |
|
47 c = 1; |
|
48 while (++c < 12) |
|
49 switch ((c % 7 * 5) + 122) { |
|
50 case 156: |
|
51 case 46128: |
|
52 case 135: |
|
53 case 148: |
|
54 case 127: |
|
55 break; |
|
56 default: |
|
57 } |
|
58 while ((d += 2) < 62) |
|
59 ; |
|
60 long k = l(e); |
|
61 return k; |
|
62 } |
|
63 long l(int[] a) { |
|
64 long m = 0; |
|
65 for (int i = 0; i < a.length; i++) |
|
66 m = a[i]; |
|
67 return m; |
|
68 } |
|
69 void f(String[] g) { |
|
70 int i = 2; |
|
71 for (; i < 20000; ++i) |
|
72 j(3, h); |
|
73 } |
|
74 public static void main(String[] o) { |
|
75 try { |
|
76 LoopRotateBadNodeBudget n = new LoopRotateBadNodeBudget(); |
|
77 n.f(o); |
|
78 } catch (Exception ex) { |
|
79 } |
|
80 } |
|
81 } |