hotspot/test/compiler/intrinsics/multiplytolen/TestMultiplyToLenReturnProfile.java
author fzhinkin
Fri, 12 Dec 2014 21:37:37 +0300
changeset 28181 ce5d307551ea
parent 26801 1b8204b516f5
permissions -rw-r--r--
8066862: TestMutuallyExclusivePlatformPredicates fails on all platforms Reviewed-by: iignatyev, kvn
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
/**
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    26
 * @test
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    27
 * @bug 8057758
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    28
 * @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
    29
 * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 TestMultiplyToLenReturnProfile
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    30
 *
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    31
 */
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    32
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    33
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    34
import java.math.*;
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    35
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    36
public class TestMultiplyToLenReturnProfile {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    37
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    38
    static BigInteger m(BigInteger i1, BigInteger i2) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    39
        BigInteger res = BigInteger.valueOf(0);
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    40
        for (int i = 0; i < 100; i++) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    41
            res.add(i1.multiply(i2));
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    42
        }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    43
        return res;
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    44
    }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    45
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    46
    static public void main(String[] args) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    47
        BigInteger v = BigInteger.valueOf(Integer.MAX_VALUE).pow(2);
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    48
        for (int i = 0; i < 20000; i++) {
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    49
            m(v, v.add(BigInteger.valueOf(1)));
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    50
        }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    51
    }
1b8204b516f5 8058636: test case for 8057758
roland
parents:
diff changeset
    52
}