author | thartmann |
Fri, 15 Mar 2019 08:27:13 +0100 | |
changeset 54143 | 8ff8b3734549 |
parent 54015 | cd701366fcf8 |
permissions | -rw-r--r-- |
54015
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
1 |
/* |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
4 |
* |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
8 |
* |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
13 |
* accompanied this code). |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
14 |
* |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
18 |
* |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
21 |
* questions. |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
22 |
*/ |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
23 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
24 |
/* |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
25 |
* @test TestOverloadCompileQueues |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
26 |
* @bug 8163511 |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
27 |
* @summary Test overloading the C1 and C2 compile queues with tasks. |
54143
8ff8b3734549
8220611: compiler/classUnloading/methodUnloading/TestOverloadCompileQueues.java timeout
thartmann
parents:
54015
diff
changeset
|
28 |
* @requires !vm.graal.enabled |
54015
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
29 |
* @run main/othervm -XX:-TieredCompilation -XX:CompileThreshold=2 -XX:CICompilerCount=1 |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
30 |
* compiler.classUnloading.methodUnloading.TestOverloadCompileQueues |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
31 |
* @run main/othervm -XX:TieredCompileTaskTimeout=1000 -XX:CompileThresholdScaling=0.001 -XX:CICompilerCount=2 |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
32 |
* compiler.classUnloading.methodUnloading.TestOverloadCompileQueues |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
33 |
*/ |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
34 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
35 |
package compiler.classUnloading.methodUnloading; |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
36 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
37 |
import java.lang.reflect.Method; |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
38 |
import java.net.URL; |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
39 |
import java.net.URLClassLoader; |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
40 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
41 |
public class TestOverloadCompileQueues { |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
42 |
public static final int ITERS = 500; // Increase for longer stress testing |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
43 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
44 |
// Some methods to fill up the compile queue |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
45 |
public static void test0() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
46 |
public static void test1() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
47 |
public static void test2() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
48 |
public static void test3() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
49 |
public static void test4() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
50 |
public static void test5() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
51 |
public static void test6() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
52 |
public static void test7() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
53 |
public static void test8() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
54 |
public static void test9() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
55 |
public static void test10() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
56 |
public static void test11() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
57 |
public static void test12() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
58 |
public static void test13() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
59 |
public static void test14() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
60 |
public static void test15() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
61 |
public static void test16() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
62 |
public static void test17() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
63 |
public static void test18() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
64 |
public static void test19() { } |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
65 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
66 |
public static void main(String[] args) throws Throwable { |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
67 |
Class<?> thisClass = TestOverloadCompileQueues.class; |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
68 |
ClassLoader defaultLoader = thisClass.getClassLoader(); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
69 |
URL classesDir = thisClass.getProtectionDomain().getCodeSource().getLocation(); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
70 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
71 |
for (int i = 0; i < ITERS; ++i) { |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
72 |
// Load test class with own class loader |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
73 |
URLClassLoader myLoader = URLClassLoader.newInstance(new URL[] {classesDir}, defaultLoader.getParent()); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
74 |
Class<?> testClass = Class.forName(thisClass.getCanonicalName(), true, myLoader); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
75 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
76 |
// Execute all test methods to trigger compilation and fill up compile queue |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
77 |
for (int j = 1; j < 20; ++j) { |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
78 |
Method method = testClass.getDeclaredMethod("test" + j); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
79 |
method.invoke(null); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
80 |
method.invoke(null); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
81 |
} |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
82 |
|
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
83 |
// Unload dead classes from ealier iterations |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
84 |
System.gc(); |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
85 |
} |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
86 |
} |
cd701366fcf8
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
thartmann
parents:
diff
changeset
|
87 |
} |