RFR: JDK-8283807: Handle CompileThreshold the same as other thresholds when scaled with -XX:CompileThresholdScaling

Ioi Lam iklam at openjdk.java.net
Mon May 2 20:41:23 UTC 2022


On Mon, 2 May 2022 13:17:49 GMT, Tobias Holenstein <duke at openjdk.java.net> wrote:

> `CompileThresholdScaling` scales several compiler thresholds. If the scaled threshold value is outside of the allowed range, a warning is printed and the default value is kept. But when scaling `CompileThreshold` we do not check the scaled value because it is not a ranged flag. Later when verifying flags with a constraint function `OnStackReplacePercentageConstraintFunc` which calls `CompileThresholdConstraintFunc` fails because `CompileThreshold` is outside of the allowed range. This stops the VM from being created. 
> 
> The fix is to call `CompileThresholdConstraintFunc` when scaling `CompileThreshold` with `CompileThresholdScaling`. If `CompileThresholdConstraintFunc` fails we print a warning and keep the default value of `CompileThreshold`. This behaviour is then consistent with the other 15 other thresholds where the VM just prints a warning if the scaled value is too large and then keeps the current value.
> 
> We also have to exclude `CompileThresholdScaling` from max. range testing in `TestOptionsWithRanges.java`, because
> it is expected to print "outside the allowed range" warnings for the scaled flag and the "outside the allowed range" warning does not refer to `CompileThresholdScaling` itself. 
> 
> One question that remains it why `CompileThresholdScaling` takes the default value when a scaled threshold is too large instead of the max. value?  Because now we can have the case where some compiler thresholds are scaled to almost their max. value and others that are already larger than the maximum are default again (which can be the minimum value in some cases). I suggest to address this issue in a separate RFE.

Could you add a test case with several large values for -XX:CompileThresholdScaling and check that the warning message is printed?

test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java line 264:

> 262:          * it is expected to print "outside the allowed range" warnings for
> 263:          * the scaled flags
> 264:          */

This comment is not very clear. Do you mean


Max range tests expect a warning message of "outside the allowed range"
but CompileThresholdScaling prints a different warning message when it's
set too high.

-------------

Changes requested by iklam (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8501


More information about the hotspot-dev mailing list