1.1 --- a/src/share/vm/compiler/compileBroker.cpp Wed Jan 25 18:58:59 2012 -0800 1.2 +++ b/src/share/vm/compiler/compileBroker.cpp Thu Jan 26 20:06:06 2012 -0500 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -855,23 +855,23 @@ 1.11 // Note that this only sets the JavaThread _priority field, which by 1.12 // definition is limited to Java priorities and not OS priorities. 1.13 // The os-priority is set in the CompilerThread startup code itself 1.14 + 1.15 java_lang_Thread::set_priority(thread_oop(), NearMaxPriority); 1.16 - // CLEANUP PRIORITIES: This -if- statement hids a bug whereby the compiler 1.17 - // threads never have their OS priority set. The assumption here is to 1.18 - // enable the Performance group to do flag tuning, figure out a suitable 1.19 - // CompilerThreadPriority, and then remove this 'if' statement (and 1.20 - // comment) and unconditionally set the priority. 1.21 1.22 - // Compiler Threads should be at the highest Priority 1.23 - if ( CompilerThreadPriority != -1 ) 1.24 - os::set_native_priority( compiler_thread, CompilerThreadPriority ); 1.25 - else 1.26 - os::set_native_priority( compiler_thread, os::java_to_os_priority[NearMaxPriority]); 1.27 + // Note that we cannot call os::set_priority because it expects Java 1.28 + // priorities and we are *explicitly* using OS priorities so that it's 1.29 + // possible to set the compiler thread priority higher than any Java 1.30 + // thread. 1.31 1.32 - // Note that I cannot call os::set_priority because it expects Java 1.33 - // priorities and I am *explicitly* using OS priorities so that it's 1.34 - // possible to set the compiler thread priority higher than any Java 1.35 - // thread. 1.36 + int native_prio = CompilerThreadPriority; 1.37 + if (native_prio == -1) { 1.38 + if (UseCriticalCompilerThreadPriority) { 1.39 + native_prio = os::java_to_os_priority[CriticalPriority]; 1.40 + } else { 1.41 + native_prio = os::java_to_os_priority[NearMaxPriority]; 1.42 + } 1.43 + } 1.44 + os::set_native_priority(compiler_thread, native_prio); 1.45 1.46 java_lang_Thread::set_daemon(thread_oop()); 1.47 1.48 @@ -879,6 +879,7 @@ 1.49 Threads::add(compiler_thread); 1.50 Thread::start(compiler_thread); 1.51 } 1.52 + 1.53 // Let go of Threads_lock before yielding 1.54 os::yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS) 1.55