Lines Matching refs:task

183   void log_compile(JavaThread* thread, CompileTask* task) {
187 task->print(&sstr, NULL, true, false);
197 void log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
199 lm.print("%4d COMPILE SKIPPED: %s", task->compile_id(), reason);
236 CompileTaskWrapper::CompileTaskWrapper(CompileTask* task) {
238 thread->set_task(task);
240 if (task->is_blocking() && CompileBroker::compiler(task->comp_level())->is_jvmci()) {
241 task->set_jvmci_compiler_thread(thread);
245 if (log != NULL) task->log_task_start(log);
250 CompileTask* task = thread->task();
252 if (log != NULL) task->log_task_done(log);
254 task->set_code_handle(NULL);
256 if (task->is_blocking()) {
259 MutexLocker notifier(task->lock(), thread);
260 task->mark_complete();
262 if (CompileBroker::compiler(task->comp_level())->is_jvmci()) {
263 if (!task->has_waiter()) {
264 // The waiting thread timed out and thus did not free the task.
267 task->set_jvmci_compiler_thread(NULL);
272 // so that it can free the task.
273 task->lock()->notify_all();
277 // The task can only be freed once the task lock is released.
278 CompileTask::free(task);
281 task->mark_complete();
285 CompileTask::free(task);
292 void CompileQueue::add(CompileTask* task) {
295 task->set_next(NULL);
296 task->set_prev(NULL);
301 _first = task;
302 _last = task;
304 // Append the task to the queue.
306 _last->set_next(task);
307 task->set_prev(_last);
308 _last = task;
313 task->method()->set_queued_for_compilation();
320 task->log_task_queued();
323 // Notify CompilerThreads that a task is available.
330 * waiting on a compilation task to finish. This can happen if background
342 // Wake up thread that blocks on the compile task.
346 // Put the task back on the freelist.
392 CompileTask* task;
395 task = CompilationPolicy::policy()->select_task(this);
398 if (task != NULL) {
399 // Save method pointers across unlock safepoint. The task is removed from
401 save_method = methodHandle(task->method());
402 save_hot_method = methodHandle(task->hot_method());
404 remove(task);
408 return task;
418 // Once task processing starts and MCQ lock is released,
424 for (CompileTask* task = head; task != NULL; ) {
425 CompileTask* next_task = task->next();
426 CompileTaskWrapper ctw(task); // Frees the task
427 task->set_failure_reason("stale task");
428 task = next_task;
434 void CompileQueue::remove(CompileTask* task) {
436 if (task->prev() != NULL) {
437 task->prev()->set_next(task->next());
440 assert(task == _first, "Sanity");
441 _first = task->next();
444 if (task->next() != NULL) {
445 task->next()->set_prev(task->prev());
448 assert(task == _last, "Sanity");
449 _last = task->prev();
454 void CompileQueue::remove_and_mark_stale(CompileTask* task) {
456 remove(task);
458 // Enqueue the task for reclamation (should be done outside MCQ lock)
459 task->set_next(_first_stale);
460 task->set_prev(NULL);
461 _first_stale = task;
467 CompileTask* task = _first;
468 while (task != NULL) {
469 task->mark_on_stack();
470 task = task->next();
501 CompileTask* task = _first;
502 if (task == NULL) {
505 while (task != NULL) {
506 task->print(st, NULL, true, true);
507 task = task->next();
912 CompileTask* task = NULL;
981 // Before a thread queues a task for compilation, it first acquires
984 // instances of a compilation task for the same method on the
986 // thread has already removed a task for that method from the queue
1003 // we are assured that we cannot introduce a duplicate task.
1007 // completed, and end up introducing a "duplicate" (redundant) task.
1015 task = create_compile_task(queue,
1023 wait_for_completion(task);
1338 // compilation. Add this task to the queue.
1366 * Waits for a JVMCI compiler to complete a given task. This thread
1367 * waits until either the task completes or it sees no JVMCI compilation
1372 * @return true if this thread needs to free/recycle the task
1374 bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask* task, JavaThread* thread) {
1375 MutexLocker waiter(task->lock(), thread);
1378 while (!task->is_complete() && !is_compilation_disabled_forever() &&
1379 task->lock()->wait(!Mutex::_no_safepoint_check_flag, JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
1380 CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
1397 task->print(tty, "wait for blocking compilation timed out");
1408 task->clear_waiter();
1409 return task->is_complete();
1414 * Wait for the compilation task to complete.
1416 void CompileBroker::wait_for_completion(CompileTask* task) {
1422 assert(task->is_blocking(), "can only wait on blocking task");
1427 methodHandle method(thread, task->method());
1430 AbstractCompiler* comp = compiler(task->comp_level());
1432 free_task = wait_for_jvmci_completion((JVMCICompiler*) comp, task, thread);
1436 MutexLocker waiter(task->lock(), thread);
1438 while (!task->is_complete() && !is_compilation_disabled_forever()) {
1439 task->lock()->wait();
1446 CompileTask::free(task);
1451 // completion is a stable property (until the task object is recycled).
1452 assert(task->is_complete(), "Compilation should have completed");
1453 assert(task->code_handle() == NULL, "must be reset");
1459 CompileTask::free(task);
1606 CompileTask* task = queue->get();
1607 if (task == NULL) {
1617 // Assign the task to the current thread. Mark this compilation
1619 CompileTaskWrapper ctw(task);
1620 nmethodLocker result_handle; // (handle for the nmethod produced by this task)
1621 task->set_code_handle(&result_handle);
1622 methodHandle method(thread, task->method());
1628 invoke_compiler_on_method(task);
1632 task->set_failure_reason("compilation is disabled");
1764 void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env) {
1767 task->mark_success();
1769 task->set_num_inlined_bytecodes(ci_env->num_inlined_bytecodes());
1772 nmethod* code = task->code();
1780 assert(task->compile_id() != CICrashAt, "just as planned");
1782 event.set_method(task->method());
1783 event.set_compileId(task->compile_id());
1784 event.set_compileLevel(task->comp_level());
1785 event.set_succeded(task->is_success());
1786 event.set_isOsr(task->osr_bci() != CompileBroker::standard_entry_bci);
1787 event.set_codeSize((task->code() == NULL) ? 0 : task->code()->total_size());
1788 event.set_inlinedBytes(task->num_inlined_bytecodes());
1802 void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
1803 task->print_ul();
1806 task->print_tty();
1814 _compilation_log->log_compile(thread, task);
1818 uint compile_id = task->compile_id();
1819 int osr_bci = task->osr_bci();
1823 const int task_level = task->comp_level();
1824 AbstractCompiler* comp = task->compiler();
1832 methodHandle method(thread, task->method());
1844 should_break = directive->BreakAtExecuteOption || task->check_break_at_flags();
1851 Method* target_handle = task->method();
1869 JVMCIEnv env(task, system_dictionary_modification_counter);
1873 post_compile(thread, task, event, task->code() != NULL, NULL);
1887 ciEnv ci_env(task, system_dictionary_modification_counter);
1920 if (!ci_env.failing() && task->code() == NULL) {
1936 post_compile(thread, task, event, !ci_env.failing(), &ci_env);
1943 task->set_failure_reason(failure_reason);
1945 _compilation_log->log_failure(thread, task, failure_reason, retry_message);
1951 task->print(tty, msg);
1955 methodHandle method(thread, task->method());
1957 DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
1959 collect_statistics(thread, time, task);
1961 nmethod* nm = task->code();
1971 if (task->code() != NULL) {
1972 tty->print("size: %d(%d) ", task->code()->total_size(), task->code()->insts_size());
1974 tty->print_cr("time: %d inlined: %d bytes", (int)time.milliseconds(), task->num_inlined_bytecodes());
2003 // when adding the task to the compile queue -- at which time the
2005 // queue lock to get this task off the compile queue; thus (to belabour
2154 void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task) {
2155 bool success = task->is_success();
2156 methodHandle method (thread, task->method());
2157 uint compile_id = task->compile_id();
2158 bool is_osr = (task->osr_bci() != standard_entry_bci);
2159 nmethod* code = task->code();
2198 int bytes_compiled = method->code_size() + task->num_inlined_bytecodes();
2204 _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
2208 AbstractCompiler* comp = compiler(task->comp_level());
2233 task->num_inlined_bytecodes());
2236 _perf_sum_osr_bytes_compiled->inc(method->code_size() + task->num_inlined_bytecodes());
2239 _perf_sum_standard_bytes_compiled->inc(method->code_size() + task->num_inlined_bytecodes());
2244 float bytes_per_sec = 1.0 * (method->code_size() + task->num_inlined_bytecodes()) / time.seconds();
2246 compile_id, time.seconds(), bytes_per_sec, method->code_size(), task->num_inlined_bytecodes());