mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
Interval checking is now being performed on the values passed in for these two flags. The current acceptable range for RefDiscoveryPolicy is [0..1], and for TLABWasteTargetPercent it is [1..100]. Reviewed-by: apetrusenko, ysr
This commit is contained in:
parent
679f958f72
commit
b34027a600
4 changed files with 32 additions and 2 deletions
|
@ -1487,6 +1487,20 @@ bool Arguments::created_by_java_launcher() {
|
|||
//===========================================================================================================
|
||||
// Parsing of main arguments
|
||||
|
||||
bool Arguments::verify_interval(uintx val, uintx min,
|
||||
uintx max, const char* name) {
|
||||
// Returns true iff value is in the inclusive interval [min..max]
|
||||
// false, otherwise.
|
||||
if (val >= min && val <= max) {
|
||||
return true;
|
||||
}
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT
|
||||
" and " UINTX_FORMAT "\n",
|
||||
name, val, min, max);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Arguments::verify_percentage(uintx value, const char* name) {
|
||||
if (value <= 100) {
|
||||
return true;
|
||||
|
@ -1723,6 +1737,16 @@ bool Arguments::check_vm_args_consistency() {
|
|||
status = false;
|
||||
}
|
||||
|
||||
status = status && verify_interval(RefDiscoveryPolicy,
|
||||
ReferenceProcessor::DiscoveryPolicyMin,
|
||||
ReferenceProcessor::DiscoveryPolicyMax,
|
||||
"RefDiscoveryPolicy");
|
||||
|
||||
// Limit the lower bound of this flag to 1 as it is used in a division
|
||||
// expression.
|
||||
status = status && verify_interval(TLABWasteTargetPercent,
|
||||
1, 100, "TLABWasteTargetPercent");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue