Skip to content

Commit 94a301a

Browse files
committed
8366875: CompileTaskTimeout should be reset for each iteration of RepeatCompilation
Reviewed-by: dlong, epeter
1 parent 937e19e commit 94a301a

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/hotspot/os/linux/compilerThreadTimeout_linux.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class CompilerThreadTimeoutLinux : public CHeapObj<mtCompiler> {
4646
bool init_timeout();
4747
void arm();
4848
void disarm();
49+
void reset() {
50+
disarm();
51+
arm();
52+
};
4953
};
5054

5155
#endif //LINUX_COMPILER_THREAD_TIMEOUT_LINUX_HPP

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
23492349
while (repeat_compilation_count > 0) {
23502350
ResourceMark rm(thread);
23512351
task->print_ul("NO CODE INSTALLED");
2352+
thread->timeout()->reset();
23522353
comp->compile_method(&ci_env, target, osr_bci, false, directive);
23532354
repeat_compilation_count--;
23542355
}

src/hotspot/share/compiler/compilerThread.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class CompilerThreadTimeoutGeneric : public CHeapObj<mtCompiler> {
5151
CompilerThreadTimeoutGeneric() {};
5252
void arm() {};
5353
void disarm() {};
54+
void reset() {};
5455
bool init_timeout() { return true; };
5556
};
5657
#endif // !LINUX

test/hotspot/jtreg/compiler/arguments/TestCompileTaskTimeout.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/*
2727
* @test TestCompileTaskTimeout
28-
* @bug 8308094 8365909
28+
* @bug 8308094 8365909 8366875
2929
* @requires vm.debug & vm.flagless & os.name == "Linux"
3030
* @summary Check functionality of CompileTaskTimeout
3131
* @library /test/lib
@@ -42,6 +42,7 @@ public static void main(String[] args) throws Throwable {
4242
timeoutFactor = Double.parseDouble(System.getProperty("test.timeout.factor", "1.0"));
4343
} catch (NumberFormatException ignored) {}
4444

45+
// Short timeouts crash the VM.
4546
ProcessTools.executeTestJava("-Xcomp", "-XX:CompileTaskTimeout=1", "--version")
4647
.shouldHaveExitValue(134)
4748
.shouldContain("timed out after");
@@ -54,8 +55,17 @@ public static void main(String[] args) throws Throwable {
5455
.shouldHaveExitValue(134)
5556
.shouldContain("timed out after");
5657

58+
// A long enough timeout succeeds.
5759
int timeout = (int)(500.0 * timeoutFactor);
5860
ProcessTools.executeTestJava("-Xcomp", "-XX:CompileTaskTimeout=" + timeout, "--version")
5961
.shouldHaveExitValue(0);
62+
63+
// Each repeated compilation has a new timeout.
64+
ProcessTools.executeTestJava("-Xcomp",
65+
"-XX:CompileTaskTimeout=" + timeout,
66+
"-XX:RepeatCompilation=100",
67+
"-XX:CompileCommand=compileonly,java/util/concurrent/ConcurrentHashMap.*",
68+
"--version")
69+
.shouldHaveExitValue(0);
6070
}
6171
}

0 commit comments

Comments
 (0)