test/hotspot/jtreg/compiler/c2/Test6857159.java
author iignatyev
Thu, 21 Nov 2019 14:15:31 -0800
changeset 59211 71a84cee0c39
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234290: compiler/c2/Test6857159.java times out and fail to clean up files Reviewed-by: thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     1
/*
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
     2
 * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     4
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     8
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    13
 * accompanied this code).
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    14
 *
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3272
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3272
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3272
diff changeset
    21
 * questions.
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    22
 */
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    23
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    24
/**
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    25
 * @test
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    26
 * @bug 6857159
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    27
 * @summary local schedule failed with checkcast of Thread.currentThread()
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    28
 * @library /test/lib
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 30604
diff changeset
    29
 * @modules java.base/jdk.internal.misc
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    30
 *
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    31
 * @build sun.hotspot.WhiteBox
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    32
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    33
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    34
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    35
 *      -Xbatch -XX:CompileCommand=compileonly,compiler.c2.Test6857159$ct0::run
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    36
 *      compiler.c2.Test6857159
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    37
 */
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    38
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    39
package compiler.c2;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    40
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    41
import sun.hotspot.WhiteBox;
28925
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    42
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    43
public class Test6857159 extends Thread {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    44
    public static void main(String[] args) throws Exception {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    45
        var whiteBox = WhiteBox.getWhiteBox();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    46
        var method = ct0.class.getDeclaredMethod("run");
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    47
        for (int i = 0; i < 20000; i++) {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    48
            Thread t = null;
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    49
            switch (i % 3) {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    50
                case 0:
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    51
                    t = new ct0();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    52
                    break;
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    53
                case 1:
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    54
                    t = new ct1();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    55
                    break;
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    56
                case 2:
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    57
                    t = new ct2();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    58
                    break;
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    59
            }
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    60
            t.start();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    61
            t.join();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    62
        }
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    63
        if (!whiteBox.isMethodCompiled(method)) {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    64
            throw new AssertionError(method + " didn't get compiled");
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    65
        }
28925
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    66
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    67
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    68
    static class ct0 extends Test6857159 {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    69
        public void message() { }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    70
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    71
        public void run() {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    72
            message();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    73
            ct0 ct = (ct0) Thread.currentThread();
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    74
            ct.message();
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    75
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    76
    }
59211
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    77
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    78
    static class ct1 extends ct0 {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    79
        public void message() { }
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    80
    }
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    81
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    82
    static class ct2 extends ct0 {
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    83
        public void message() { }
71a84cee0c39 8234290: compiler/c2/Test6857159.java times out and fail to clean up files
iignatyev
parents: 47216
diff changeset
    84
    }
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    85
}