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