Tue, 31 Dec 2013 19:26:57 +0400
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
Reviewed-by: twisti
Contributed-by: anton.ivanov@oracle.com
iignatyev@5982 | 1 | /* |
iignatyev@5982 | 2 | * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
iignatyev@5982 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
iignatyev@5982 | 4 | * |
iignatyev@5982 | 5 | * This code is free software; you can redistribute it and/or modify it |
iignatyev@5982 | 6 | * under the terms of the GNU General Public License version 2 only, as |
iignatyev@5982 | 7 | * published by the Free Software Foundation. |
iignatyev@5982 | 8 | * |
iignatyev@5982 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
iignatyev@5982 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
iignatyev@5982 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
iignatyev@5982 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
iignatyev@5982 | 13 | * accompanied this code). |
iignatyev@5982 | 14 | * |
iignatyev@5982 | 15 | * You should have received a copy of the GNU General Public License version |
iignatyev@5982 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
iignatyev@5982 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
iignatyev@5982 | 18 | * |
iignatyev@5982 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
iignatyev@5982 | 20 | * or visit www.oracle.com if you need additional information or have any |
iignatyev@5982 | 21 | * questions. |
iignatyev@5982 | 22 | */ |
iignatyev@5982 | 23 | |
iignatyev@5982 | 24 | import java.util.function.IntPredicate; |
iignatyev@5982 | 25 | |
iignatyev@5982 | 26 | /** |
iignatyev@5982 | 27 | * @test NonTieredLevelsTest |
iignatyev@5982 | 28 | * @library /testlibrary /testlibrary/whitebox /compiler/whitebox |
iignatyev@5982 | 29 | * @build NonTieredLevelsTest |
iignatyev@5982 | 30 | * @run main ClassFileInstaller sun.hotspot.WhiteBox |
iignatyev@5982 | 31 | * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation |
iignatyev@5982 | 32 | * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
iignatyev@6211 | 33 | * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* |
iignatyev@5982 | 34 | * NonTieredLevelsTest |
iignatyev@5982 | 35 | * @summary Verify that only one level can be used |
iignatyev@5982 | 36 | * @author igor.ignatyev@oracle.com |
iignatyev@5982 | 37 | */ |
iignatyev@5982 | 38 | public class NonTieredLevelsTest extends CompLevelsTest { |
iignatyev@5982 | 39 | private static final int AVAILABLE_COMP_LEVEL; |
iignatyev@5982 | 40 | private static final IntPredicate IS_AVAILABLE_COMPLEVEL; |
iignatyev@5982 | 41 | static { |
iignatyev@5982 | 42 | String vmName = System.getProperty("java.vm.name"); |
iignatyev@5982 | 43 | if (vmName.endsWith(" Server VM")) { |
iignatyev@5982 | 44 | AVAILABLE_COMP_LEVEL = COMP_LEVEL_FULL_OPTIMIZATION; |
iignatyev@5982 | 45 | IS_AVAILABLE_COMPLEVEL = x -> x == COMP_LEVEL_FULL_OPTIMIZATION; |
iignatyev@5982 | 46 | } else if (vmName.endsWith(" Client VM") |
iignatyev@5982 | 47 | || vmName.endsWith(" Minimal VM")) { |
iignatyev@5982 | 48 | AVAILABLE_COMP_LEVEL = COMP_LEVEL_SIMPLE; |
iignatyev@5982 | 49 | IS_AVAILABLE_COMPLEVEL = x -> x >= COMP_LEVEL_SIMPLE |
iignatyev@5982 | 50 | && x <= COMP_LEVEL_FULL_PROFILE; |
iignatyev@5982 | 51 | } else { |
iignatyev@5982 | 52 | throw new RuntimeException("Unknown VM: " + vmName); |
iignatyev@5982 | 53 | } |
iignatyev@5982 | 54 | |
iignatyev@5982 | 55 | } |
iignatyev@5982 | 56 | public static void main(String[] args) throws Exception { |
iignatyev@5982 | 57 | if (TIERED_COMPILATION) { |
iignatyev@5982 | 58 | System.err.println("Test isn't applicable w/ enabled " |
iignatyev@5982 | 59 | + "TieredCompilation. Skip test."); |
iignatyev@5982 | 60 | return; |
iignatyev@5982 | 61 | } |
iignatyev@6211 | 62 | CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args); |
iignatyev@5982 | 63 | } |
iignatyev@5982 | 64 | |
iignatyev@5982 | 65 | private NonTieredLevelsTest(TestCase testCase) { |
iignatyev@5982 | 66 | super(testCase); |
iignatyev@5982 | 67 | // to prevent inlining of #method |
iignatyev@5982 | 68 | WHITE_BOX.testSetDontInlineMethod(method, true); |
iignatyev@5982 | 69 | } |
iignatyev@5982 | 70 | |
iignatyev@5982 | 71 | @Override |
iignatyev@5982 | 72 | protected void test() throws Exception { |
iignatyev@5982 | 73 | checkNotCompiled(); |
iignatyev@5982 | 74 | compile(); |
iignatyev@5982 | 75 | checkCompiled(); |
iignatyev@5982 | 76 | |
iignatyev@5982 | 77 | int compLevel = getCompLevel(); |
iignatyev@5982 | 78 | checkLevel(AVAILABLE_COMP_LEVEL, compLevel); |
iignatyev@5982 | 79 | int bci = WHITE_BOX.getMethodEntryBci(method); |
iignatyev@5982 | 80 | deoptimize(); |
iignatyev@6211 | 81 | if (!testCase.isOsr()) { |
iignatyev@5982 | 82 | for (int level = 1; level <= COMP_LEVEL_MAX; ++level) { |
iignatyev@5982 | 83 | if (IS_AVAILABLE_COMPLEVEL.test(level)) { |
iignatyev@5982 | 84 | testAvailableLevel(level, bci); |
iignatyev@5982 | 85 | } else { |
iignatyev@5982 | 86 | testUnavailableLevel(level, bci); |
iignatyev@5982 | 87 | } |
iignatyev@5982 | 88 | } |
iignatyev@5982 | 89 | } else { |
iignatyev@5982 | 90 | System.out.println("skip other levels testing in OSR"); |
iignatyev@5982 | 91 | testAvailableLevel(AVAILABLE_COMP_LEVEL, bci); |
iignatyev@5982 | 92 | } |
iignatyev@5982 | 93 | } |
iignatyev@5982 | 94 | } |
iignatyev@6211 | 95 |