Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp Fri Aug 13 07:33:20 2010 -0700 +++ b/src/share/vm/runtime/arguments.cpp Thu Aug 19 14:23:59 2010 -0400 @@ -1559,6 +1559,18 @@ return false; } +bool Arguments::verify_min_value(intx val, intx min, const char* name) { + // Returns true if given value is greater than specified min threshold + // false, otherwise. + if (val >= min ) { + return true; + } + jio_fprintf(defaultStream::error_stream(), + "%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n", + name, val, min); + return false; +} + bool Arguments::verify_percentage(uintx value, const char* name) { if (value <= 100) { return true; @@ -1611,6 +1623,16 @@ return status; } +// Check stack pages settings +bool Arguments::check_stack_pages() +{ + bool status = true; + status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages"); + status = status && verify_min_value(StackRedPages, 1, "StackRedPages"); + status = status && verify_min_value(StackShadowPages, 1, "StackShadowPages"); + return status; +} + // Check the consistency of vm_init_args bool Arguments::check_vm_args_consistency() { // Method for adding checks for flag consistency. @@ -1723,6 +1745,7 @@ } status = status && check_gc_consistency(); + status = status && check_stack_pages(); if (_has_alloc_profile) { if (UseParallelGC || UseParallelOldGC) {