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