src/share/vm/runtime/compilationPolicy.cpp
Print this page
@@ -157,10 +157,30 @@
bool CompilationPolicy::is_compilation_enabled() {
// NOTE: CompileBroker::should_compile_new_jobs() checks for UseCompiler
return !delay_compilation_during_startup() && CompileBroker::should_compile_new_jobs();
}
+CompileTask* CompilationPolicy::select_task_helper(CompileQueue* compile_queue) {
+#if INCLUDE_JVMCI
+ if (UseJVMCICompiler && !BackgroundCompilation) {
+ /*
+ * In blocking compilation mode, the CompileBroker will make
+ * compilations submitted by a JVMCI compiler thread non-blocking. These
+ * compilations should be scheduled after all blocking compilations
+ * to service non-compiler related compilations sooner and reduce the
+ * chance of such compilations timing out.
+ */
+ for (CompileTask* task = compile_queue->first(); task != NULL; task = task->next()) {
+ if (task->is_blocking()) {
+ return task;
+ }
+ }
+ }
+#endif
+ return compile_queue->first();
+}
+
#ifndef PRODUCT
void CompilationPolicy::print_time() {
tty->print_cr ("Accumulated compilationPolicy times:");
tty->print_cr ("---------------------------");
tty->print_cr (" Total: %3.3f sec.", _accumulated_time.seconds());
@@ -337,11 +357,11 @@
mcs->backedge_counter()->set_state(InvocationCounter::wait_for_nothing);
}
}
CompileTask* NonTieredCompPolicy::select_task(CompileQueue* compile_queue) {
- return compile_queue->first();
+ return select_task_helper(compile_queue);
}
bool NonTieredCompPolicy::is_mature(Method* method) {
MethodData* mdo = method->method_data();
assert(mdo != NULL, "Should be");