test/hotspot/jtreg/compiler/whitebox/CompilerWhiteBoxTest.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 51355 9fb336cee537
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
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
/*
51355
9fb336cee537 8204966: [TESTBUG] hotspot/test/compiler/whitebox/IsMethodCompilableTest.java test fails with -XX:CompileThreshold=1
dbuck
parents: 47687
diff changeset
     2
 * Copyright (c) 2013, 2018, 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
 */
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38025
diff changeset
    23
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    24
package compiler.whitebox;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    25
40067
db6c74a53556 8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents: 40059
diff changeset
    26
import jdk.test.lib.Platform;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    27
import sun.hotspot.WhiteBox;
23499
9d5b7480c9f4 8038240: new WB API to get nmethod
iignatyev
parents: 23207
diff changeset
    28
import sun.hotspot.code.NMethod;
38025
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
    29
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    30
import java.lang.reflect.Executable;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    31
import java.util.Objects;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    32
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
    33
import java.util.function.Function;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    34
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    35
/**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    36
 * Abstract class for WhiteBox testing of JIT.
40067
db6c74a53556 8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents: 40059
diff changeset
    37
 * Depends on jdk.test.lib.Platform from testlibrary.
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    38
 *
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    39
 * @author igor.ignatyev@oracle.com
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    40
 */
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    41
public abstract class CompilerWhiteBoxTest {
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    42
    /** {@code CompLevel::CompLevel_none} -- Interpreter */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    43
    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
    44
    /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40067
diff changeset
    45
    public static final int COMP_LEVEL_ANY = -2;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40067
diff changeset
    46
    /** {@code CompLevel::CompLevel_aot} -- AOT */
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40067
diff changeset
    47
    public static final int COMP_LEVEL_AOT = -1;
17126
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
    48
    /** {@code CompLevel::CompLevel_simple} -- C1 */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    49
    public static final int COMP_LEVEL_SIMPLE = 1;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    50
    /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    51
    public static final int COMP_LEVEL_LIMITED_PROFILE = 2;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    52
    /** {@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
    53
    public static final int COMP_LEVEL_FULL_PROFILE = 3;
47687
fb290fd1f9d4 8171853: Remove Shark compiler
rkennke
parents: 47216
diff changeset
    54
    /** {@code CompLevel::CompLevel_full_optimization} -- C2 */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    55
    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
    56
    /** Maximal value for CompLevel */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
    57
    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
    58
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    59
    /** Instance of WhiteBox */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    60
    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
    61
    /** Value of {@code -XX:CompileThreshold} */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    62
    protected static final int COMPILE_THRESHOLD
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    63
            = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    64
    /** Value of {@code -XX:BackgroundCompilation} */
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
    65
    protected static final boolean BACKGROUND_COMPILATION
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
    66
            = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
38025
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
    67
    protected static final boolean USE_COUNTER_DECAY
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
    68
            = Boolean.valueOf(getVMOption("UseCounterDecay", "true"));
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    69
    /** Value of {@code -XX:TieredCompilation} */
16689
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
    70
    protected static final boolean TIERED_COMPILATION
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
    71
            = Boolean.valueOf(getVMOption("TieredCompilation", "false"));
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    72
    /** Value of {@code -XX:TieredStopAtLevel} */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    73
    protected static final int TIERED_STOP_AT_LEVEL
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    74
            = Integer.parseInt(getVMOption("TieredStopAtLevel", "0"));
19282
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
    75
    /** Flag for verbose output, true if {@code -Dverbose} specified */
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
    76
    protected static final boolean IS_VERBOSE
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
    77
            = System.getProperty("verbose") != null;
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
    78
    /** 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
    79
    public static final int THRESHOLD;
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
    80
    /** invocation count to trigger OSR compilation */
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    81
    protected static final long BACKEDGE_THRESHOLD;
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    82
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    83
    static {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    84
        if (TIERED_COMPILATION) {
21091
588413a8426e 8023318: compiler/whitebox tests timeout with enabled TieredCompilation
iignatyev
parents: 20294
diff changeset
    85
            BACKEDGE_THRESHOLD = THRESHOLD = 150000;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    86
        } else {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    87
            THRESHOLD = COMPILE_THRESHOLD;
51355
9fb336cee537 8204966: [TESTBUG] hotspot/test/compiler/whitebox/IsMethodCompilableTest.java test fails with -XX:CompileThreshold=1
dbuck
parents: 47687
diff changeset
    88
            BACKEDGE_THRESHOLD = Math.max(10000, COMPILE_THRESHOLD *
9fb336cee537 8204966: [TESTBUG] hotspot/test/compiler/whitebox/IsMethodCompilableTest.java test fails with -XX:CompileThreshold=1
dbuck
parents: 47687
diff changeset
    89
                    Long.parseLong(getVMOption("OnStackReplacePercentage")));
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    90
        }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
    91
    }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
    92
17015
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
     * Returns value of VM option.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    95
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    96
     * @param name option's name
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
    97
     * @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
    98
     * @throws NullPointerException if name is null
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
    protected static String getVMOption(String name) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   101
        Objects.requireNonNull(name);
25736
6f35dbe32581 8032449: Get rid of JMX in test/compiler
iignatyev
parents: 23499
diff changeset
   102
        return Objects.toString(WHITE_BOX.getVMFlag(name), null);
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   103
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   104
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   105
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   106
     * Returns value of VM option or default value.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   107
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   108
     * @param name         option's name
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   109
     * @param defaultValue default value
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   110
     * @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
   111
     * @throws NullPointerException if name is null
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   112
     * @see #getVMOption(String)
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   113
     */
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   114
    protected static String getVMOption(String name, String defaultValue) {
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   115
        String result = getVMOption(name);
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   116
        return result == null ? defaultValue : result;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   117
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   118
17126
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   119
    /** 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
   120
    protected static boolean isC1Compile(int compLevel) {
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   121
        return (compLevel > COMP_LEVEL_NONE)
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   122
                && (compLevel < COMP_LEVEL_FULL_OPTIMIZATION);
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   123
    }
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   124
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   125
    /** 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
   126
    protected static boolean isC2Compile(int compLevel) {
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   127
        return compLevel == COMP_LEVEL_FULL_OPTIMIZATION;
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   128
    }
42a942feeea2 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 17015
diff changeset
   129
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   130
    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
   131
            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
   132
            String[] args) {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   133
        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
   134
            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
   135
                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
   136
            }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   137
        } else {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   138
            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
   139
                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
   140
            }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   141
        }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   142
    }
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   143
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   144
    /** tested method */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   145
    protected final Executable method;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   146
    protected final TestCase testCase;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   147
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   148
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   149
     * Constructor.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   150
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   151
     * @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
   152
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   153
    protected CompilerWhiteBoxTest(TestCase testCase) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   154
        Objects.requireNonNull(testCase);
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   155
        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
   156
        method = testCase.getExecutable();
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   157
        this.testCase = testCase;
17015
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
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   160
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   161
     * 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
   162
     * {@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
   163
     * exception.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   164
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   165
     * @throws RuntimeException if method {@linkplain #test()} throws any
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   166
     *                          exception
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   167
     * @see #test()
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   168
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   169
    protected final void runTest() {
40067
db6c74a53556 8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents: 40059
diff changeset
   170
        if (Platform.isInt()) {
db6c74a53556 8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents: 40059
diff changeset
   171
            throw new Error("TESTBUG: test can not be run in interpreter");
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   172
        }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   173
        System.out.println("at test's start:");
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   174
        printInfo();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   175
        try {
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   176
            test();
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   177
        } catch (Exception e) {
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   178
            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
   179
            printInfo();
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   180
            e.printStackTrace();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   181
            if (e instanceof RuntimeException) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   182
                throw (RuntimeException) e;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   183
            }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   184
            throw new RuntimeException(e);
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   185
        }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   186
        System.out.println("at test's end:");
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   187
        printInfo();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   188
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   189
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   190
    /**
23188
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   191
     * Checks, that {@linkplain #method} is not compiled at the given compilation
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   192
     * level or above.
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   193
     *
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   194
     * @param compLevel
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
     * @throws RuntimeException if {@linkplain #method} is in compiler queue or
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   197
     *                          is compiled, or if {@linkplain #method} has zero
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   198
     *                          compilation level.
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
    protected final void checkNotCompiled(int compLevel) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   201
        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   202
            throw new RuntimeException(method + " must not be in queue");
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   203
        }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   204
        if (WHITE_BOX.getMethodCompilationLevel(method, false) >= compLevel) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   205
            throw new RuntimeException(method + " comp_level must be >= maxCompLevel");
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
        if (WHITE_BOX.getMethodCompilationLevel(method, true) >= compLevel) {
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   208
            throw new RuntimeException(method + " osr_comp_level must be >= maxCompLevel");
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   209
        }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   210
    }
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   211
21757c31b2c9 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 22214
diff changeset
   212
    /**
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   213
     * Checks, that {@linkplain #method} is not compiled.
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
     * @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
   216
     *                          is compiled, or if {@linkplain #method} has zero
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   217
     *                          compilation level.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   218
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   219
    protected final void checkNotCompiled() {
36599
8dd1694c0480 8066770: EnqueueMethodForCompilationTest.java fails to compile method
neliasso
parents: 34172
diff changeset
   220
        waitBackgroundCompilation();
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   221
        checkNotCompiled(true);
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   222
        checkNotCompiled(false);
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   223
    }
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   224
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   225
    /**
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   226
     * 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
   227
     *
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   228
     * @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
   229
     * @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
   230
     *                          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
   231
     *                          compilation level.
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   232
     */
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   233
    protected final void checkNotCompiled(boolean isOsr) {
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   234
        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   235
            throw new RuntimeException(method + " must not be in queue");
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
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.isMethodCompiled(method, isOsr)) {
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   238
            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
   239
                                       (isOsr ? "osr_" : "") + "compiled");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   240
        }
27430
c148f9c9fd4f 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 27419
diff changeset
   241
        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
   242
            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
   243
                                       "comp_level must be == 0");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   244
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   245
    }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   246
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   247
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   248
     * Checks, that {@linkplain #method} is compiled.
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
     * @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
   251
     *                          and isn't compiled, or if {@linkplain #method}
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   252
     *                          has nonzero compilation level
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   253
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   254
    protected final void checkCompiled() {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   255
        final long start = System.currentTimeMillis();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   256
        waitBackgroundCompilation();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   257
        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   258
            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
   259
                    method, System.currentTimeMillis() - start);
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   260
            return;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
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.isMethodCompiled(method, testCase.isOsr())) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   263
            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
   264
                    + (testCase.isOsr() ? "osr_" : "") + "compiled");
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   265
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   266
        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
   267
                == 0) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   268
            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
   269
                    + (testCase.isOsr() ? " osr_" : " ")
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   270
                    + "comp_level must be != 0");
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   271
        }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   272
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   273
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   274
    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
   275
        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
   276
        if (testCase.isOsr()) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   277
            WHITE_BOX.deoptimizeMethod(method, false);
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   278
        }
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   279
    }
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
    protected final int getCompLevel() {
23499
9d5b7480c9f4 8038240: new WB API to get nmethod
iignatyev
parents: 23207
diff changeset
   282
        NMethod nm = NMethod.get(method, testCase.isOsr());
9d5b7480c9f4 8038240: new WB API to get nmethod
iignatyev
parents: 23207
diff changeset
   283
        return nm == null ? COMP_LEVEL_NONE : nm.comp_level;
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   284
    }
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
    protected final boolean isCompilable() {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   287
        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
   288
                testCase.isOsr());
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   289
    }
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
    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
   292
        return WHITE_BOX
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   293
                .isMethodCompilable(method, compLevel, testCase.isOsr());
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   294
    }
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
    protected final void makeNotCompilable() {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   297
        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
   298
                testCase.isOsr());
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   299
    }
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   300
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   301
    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
   302
        WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   303
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   304
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   305
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   306
     * 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
   307
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   308
    protected final void waitBackgroundCompilation() {
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   309
        waitBackgroundCompilation(method);
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
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   312
    /**
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   313
     * 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
   314
     *
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   315
     * @param executable Executable
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   316
     */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
   317
    public static final void waitBackgroundCompilation(Executable executable) {
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   318
        if (!BACKGROUND_COMPILATION) {
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   319
            return;
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   320
        }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   321
        final Object obj = new Object();
36599
8dd1694c0480 8066770: EnqueueMethodForCompilationTest.java fails to compile method
neliasso
parents: 34172
diff changeset
   322
        for (int i = 0; i < 100
27146
06664440c7a3 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 25736
diff changeset
   323
                && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   324
            synchronized (obj) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   325
                try {
36599
8dd1694c0480 8066770: EnqueueMethodForCompilationTest.java fails to compile method
neliasso
parents: 34172
diff changeset
   326
                    obj.wait(100);
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   327
                } catch (InterruptedException e) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   328
                    Thread.currentThread().interrupt();
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   329
                }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   330
            }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   331
        }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   332
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   333
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   334
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   335
     * Prints information about {@linkplain #method}.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   336
     */
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   337
    protected final void printInfo() {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   338
        System.out.printf("%n%s:%n", method);
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   339
        System.out.printf("\tcompilable:\t%b%n",
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   340
                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
   341
        boolean isCompiled = WHITE_BOX.isMethodCompiled(method, false);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   342
        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
   343
        if (isCompiled) {
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   344
            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
   345
                    NMethod.get(method, false).compile_id);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   346
        }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   347
        System.out.printf("\tcomp_level:\t%d%n",
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   348
                WHITE_BOX.getMethodCompilationLevel(method, false));
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   349
        System.out.printf("\tosr_compilable:\t%b%n",
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   350
                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
   351
        isCompiled = WHITE_BOX.isMethodCompiled(method, true);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   352
        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
   353
        if (isCompiled) {
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   354
            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
   355
                    NMethod.get(method, true).compile_id);
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   356
        }
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   357
        System.out.printf("\tosr_comp_level:\t%d%n",
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   358
                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
   359
        System.out.printf("\tin_queue:\t%b%n",
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   360
                WHITE_BOX.isMethodQueuedForCompilation(method));
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   361
        System.out.printf("compile_queues_size:\t%d%n%n",
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   362
                WHITE_BOX.getCompileQueuesSize());
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   363
    }
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   364
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   365
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   366
     * Executes testing.
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   367
     */
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   368
    protected abstract void test() throws Exception;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   369
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   370
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   371
     * 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
   372
     * {@linkplain TestCase#getCallable()} enough times.
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   373
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   374
     * @return accumulated result
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   375
     * @see #compile(int)
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   376
     */
38025
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
   377
    protected final int compile() throws Exception {
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
   378
        if (USE_COUNTER_DECAY) {
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
   379
            throw new Exception("Tests using compile method must turn off counter decay for reliability");
5ed9ce1e4a2f 8151880: EnqueueMethodForCompilationTest.java still fails to compile method
neliasso
parents: 36599
diff changeset
   380
        }
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   381
        if (testCase.isOsr()) {
19332
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   382
            return compile(1);
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   383
        } else {
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   384
            return compile(THRESHOLD);
ee4c8c2af356 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 19282
diff changeset
   385
        }
16689
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
   386
    }
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
   387
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   388
    /**
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   389
     * 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
   390
     * {@linkplain TestCase#getCallable()} specified times.
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   391
     *
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   392
     * @param count invocation count
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   393
     * @return accumulated result
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   394
     */
16689
efce070b8d42 8007288: Additional WB API for compiler's testing
iignatyev
parents: 16367
diff changeset
   395
    protected final int compile(int count) {
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   396
        int result = 0;
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   397
        Integer tmp;
16367
9cd60b8380a1 8008211: Some of WB tests on compiler fail
iignatyev
parents: 15621
diff changeset
   398
        for (int i = 0; i < count; ++i) {
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   399
            try {
22214
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   400
                tmp = testCase.getCallable().call();
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   401
            } catch (Exception e) {
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   402
                tmp = null;
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   403
            }
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   404
            result += tmp == null ? 0 : tmp;
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   405
        }
19282
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
   406
        if (IS_VERBOSE) {
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
   407
            System.out.println("method was invoked " + count + " times");
9764b5a041b6 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 17126
diff changeset
   408
        }
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   409
        return result;
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   410
    }
22214
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
    /**
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   413
     * 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
   414
     */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   415
    public interface TestCase {
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   416
        /** 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
   417
        String name();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   418
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   419
        /** tested method */
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   420
        Executable getExecutable();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   421
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   422
        /** 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
   423
        Callable<Integer> getCallable();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   424
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   425
        /** 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
   426
        boolean isOsr();
c551021e75b2 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 21091
diff changeset
   427
    }
23207
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   428
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   429
    /**
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   430
     * @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
   431
     *          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
   432
     */
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   433
    protected boolean skipXcompOSR() {
40067
db6c74a53556 8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents: 40059
diff changeset
   434
        boolean result = testCase.isOsr() && Platform.isComp();
23207
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   435
        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
   436
            System.err.printf("Warning: %s is not applicable in %s%n",
40067
db6c74a53556 8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents: 40059
diff changeset
   437
                    testCase.name(), Platform.vmInfo);
23207
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   438
        }
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   439
        return result;
fc39038d37dc 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 23188
diff changeset
   440
    }
28194
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   441
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   442
    /**
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   443
     * 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
   444
     * @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
   445
     * @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
   446
     *         {@code false} otherwise
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   447
     */
34155
8d9e0cbf93a2 8138689: use package for /compiler/whitebox common classes
dpochepk
parents: 28194
diff changeset
   448
    public static boolean skipOnTieredCompilation(boolean value) {
28194
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   449
        if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) {
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   450
            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
   451
                    + (value ? "enabled" : "disabled")
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   452
                    + "TieredCompilation. Skip test.");
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   453
            return true;
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   454
        }
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   455
        return false;
8c6c124a108b 8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents: 27430
diff changeset
   456
    }
17015
92390f57e8b1 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 16689
diff changeset
   457
}
15621
b094c56bba84 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
   458