// Called with the queue locked and with at least one element CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { CompileTask *max_task = NULL; methodOop max_method; jlong t = os::javaTimeMillis(); // Iterate through the queue and find a method with a maximum rate. for (CompileTask* task = compile_queue->first(); task != NULL;) { CompileTask* next_task = task->next(); methodOop method = (methodOop)JNIHandles::resolve(task->method_handle()); methodDataOop mdo = method->method_data(); update_rate(t, method); if (max_task == NULL) { max_task = task; max_method = method; } else { // If a method has been stale for some time, remove it from the queue. if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) { if (PrintTieredEvents) { print_event(KILL, method, method, task->osr_bci(), (CompLevel)task->comp_level()); } CompileTaskWrapper ctw(task); // Frees the task compile_queue->remove(task); method->clear_queued_for_compilation(); task = next_task; continue; } // Select a method with a higher rate if (compare_methods(method, max_method)) { max_task = task; max_method = method; } } task = next_task; } if (max_task->comp_level() == CompLevel_full_profile && is_method_profiled(max_method)) { max_task->set_comp_level(CompLevel_limited_profile); if (PrintTieredEvents) { print_event(UPDATE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level()); } } return max_task; }
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(); }
// Called with the queue locked and with at least one element CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { CompileTask *max_task = NULL; Method* max_method = NULL; jlong t = os::javaTimeMillis(); // Iterate through the queue and find a method with a maximum rate. for (CompileTask* task = compile_queue->first(); task != NULL;) { CompileTask* next_task = task->next(); Method* method = task->method(); update_rate(t, method); if (max_task == NULL) { max_task = task; max_method = method; } else { // If a method has been stale for some time, remove it from the queue. if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) { if (PrintTieredEvents) { print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level()); } compile_queue->remove_and_mark_stale(task); method->clear_queued_for_compilation(); task = next_task; continue; } // Select a method with a higher rate if (compare_methods(method, max_method)) { max_task = task; max_method = method; } } task = next_task; } 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); if (PrintTieredEvents) { print_event(UPDATE_IN_QUEUE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level()); } } return max_task; }
bool ModuleGenerator::startFunc(PropertyName* name, unsigned line, unsigned column, FunctionGenerator* fg) { MOZ_ASSERT(!active_); if (freeTasks_.empty() && !finishOutstandingTask()) return false; CompileTask* task = freeTasks_.popCopy(); FuncIR* func = task->lifo().new_<FuncIR>(task->lifo(), name, line, column); if (!func) return false; task->init(*func); fg->m_ = this; fg->task_ = task; fg->func_ = func; active_ = fg; return true; }