4431 void * hdl = dlopen("libdl.so", RTLD_NOW);
4432 if (hdl) {
4433 dladdr1_func = CAST_TO_FN_PTR(dladdr1_func_type, dlsym(hdl, "dladdr1"));
4434 }
4435
4436 // (Solaris only) this switches to calls that actually do locking.
4437 ThreadCritical::initialize();
4438
4439 main_thread = thr_self();
4440
4441 // Constant minimum stack size allowed. It must be at least
4442 // the minimum of what the OS supports (thr_min_stack()), and
4443 // enough to allow the thread to get to user bytecode execution.
4444 Solaris::min_stack_allowed = MAX2(thr_min_stack(), Solaris::min_stack_allowed);
4445 // If the pagesize of the VM is greater than 8K determine the appropriate
4446 // number of initial guard pages. The user can change this with the
4447 // command line arguments, if needed.
4448 if (vm_page_size() > 8*K) {
4449 StackYellowPages = 1;
4450 StackRedPages = 1;
4451 StackShadowPages = round_to((StackShadowPages*8*K), vm_page_size()) / vm_page_size();
4452 }
4453 }
4454
4455 // To install functions for atexit system call
4456 extern "C" {
4457 static void perfMemory_exit_helper() {
4458 perfMemory_exit();
4459 }
4460 }
4461
4462 // this is called _after_ the global arguments have been parsed
4463 jint os::init_2(void) {
4464 // try to enable extended file IO ASAP, see 6431278
4465 os::Solaris::try_enable_extended_io();
4466
4467 // Allocate a single page and mark it as readable for safepoint polling. Also
4468 // use this first mmap call to check support for MAP_ALIGN.
4469 address polling_page = (address)Solaris::mmap_chunk((char*)page_size,
4470 page_size,
4487
4488 if (!UseMembar) {
4489 address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
4490 guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
4491 os::set_memory_serialize_page(mem_serialize_page);
4492
4493 #ifndef PRODUCT
4494 if (Verbose && PrintMiscellaneous) {
4495 tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
4496 (intptr_t)mem_serialize_page);
4497 }
4498 #endif
4499 }
4500
4501 // Check minimum allowable stack size for thread creation and to initialize
4502 // the java system classes, including StackOverflowError - depends on page
4503 // size. Add a page for compiler2 recursion in main thread.
4504 // Add in 2*BytesPerWord times page size to account for VM stack during
4505 // class initialization depending on 32 or 64 bit VM.
4506 os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
4507 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
4508 2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size);
4509
4510 size_t threadStackSizeInBytes = ThreadStackSize * K;
4511 if (threadStackSizeInBytes != 0 &&
4512 threadStackSizeInBytes < os::Solaris::min_stack_allowed) {
4513 tty->print_cr("\nThe stack size specified is too small, Specify at least %dk",
4514 os::Solaris::min_stack_allowed/K);
4515 return JNI_ERR;
4516 }
4517
4518 // For 64kbps there will be a 64kb page size, which makes
4519 // the usable default stack size quite a bit less. Increase the
4520 // stack for 64kb (or any > than 8kb) pages, this increases
4521 // virtual memory fragmentation (since we're not creating the
4522 // stack on a power of 2 boundary. The real fix for this
4523 // should be to fix the guard page mechanism.
4524
4525 if (vm_page_size() > 8*K) {
4526 threadStackSizeInBytes = (threadStackSizeInBytes != 0)
4527 ? threadStackSizeInBytes +
|
4431 void * hdl = dlopen("libdl.so", RTLD_NOW);
4432 if (hdl) {
4433 dladdr1_func = CAST_TO_FN_PTR(dladdr1_func_type, dlsym(hdl, "dladdr1"));
4434 }
4435
4436 // (Solaris only) this switches to calls that actually do locking.
4437 ThreadCritical::initialize();
4438
4439 main_thread = thr_self();
4440
4441 // Constant minimum stack size allowed. It must be at least
4442 // the minimum of what the OS supports (thr_min_stack()), and
4443 // enough to allow the thread to get to user bytecode execution.
4444 Solaris::min_stack_allowed = MAX2(thr_min_stack(), Solaris::min_stack_allowed);
4445 // If the pagesize of the VM is greater than 8K determine the appropriate
4446 // number of initial guard pages. The user can change this with the
4447 // command line arguments, if needed.
4448 if (vm_page_size() > 8*K) {
4449 StackYellowPages = 1;
4450 StackRedPages = 1;
4451 StackReservedPages = 1;
4452 StackShadowPages = round_to((StackShadowPages*8*K), vm_page_size()) / vm_page_size();
4453 }
4454 }
4455
4456 // To install functions for atexit system call
4457 extern "C" {
4458 static void perfMemory_exit_helper() {
4459 perfMemory_exit();
4460 }
4461 }
4462
4463 // this is called _after_ the global arguments have been parsed
4464 jint os::init_2(void) {
4465 // try to enable extended file IO ASAP, see 6431278
4466 os::Solaris::try_enable_extended_io();
4467
4468 // Allocate a single page and mark it as readable for safepoint polling. Also
4469 // use this first mmap call to check support for MAP_ALIGN.
4470 address polling_page = (address)Solaris::mmap_chunk((char*)page_size,
4471 page_size,
4488
4489 if (!UseMembar) {
4490 address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
4491 guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
4492 os::set_memory_serialize_page(mem_serialize_page);
4493
4494 #ifndef PRODUCT
4495 if (Verbose && PrintMiscellaneous) {
4496 tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
4497 (intptr_t)mem_serialize_page);
4498 }
4499 #endif
4500 }
4501
4502 // Check minimum allowable stack size for thread creation and to initialize
4503 // the java system classes, including StackOverflowError - depends on page
4504 // size. Add a page for compiler2 recursion in main thread.
4505 // Add in 2*BytesPerWord times page size to account for VM stack during
4506 // class initialization depending on 32 or 64 bit VM.
4507 os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
4508 (size_t)(StackReservedPages+StackYellowPages+StackRedPages+StackShadowPages+
4509 2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size);
4510
4511 size_t threadStackSizeInBytes = ThreadStackSize * K;
4512 if (threadStackSizeInBytes != 0 &&
4513 threadStackSizeInBytes < os::Solaris::min_stack_allowed) {
4514 tty->print_cr("\nThe stack size specified is too small, Specify at least %dk",
4515 os::Solaris::min_stack_allowed/K);
4516 return JNI_ERR;
4517 }
4518
4519 // For 64kbps there will be a 64kb page size, which makes
4520 // the usable default stack size quite a bit less. Increase the
4521 // stack for 64kb (or any > than 8kb) pages, this increases
4522 // virtual memory fragmentation (since we're not creating the
4523 // stack on a power of 2 boundary. The real fix for this
4524 // should be to fix the guard page mechanism.
4525
4526 if (vm_page_size() > 8*K) {
4527 threadStackSizeInBytes = (threadStackSizeInBytes != 0)
4528 ? threadStackSizeInBytes +
|