author | jiangli |
Fri, 02 Nov 2018 19:30:31 -0400 | |
changeset 52397 | 1322829d1501 |
parent 47216 | 71c04702a3d5 |
child 59211 | 71a84cee0c39 |
permissions | -rw-r--r-- |
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 | 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 | 31 |
* |
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 | 35 |
package compiler.c2; |
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 | 39 |
|
40 |
public class Test6857159 { |
|
39244 | 41 |
public static void main(String[] args) throws Throwable { |
40059 | 42 |
String className = Test.class.getName(); |
39244 | 43 |
OutputAnalyzer analyzer = ProcessTools.executeTestJvm("-Xbatch", |
40059 | 44 |
"-XX:+PrintCompilation", |
45 |
"-XX:CompileOnly="+ className + "$ct::run", |
|
46 |
className); |
|
28925 | 47 |
analyzer.shouldNotContain("COMPILE SKIPPED"); |
40059 | 48 |
analyzer.shouldContain(className + "$ct0::run (16 bytes)"); |
39244 | 49 |
analyzer.shouldHaveExitValue(0); |
28925 | 50 |
} |
40059 | 51 |
|
52 |
static class Test extends Thread { |
|
53 |
static class ct0 extends Test { |
|
54 |
public void message() { |
|
55 |
} |
|
28925 | 56 |
|
40059 | 57 |
public void run() { |
58 |
message(); |
|
59 |
ct0 ct = (ct0) Thread.currentThread(); |
|
60 |
ct.message(); |
|
61 |
} |
|
62 |
} |
|
3272
5a1e113bfed5
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff
changeset
|
63 |
|
40059 | 64 |
static class ct1 extends ct0 { |
65 |
public void message() { |
|
66 |
} |
|
3272
5a1e113bfed5
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff
changeset
|
67 |
} |
40059 | 68 |
|
69 |
static class ct2 extends ct0 { |
|
70 |
public void message() { |
|
71 |
} |
|
72 |
} |
|
3272
5a1e113bfed5
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
diff
changeset
|
73 |
|
40059 | 74 |
public static void main(String[] args) throws Exception { |
75 |
for (int i = 0; i < 20000; i++) { |
|
76 |
Thread t = null; |
|
77 |
switch (i % 3) { |
|
78 |
case 0: |
|
79 |
t = new ct0(); |
|
80 |
break; |
|
81 |
case 1: |
|
82 |
t = new ct1(); |
|
83 |
break; |
|
84 |
case 2: |
|
85 |
t = new ct2(); |
|
86 |
break; |
|
87 |
} |
|
88 |
t.start(); |
|
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 |
} |