938 string,
939 CHECK_0);
940
941 {
942 MutexLocker mu(Threads_lock, THREAD);
943 compiler_thread = new CompilerThread(queue, counters);
944 // At this point the new CompilerThread data-races with this startup
945 // thread (which I believe is the primoridal thread and NOT the VM
946 // thread). This means Java bytecodes being executed at startup can
947 // queue compile jobs which will run at whatever default priority the
948 // newly created CompilerThread runs at.
949
950
951 // At this point it may be possible that no osthread was created for the
952 // JavaThread due to lack of memory. We would have to throw an exception
953 // in that case. However, since this must work and we do not allow
954 // exceptions anyway, check and abort if this fails.
955
956 if (compiler_thread == NULL || compiler_thread->osthread() == NULL){
957 vm_exit_during_initialization("java.lang.OutOfMemoryError",
958 "unable to create new native thread");
959 }
960
961 java_lang_Thread::set_thread(thread_oop(), compiler_thread);
962
963 // Note that this only sets the JavaThread _priority field, which by
964 // definition is limited to Java priorities and not OS priorities.
965 // The os-priority is set in the CompilerThread startup code itself
966
967 java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
968
969 // Note that we cannot call os::set_priority because it expects Java
970 // priorities and we are *explicitly* using OS priorities so that it's
971 // possible to set the compiler thread priority higher than any Java
972 // thread.
973
974 int native_prio = CompilerThreadPriority;
975 if (native_prio == -1) {
976 if (UseCriticalCompilerThreadPriority) {
977 native_prio = os::java_to_os_priority[CriticalPriority];
978 } else {
|
938 string,
939 CHECK_0);
940
941 {
942 MutexLocker mu(Threads_lock, THREAD);
943 compiler_thread = new CompilerThread(queue, counters);
944 // At this point the new CompilerThread data-races with this startup
945 // thread (which I believe is the primoridal thread and NOT the VM
946 // thread). This means Java bytecodes being executed at startup can
947 // queue compile jobs which will run at whatever default priority the
948 // newly created CompilerThread runs at.
949
950
951 // At this point it may be possible that no osthread was created for the
952 // JavaThread due to lack of memory. We would have to throw an exception
953 // in that case. However, since this must work and we do not allow
954 // exceptions anyway, check and abort if this fails.
955
956 if (compiler_thread == NULL || compiler_thread->osthread() == NULL){
957 vm_exit_during_initialization("java.lang.OutOfMemoryError",
958 os::native_thread_creation_failed_msg());
959 }
960
961 java_lang_Thread::set_thread(thread_oop(), compiler_thread);
962
963 // Note that this only sets the JavaThread _priority field, which by
964 // definition is limited to Java priorities and not OS priorities.
965 // The os-priority is set in the CompilerThread startup code itself
966
967 java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
968
969 // Note that we cannot call os::set_priority because it expects Java
970 // priorities and we are *explicitly* using OS priorities so that it's
971 // possible to set the compiler thread priority higher than any Java
972 // thread.
973
974 int native_prio = CompilerThreadPriority;
975 if (native_prio == -1) {
976 if (UseCriticalCompilerThreadPriority) {
977 native_prio = os::java_to_os_priority[CriticalPriority];
978 } else {
|