< prev index next >

src/hotspot/share/runtime/tieredThresholdPolicy.cpp

Print this page




 209       tty->print("c2-osr");
 210     }
 211     tty->print(" status=");
 212     if (mh->queued_for_compilation()) {
 213       tty->print("in-queue");
 214     } else tty->print("idle");
 215   }
 216   tty->print_cr("]");
 217 }
 218 
 219 void TieredThresholdPolicy::initialize() {
 220   int count = CICompilerCount;
 221   bool c1_only = TieredStopAtLevel < CompLevel_full_optimization;
 222 #ifdef _LP64
 223   // Turn on ergonomic compiler count selection
 224   if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
 225     FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
 226   }
 227   if (CICompilerCountPerCPU) {
 228     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
 229     int log_cpu = log2_intptr(os::active_processor_count());
 230     int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
 231     count = MAX2(log_cpu * loglog_cpu * 3 / 2, 2);
 232     // Make sure there is enough space in the code cache to hold all the compiler buffers
 233     size_t c1_size = Compiler::code_buffer_size();
 234     size_t c2_size = C2Compiler::initial_code_buffer_size();
 235     size_t buffer_size = c1_only ? c1_size : (c1_size/3 + 2*c2_size/3);
 236     int max_count = (ReservedCodeCacheSize - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / (int)buffer_size;
 237     if (count > max_count) {
 238       // Lower the compiler count such that all buffers fit into the code cache
 239       count = MAX2(max_count, c1_only ? 1 : 2);
 240     }
 241     FLAG_SET_ERGO(intx, CICompilerCount, count);
 242   }
 243 #else
 244   // On 32-bit systems, the number of compiler threads is limited to 3.
 245   // On these systems, the virtual address space available to the JVM
 246   // is usually limited to 2-4 GB (the exact value depends on the platform).
 247   // As the compilers (especially C2) can consume a large amount of
 248   // memory, scaling the number of compiler threads with the number of
 249   // available cores can result in the exhaustion of the address space
 250   /// available to the VM and thus cause the VM to crash.




 209       tty->print("c2-osr");
 210     }
 211     tty->print(" status=");
 212     if (mh->queued_for_compilation()) {
 213       tty->print("in-queue");
 214     } else tty->print("idle");
 215   }
 216   tty->print_cr("]");
 217 }
 218 
 219 void TieredThresholdPolicy::initialize() {
 220   int count = CICompilerCount;
 221   bool c1_only = TieredStopAtLevel < CompLevel_full_optimization;
 222 #ifdef _LP64
 223   // Turn on ergonomic compiler count selection
 224   if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
 225     FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
 226   }
 227   if (CICompilerCountPerCPU) {
 228     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
 229     int log_cpu = log2_int(os::active_processor_count());
 230     int loglog_cpu = log2_int(MAX2(log_cpu, 1));
 231     count = MAX2(log_cpu * loglog_cpu * 3 / 2, 2);
 232     // Make sure there is enough space in the code cache to hold all the compiler buffers
 233     size_t c1_size = Compiler::code_buffer_size();
 234     size_t c2_size = C2Compiler::initial_code_buffer_size();
 235     size_t buffer_size = c1_only ? c1_size : (c1_size/3 + 2*c2_size/3);
 236     int max_count = (ReservedCodeCacheSize - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / (int)buffer_size;
 237     if (count > max_count) {
 238       // Lower the compiler count such that all buffers fit into the code cache
 239       count = MAX2(max_count, c1_only ? 1 : 2);
 240     }
 241     FLAG_SET_ERGO(intx, CICompilerCount, count);
 242   }
 243 #else
 244   // On 32-bit systems, the number of compiler threads is limited to 3.
 245   // On these systems, the virtual address space available to the JVM
 246   // is usually limited to 2-4 GB (the exact value depends on the platform).
 247   // As the compilers (especially C2) can consume a large amount of
 248   // memory, scaling the number of compiler threads with the number of
 249   // available cores can result in the exhaustion of the address space
 250   /// available to the VM and thus cause the VM to crash.


< prev index next >