hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 40059 c2304140ed64
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21208
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
     1
/*
2ae445f57ac6 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.
2ae445f57ac6 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.
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
     4
 *
2ae445f57ac6 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
2ae445f57ac6 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
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
     8
 *
2ae445f57ac6 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
2ae445f57ac6 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
2ae445f57ac6 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
2ae445f57ac6 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
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    13
 * accompanied this code).
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    14
 *
2ae445f57ac6 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
2ae445f57ac6 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,
2ae445f57ac6 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.
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    18
 *
2ae445f57ac6 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
2ae445f57ac6 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
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    21
 * questions.
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    22
 */
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    23
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    24
/*
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    25
 * @test
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    26
 * @bug 8027444
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    27
 * @summary Test nested loops
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 22911
diff changeset
    29
 * @run main compiler.intrinsics.mathexact.NestedMathExactTest
21208
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    30
 */
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    31
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 22911
diff changeset
    32
package compiler.intrinsics.mathexact;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 22911
diff changeset
    33
21208
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    34
public class NestedMathExactTest {
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    35
    public static final int LIMIT = 100;
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    36
    public static int[] result = new int[LIMIT];
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    37
    public static int value = 17;
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    38
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    39
    public static void main(String[] args) {
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    40
        for (int i = 0; i < 100; ++i) {
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    41
            result[i] = runTest();
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    42
        }
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    43
    }
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    44
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    45
    public static int runTest() {
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    46
        int sum = 0;
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    47
        for (int j = 0; j < 100000; j = Math.addExact(j, 1)) {
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    48
            sum = 1;
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    49
            for (int i = 0; i < 5; ++i) {
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    50
                sum *= value;
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    51
            }
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    52
        }
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    53
        return sum;
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    54
    }
2ae445f57ac6 8027444: mathExact: assert(i < _max) failed: oob: i=1, _max=1
rbackman
parents:
diff changeset
    55
}