< prev index next >

src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp

Print this page
rev 12307 : 8169373: Work around linux NPTL stack guard error.
Summary: Also streamline OS guard page handling on linuxs390, linuxppc, aixppc.
rev 12308 : imported patch new_os_guard_for_java_thread.patch


 518   sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 519 
 520   VMError::report_and_die(t, sig, pc, info, ucVoid);
 521 
 522   ShouldNotReachHere();
 523   return 0;
 524 }
 525 
 526 void os::Aix::init_thread_fpu_state(void) {
 527 #if !defined(USE_XLC_BUILTINS)
 528   // Disable FP exceptions.
 529   __asm__ __volatile__ ("mtfsfi 6,0");
 530 #else
 531   __mtfsfi(6, 0);
 532 #endif
 533 }
 534 
 535 ////////////////////////////////////////////////////////////////////////////////
 536 // thread stack
 537 
 538 // These sizes exclude OS stack guard pages, but include
 539 // the VM guard pages.
 540 size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K;
 541 size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
 542 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
 543 
 544 // Return default stack size for thr_type.
 545 size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
 546   // Default stack size (compiler thread needs larger stack).
 547   size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
 548   return s;
 549 }
 550 
 551 size_t os::Aix::default_guard_size(os::ThreadType thr_type) {
 552   // Creating guard pages is very expensive. Java thread has HotSpot
 553   // guard pages, so only enable libc guard pages for non-Java threads.
 554   //
 555   // Aix can have different page sizes for stack (4K) and heap (64K).
 556   // As Hotspot knows only one page size, we assume the stack has 
 557   // the same page size as the heap. Returning page_size() here can
 558   // cause 16 guard pages which we want to avoid.  Thus we return 4K
 559   // which will be rounded to the real page size by the OS.
 560   return (thr_type == java_thread ? 0 : 4*K);
 561 }
 562 
 563 /////////////////////////////////////////////////////////////////////////////
 564 // helper functions for fatal error handler
 565 
 566 void os::print_context(outputStream *st, const void *context) {
 567   if (context == NULL) return;
 568 
 569   const ucontext_t* uc = (const ucontext_t*)context;
 570 
 571   st->print_cr("Registers:");
 572   st->print("pc =" INTPTR_FORMAT "  ", uc->uc_mcontext.jmp_context.iar);
 573   st->print("lr =" INTPTR_FORMAT "  ", uc->uc_mcontext.jmp_context.lr);
 574   st->print("ctr=" INTPTR_FORMAT "  ", uc->uc_mcontext.jmp_context.ctr);
 575   st->cr();
 576   for (int i = 0; i < 32; i++) {
 577     st->print("r%-2d=" INTPTR_FORMAT "  ", i, uc->uc_mcontext.jmp_context.gpr[i]);
 578     if (i % 3 == 2) st->cr();
 579   }
 580   st->cr();




 518   sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 519 
 520   VMError::report_and_die(t, sig, pc, info, ucVoid);
 521 
 522   ShouldNotReachHere();
 523   return 0;
 524 }
 525 
 526 void os::Aix::init_thread_fpu_state(void) {
 527 #if !defined(USE_XLC_BUILTINS)
 528   // Disable FP exceptions.
 529   __asm__ __volatile__ ("mtfsfi 6,0");
 530 #else
 531   __mtfsfi(6, 0);
 532 #endif
 533 }
 534 
 535 ////////////////////////////////////////////////////////////////////////////////
 536 // thread stack
 537 
 538 // Minimum usable stack sizes required to get to user code. Space for VM
 539 // guard pages is added later.
 540 size_t os::Posix::_compiler_thread_min_stack_allowed = 192 * K;
 541 size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
 542 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
 543 
 544 // Return default stack size for thr_type.
 545 size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
 546   // Default stack size (compiler thread needs larger stack).
 547   size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
 548   return s;
 549 }
 550 
 551 size_t os::Aix::default_guard_size(os::ThreadType thr_type) {
 552   // Creating guard pages is very expensive. Java thread has HotSpot
 553   // guard pages, so only enable libc guard pages for non-Java threads.
 554   //
 555   // Aix can have different page sizes for stack (4K) and heap (64K).
 556   // As Hotspot knows only one page size, we assume the stack has 
 557   // the same page size as the heap. Returning page_size() here can
 558   // cause 16 guard pages which we want to avoid.  Thus we return 4K
 559   // which will be rounded to the real page size by the OS.
 560   return ((thr_type == java_thread || thr_type == os::compiler_thread) ? 0 : 4*K);
 561 }
 562 
 563 /////////////////////////////////////////////////////////////////////////////
 564 // helper functions for fatal error handler
 565 
 566 void os::print_context(outputStream *st, const void *context) {
 567   if (context == NULL) return;
 568 
 569   const ucontext_t* uc = (const ucontext_t*)context;
 570 
 571   st->print_cr("Registers:");
 572   st->print("pc =" INTPTR_FORMAT "  ", uc->uc_mcontext.jmp_context.iar);
 573   st->print("lr =" INTPTR_FORMAT "  ", uc->uc_mcontext.jmp_context.lr);
 574   st->print("ctr=" INTPTR_FORMAT "  ", uc->uc_mcontext.jmp_context.ctr);
 575   st->cr();
 576   for (int i = 0; i < 32; i++) {
 577     st->print("r%-2d=" INTPTR_FORMAT "  ", i, uc->uc_mcontext.jmp_context.gpr[i]);
 578     if (i % 3 == 2) st->cr();
 579   }
 580   st->cr();


< prev index next >