825 if (stack_size == 0) { |
825 if (stack_size == 0) { |
826 stack_size = os::Linux::default_stack_size(thr_type); |
826 stack_size = os::Linux::default_stack_size(thr_type); |
827 |
827 |
828 switch (thr_type) { |
828 switch (thr_type) { |
829 case os::java_thread: |
829 case os::java_thread: |
830 // Java threads use ThreadStackSize which default value can be changed with the flag -Xss |
830 // Java threads use ThreadStackSize which default value can be |
831 if (JavaThread::stack_size_at_create() > 0) stack_size = JavaThread::stack_size_at_create(); |
831 // changed with the flag -Xss |
|
832 assert (JavaThread::stack_size_at_create() > 0, "this should be set"); |
|
833 stack_size = JavaThread::stack_size_at_create(); |
832 break; |
834 break; |
833 case os::compiler_thread: |
835 case os::compiler_thread: |
834 if (CompilerThreadStackSize > 0) { |
836 if (CompilerThreadStackSize > 0) { |
835 stack_size = (size_t)(CompilerThreadStackSize * K); |
837 stack_size = (size_t)(CompilerThreadStackSize * K); |
836 break; |
838 break; |
3920 } |
3922 } |
3921 |
3923 |
3922 Linux::signal_sets_init(); |
3924 Linux::signal_sets_init(); |
3923 Linux::install_signal_handlers(); |
3925 Linux::install_signal_handlers(); |
3924 |
3926 |
|
3927 // Check minimum allowable stack size for thread creation and to initialize |
|
3928 // the java system classes, including StackOverflowError - depends on page |
|
3929 // size. Add a page for compiler2 recursion in main thread. |
|
3930 // Add in 2*BytesPerWord times page size to account for VM stack during |
|
3931 // class initialization depending on 32 or 64 bit VM. |
|
3932 os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed, |
|
3933 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ |
|
3934 2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::page_size()); |
|
3935 |
3925 size_t threadStackSizeInBytes = ThreadStackSize * K; |
3936 size_t threadStackSizeInBytes = ThreadStackSize * K; |
3926 if (threadStackSizeInBytes != 0 && |
3937 if (threadStackSizeInBytes != 0 && |
3927 threadStackSizeInBytes < Linux::min_stack_allowed) { |
3938 threadStackSizeInBytes < os::Linux::min_stack_allowed) { |
3928 tty->print_cr("\nThe stack size specified is too small, " |
3939 tty->print_cr("\nThe stack size specified is too small, " |
3929 "Specify at least %dk", |
3940 "Specify at least %dk", |
3930 Linux::min_stack_allowed / K); |
3941 os::Linux::min_stack_allowed/ K); |
3931 return JNI_ERR; |
3942 return JNI_ERR; |
3932 } |
3943 } |
3933 |
3944 |
3934 // Make the stack size a multiple of the page size so that |
3945 // Make the stack size a multiple of the page size so that |
3935 // the yellow/red zones can be guarded. |
3946 // the yellow/red zones can be guarded. |