comparison src/share/vm/compiler/compileBroker.cpp @ 4854:de268c8a8075

7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11 Summary: Add CriticalPriority == MaxPriority+1 and enable scheduling class as well as thread priority to change on Solaris. Reviewed-by: dholmes, dcubed
author phh
date Thu, 26 Jan 2012 20:06:06 -0500
parents cc81b9c09bbb
children bf5da1648543
comparison
equal deleted inserted replaced
4853:6db63e782d3d 4854:de268c8a8075
1 /* 1 /*
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
853 java_lang_Thread::set_thread(thread_oop(), compiler_thread); 853 java_lang_Thread::set_thread(thread_oop(), compiler_thread);
854 854
855 // Note that this only sets the JavaThread _priority field, which by 855 // Note that this only sets the JavaThread _priority field, which by
856 // definition is limited to Java priorities and not OS priorities. 856 // definition is limited to Java priorities and not OS priorities.
857 // The os-priority is set in the CompilerThread startup code itself 857 // The os-priority is set in the CompilerThread startup code itself
858
858 java_lang_Thread::set_priority(thread_oop(), NearMaxPriority); 859 java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
859 // CLEANUP PRIORITIES: This -if- statement hids a bug whereby the compiler 860
860 // threads never have their OS priority set. The assumption here is to 861 // Note that we cannot call os::set_priority because it expects Java
861 // enable the Performance group to do flag tuning, figure out a suitable 862 // priorities and we are *explicitly* using OS priorities so that it's
862 // CompilerThreadPriority, and then remove this 'if' statement (and 863 // possible to set the compiler thread priority higher than any Java
863 // comment) and unconditionally set the priority. 864 // thread.
864 865
865 // Compiler Threads should be at the highest Priority 866 int native_prio = CompilerThreadPriority;
866 if ( CompilerThreadPriority != -1 ) 867 if (native_prio == -1) {
867 os::set_native_priority( compiler_thread, CompilerThreadPriority ); 868 if (UseCriticalCompilerThreadPriority) {
868 else 869 native_prio = os::java_to_os_priority[CriticalPriority];
869 os::set_native_priority( compiler_thread, os::java_to_os_priority[NearMaxPriority]); 870 } else {
870 871 native_prio = os::java_to_os_priority[NearMaxPriority];
871 // Note that I cannot call os::set_priority because it expects Java 872 }
872 // priorities and I am *explicitly* using OS priorities so that it's 873 }
873 // possible to set the compiler thread priority higher than any Java 874 os::set_native_priority(compiler_thread, native_prio);
874 // thread.
875 875
876 java_lang_Thread::set_daemon(thread_oop()); 876 java_lang_Thread::set_daemon(thread_oop());
877 877
878 compiler_thread->set_threadObj(thread_oop()); 878 compiler_thread->set_threadObj(thread_oop());
879 Threads::add(compiler_thread); 879 Threads::add(compiler_thread);
880 Thread::start(compiler_thread); 880 Thread::start(compiler_thread);
881 } 881 }
882
882 // Let go of Threads_lock before yielding 883 // Let go of Threads_lock before yielding
883 os::yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS) 884 os::yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS)
884 885
885 return compiler_thread; 886 return compiler_thread;
886 } 887 }