diff --git a/src/hotspot/share/compiler/compilationPolicy.cpp b/src/hotspot/share/compiler/compilationPolicy.cpp index 02dec8d957bb9..fd1357398f5de 100644 --- a/src/hotspot/share/compiler/compilationPolicy.cpp +++ b/src/hotspot/share/compiler/compilationPolicy.cpp @@ -571,8 +571,15 @@ 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 + 2 * c2_size / 3; + } + size_t max_count = (NonNMethodCodeHeapSize - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / 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 +598,7 @@ void CompilationPolicy::initialize() { count = 3; FLAG_SET_ERGO(CICompilerCount, count); } -#endif +#endif // _LP64 if (c1_only) { // No C2 compiler threads are needed