Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/hotspot/share/compiler/compilationPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down