hotspot/test/compiler/whitebox/BlockingCompilation.java
author iignatyev
Mon, 22 May 2017 15:27:20 -0700
changeset 45245 48fed68b35c1
parent 40631 ed82623d7831
permissions -rw-r--r--
8180793: move jdk.test.lib.wrappers.* to jdk.test.lib package Reviewed-by: mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     1
/*
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     2
 * Copyright (c) 2016 SAP SE. All rights reserved.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     4
 *
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     8
 *
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    13
 * accompanied this code).
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    14
 *
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    18
 *
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    21
 * questions.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    22
 */
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    23
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    24
/*
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    25
 * @test
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    26
 * @bug 8150646 8153013
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    27
 * @summary Add support for blocking compiles through whitebox API
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 36608
diff changeset
    28
 * @modules java.base/jdk.internal.misc
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    29
 * @library /test/lib /
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    30
 * @build sun.hotspot.WhiteBox
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    31
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    32
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    33
 * @run main/othervm
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    34
 *        -Xbootclasspath/a:.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    35
 *        -Xmixed
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    36
 *        -XX:+UnlockDiagnosticVMOptions
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    37
 *        -XX:+WhiteBoxAPI
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    38
 *        -XX:+PrintCompilation
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    39
 *        compiler.whitebox.BlockingCompilation
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    40
 */
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    41
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    42
package compiler.whitebox;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    43
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    44
import compiler.testlibrary.CompilerUtils;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    45
import sun.hotspot.WhiteBox;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    46
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    47
import java.lang.reflect.Method;
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    48
import java.util.Random;
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    49
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    50
public class BlockingCompilation {
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    51
    private static final WhiteBox WB = WhiteBox.getWhiteBox();
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    52
    private static final Random RANDOM = new Random();
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    53
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    54
    public static int foo() {
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    55
        return RANDOM.nextInt();
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    56
    }
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    57
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    58
    public static void main(String[] args) throws Exception {
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    59
        Method m = BlockingCompilation.class.getMethod("foo");
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    60
        int[] levels = CompilerUtils.getAvailableCompilationLevels();
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    61
        int highest_level = levels[levels.length-1];
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    62
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    63
        // If there are no compilers available these tests don't make any sense.
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    64
        if (levels.length == 0) return;
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    65
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    66
        // Make sure no compilations can progress, blocking compiles will hang
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    67
        WB.lockCompilation();
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    68
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    69
        // Verify method state before test
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    70
        if (WB.isMethodCompiled(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    71
            throw new Exception("Should not be compiled after deoptimization");
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    72
        }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    73
        if (WB.isMethodQueuedForCompilation(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    74
            throw new Exception("Should not be enqueued on any level");
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    75
        }
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    76
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    77
        // Try compiling on highest available comp level.
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    78
        // If the compiles are blocking, this call will block until the test time out,
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    79
        // Progress == success
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    80
        // (Don't run with -Xcomp since that can cause long timeouts due to many compiles)
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    81
        if (!WB.enqueueMethodForCompilation(m, highest_level)) {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    82
            throw new Exception("Failed to enqueue method on level: " + highest_level);
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    83
        }
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    84
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    85
        if (!WB.isMethodQueuedForCompilation(m)) {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    86
            throw new Exception("Must be enqueued because of locked compilation");
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 36608
diff changeset
    87
        }
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    88
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    89
        // restore state
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    90
        WB.unlockCompilation();
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    91
        while (!WB.isMethodCompiled(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    92
          Thread.sleep(100);
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    93
        }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
    94
        WB.deoptimizeMethod(m);
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    95
        WB.clearMethodState(m);
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    96
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    97
        // Blocking compilations on all levels, using the default versions of
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
    98
        // WB.enqueueMethodForCompilation() and manually setting compiler directives.
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
    99
        String directive = "[{ match: \""
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
   100
                + BlockingCompilation.class.getName().replace('.', '/')
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38241
diff changeset
   101
                + ".foo\", BackgroundCompilation: false }]";
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   102
        if (WB.addCompilerDirective(directive) != 1) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   103
            throw new Exception("Failed to add compiler directive");
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   104
        }
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   105
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   106
        try {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   107
            for (int l : levels) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   108
                // Make uncompiled
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   109
                WB.deoptimizeMethod(m);
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   110
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   111
                // Verify that it's not compiled
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   112
                if (WB.isMethodCompiled(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   113
                    throw new Exception("Should not be compiled after deoptimization");
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   114
                }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   115
                if (WB.isMethodQueuedForCompilation(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   116
                    throw new Exception("Should not be enqueued on any level");
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   117
                }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   118
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   119
                // Add to queue and verify that it went well
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   120
                if (!WB.enqueueMethodForCompilation(m, l)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   121
                    throw new Exception("Could not be enqueued for compilation");
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   122
                }
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   123
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   124
                // Verify that it is compiled
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   125
                if (!WB.isMethodCompiled(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   126
                    throw new Exception("Must be compiled here");
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   127
                }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   128
                // And verify the level
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   129
                if (WB.getMethodCompilationLevel(m) != l) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   130
                    String msg = m + " should be compiled at level " + l +
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   131
                                 "(but is actually compiled at level " +
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   132
                                 WB.getMethodCompilationLevel(m) + ")";
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   133
                    System.out.println("==> " + msg);
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   134
                    throw new Exception(msg);
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   135
                }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   136
            }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   137
        } finally {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   138
            WB.removeCompilerDirective(1);
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   139
        }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   140
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   141
        // Clean up
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   142
        WB.deoptimizeMethod(m);
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   143
        WB.clearMethodState(m);
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   144
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   145
        // Make sure no compilations can progress, blocking compiles will hang
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   146
        WB.lockCompilation();
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   147
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   148
        // Verify method state before test
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   149
        if (WB.isMethodCompiled(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   150
            throw new Exception("Should not be compiled after deoptimization");
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   151
        }
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   152
        if (WB.isMethodQueuedForCompilation(m)) {
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   153
            throw new Exception("Should not be enqueued on any level");
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   154
        }
36608
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   155
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   156
        // Try compiling on highest available comp level.
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   157
        // If the compiles are blocking, this call will block until the test time out,
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   158
        // Progress == success
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   159
        // (Don't run with -Xcomp since that can cause long timeouts due to many compiles)
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   160
        WB.enqueueMethodForCompilation(m, highest_level);
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   161
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   162
        // restore state
f8bb5522b4e4 8151796: compiler/whitebox/BlockingCompilation.java fails due to method not compiled
neliasso
parents: 36597
diff changeset
   163
        WB.unlockCompilation();
36597
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   164
    }
ee256e343585 8150646: Add support for blocking compiles though whitebox API
simonis
parents:
diff changeset
   165
}