--- old/src/share/vm/runtime/advancedThresholdPolicy.cpp 2015-09-16 15:18:56.000000000 -0700 +++ new/src/share/vm/runtime/advancedThresholdPolicy.cpp 2015-09-16 15:18:56.000000000 -0700 @@ -162,6 +162,9 @@ // Called with the queue locked and with at least one element CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { +#if INCLUDE_JVMCI + CompileTask *max_non_jvmci_task = NULL; +#endif CompileTask *max_task = NULL; Method* max_method = NULL; jlong t = os::javaTimeMillis(); @@ -179,6 +182,7 @@ if (PrintTieredEvents) { print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level()); } + task->log_task_dequeued("stale"); compile_queue->remove_and_mark_stale(task); method->clear_queued_for_compilation(); task = next_task; @@ -194,6 +198,15 @@ task = next_task; } +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + if (max_non_jvmci_task != NULL) { + max_task = max_non_jvmci_task; + max_method = max_task->method(); + } + } +#endif + if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile && is_method_profiled(max_method)) { max_task->set_comp_level(CompLevel_limited_profile); @@ -354,6 +367,14 @@ if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) { next_level = CompLevel_full_optimization; } else if ((this->*p)(i, b, cur_level, method)) { +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + // Since JVMCI takes a while to warm up, its queue inevitably backs up during + // early VM execution. + next_level = CompLevel_full_profile; + break; + } +#endif // C1-generated fully profiled code is about 30% slower than the limited profile // code that has only invocation and backedge counters. The observation is that // if C2 queue is large enough we can spend too much time in the fully profiled code @@ -362,7 +383,7 @@ // we choose to compile a limited profiled version and then recompile with full profiling // when the load on C2 goes down. if (!disable_feedback && CompileBroker::queue_size(CompLevel_full_optimization) > - Tier3DelayOn * compiler_count(CompLevel_full_optimization)) { + Tier3DelayOn * compiler_count(CompLevel_full_optimization)) { next_level = CompLevel_limited_profile; } else { next_level = CompLevel_full_profile;