src/share/vm/runtime/advancedThresholdPolicy.cpp
Print this page
rev 4616 : fixes fill up of code cache: added command line parameter which defines a
threshold (percentage of used code cache) at which the threshold for
recompilation is increased.
@@ -66,11 +66,11 @@
if (FLAG_IS_DEFAULT(InlineSmallCode)) {
FLAG_SET_DEFAULT(InlineSmallCode, 2500);
}
#endif
-
+ set_reverse_cmdline_free_ratio();
set_start_time(os::javaTimeMillis());
}
// update_rate() is called from select_task() while holding a compile queue lock.
void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
@@ -203,10 +203,18 @@
double AdvancedThresholdPolicy::threshold_scale(CompLevel level, int feedback_k) {
double queue_size = CompileBroker::queue_size(level);
int comp_count = compiler_count(level);
double k = queue_size / (feedback_k * comp_count) + 1;
+
+ double reverse_free_ratio = CodeCache::reverse_free_ratio();
+ // E.g., 4 means that 25% (1/4) of the code cache is free
+ if (level != CompLevel_full_optimization) {
+ if (reverse_free_ratio > _reverse_cmdline_free_ratio) {
+ k *= exp(reverse_free_ratio - _reverse_cmdline_free_ratio);
+ }
+ }
return k;
}
// Call and loop predicates determine whether a transition to a higher
// compilation level should be performed (pointers to predicate functions