hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
changeset 36556 7f092a7ce938
parent 35547 0ee84aa8e705
child 36597 ee256e343585
equal deleted inserted replaced
36555:4f37fd7a5a09 36556:7f092a7ce938
    40                                threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
    40                                threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
    41 
    41 
    42 }
    42 }
    43 
    43 
    44 void AdvancedThresholdPolicy::initialize() {
    44 void AdvancedThresholdPolicy::initialize() {
       
    45   int count = CICompilerCount;
       
    46 #ifdef _LP64
    45   // Turn on ergonomic compiler count selection
    47   // Turn on ergonomic compiler count selection
    46   if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
    48   if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
    47     FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
    49     FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
    48   }
    50   }
    49   int count = CICompilerCount;
       
    50   if (CICompilerCountPerCPU) {
    51   if (CICompilerCountPerCPU) {
    51     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
    52     // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
    52     int log_cpu = log2_intptr(os::active_processor_count());
    53     int log_cpu = log2_intptr(os::active_processor_count());
    53     int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
    54     int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
    54     count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
    55     count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
    55   }
    56   }
       
    57 #else
       
    58   // On 32-bit systems, the number of compiler threads is limited to 3.
       
    59   // On these systems, the virtual address space available to the JVM
       
    60   // is usually limited to 2-4 GB (the exact value depends on the platform).
       
    61   // As the compilers (especially C2) can consume a large amount of
       
    62   // memory, scaling the number of compiler threads with the number of
       
    63   // available cores can result in the exhaustion of the address space
       
    64   /// available to the VM and thus cause the VM to crash.
       
    65   if (FLAG_IS_DEFAULT(CICompilerCount)) {
       
    66     count = 3;
       
    67   }
       
    68 #endif
    56 
    69 
    57   set_c1_count(MAX2(count / 3, 1));
    70   set_c1_count(MAX2(count / 3, 1));
    58   set_c2_count(MAX2(count - c1_count(), 1));
    71   set_c2_count(MAX2(count - c1_count(), 1));
    59   FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
    72   FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
    60 
    73