< prev index next >

src/hotspot/share/runtime/advancedThresholdPolicy.cpp

Print this page
rev 49022 : 8198756: Limit number of compiler threads for small code cache
Reviewed-by:


  38   if (mh->prev_time() == 0) tty->print("n/a");
  39   else tty->print("%f", mh->rate());
  40 
  41   tty->print(" k=%.2lf,%.2lf", threshold_scale(CompLevel_full_profile, Tier3LoadFeedback),
  42                                threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
  43 
  44 }
  45 
  46 void AdvancedThresholdPolicy::initialize() {
  47   int count = CICompilerCount;
  48 #ifdef _LP64
  49   // Turn on ergonomic compiler count selection
  50   if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
  51     FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
  52   }
  53   if (CICompilerCountPerCPU) {
  54     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
  55     int log_cpu = log2_intptr(os::active_processor_count());
  56     int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
  57     count = MAX2(log_cpu * loglog_cpu * 3 / 2, 2);




  58     FLAG_SET_ERGO(intx, CICompilerCount, count);
  59   }
  60 #else
  61   // On 32-bit systems, the number of compiler threads is limited to 3.
  62   // On these systems, the virtual address space available to the JVM
  63   // is usually limited to 2-4 GB (the exact value depends on the platform).
  64   // As the compilers (especially C2) can consume a large amount of
  65   // memory, scaling the number of compiler threads with the number of
  66   // available cores can result in the exhaustion of the address space
  67   /// available to the VM and thus cause the VM to crash.
  68   if (FLAG_IS_DEFAULT(CICompilerCount)) {
  69     count = 3;
  70     FLAG_SET_ERGO(intx, CICompilerCount, count);
  71   }
  72 #endif
  73 
  74   if (TieredStopAtLevel < CompLevel_full_optimization) {
  75     // No C2 compiler thread required
  76     set_c1_count(count);
  77   } else {




  38   if (mh->prev_time() == 0) tty->print("n/a");
  39   else tty->print("%f", mh->rate());
  40 
  41   tty->print(" k=%.2lf,%.2lf", threshold_scale(CompLevel_full_profile, Tier3LoadFeedback),
  42                                threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
  43 
  44 }
  45 
  46 void AdvancedThresholdPolicy::initialize() {
  47   int count = CICompilerCount;
  48 #ifdef _LP64
  49   // Turn on ergonomic compiler count selection
  50   if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
  51     FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
  52   }
  53   if (CICompilerCountPerCPU) {
  54     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
  55     int log_cpu = log2_intptr(os::active_processor_count());
  56     int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
  57     count = MAX2(log_cpu * loglog_cpu * 3 / 2, 2);
  58     // We only consider the processors up one per certain amount of CodeCache space.
  59     // Configuring a larger CodeCache enables more compiler threads.
  60     int CodeCacheSize_based_thread_limit = MAX2((int)(ReservedCodeCacheSize / (32 * M)), 2);
  61     count = MIN2(count, CodeCacheSize_based_thread_limit);
  62     FLAG_SET_ERGO(intx, CICompilerCount, count);
  63   }
  64 #else
  65   // On 32-bit systems, the number of compiler threads is limited to 3.
  66   // On these systems, the virtual address space available to the JVM
  67   // is usually limited to 2-4 GB (the exact value depends on the platform).
  68   // As the compilers (especially C2) can consume a large amount of
  69   // memory, scaling the number of compiler threads with the number of
  70   // available cores can result in the exhaustion of the address space
  71   /// available to the VM and thus cause the VM to crash.
  72   if (FLAG_IS_DEFAULT(CICompilerCount)) {
  73     count = 3;
  74     FLAG_SET_ERGO(intx, CICompilerCount, count);
  75   }
  76 #endif
  77 
  78   if (TieredStopAtLevel < CompLevel_full_optimization) {
  79     // No C2 compiler thread required
  80     set_c1_count(count);
  81   } else {


< prev index next >