Mercurial > hg > truffle
annotate test/compiler/intrinsics/mathexact/NestedMathExactTest.java @ 15331:71cdf5518dab
Use LIRGeneratorTool in NodeLIRBuilder.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 23 Apr 2014 10:39:55 +0200 |
parents | 4ca6dc0799b6 |
children | 52b4284cb496 |
rev | line source |
---|---|
13020
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
1 /* |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
4 * |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
8 * |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
13 * accompanied this code). |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
14 * |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
18 * |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
21 * questions. |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
22 */ |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
23 |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
24 /* |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
25 * @test |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
26 * @bug 8027444 |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
27 * @summary Test nested loops |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
28 * @compile NestedMathExactTest.java |
14909 | 29 * @run main NestedMathExactTest -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseMathExactIntrinsics |
13020
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
30 * |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
31 */ |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
32 |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
33 public class NestedMathExactTest { |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
34 public static final int LIMIT = 100; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
35 public static int[] result = new int[LIMIT]; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
36 public static int value = 17; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
37 |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
38 public static void main(String[] args) { |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
39 for (int i = 0; i < 100; ++i) { |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
40 result[i] = runTest(); |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
41 } |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
42 } |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
43 |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
44 public static int runTest() { |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
45 int sum = 0; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
46 for (int j = 0; j < 100000; j = Math.addExact(j, 1)) { |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
47 sum = 1; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
48 for (int i = 0; i < 5; ++i) { |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
49 sum *= value; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
50 } |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
51 } |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
52 return sum; |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
53 } |
60a32bb8ff99
8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff
changeset
|
54 } |