hotspot/src/share/vm/compiler/compileBroker.cpp
changeset 46986 26697fda7a45
parent 46701 f559541c0daa
equal deleted inserted replaced
46985:1294e2eb56eb 46986:26697fda7a45
   718 
   718 
   719 
   719 
   720     // At this point it may be possible that no osthread was created for the
   720     // At this point it may be possible that no osthread was created for the
   721     // JavaThread due to lack of memory. We would have to throw an exception
   721     // JavaThread due to lack of memory. We would have to throw an exception
   722     // in that case. However, since this must work and we do not allow
   722     // in that case. However, since this must work and we do not allow
   723     // exceptions anyway, check and abort if this fails.
   723     // exceptions anyway, check and abort if this fails. But first release the
   724 
   724     // lock.
   725     if (thread == NULL || thread->osthread() == NULL) {
   725 
   726       vm_exit_during_initialization("java.lang.OutOfMemoryError",
   726     if (thread != NULL && thread->osthread() != NULL) {
   727                                     os::native_thread_creation_failed_msg());
   727 
   728     }
   728       java_lang_Thread::set_thread(thread_oop(), thread);
   729 
   729 
   730     java_lang_Thread::set_thread(thread_oop(), thread);
   730       // Note that this only sets the JavaThread _priority field, which by
   731 
   731       // definition is limited to Java priorities and not OS priorities.
   732     // Note that this only sets the JavaThread _priority field, which by
   732       // The os-priority is set in the CompilerThread startup code itself
   733     // definition is limited to Java priorities and not OS priorities.
   733 
   734     // The os-priority is set in the CompilerThread startup code itself
   734       java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
   735 
   735 
   736     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
   736       // Note that we cannot call os::set_priority because it expects Java
   737 
   737       // priorities and we are *explicitly* using OS priorities so that it's
   738     // Note that we cannot call os::set_priority because it expects Java
   738       // possible to set the compiler thread priority higher than any Java
   739     // priorities and we are *explicitly* using OS priorities so that it's
   739       // thread.
   740     // possible to set the compiler thread priority higher than any Java
   740 
   741     // thread.
   741       int native_prio = CompilerThreadPriority;
   742 
   742       if (native_prio == -1) {
   743     int native_prio = CompilerThreadPriority;
   743         if (UseCriticalCompilerThreadPriority) {
   744     if (native_prio == -1) {
   744           native_prio = os::java_to_os_priority[CriticalPriority];
   745       if (UseCriticalCompilerThreadPriority) {
   745         } else {
   746         native_prio = os::java_to_os_priority[CriticalPriority];
   746           native_prio = os::java_to_os_priority[NearMaxPriority];
   747       } else {
   747         }
   748         native_prio = os::java_to_os_priority[NearMaxPriority];
   748       }
   749       }
   749       os::set_native_priority(thread, native_prio);
   750     }
   750 
   751     os::set_native_priority(thread, native_prio);
   751       java_lang_Thread::set_daemon(thread_oop());
   752 
   752 
   753     java_lang_Thread::set_daemon(thread_oop());
   753       thread->set_threadObj(thread_oop());
   754 
   754       if (compiler_thread) {
   755     thread->set_threadObj(thread_oop());
   755         thread->as_CompilerThread()->set_compiler(comp);
   756     if (compiler_thread) {
   756       }
   757       thread->as_CompilerThread()->set_compiler(comp);
   757       Threads::add(thread);
   758     }
   758       Thread::start(thread);
   759     Threads::add(thread);
   759     }
   760     Thread::start(thread);
   760   }
       
   761 
       
   762   // First release lock before aborting VM.
       
   763   if (thread == NULL || thread->osthread() == NULL) {
       
   764     vm_exit_during_initialization("java.lang.OutOfMemoryError",
       
   765                                   os::native_thread_creation_failed_msg());
   761   }
   766   }
   762 
   767 
   763   // Let go of Threads_lock before yielding
   768   // Let go of Threads_lock before yielding
   764   os::naked_yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS)
   769   os::naked_yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS)
   765 
   770