comparison src/os/windows/vm/os_windows.cpp @ 1867:b6aedd1acdc0

6983240: guarantee((Solaris::min_stack_allowed >= (StackYellowPages+StackRedPages...) wrong Summary: min_stack_allowed is a compile time constant and Stack*Pages are settable Reviewed-by: dholmes, kvn
author coleenp
date Thu, 07 Oct 2010 08:06:06 -0700
parents 1c352af0135d
children f95d63e2154a
comparison
equal deleted inserted replaced
1866:644f98c78e33 1867:b6aedd1acdc0
3309 static void perfMemory_exit_helper() { 3309 static void perfMemory_exit_helper() {
3310 perfMemory_exit(); 3310 perfMemory_exit();
3311 } 3311 }
3312 } 3312 }
3313 3313
3314
3315 // this is called _after_ the global arguments have been parsed 3314 // this is called _after_ the global arguments have been parsed
3316 jint os::init_2(void) { 3315 jint os::init_2(void) {
3317 // Allocate a single page and mark it as readable for safepoint polling 3316 // Allocate a single page and mark it as readable for safepoint polling
3318 address polling_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READONLY); 3317 address polling_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READONLY);
3319 guarantee( polling_page != NULL, "Reserve Failed for polling page"); 3318 guarantee( polling_page != NULL, "Reserve Failed for polling page");
3386 size_t default_reserve_size = os::win32::default_stack_size(); 3385 size_t default_reserve_size = os::win32::default_stack_size();
3387 size_t actual_reserve_size = stack_commit_size; 3386 size_t actual_reserve_size = stack_commit_size;
3388 if (stack_commit_size < default_reserve_size) { 3387 if (stack_commit_size < default_reserve_size) {
3389 // If stack_commit_size == 0, we want this too 3388 // If stack_commit_size == 0, we want this too
3390 actual_reserve_size = default_reserve_size; 3389 actual_reserve_size = default_reserve_size;
3390 }
3391
3392 // Check minimum allowable stack size for thread creation and to initialize
3393 // the java system classes, including StackOverflowError - depends on page
3394 // size. Add a page for compiler2 recursion in main thread.
3395 // Add in 2*BytesPerWord times page size to account for VM stack during
3396 // class initialization depending on 32 or 64 bit VM.
3397 size_t min_stack_allowed =
3398 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
3399 2*BytesPerWord COMPILER2_PRESENT(+1)) * os::vm_page_size();
3400 if (actual_reserve_size < min_stack_allowed) {
3401 tty->print_cr("\nThe stack size specified is too small, "
3402 "Specify at least %dk",
3403 min_stack_allowed / K);
3404 return JNI_ERR;
3391 } 3405 }
3392 3406
3393 JavaThread::set_stack_size_at_create(stack_commit_size); 3407 JavaThread::set_stack_size_at_create(stack_commit_size);
3394 3408
3395 // Calculate theoretical max. size of Threads to guard gainst artifical 3409 // Calculate theoretical max. size of Threads to guard gainst artifical