test/compiler/tiered/TieredLevelsTest.java

Thu, 05 Sep 2019 18:52:27 +0800

author
aoqi
date
Thu, 05 Sep 2019 18:52:27 +0800
changeset 9703
2fdf635bcf28
parent 6876
710a3c8b516e
parent 9689
89dcef434423
permissions
-rw-r--r--

Merge

iignatyev@5982 1 /*
iignatyev@6353 2 * Copyright (c) 2013, 2014, 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 /**
iignatyev@5982 25 * @test TieredLevelsTest
iignatyev@5982 26 * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
iignatyev@5982 27 * @build TieredLevelsTest
iignatyev@5982 28 * @run main ClassFileInstaller sun.hotspot.WhiteBox
iignatyev@5982 29 * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
iignatyev@5982 30 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
iignatyev@6211 31 * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
iignatyev@5982 32 * TieredLevelsTest
iignatyev@5982 33 * @summary Verify that all levels < 'TieredStopAtLevel' can be used
iignatyev@5982 34 * @author igor.ignatyev@oracle.com
iignatyev@5982 35 */
iignatyev@5982 36 public class TieredLevelsTest extends CompLevelsTest {
xliu@9689 37 public static void main(String[] args) throws Exception, Throwable {
xliu@9689 38 if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
iignatyev@5982 39 return;
iignatyev@5982 40 }
iignatyev@6211 41 CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
iignatyev@5982 42 }
iignatyev@5982 43
xliu@9689 44 protected TieredLevelsTest(TestCase testCase) {
iignatyev@5982 45 super(testCase);
iignatyev@5982 46 // to prevent inlining of #method
iignatyev@5982 47 WHITE_BOX.testSetDontInlineMethod(method, true);
iignatyev@5982 48 }
iignatyev@5982 49
iignatyev@5982 50 @Override
iignatyev@5982 51 protected void test() throws Exception {
iignatyev@6353 52 if (skipXcompOSR()) {
iignatyev@6353 53 return;
iignatyev@6353 54 }
iignatyev@5982 55 checkNotCompiled();
iignatyev@5982 56 compile();
iignatyev@5982 57 checkCompiled();
iignatyev@5982 58
iignatyev@5982 59 int compLevel = getCompLevel();
iignatyev@5982 60 if (compLevel > TIERED_STOP_AT_LEVEL) {
iignatyev@5982 61 throw new RuntimeException("method.compLevel[" + compLevel
iignatyev@5982 62 + "] > TieredStopAtLevel [" + TIERED_STOP_AT_LEVEL + "]");
iignatyev@5982 63 }
iignatyev@5982 64 int bci = WHITE_BOX.getMethodEntryBci(method);
iignatyev@5982 65 deoptimize();
iignatyev@5982 66
iignatyev@5982 67 for (int testedTier = 1; testedTier <= TIERED_STOP_AT_LEVEL;
iignatyev@5982 68 ++testedTier) {
iignatyev@5982 69 testAvailableLevel(testedTier, bci);
iignatyev@5982 70 }
iignatyev@5982 71 for (int testedTier = TIERED_STOP_AT_LEVEL + 1;
iignatyev@5982 72 testedTier <= COMP_LEVEL_MAX; ++testedTier) {
iignatyev@5982 73 testUnavailableLevel(testedTier, bci);
iignatyev@5982 74 }
iignatyev@5982 75 }
iignatyev@5982 76
iignatyev@5982 77 @Override
iignatyev@5982 78 protected void checkLevel(int expected, int actual) {
iignatyev@5982 79 if (expected == COMP_LEVEL_FULL_PROFILE
iignatyev@5982 80 && actual == COMP_LEVEL_LIMITED_PROFILE) {
iignatyev@5982 81 // for simple method full_profile may be replaced by limited_profile
xliu@9689 82 if (IS_VERBOSE) {
xliu@9689 83 System.out.printf("Level check: full profiling was replaced "
xliu@9689 84 + "by limited profiling. Expected: %d, actual:%d",
xliu@9689 85 expected, actual);
xliu@9689 86 }
iignatyev@5982 87 return;
iignatyev@5982 88 }
iignatyev@5982 89 super.checkLevel(expected, actual);
xliu@9689 90 }
iignatyev@5982 91 }

mercurial