hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 41705 332239c052cc
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:
26801
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     1
/*
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     4
 *
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     8
 *
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    13
 * accompanied this code).
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    14
 *
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    18
 *
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    21
 * questions.
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    22
 */
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    23
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    24
/**
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    25
 * @test
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    26
 * @bug 8057758
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    27
 * @summary MultiplyToLen sets its return type to have a bottom offset which confuses code generation
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 26801
diff changeset
    29
 * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 26801
diff changeset
    30
 *      -XX:TypeProfileLevel=222
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 26801
diff changeset
    31
 *      compiler.intrinsics.bigInteger.TestMultiplyToLenReturnProfile
26801
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    32
 */
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    33
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 26801
diff changeset
    34
package compiler.intrinsics.bigInteger;
26801
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    35
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 26801
diff changeset
    36
import java.math.BigInteger;
26801
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    37
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    38
public class TestMultiplyToLenReturnProfile {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    39
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    40
    static BigInteger m(BigInteger i1, BigInteger i2) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    41
        BigInteger res = BigInteger.valueOf(0);
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    42
        for (int i = 0; i < 100; i++) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    43
            res.add(i1.multiply(i2));
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    44
        }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    45
        return res;
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    46
    }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    47
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    48
    static public void main(String[] args) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    49
        BigInteger v = BigInteger.valueOf(Integer.MAX_VALUE).pow(2);
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    50
        for (int i = 0; i < 20000; i++) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    51
            m(v, v.add(BigInteger.valueOf(1)));
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    52
        }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    53
    }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    54
}