Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 1744:f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
Summary: Test minimal stack sizes given (also fixed linux compilation error)
Reviewed-by: never, phh, coleenp
author | ptisnovs |
---|---|
date | Thu, 19 Aug 2010 14:23:59 -0400 |
parents | 126ea7725993 |
children | ebfb7c68865e |
comparison
equal
deleted
inserted
replaced
1695:21e519b91576 | 1744:f8c5d1bdaad4 |
---|---|
1557 " and " UINTX_FORMAT "\n", | 1557 " and " UINTX_FORMAT "\n", |
1558 name, val, min, max); | 1558 name, val, min, max); |
1559 return false; | 1559 return false; |
1560 } | 1560 } |
1561 | 1561 |
1562 bool Arguments::verify_min_value(intx val, intx min, const char* name) { | |
1563 // Returns true if given value is greater than specified min threshold | |
1564 // false, otherwise. | |
1565 if (val >= min ) { | |
1566 return true; | |
1567 } | |
1568 jio_fprintf(defaultStream::error_stream(), | |
1569 "%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n", | |
1570 name, val, min); | |
1571 return false; | |
1572 } | |
1573 | |
1562 bool Arguments::verify_percentage(uintx value, const char* name) { | 1574 bool Arguments::verify_percentage(uintx value, const char* name) { |
1563 if (value <= 100) { | 1575 if (value <= 100) { |
1564 return true; | 1576 return true; |
1565 } | 1577 } |
1566 jio_fprintf(defaultStream::error_stream(), | 1578 jio_fprintf(defaultStream::error_stream(), |
1609 } | 1621 } |
1610 | 1622 |
1611 return status; | 1623 return status; |
1612 } | 1624 } |
1613 | 1625 |
1626 // Check stack pages settings | |
1627 bool Arguments::check_stack_pages() | |
1628 { | |
1629 bool status = true; | |
1630 status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages"); | |
1631 status = status && verify_min_value(StackRedPages, 1, "StackRedPages"); | |
1632 status = status && verify_min_value(StackShadowPages, 1, "StackShadowPages"); | |
1633 return status; | |
1634 } | |
1635 | |
1614 // Check the consistency of vm_init_args | 1636 // Check the consistency of vm_init_args |
1615 bool Arguments::check_vm_args_consistency() { | 1637 bool Arguments::check_vm_args_consistency() { |
1616 // Method for adding checks for flag consistency. | 1638 // Method for adding checks for flag consistency. |
1617 // The intent is to warn the user of all possible conflicts, | 1639 // The intent is to warn the user of all possible conflicts, |
1618 // before returning an error. | 1640 // before returning an error. |
1721 } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) { | 1743 } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) { |
1722 FLAG_SET_DEFAULT(UseLargePages, false); | 1744 FLAG_SET_DEFAULT(UseLargePages, false); |
1723 } | 1745 } |
1724 | 1746 |
1725 status = status && check_gc_consistency(); | 1747 status = status && check_gc_consistency(); |
1748 status = status && check_stack_pages(); | |
1726 | 1749 |
1727 if (_has_alloc_profile) { | 1750 if (_has_alloc_profile) { |
1728 if (UseParallelGC || UseParallelOldGC) { | 1751 if (UseParallelGC || UseParallelOldGC) { |
1729 jio_fprintf(defaultStream::error_stream(), | 1752 jio_fprintf(defaultStream::error_stream(), |
1730 "error: invalid argument combination.\n" | 1753 "error: invalid argument combination.\n" |