hotspot/test/compiler/tiered/TieredLevelsTest.java
author serb
Fri, 18 Apr 2014 20:10:39 +0400
changeset 24521 97047c850d31
parent 23207 fc39038d37dc
child 25379 d50969e81568
permissions -rw-r--r--
8026252: [macosx] Change AWT_DEBUG_BUG_REPORT_MESSAGE for macosx platform Reviewed-by: azvegint, pchelko
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21090
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     1
/*
23207
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 22214
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
21090
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     4
 *
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     8
 *
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    14
 *
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    18
 *
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    21
 * questions.
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    22
 */
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    23
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    24
/**
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    25
 * @test TieredLevelsTest
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    26
 * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    27
 * @build TieredLevelsTest
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    28
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    29
 * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    30
 *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21090
diff changeset
    31
 *                   -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
21090
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    32
 *                   TieredLevelsTest
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    33
 * @summary Verify that all levels < 'TieredStopAtLevel' can be used
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    34
 * @author igor.ignatyev@oracle.com
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    35
 */
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    36
public class TieredLevelsTest extends CompLevelsTest {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    37
    public static void main(String[] args) throws Exception {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    38
        if (!TIERED_COMPILATION) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    39
            System.err.println("Test isn't applicable w/ disabled "
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    40
                    + "TieredCompilation. Skip test.");
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    41
            return;
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    42
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21090
diff changeset
    43
        CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
21090
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    44
    }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    45
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    46
    private TieredLevelsTest(TestCase testCase) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    47
        super(testCase);
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    48
        // to prevent inlining of #method
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    49
        WHITE_BOX.testSetDontInlineMethod(method, true);
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    50
    }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    51
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    52
    @Override
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    53
    protected void test() throws Exception {
23207
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 22214
diff changeset
    54
        if (skipXcompOSR()) {
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 22214
diff changeset
    55
          return;
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 22214
diff changeset
    56
        }
21090
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    57
        checkNotCompiled();
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    58
        compile();
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    59
        checkCompiled();
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    60
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    61
        int compLevel = getCompLevel();
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    62
        if (compLevel > TIERED_STOP_AT_LEVEL) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    63
            throw new RuntimeException("method.compLevel[" + compLevel
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    64
                    + "] > TieredStopAtLevel [" + TIERED_STOP_AT_LEVEL + "]");
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    65
        }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    66
        int bci = WHITE_BOX.getMethodEntryBci(method);
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    67
        deoptimize();
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    68
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    69
        for (int testedTier = 1; testedTier <= TIERED_STOP_AT_LEVEL;
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    70
                ++testedTier) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    71
            testAvailableLevel(testedTier, bci);
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    72
        }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    73
        for (int testedTier = TIERED_STOP_AT_LEVEL + 1;
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    74
                testedTier <= COMP_LEVEL_MAX; ++testedTier) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    75
            testUnavailableLevel(testedTier, bci);
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    76
        }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    77
    }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    78
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    79
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    80
    @Override
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    81
    protected void checkLevel(int expected, int actual) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    82
        if (expected == COMP_LEVEL_FULL_PROFILE
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    83
                && actual == COMP_LEVEL_LIMITED_PROFILE) {
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    84
            // for simple method full_profile may be replaced by limited_profile
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    85
            return;
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    86
        }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    87
        super.checkLevel(expected, actual);
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    88
   }
345ca798bcde 8026414: [TESTBUG] Tests for Tiered/NonTiered levels
iignatyev
parents:
diff changeset
    89
}