diff src/share/vm/runtime/advancedThresholdPolicy.cpp @ 10319:91eba9f82325

8012371: Adjust Tiered compile threshold according to available space in code cache Summary: Added command line parameter to define a threshold at which C1 compilation threshold for is increased. Reviewed-by: kvn, iveresov
author anoll
date Thu, 16 May 2013 15:46:49 +0200
parents aeaca88565e6
children 63a4eb8bcd23 7150b16fda52
line wrap: on
line diff
--- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Fri May 17 09:10:04 2013 -0700
+++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu May 16 15:46:49 2013 +0200
@@ -68,7 +68,7 @@
   }
 #endif
 
-
+  set_increase_threshold_at_ratio();
   set_start_time(os::javaTimeMillis());
 }
 
@@ -205,6 +205,17 @@
   double queue_size = CompileBroker::queue_size(level);
   int comp_count = compiler_count(level);
   double k = queue_size / (feedback_k * comp_count) + 1;
+
+  // Increase C1 compile threshold when the code cache is filled more
+  // than specified by IncreaseFirstTierCompileThresholdAt percentage.
+  // The main intention is to keep enough free space for C2 compiled code
+  // to achieve peak performance if the code cache is under stress.
+  if ((TieredStopAtLevel == CompLevel_full_optimization) && (level != CompLevel_full_optimization))  {
+    double current_reverse_free_ratio = CodeCache::reverse_free_ratio();
+    if (current_reverse_free_ratio > _increase_threshold_at_ratio) {
+      k *= exp(current_reverse_free_ratio - _increase_threshold_at_ratio);
+    }
+  }
   return k;
 }