hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java
author neliasso
Fri, 13 Nov 2015 13:31:48 +0100
changeset 34185 ee71c590a456
parent 34172 19299c8b7c81
child 36599 8dd1694c0480
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
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: 23188
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     4
 *
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     8
 *
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    14
 *
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    18
 *
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    21
 * questions.
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    22
 */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    23
package compiler.whitebox;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    24
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    25
import sun.hotspot.WhiteBox;
23499
9d5b7480c9f4 8038240: new WB API to get nmethod
iignatyev
parents: 23207
diff changeset
    26
import sun.hotspot.code.NMethod;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    27
import java.lang.reflect.Executable;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    28
import java.util.Objects;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    29
import java.util.concurrent.Callable;
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
    30
import java.util.function.Function;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    31
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    32
/**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    33
 * Abstract class for WhiteBox testing of JIT.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    34
 *
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    35
 * @author igor.ignatyev@oracle.com
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    36
 */
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    37
public abstract class CompilerWhiteBoxTest {
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    38
    /** {@code CompLevel::CompLevel_none} -- Interpreter */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    39
    public static final int COMP_LEVEL_NONE = 0;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    40
    /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    41
    public static final int COMP_LEVEL_ANY = -1;
17126
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
    42
    /** {@code CompLevel::CompLevel_simple} -- C1 */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    43
    public static final int COMP_LEVEL_SIMPLE = 1;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    44
    /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    45
    public static final int COMP_LEVEL_LIMITED_PROFILE = 2;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    46
    /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation & backedge counters + mdo */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    47
    public static final int COMP_LEVEL_FULL_PROFILE = 3;
17126
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
    48
    /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    49
    public static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
    50
    /** Maximal value for CompLevel */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    51
    public static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
17126
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
    52
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    53
    /** Instance of WhiteBox */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    54
    protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    55
    /** Value of {@code -XX:CompileThreshold} */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    56
    protected static final int COMPILE_THRESHOLD
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    57
            = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    58
    /** Value of {@code -XX:BackgroundCompilation} */
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
    59
    protected static final boolean BACKGROUND_COMPILATION
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
    60
            = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    61
    /** Value of {@code -XX:TieredCompilation} */
16689
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
    62
    protected static final boolean TIERED_COMPILATION
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
    63
            = Boolean.valueOf(getVMOption("TieredCompilation", "false"));
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    64
    /** Value of {@code -XX:TieredStopAtLevel} */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    65
    protected static final int TIERED_STOP_AT_LEVEL
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    66
            = Integer.parseInt(getVMOption("TieredStopAtLevel", "0"));
19282
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
    67
    /** Flag for verbose output, true if {@code -Dverbose} specified */
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
    68
    protected static final boolean IS_VERBOSE
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
    69
            = System.getProperty("verbose") != null;
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
    70
    /** invocation count to trigger compilation */
34172
19299c8b7c81 8139388: [TESTBUG] JVMCI test failed with RuntimeException profiling info wasn't changed after 100 invocations (assert failed: BaseProfilingInfo<> != BaseProfilingInfo<>)
tpivovarova
parents: 34155
diff changeset
    71
    public static final int THRESHOLD;
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
    72
    /** invocation count to trigger OSR compilation */
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    73
    protected static final long BACKEDGE_THRESHOLD;
20294
af95d17f2e04 8023452: TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 19332
diff changeset
    74
    /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
    75
    protected static final String MODE = System.getProperty("java.vm.info");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    76
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    77
    static {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    78
        if (TIERED_COMPILATION) {
21091
588413a8426e 8023318: compiler/whitebox tests timeout with enabled TieredCompilation
iignatyev
parents: 20294
diff changeset
    79
            BACKEDGE_THRESHOLD = THRESHOLD = 150000;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    80
        } else {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    81
            THRESHOLD = COMPILE_THRESHOLD;
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    82
            BACKEDGE_THRESHOLD = COMPILE_THRESHOLD * Long.parseLong(getVMOption(
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    83
                    "OnStackReplacePercentage"));
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    84
        }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    85
    }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    86
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    87
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    88
     * Returns value of VM option.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    89
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    90
     * @param name option's name
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    91
     * @return value of option or {@code null}, if option doesn't exist
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    92
     * @throws NullPointerException if name is null
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    93
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    94
    protected static String getVMOption(String name) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    95
        Objects.requireNonNull(name);
25736
6f35dbe32581 8032449: Get rid of JMX in test/compiler
iignatyev
parents: 23499
diff changeset
    96
        return Objects.toString(WHITE_BOX.getVMFlag(name), null);
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    97
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    98
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    99
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   100
     * Returns value of VM option or default value.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   101
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   102
     * @param name         option's name
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   103
     * @param defaultValue default value
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   104
     * @return value of option or {@code defaultValue}, if option doesn't exist
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   105
     * @throws NullPointerException if name is null
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   106
     * @see #getVMOption(String)
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   107
     */
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   108
    protected static String getVMOption(String name, String defaultValue) {
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   109
        String result = getVMOption(name);
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   110
        return result == null ? defaultValue : result;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   111
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   112
17126
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   113
    /** copy of is_c1_compile(int) from utilities/globalDefinitions.hpp */
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   114
    protected static boolean isC1Compile(int compLevel) {
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   115
        return (compLevel > COMP_LEVEL_NONE)
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   116
                && (compLevel < COMP_LEVEL_FULL_OPTIMIZATION);
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   117
    }
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   118
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   119
    /** copy of is_c2_compile(int) from utilities/globalDefinitions.hpp */
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   120
    protected static boolean isC2Compile(int compLevel) {
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   121
        return compLevel == COMP_LEVEL_FULL_OPTIMIZATION;
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   122
    }
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   123
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   124
    protected static void main(
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   125
            Function<TestCase, CompilerWhiteBoxTest> constructor,
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   126
            String[] args) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   127
        if (args.length == 0) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   128
            for (TestCase test : SimpleTestCase.values()) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   129
                constructor.apply(test).runTest();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   130
            }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   131
        } else {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   132
            for (String name : args) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   133
                constructor.apply(SimpleTestCase.valueOf(name)).runTest();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   134
            }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   135
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   136
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   137
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   138
    /** tested method */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   139
    protected final Executable method;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   140
    protected final TestCase testCase;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   141
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   142
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   143
     * Constructor.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   144
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   145
     * @param testCase object, that contains tested method and way to invoke it.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   146
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   147
    protected CompilerWhiteBoxTest(TestCase testCase) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   148
        Objects.requireNonNull(testCase);
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   149
        System.out.println("TEST CASE:" + testCase.name());
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   150
        method = testCase.getExecutable();
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   151
        this.testCase = testCase;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   152
    }
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   153
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   154
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   155
     * Template method for testing. Prints tested method's info before
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   156
     * {@linkplain #test()} and after {@linkplain #test()} or on thrown
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   157
     * exception.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   158
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   159
     * @throws RuntimeException if method {@linkplain #test()} throws any
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   160
     *                          exception
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   161
     * @see #test()
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   162
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   163
    protected final void runTest() {
25736
6f35dbe32581 8032449: Get rid of JMX in test/compiler
iignatyev
parents: 23499
diff changeset
   164
        if (CompilerWhiteBoxTest.MODE.startsWith("interpreted ")) {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   165
            System.err.println(
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   166
                    "Warning: test is not applicable in interpreted mode");
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   167
            return;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   168
        }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   169
        System.out.println("at test's start:");
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   170
        printInfo();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   171
        try {
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   172
            test();
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   173
        } catch (Exception e) {
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   174
            System.out.printf("on exception '%s':", e.getMessage());
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   175
            printInfo();
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   176
            e.printStackTrace();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   177
            if (e instanceof RuntimeException) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   178
                throw (RuntimeException) e;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   179
            }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   180
            throw new RuntimeException(e);
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   181
        }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   182
        System.out.println("at test's end:");
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   183
        printInfo();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   184
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   185
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   186
    /**
23188
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   187
     * Checks, that {@linkplain #method} is not compiled at the given compilation
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   188
     * level or above.
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   189
     *
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   190
     * @param compLevel
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   191
     *
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   192
     * @throws RuntimeException if {@linkplain #method} is in compiler queue or
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   193
     *                          is compiled, or if {@linkplain #method} has zero
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   194
     *                          compilation level.
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   195
     */
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   196
    protected final void checkNotCompiled(int compLevel) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   197
        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   198
            throw new RuntimeException(method + " must not be in queue");
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   199
        }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   200
        if (WHITE_BOX.getMethodCompilationLevel(method, false) >= compLevel) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   201
            throw new RuntimeException(method + " comp_level must be >= maxCompLevel");
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   202
        }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   203
        if (WHITE_BOX.getMethodCompilationLevel(method, true) >= compLevel) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   204
            throw new RuntimeException(method + " osr_comp_level must be >= maxCompLevel");
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   205
        }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   206
    }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   207
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   208
    /**
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   209
     * Checks, that {@linkplain #method} is not compiled.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   210
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   211
     * @throws RuntimeException if {@linkplain #method} is in compiler queue or
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   212
     *                          is compiled, or if {@linkplain #method} has zero
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   213
     *                          compilation level.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   214
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   215
    protected final void checkNotCompiled() {
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   216
        checkNotCompiled(true);
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   217
        checkNotCompiled(false);
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   218
    }
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   219
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   220
    /**
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   221
     * Checks, that {@linkplain #method} is not (OSR-)compiled.
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   222
     *
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   223
     * @param isOsr Check for OSR compilation if true
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   224
     * @throws RuntimeException if {@linkplain #method} is in compiler queue or
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   225
     *                          is compiled, or if {@linkplain #method} has zero
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   226
     *                          compilation level.
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   227
     */
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   228
    protected final void checkNotCompiled(boolean isOsr) {
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   229
        waitBackgroundCompilation();
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   230
        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   231
            throw new RuntimeException(method + " must not be in queue");
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   232
        }
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   233
        if (WHITE_BOX.isMethodCompiled(method, isOsr)) {
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   234
            throw new RuntimeException(method + " must not be " +
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   235
                                       (isOsr ? "osr_" : "") + "compiled");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   236
        }
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   237
        if (WHITE_BOX.getMethodCompilationLevel(method, isOsr) != 0) {
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   238
            throw new RuntimeException(method + (isOsr ? " osr_" : " ") +
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   239
                                       "comp_level must be == 0");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   240
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   241
    }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   242
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   243
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   244
     * Checks, that {@linkplain #method} is compiled.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   245
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   246
     * @throws RuntimeException if {@linkplain #method} isn't in compiler queue
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   247
     *                          and isn't compiled, or if {@linkplain #method}
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   248
     *                          has nonzero compilation level
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   249
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   250
    protected final void checkCompiled() {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   251
        final long start = System.currentTimeMillis();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   252
        waitBackgroundCompilation();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   253
        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   254
            System.err.printf("Warning: %s is still in queue after %dms%n",
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   255
                    method, System.currentTimeMillis() - start);
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   256
            return;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   257
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   258
        if (!WHITE_BOX.isMethodCompiled(method, testCase.isOsr())) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   259
            throw new RuntimeException(method + " must be "
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   260
                    + (testCase.isOsr() ? "osr_" : "") + "compiled");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   261
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   262
        if (WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr())
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   263
                == 0) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   264
            throw new RuntimeException(method
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   265
                    + (testCase.isOsr() ? " osr_" : " ")
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   266
                    + "comp_level must be != 0");
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   267
        }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   268
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   269
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   270
    protected final void deoptimize() {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   271
        WHITE_BOX.deoptimizeMethod(method, testCase.isOsr());
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   272
        if (testCase.isOsr()) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   273
            WHITE_BOX.deoptimizeMethod(method, false);
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   274
        }
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   275
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   276
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   277
    protected final int getCompLevel() {
23499
9d5b7480c9f4 8038240: new WB API to get nmethod
iignatyev
parents: 23207
diff changeset
   278
        NMethod nm = NMethod.get(method, testCase.isOsr());
9d5b7480c9f4 8038240: new WB API to get nmethod
iignatyev
parents: 23207
diff changeset
   279
        return nm == null ? COMP_LEVEL_NONE : nm.comp_level;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   280
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   281
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   282
    protected final boolean isCompilable() {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   283
        return WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY,
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   284
                testCase.isOsr());
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   285
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   286
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   287
    protected final boolean isCompilable(int compLevel) {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   288
        return WHITE_BOX
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   289
                .isMethodCompilable(method, compLevel, testCase.isOsr());
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   290
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   291
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   292
    protected final void makeNotCompilable() {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   293
        WHITE_BOX.makeMethodNotCompilable(method, COMP_LEVEL_ANY,
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   294
                testCase.isOsr());
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   295
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   296
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   297
    protected final void makeNotCompilable(int compLevel) {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   298
        WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   299
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   300
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   301
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   302
     * Waits for completion of background compilation of {@linkplain #method}.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   303
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   304
    protected final void waitBackgroundCompilation() {
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   305
        waitBackgroundCompilation(method);
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   306
    }
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   307
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   308
    /**
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   309
     * Waits for completion of background compilation of the given executable.
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   310
     *
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   311
     * @param executable Executable
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   312
     */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
   313
    public static final void waitBackgroundCompilation(Executable executable) {
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   314
        if (!BACKGROUND_COMPILATION) {
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   315
            return;
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   316
        }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   317
        final Object obj = new Object();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   318
        for (int i = 0; i < 10
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   319
                && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   320
            synchronized (obj) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   321
                try {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   322
                    obj.wait(1000);
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   323
                } catch (InterruptedException e) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   324
                    Thread.currentThread().interrupt();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   325
                }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   326
            }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   327
        }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   328
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   329
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   330
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   331
     * Prints information about {@linkplain #method}.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   332
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   333
    protected final void printInfo() {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   334
        System.out.printf("%n%s:%n", method);
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   335
        System.out.printf("\tcompilable:\t%b%n",
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   336
                WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
28194
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   337
        boolean isCompiled = WHITE_BOX.isMethodCompiled(method, false);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   338
        System.out.printf("\tcompiled:\t%b%n", isCompiled);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   339
        if (isCompiled) {
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   340
            System.out.printf("\tcompile_id:\t%d%n",
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   341
                    NMethod.get(method, false).compile_id);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   342
        }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   343
        System.out.printf("\tcomp_level:\t%d%n",
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   344
                WHITE_BOX.getMethodCompilationLevel(method, false));
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   345
        System.out.printf("\tosr_compilable:\t%b%n",
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   346
                WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));
28194
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   347
        isCompiled = WHITE_BOX.isMethodCompiled(method, true);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   348
        System.out.printf("\tosr_compiled:\t%b%n", isCompiled);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   349
        if (isCompiled) {
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   350
            System.out.printf("\tosr_compile_id:\t%d%n",
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   351
                    NMethod.get(method, true).compile_id);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   352
        }
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   353
        System.out.printf("\tosr_comp_level:\t%d%n",
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   354
                WHITE_BOX.getMethodCompilationLevel(method, true));
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   355
        System.out.printf("\tin_queue:\t%b%n",
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   356
                WHITE_BOX.isMethodQueuedForCompilation(method));
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   357
        System.out.printf("compile_queues_size:\t%d%n%n",
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   358
                WHITE_BOX.getCompileQueuesSize());
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   359
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   360
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   361
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   362
     * Executes testing.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   363
     */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   364
    protected abstract void test() throws Exception;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   365
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   366
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   367
     * Tries to trigger compilation of {@linkplain #method} by call
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   368
     * {@linkplain TestCase#getCallable()} enough times.
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   369
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   370
     * @return accumulated result
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   371
     * @see #compile(int)
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   372
     */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   373
    protected final int compile() {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   374
        if (testCase.isOsr()) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   375
            return compile(1);
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   376
        } else {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   377
            return compile(THRESHOLD);
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   378
        }
16689
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
   379
    }
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
   380
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   381
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   382
     * Tries to trigger compilation of {@linkplain #method} by call
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   383
     * {@linkplain TestCase#getCallable()} specified times.
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   384
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   385
     * @param count invocation count
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   386
     * @return accumulated result
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   387
     */
16689
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
   388
    protected final int compile(int count) {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   389
        int result = 0;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   390
        Integer tmp;
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   391
        for (int i = 0; i < count; ++i) {
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   392
            try {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   393
                tmp = testCase.getCallable().call();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   394
            } catch (Exception e) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   395
                tmp = null;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   396
            }
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   397
            result += tmp == null ? 0 : tmp;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   398
        }
19282
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
   399
        if (IS_VERBOSE) {
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
   400
            System.out.println("method was invoked " + count + " times");
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
   401
        }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   402
        return result;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   403
    }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   404
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   405
    /**
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   406
     * Utility interface provides tested method and object to invoke it.
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   407
     */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   408
    public interface TestCase {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   409
        /** the name of test case */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   410
        String name();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   411
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   412
        /** tested method */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   413
        Executable getExecutable();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   414
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   415
        /** object to invoke {@linkplain #getExecutable()} */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   416
        Callable<Integer> getCallable();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   417
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   418
        /** flag for OSR test case */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   419
        boolean isOsr();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   420
    }
23207
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   421
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   422
    /**
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   423
     * @return {@code true} if the current test case is OSR and the mode is
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   424
     *          Xcomp, otherwise {@code false}
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   425
     */
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   426
    protected boolean skipXcompOSR() {
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   427
        boolean result =  testCase.isOsr()
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   428
                && CompilerWhiteBoxTest.MODE.startsWith("compiled ");
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   429
        if (result && IS_VERBOSE) {
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   430
            System.err.printf("Warning: %s is not applicable in %s%n",
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   431
                    testCase.name(), CompilerWhiteBoxTest.MODE);
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   432
        }
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   433
        return result;
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   434
    }
28194
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   435
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   436
    /**
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   437
     * Skip the test for the specified value of Tiered Compilation
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   438
     * @param value of TieredCompilation the test should not run with
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   439
     * @return {@code true} if the test should be skipped,
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   440
     *         {@code false} otherwise
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   441
     */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
   442
    public static boolean skipOnTieredCompilation(boolean value) {
28194
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   443
        if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) {
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   444
            System.err.println("Test isn't applicable w/ "
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   445
                    + (value ? "enabled" : "disabled")
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   446
                    + "TieredCompilation. Skip test.");
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   447
            return true;
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   448
        }
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   449
        return false;
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   450
    }
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   451
}
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   452