6983240: guarantee((Solaris::min_stack_allowed >= (StackYellowPages+StackRedPages...) wrong

Min_stack_allowed is a compile time constant and Stack*Pages are settable

Reviewed-by: dholmes, kvn
This commit is contained in:
Coleen Phillimore 2010-10-07 08:06:06 -07:00
parent 4ba2050f4e
commit 39992cab03
6 changed files with 52 additions and 15 deletions

View file

@ -827,8 +827,10 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
switch (thr_type) {
case os::java_thread:
// Java threads use ThreadStackSize which default value can be changed with the flag -Xss
if (JavaThread::stack_size_at_create() > 0) stack_size = JavaThread::stack_size_at_create();
// Java threads use ThreadStackSize which default value can be
// changed with the flag -Xss
assert (JavaThread::stack_size_at_create() > 0, "this should be set");
stack_size = JavaThread::stack_size_at_create();
break;
case os::compiler_thread:
if (CompilerThreadStackSize > 0) {
@ -3922,12 +3924,21 @@ jint os::init_2(void)
Linux::signal_sets_init();
Linux::install_signal_handlers();
// Check minimum allowable stack size for thread creation and to initialize
// the java system classes, including StackOverflowError - depends on page
// size. Add a page for compiler2 recursion in main thread.
// Add in 2*BytesPerWord times page size to account for VM stack during
// class initialization depending on 32 or 64 bit VM.
os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
(size_t)(StackYellowPages+StackRedPages+StackShadowPages+
2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::page_size());
size_t threadStackSizeInBytes = ThreadStackSize * K;
if (threadStackSizeInBytes != 0 &&
threadStackSizeInBytes < Linux::min_stack_allowed) {
threadStackSizeInBytes < os::Linux::min_stack_allowed) {
tty->print_cr("\nThe stack size specified is too small, "
"Specify at least %dk",
Linux::min_stack_allowed / K);
os::Linux::min_stack_allowed/ K);
return JNI_ERR;
}