src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-rt-fx60 Sdiff src/share/vm/compiler

src/share/vm/compiler/compileBroker.cpp

Print this page




 838     // thread).  This means Java bytecodes being executed at startup can
 839     // queue compile jobs which will run at whatever default priority the
 840     // newly created CompilerThread runs at.
 841 
 842 
 843     // At this point it may be possible that no osthread was created for the
 844     // JavaThread due to lack of memory. We would have to throw an exception
 845     // in that case. However, since this must work and we do not allow
 846     // exceptions anyway, check and abort if this fails.
 847 
 848     if (compiler_thread == NULL || compiler_thread->osthread() == NULL){
 849       vm_exit_during_initialization("java.lang.OutOfMemoryError",
 850                                     "unable to create new native thread");
 851     }
 852 
 853     java_lang_Thread::set_thread(thread_oop(), compiler_thread);
 854 
 855     // Note that this only sets the JavaThread _priority field, which by
 856     // definition is limited to Java priorities and not OS priorities.
 857     // The os-priority is set in the CompilerThread startup code itself

 858     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
 859     // CLEANUP PRIORITIES: This -if- statement hids a bug whereby the compiler
 860     // threads never have their OS priority set.  The assumption here is to
 861     // enable the Performance group to do flag tuning, figure out a suitable
 862     // CompilerThreadPriority, and then remove this 'if' statement (and
 863     // comment) and unconditionally set the priority.
 864 
 865     // Compiler Threads should be at the highest Priority
 866     if ( CompilerThreadPriority != -1 )
 867       os::set_native_priority( compiler_thread, CompilerThreadPriority );
 868     else
 869       os::set_native_priority( compiler_thread, os::java_to_os_priority[NearMaxPriority]);
 870 
 871       // Note that I cannot call os::set_priority because it expects Java
 872       // priorities and I am *explicitly* using OS priorities so that it's
 873       // possible to set the compiler thread priority higher than any Java
 874       // thread.
 875 










 876     java_lang_Thread::set_daemon(thread_oop());
 877 
 878     compiler_thread->set_threadObj(thread_oop());
 879     Threads::add(compiler_thread);
 880     Thread::start(compiler_thread);
 881   }

 882   // Let go of Threads_lock before yielding
 883   os::yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS)
 884 
 885   return compiler_thread;
 886 }
 887 
 888 
 889 // ------------------------------------------------------------------
 890 // CompileBroker::init_compiler_threads
 891 //
 892 // Initialize the compilation queue
 893 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
 894   EXCEPTION_MARK;
 895 #if !defined(ZERO) && !defined(SHARK)
 896   assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
 897 #endif // !ZERO && !SHARK
 898   if (c2_compiler_count > 0) {
 899     _c2_method_queue  = new CompileQueue("C2MethodQueue",  MethodCompileQueue_lock);
 900   }
 901   if (c1_compiler_count > 0) {




 838     // thread).  This means Java bytecodes being executed at startup can
 839     // queue compile jobs which will run at whatever default priority the
 840     // newly created CompilerThread runs at.
 841 
 842 
 843     // At this point it may be possible that no osthread was created for the
 844     // JavaThread due to lack of memory. We would have to throw an exception
 845     // in that case. However, since this must work and we do not allow
 846     // exceptions anyway, check and abort if this fails.
 847 
 848     if (compiler_thread == NULL || compiler_thread->osthread() == NULL){
 849       vm_exit_during_initialization("java.lang.OutOfMemoryError",
 850                                     "unable to create new native thread");
 851     }
 852 
 853     java_lang_Thread::set_thread(thread_oop(), compiler_thread);
 854 
 855     // Note that this only sets the JavaThread _priority field, which by
 856     // definition is limited to Java priorities and not OS priorities.
 857     // The os-priority is set in the CompilerThread startup code itself
 858 
 859     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);





 860 
 861     // Note that we cannot call os::set_priority because it expects Java
 862     // priorities and we are *explicitly* using OS priorities so that it's






 863     // possible to set the compiler thread priority higher than any Java
 864     // thread.
 865 
 866     int native_prio = CompilerThreadPriority;
 867     if (native_prio == -1) {
 868       if (UseCriticalCompilerThreadPriority) {
 869         native_prio = os::java_to_os_priority[CriticalPriority];
 870       } else {
 871         native_prio = os::java_to_os_priority[NearMaxPriority];
 872       }
 873     }
 874     os::set_native_priority(compiler_thread, native_prio);
 875 
 876     java_lang_Thread::set_daemon(thread_oop());
 877 
 878     compiler_thread->set_threadObj(thread_oop());
 879     Threads::add(compiler_thread);
 880     Thread::start(compiler_thread);
 881   }
 882 
 883   // Let go of Threads_lock before yielding
 884   os::yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS)
 885 
 886   return compiler_thread;
 887 }
 888 
 889 
 890 // ------------------------------------------------------------------
 891 // CompileBroker::init_compiler_threads
 892 //
 893 // Initialize the compilation queue
 894 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
 895   EXCEPTION_MARK;
 896 #if !defined(ZERO) && !defined(SHARK)
 897   assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
 898 #endif // !ZERO && !SHARK
 899   if (c2_compiler_count > 0) {
 900     _c2_method_queue  = new CompileQueue("C2MethodQueue",  MethodCompileQueue_lock);
 901   }
 902   if (c1_compiler_count > 0) {


src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File