Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hotspot/os/linux/compilerThreadTimeout_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class CompilerThreadTimeoutLinux : public CHeapObj<mtCompiler> {
bool init_timeout();
void arm();
void disarm();
void reset() {
disarm();
arm();
};
};

#endif //LINUX_COMPILER_THREAD_TIMEOUT_LINUX_HPP
1 change: 1 addition & 0 deletions src/hotspot/share/compiler/compileBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2346,6 +2346,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
while (repeat_compilation_count > 0) {
ResourceMark rm(thread);
task->print_ul("NO CODE INSTALLED");
thread->timeout()->reset();
comp->compile_method(&ci_env, target, osr_bci, false, directive);
repeat_compilation_count--;
}
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/compiler/compilerThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CompilerThreadTimeoutGeneric : public CHeapObj<mtCompiler> {
CompilerThreadTimeoutGeneric() {};
void arm() {};
void disarm() {};
void reset() {};
bool init_timeout() { return true; };
};
#endif // !LINUX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

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

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

// A long enough timeout succeeds.
int timeout = (int)(500.0 * timeoutFactor);
ProcessTools.executeTestJava("-Xcomp", "-XX:CompileTaskTimeout=" + timeout, "--version")
.shouldHaveExitValue(0);

// Each repeated compilation has a new timeout.
ProcessTools.executeTestJava("-Xcomp",
"-XX:CompileTaskTimeout=" + timeout,
"-XX:RepeatCompilation=100",
"-XX:CompileCommand=compileonly,java/util/concurrent/ConcurrentHashMap.*",
"--version")
.shouldHaveExitValue(0);
}
}