comparison src/share/vm/runtime/arguments.cpp @ 1244:745c853ee57f

6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash Summary: 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
author johnc
date Fri, 29 Jan 2010 14:51:38 -0800
parents 99af867dfa05
children 7b4415a18c8a
comparison
equal deleted inserted replaced
1196:f3345b7b01b4 1244:745c853ee57f
1485 } 1485 }
1486 1486
1487 //=========================================================================================================== 1487 //===========================================================================================================
1488 // Parsing of main arguments 1488 // Parsing of main arguments
1489 1489
1490 bool Arguments::verify_interval(uintx val, uintx min,
1491 uintx max, const char* name) {
1492 // Returns true iff value is in the inclusive interval [min..max]
1493 // false, otherwise.
1494 if (val >= min && val <= max) {
1495 return true;
1496 }
1497 jio_fprintf(defaultStream::error_stream(),
1498 "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT
1499 " and " UINTX_FORMAT "\n",
1500 name, val, min, max);
1501 return false;
1502 }
1503
1490 bool Arguments::verify_percentage(uintx value, const char* name) { 1504 bool Arguments::verify_percentage(uintx value, const char* name) {
1491 if (value <= 100) { 1505 if (value <= 100) {
1492 return true; 1506 return true;
1493 } 1507 }
1494 jio_fprintf(defaultStream::error_stream(), 1508 jio_fprintf(defaultStream::error_stream(),
1720 jio_fprintf(defaultStream::error_stream(), 1734 jio_fprintf(defaultStream::error_stream(),
1721 "error: +ExplictGCInvokesConcurrent[AndUnloadsClasses] conflicts" 1735 "error: +ExplictGCInvokesConcurrent[AndUnloadsClasses] conflicts"
1722 " with -UseAsyncConcMarkSweepGC"); 1736 " with -UseAsyncConcMarkSweepGC");
1723 status = false; 1737 status = false;
1724 } 1738 }
1739
1740 status = status && verify_interval(RefDiscoveryPolicy,
1741 ReferenceProcessor::DiscoveryPolicyMin,
1742 ReferenceProcessor::DiscoveryPolicyMax,
1743 "RefDiscoveryPolicy");
1744
1745 // Limit the lower bound of this flag to 1 as it is used in a division
1746 // expression.
1747 status = status && verify_interval(TLABWasteTargetPercent,
1748 1, 100, "TLABWasteTargetPercent");
1725 1749
1726 return status; 1750 return status;
1727 } 1751 }
1728 1752
1729 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 1753 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,