< prev index next >

src/hotspot/share/compiler/compileBroker.cpp

Print this page




1760     CompileTask* task = queue->get();
1761     if (task == NULL) {
1762       if (UseDynamicNumberOfCompilerThreads) {
1763         // Access compiler_count under lock to enforce consistency.
1764         MutexLocker only_one(CompileThread_lock);
1765         if (can_remove(thread, true)) {
1766           if (TraceCompilerThreads) {
1767             tty->print_cr("Removing compiler thread %s after " JLONG_FORMAT " ms idle time",
1768                           thread->name(), thread->idle_time_millis());
1769           }
1770           return; // Stop this thread.
1771         }
1772       }
1773       continue;
1774     }
1775 
1776     if (UseDynamicNumberOfCompilerThreads) {
1777       possibly_add_compiler_threads();
1778     }
1779 
1780     // Give compiler threads an extra quanta.  They tend to be bursty and
1781     // this helps the compiler to finish up the job.
1782     if (CompilerThreadHintNoPreempt) {
1783       os::hint_no_preempt();
1784     }
1785 
1786     // Assign the task to the current thread.  Mark this compilation
1787     // thread as active for the profiler.
1788     CompileTaskWrapper ctw(task);
1789     nmethodLocker result_handle;  // (handle for the nmethod produced by this task)
1790     task->set_code_handle(&result_handle);
1791     methodHandle method(thread, task->method());
1792 
1793     // Never compile a method if breakpoints are present in it
1794     if (method()->number_of_breakpoints() == 0) {
1795       // Compile the method.
1796       if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
1797         invoke_compiler_on_method(task);
1798         thread->start_idle_timer();
1799       } else {
1800         // After compilation is disabled, remove remaining methods from queue
1801         method->clear_queued_for_compilation();
1802         task->set_failure_reason("compilation is disabled");
1803       }
1804     }
1805   }




1760     CompileTask* task = queue->get();
1761     if (task == NULL) {
1762       if (UseDynamicNumberOfCompilerThreads) {
1763         // Access compiler_count under lock to enforce consistency.
1764         MutexLocker only_one(CompileThread_lock);
1765         if (can_remove(thread, true)) {
1766           if (TraceCompilerThreads) {
1767             tty->print_cr("Removing compiler thread %s after " JLONG_FORMAT " ms idle time",
1768                           thread->name(), thread->idle_time_millis());
1769           }
1770           return; // Stop this thread.
1771         }
1772       }
1773       continue;
1774     }
1775 
1776     if (UseDynamicNumberOfCompilerThreads) {
1777       possibly_add_compiler_threads();
1778     }
1779 






1780     // Assign the task to the current thread.  Mark this compilation
1781     // thread as active for the profiler.
1782     CompileTaskWrapper ctw(task);
1783     nmethodLocker result_handle;  // (handle for the nmethod produced by this task)
1784     task->set_code_handle(&result_handle);
1785     methodHandle method(thread, task->method());
1786 
1787     // Never compile a method if breakpoints are present in it
1788     if (method()->number_of_breakpoints() == 0) {
1789       // Compile the method.
1790       if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
1791         invoke_compiler_on_method(task);
1792         thread->start_idle_timer();
1793       } else {
1794         // After compilation is disabled, remove remaining methods from queue
1795         method->clear_queued_for_compilation();
1796         task->set_failure_reason("compilation is disabled");
1797       }
1798     }
1799   }


< prev index next >