This issue is related to JDK-8050853, which proposes per-method compilation thresholds (thresholds that control after how many iterations a method is compiled).
JDK-8050853 splits up the task of adding per-method compilation thresholds into three parts:
1. General support of flags with value in option command (JDK-8055286 and JDK-8056964)
2. Make use of CompileThreshold in Tiered. (the current issue)
3. Per method compilation threshold. (JDK-8059606)
The current issue corresponds to Part 2 "Make use of CompileThreshold in Tiered".
With tiered compilation disabled, controlling when compilation happens is straightforward, as only the value of the CompileThreshold flag must be set. With tiered compilation enabled, controlling when compilation happens is more complicated : To control when a method is first compiled, the value of a number of flags (typically Tier3InvocationThreshold, Tier3inInvocationThreshold, Tier3CompileThreshold, and Tier0InvokeNotifyFreqLog) must be altered.
We propose a new flag, CompileThresholdScalingPercentage, that controls compilation for both the tiered- and the non-tiered modes of operation. CompileThresholdScaling has an integer value between 0 and +Inf and scales the thresholds corresponding to the current mode of operation (tiered resp. non-tiered).
With tiered compilation disabled, CompileThresholdScalingPercentage the compliation threshold is set to CompileThreshold * CompileThresholdScalingPercentage. If CompileThresholdScalingPercentage == 0, each method is compiled on its first invocation. If 0 < CompileThresholdScalingPercentage < 100, all methods are compiled earlier than a CompileThreshold number of iterations (after CompileThresholdScalingPercentage * CompileThreshold number of iterations). If CompileThresholdScalingPercentage > 100, all methods are compiled later. The default value of CompileThresholdScalingPercentage is 100, that is, all methods are compiled as specified by the CompileThreshold flag.
With tiered compilation enabled, Tier3InvocationThreshold, Tier3MinInvocationThreshold, Tier3CompileThreshold are scaled (i.e., are multiplied with CompileThresholdScalingPercentage), Tier3InvokeNotifyFreqLog is ajusted by adding log2(CompileThresholdScalingPercentage) to it.
The advantage of having a single flag is that
- with tiered compilation enabled the user does not have to be aware of the internals of the AdvancedThresholdPolicy (i.e., the way compilation is controlled)
- there is a single flag no matter is the VM is operating with tiered compilation enabled/disabled.