diff --git a/src/hotspot/share/compiler/compilationPolicy.cpp b/src/hotspot/share/compiler/compilationPolicy.cpp index 5ca719d030957..4a9fa16ec2b52 100644 --- a/src/hotspot/share/compiler/compilationPolicy.cpp +++ b/src/hotspot/share/compiler/compilationPolicy.cpp @@ -571,8 +571,16 @@ void CompilationPolicy::initialize() { #ifdef COMPILER2 c2_size = C2Compiler::initial_code_buffer_size(); #endif - size_t buffer_size = c1_only ? c1_size : (c1_size/3 + 2*c2_size/3); - size_t max_count = (ReservedCodeCacheSize - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / buffer_size; + size_t buffer_size = 0; + if (c1_only) { + buffer_size = c1_size; + } else if (c2_only) { + buffer_size = c2_size; + } else { + buffer_size = c1_size / 3 + c2_size * 2/3; + } + size_t max_buffer_size = FLAG_IS_CMDLINE(NonNMethodCodeHeapSize) ? NonNMethodCodeHeapSize : ReservedCodeCacheSize; + size_t max_count = (max_buffer_size - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / (int)buffer_size; if ((size_t)count > max_count) { // Lower the compiler count such that all buffers fit into the code cache count = MAX2((int)max_count, min_count); @@ -591,7 +599,7 @@ void CompilationPolicy::initialize() { count = 3; FLAG_SET_ERGO(CICompilerCount, count); } -#endif +#endif // _LP64 if (c1_only) { // No C2 compiler threads are needed