Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit bbcb3b6

Browse files
committedMay 4, 2020
8230402: Allocation of compile task fails with assert: "Leaking compilation tasks?"
Remove assert that is only hit with hand written edge case tests. Reviewed-by: kvn, thartmann
1 parent 57fbf93 commit bbcb3b6

File tree

3 files changed

+84
-12
lines changed

3 files changed

+84
-12
lines changed
 

‎src/hotspot/share/compiler/compileTask.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#include "runtime/handles.inline.hpp"
3434

3535
CompileTask* CompileTask::_task_free_list = NULL;
36-
#ifdef ASSERT
37-
int CompileTask::_num_allocated_tasks = 0;
38-
#endif
3936

4037
/**
4138
* Allocate a CompileTask, from the free list if possible.
@@ -50,8 +47,6 @@ CompileTask* CompileTask::allocate() {
5047
task->set_next(NULL);
5148
} else {
5249
task = new CompileTask();
53-
DEBUG_ONLY(_num_allocated_tasks++;)
54-
assert (WhiteBoxAPI || JVMCI_ONLY(UseJVMCICompiler ||) _num_allocated_tasks < 10000, "Leaking compilation tasks?");
5550
task->set_next(NULL);
5651
task->set_is_free(true);
5752
}

‎src/hotspot/share/compiler/compileTask.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ class CompileTask : public CHeapObj<mtCompiler> {
7575

7676
private:
7777
static CompileTask* _task_free_list;
78-
#ifdef ASSERT
79-
static int _num_allocated_tasks;
80-
#endif
81-
8278
Monitor* _lock;
8379
uint _compile_id;
8480
Method* _method;

‎test/hotspot/jtreg/compiler/classUnloading/methodUnloading/TestOverloadCompileQueues.java

+84-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
/*
2525
* @test TestOverloadCompileQueues
26-
* @bug 8163511
26+
* @bug 8163511 8230402
2727
* @summary Test overloading the C1 and C2 compile queues with tasks.
2828
* @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
3030
* 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
3232
* compiler.classUnloading.methodUnloading.TestOverloadCompileQueues
3333
*/
3434

@@ -37,9 +37,13 @@
3737
import java.lang.reflect.Method;
3838
import java.net.URL;
3939
import java.net.URLClassLoader;
40+
import java.util.Arrays;
4041

4142
public class TestOverloadCompileQueues {
4243
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];
4347

4448
// Some methods to fill up the compile queue
4549
public static void test0() { }
@@ -63,7 +67,65 @@ public static void test17() { }
6367
public static void test18() { }
6468
public static void test19() { }
6569

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+
66123
public static void main(String[] args) throws Throwable {
124+
run();
125+
runA();
126+
}
127+
128+
public static void run() throws Throwable {
67129
Class<?> thisClass = TestOverloadCompileQueues.class;
68130
ClassLoader defaultLoader = thisClass.getClassLoader();
69131
URL classesDir = thisClass.getProtectionDomain().getCodeSource().getLocation();
@@ -84,4 +146,23 @@ public static void main(String[] args) throws Throwable {
84146
System.gc();
85147
}
86148
}
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+
}
87168
}

0 commit comments

Comments
 (0)
This repository has been archived.