23
23
24
24
/*
25
25
* @test TestOverloadCompileQueues
26
- * @bug 8163511
26
+ * @bug 8163511 8230402
27
27
* @summary Test overloading the C1 and C2 compile queues with tasks.
28
28
* @requires !vm.graal.enabled
29
- * @run main/othervm -XX:-TieredCompilation -XX:CompileThreshold=2 -XX:CICompilerCount=1
29
+ * @run main/othervm/timeout=300 -XX:-TieredCompilation -XX:CompileThreshold=2 -XX:CICompilerCount=1
30
30
* compiler.classUnloading.methodUnloading.TestOverloadCompileQueues
31
- * @run main/othervm -XX:TieredCompileTaskTimeout=1000 -XX:CompileThresholdScaling=0.001 -XX:CICompilerCount=2
31
+ * @run main/othervm/timeout=300 -XX:TieredCompileTaskTimeout=1000 -XX:CompileThresholdScaling=0.001 -XX:CICompilerCount=2
32
32
* compiler.classUnloading.methodUnloading.TestOverloadCompileQueues
33
33
*/
34
34
37
37
import java .lang .reflect .Method ;
38
38
import java .net .URL ;
39
39
import java .net .URLClassLoader ;
40
+ import java .util .Arrays ;
40
41
41
42
public class TestOverloadCompileQueues {
42
43
public static final int ITERS = 500 ; // Increase for longer stress testing
44
+ public static final int ITERS_A = 1000 ; // Increase for longer stress testing
45
+
46
+ public static int iArr [] = new int [100 ];
43
47
44
48
// Some methods to fill up the compile queue
45
49
public static void test0 () { }
@@ -63,7 +67,65 @@ public static void test17() { }
63
67
public static void test18 () { }
64
68
public static void test19 () { }
65
69
70
+ // More methods that do some more complex things. Therefore, the compiler needs to spend some more time compiling them.
71
+ // With 50 methods, a queue size of 10000 is also reached in the second run with TieredCompilation enabled.
72
+ public static void testA0 () { Arrays .sort (iArr ); }
73
+ public static void testA1 () { Arrays .sort (iArr ); }
74
+ public static void testA2 () { Arrays .sort (iArr ); }
75
+ public static void testA3 () { Arrays .sort (iArr ); }
76
+ public static void testA4 () { Arrays .sort (iArr ); }
77
+ public static void testA5 () { Arrays .sort (iArr ); }
78
+ public static void testA6 () { Arrays .sort (iArr ); }
79
+ public static void testA7 () { Arrays .sort (iArr ); }
80
+ public static void testA8 () { Arrays .sort (iArr ); }
81
+ public static void testA9 () { Arrays .sort (iArr ); }
82
+ public static void testA10 () { Arrays .sort (iArr ); }
83
+ public static void testA11 () { Arrays .sort (iArr ); }
84
+ public static void testA12 () { Arrays .sort (iArr ); }
85
+ public static void testA13 () { Arrays .sort (iArr ); }
86
+ public static void testA14 () { Arrays .sort (iArr ); }
87
+ public static void testA15 () { Arrays .sort (iArr ); }
88
+ public static void testA16 () { Arrays .sort (iArr ); }
89
+ public static void testA17 () { Arrays .sort (iArr ); }
90
+ public static void testA18 () { Arrays .sort (iArr ); }
91
+ public static void testA19 () { Arrays .sort (iArr ); }
92
+ public static void testA20 () { Arrays .sort (iArr ); }
93
+ public static void testA21 () { Arrays .sort (iArr ); }
94
+ public static void testA22 () { Arrays .sort (iArr ); }
95
+ public static void testA23 () { Arrays .sort (iArr ); }
96
+ public static void testA24 () { Arrays .sort (iArr ); }
97
+ public static void testA25 () { Arrays .sort (iArr ); }
98
+ public static void testA26 () { Arrays .sort (iArr ); }
99
+ public static void testA27 () { Arrays .sort (iArr ); }
100
+ public static void testA28 () { Arrays .sort (iArr ); }
101
+ public static void testA29 () { Arrays .sort (iArr ); }
102
+ public static void testA30 () { Arrays .sort (iArr ); }
103
+ public static void testA31 () { Arrays .sort (iArr ); }
104
+ public static void testA32 () { Arrays .sort (iArr ); }
105
+ public static void testA33 () { Arrays .sort (iArr ); }
106
+ public static void testA34 () { Arrays .sort (iArr ); }
107
+ public static void testA35 () { Arrays .sort (iArr ); }
108
+ public static void testA36 () { Arrays .sort (iArr ); }
109
+ public static void testA37 () { Arrays .sort (iArr ); }
110
+ public static void testA38 () { Arrays .sort (iArr ); }
111
+ public static void testA39 () { Arrays .sort (iArr ); }
112
+ public static void testA40 () { Arrays .sort (iArr ); }
113
+ public static void testA41 () { Arrays .sort (iArr ); }
114
+ public static void testA42 () { Arrays .sort (iArr ); }
115
+ public static void testA43 () { Arrays .sort (iArr ); }
116
+ public static void testA44 () { Arrays .sort (iArr ); }
117
+ public static void testA45 () { Arrays .sort (iArr ); }
118
+ public static void testA46 () { Arrays .sort (iArr ); }
119
+ public static void testA47 () { Arrays .sort (iArr ); }
120
+ public static void testA48 () { Arrays .sort (iArr ); }
121
+ public static void testA49 () { Arrays .sort (iArr ); }
122
+
66
123
public static void main (String [] args ) throws Throwable {
124
+ run ();
125
+ runA ();
126
+ }
127
+
128
+ public static void run () throws Throwable {
67
129
Class <?> thisClass = TestOverloadCompileQueues .class ;
68
130
ClassLoader defaultLoader = thisClass .getClassLoader ();
69
131
URL classesDir = thisClass .getProtectionDomain ().getCodeSource ().getLocation ();
@@ -84,4 +146,23 @@ public static void main(String[] args) throws Throwable {
84
146
System .gc ();
85
147
}
86
148
}
149
+
150
+ public static void runA () throws Throwable {
151
+ Class <?> thisClass = TestOverloadCompileQueues .class ;
152
+ ClassLoader defaultLoader = thisClass .getClassLoader ();
153
+ URL classesDir = thisClass .getProtectionDomain ().getCodeSource ().getLocation ();
154
+
155
+ for (int i = 0 ; i < ITERS_A ; ++i ) {
156
+ // Load test class with own class loader
157
+ URLClassLoader myLoader = URLClassLoader .newInstance (new URL [] {classesDir }, defaultLoader .getParent ());
158
+ Class <?> testClass = Class .forName (thisClass .getCanonicalName (), true , myLoader );
159
+
160
+ // Execute all test methods to trigger compilation and fill up compile queue
161
+ for (int j = 0 ; j < 50 ; ++j ) {
162
+ Method method = testClass .getDeclaredMethod ("testA" + j );
163
+ method .invoke (null );
164
+ method .invoke (null );
165
+ }
166
+ }
167
+ }
87
168
}
0 commit comments