# HG changeset patch # User iveresov # Date 1285625080 25200 # Node ID df015ec64052fd5796143efaa950a6d98b0388d1 # Parent 861f533d12b0e944d261e058101a7b3db36dd517 6987115: Non-tiered compilation policy creates unnecessary C1 threads Summary: Fixed NonTieredCompPolicy::compiler_count() to return correct thread count. Reviewed-by: twisti, kvn diff -r 861f533d12b0 -r df015ec64052 src/share/vm/runtime/compilationPolicy.cpp --- a/src/share/vm/runtime/compilationPolicy.cpp Fri Sep 24 13:14:32 2010 -0700 +++ b/src/share/vm/runtime/compilationPolicy.cpp Mon Sep 27 15:04:40 2010 -0700 @@ -129,16 +129,31 @@ } } +// Note: this policy is used ONLY if TieredCompilation is off. +// compiler_count() behaves the following way: +// - with TIERED build (with both COMPILER1 and COMPILER2 defined) it should return +// zero for the c1 compilation levels, hence the particular ordering of the +// statements. +// - the same should happen when COMPILER2 is defined and COMPILER1 is not +// (server build without TIERED defined). +// - if only COMPILER1 is defined (client build), zero should be returned for +// the c2 level. +// - if neither is defined - always return zero. int NonTieredCompPolicy::compiler_count(CompLevel comp_level) { + assert(!TieredCompilation, "This policy should not be used with TieredCompilation"); +#ifdef COMPILER2 + if (is_c2_compile(comp_level)) { + return _compiler_count; + } else { + return 0; + } +#endif + #ifdef COMPILER1 if (is_c1_compile(comp_level)) { return _compiler_count; - } -#endif - -#ifdef COMPILER2 - if (is_c2_compile(comp_level)) { - return _compiler_count; + } else { + return 0; } #endif