test/hotspot/jtreg/compiler/c2/Test6857159.java
author jiangli
Fri, 02 Nov 2018 19:30:31 -0400
changeset 52397 1322829d1501
parent 47216 71c04702a3d5
child 59211 71a84cee0c39
permissions -rw-r--r--
8209564: runtime/appcds/CDSandJFR.java timeout on tier6 on sparc Summary: Set timeout 500 in CDSandJFR.java Reviewed-by: dcubed
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
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
     2
 * Copyright (c) 2009, 2016, 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
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28925
diff changeset
    30
 *          java.management
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    31
 *
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    32
 * @run driver compiler.c2.Test6857159
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    33
 */
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    34
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    35
package compiler.c2;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    36
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    37
import jdk.test.lib.process.OutputAnalyzer;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    38
import jdk.test.lib.process.ProcessTools;
28925
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    39
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    40
public class Test6857159 {
39244
40e48930ff3d 8073159: improve Test6857159.java
iignatyev
parents: 36851
diff changeset
    41
    public static void main(String[] args) throws Throwable {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    42
        String className = Test.class.getName();
39244
40e48930ff3d 8073159: improve Test6857159.java
iignatyev
parents: 36851
diff changeset
    43
        OutputAnalyzer analyzer = ProcessTools.executeTestJvm("-Xbatch",
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    44
                "-XX:+PrintCompilation",
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    45
                "-XX:CompileOnly="+ className + "$ct::run",
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    46
                className);
28925
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    47
        analyzer.shouldNotContain("COMPILE SKIPPED");
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    48
        analyzer.shouldContain(className + "$ct0::run (16 bytes)");
39244
40e48930ff3d 8073159: improve Test6857159.java
iignatyev
parents: 36851
diff changeset
    49
        analyzer.shouldHaveExitValue(0);
28925
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    50
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    51
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    52
    static class Test extends Thread {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    53
        static class ct0 extends Test {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    54
            public void message() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    55
            }
28925
11712bea9d85 8068440: Test6857159.java times out
anoll
parents: 27699
diff changeset
    56
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    57
            public void run() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    58
                message();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    59
                ct0 ct = (ct0) Thread.currentThread();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    60
                ct.message();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    61
            }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    62
        }
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    63
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    64
        static class ct1 extends ct0 {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    65
            public void message() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    66
            }
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    67
        }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    68
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    69
        static class ct2 extends ct0 {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    70
            public void message() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    71
            }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    72
        }
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    73
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    74
        public static void main(String[] args) throws Exception {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    75
            for (int i = 0; i < 20000; i++) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    76
                Thread t = null;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    77
                switch (i % 3) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    78
                    case 0:
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    79
                        t = new ct0();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    80
                        break;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    81
                    case 1:
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    82
                        t = new ct1();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    83
                        break;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    84
                    case 2:
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    85
                        t = new ct2();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    86
                        break;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    87
                }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    88
                t.start();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39244
diff changeset
    89
                t.join();
3272
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    90
            }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    91
        }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    92
    }
5a1e113bfed5 6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff changeset
    93
}