< prev index next >

src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp

Print this page




  68 # include <thread.h>
  69 # include <sys/stat.h>
  70 # include <sys/time.h>
  71 # include <sys/filio.h>
  72 # include <sys/utsname.h>
  73 # include <sys/systeminfo.h>
  74 # include <sys/socket.h>
  75 # include <sys/lwp.h>
  76 # include <poll.h>
  77 # include <sys/lwp.h>
  78 
  79 # define _STRUCTURED_PROC 1  //  this gets us the new structured proc interfaces of 5.6 & later
  80 # include <sys/procfs.h>     //  see comment in <sys/procfs.h>
  81 
  82 #define MAX_PATH (2 * K)
  83 
  84 // Minimum usable stack sizes required to get to user code. Space for
  85 // HotSpot guard pages is added later.
  86 size_t os::Posix::_compiler_thread_min_stack_allowed = 104 * K;
  87 size_t os::Posix::_java_thread_min_stack_allowed = 86 * K;
  88 #ifdef _LP64
  89 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
  90 #else
  91 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 96 * K;
  92 #endif
  93 
  94 int os::Solaris::max_register_window_saves_before_flushing() {
  95   // We should detect this at run time. For now, filling
  96   // in with a constant.
  97   return 8;
  98 }
  99 
 100 static void handle_unflushed_register_windows(gwindows_t *win) {
 101   int restore_count = win->wbcnt;
 102   int i;
 103 
 104   for(i=0; i<restore_count; i++) {
 105     address sp = ((address)win->spbuf[i]) + STACK_BIAS;
 106     address reg_win = (address)&win->wbuf[i];
 107     memcpy(sp,reg_win,sizeof(struct rwindow));
 108   }
 109 }
 110 
 111 char* os::non_memory_address_word() {
 112   // Must never look like an address returned by reserve_memory,


 303 // pointer.
 304 address os::current_stack_pointer() {
 305   volatile int dummy;
 306   address sp = (address)&dummy + 8;     // %%%% need to confirm if this is right
 307   return sp;
 308 }
 309 
 310 frame os::current_frame() {
 311   intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
 312   frame myframe(sp, frame::unpatchable,
 313                 CAST_FROM_FN_PTR(address, os::current_frame));
 314   if (os::is_first_C_frame(&myframe)) {
 315     // stack is not walkable
 316     return frame(NULL, NULL, false);
 317   } else {
 318     return os::get_sender_for_C_frame(&myframe);
 319   }
 320 }
 321 
 322 bool os::is_allocatable(size_t bytes) {
 323 #ifdef _LP64
 324    return true;
 325 #else
 326    return (bytes <= (size_t)3835*M);
 327 #endif
 328 }
 329 
 330 extern "C" JNIEXPORT int
 331 JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
 332                           int abort_if_unrecognized) {
 333   ucontext_t* uc = (ucontext_t*) ucVoid;
 334 
 335   Thread* t = Thread::current_or_null_safe();
 336 
 337   // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
 338   // (no destructors can be run)
 339   os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
 340 
 341   SignalHandlerMark shm(t);
 342 
 343   if(sig == SIGPIPE || sig == SIGXFSZ) {
 344     if (os::Solaris::chained_handler(sig, info, ucVoid)) {
 345       return true;
 346     } else {
 347       // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219


 715   st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]);
 716   st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]);
 717   st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]);
 718   st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]);
 719   st->cr();
 720 
 721   st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]);
 722   st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]);
 723   st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]);
 724   st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]);
 725   st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]);
 726   st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]);
 727   st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]);
 728   st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]);
 729   st->cr();
 730 }
 731 
 732 void os::Solaris::init_thread_fpu_state(void) {
 733     // Nothing needed on Sparc.
 734 }
 735 
 736 #if !defined(COMPILER2) && !defined(_LP64)
 737 
 738 // These routines are the initial value of atomic_xchg_entry(),
 739 // atomic_cmpxchg_entry(), atomic_add_entry() and fence_entry()
 740 // until initialization is complete.
 741 // TODO - remove when the VM drops support for V8.
 742 
 743 typedef jint  xchg_func_t        (jint,  volatile jint*);
 744 typedef jint  cmpxchg_func_t     (jint,  volatile jint*,  jint);
 745 typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
 746 typedef jint  add_func_t         (jint,  volatile jint*);
 747 
 748 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
 749   // try to use the stub:
 750   xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
 751 
 752   if (func != NULL) {
 753     os::atomic_xchg_func = func;
 754     return (*func)(exchange_value, dest);
 755   }
 756   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 757 
 758   jint old_value = *dest;
 759   *dest = exchange_value;
 760   return old_value;
 761 }
 762 
 763 jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
 764   // try to use the stub:
 765   cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
 766 
 767   if (func != NULL) {
 768     os::atomic_cmpxchg_func = func;
 769     return (*func)(exchange_value, dest, compare_value);
 770   }
 771   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 772 
 773   jint old_value = *dest;
 774   if (old_value == compare_value)
 775     *dest = exchange_value;
 776   return old_value;
 777 }
 778 
 779 jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
 780   // try to use the stub:
 781   cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
 782 
 783   if (func != NULL) {
 784     os::atomic_cmpxchg_long_func = func;
 785     return (*func)(exchange_value, dest, compare_value);
 786   }
 787   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 788 
 789   jlong old_value = *dest;
 790   if (old_value == compare_value)
 791     *dest = exchange_value;
 792   return old_value;
 793 }
 794 
 795 jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
 796   // try to use the stub:
 797   add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
 798 
 799   if (func != NULL) {
 800     os::atomic_add_func = func;
 801     return (*func)(add_value, dest);
 802   }
 803   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 804 
 805   return (*dest) += add_value;
 806 }
 807 
 808 xchg_func_t*         os::atomic_xchg_func         = os::atomic_xchg_bootstrap;
 809 cmpxchg_func_t*      os::atomic_cmpxchg_func      = os::atomic_cmpxchg_bootstrap;
 810 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
 811 add_func_t*          os::atomic_add_func          = os::atomic_add_bootstrap;
 812 
 813 #endif // !_LP64 && !COMPILER2
 814 
 815 #if defined(__sparc) && defined(COMPILER2) && defined(_GNU_SOURCE)
 816  // See file build/solaris/makefiles/$compiler.make
 817  // For compiler1 the architecture is v8 and frps isn't present in v8
 818  extern "C"  void _mark_fpu_nosave() {
 819    __asm__ __volatile__ ("wr %%g0, 0, %%fprs \n\t" : : :);
 820   }
 821 #endif //defined(__sparc) && defined(COMPILER2)
 822 
 823 #ifndef PRODUCT
 824 void os::verify_stack_alignment() {
 825 }
 826 #endif
 827 
 828 int os::extra_bang_size_in_bytes() {
 829   // SPARC does not require an additional stack bang.
 830   return 0;
 831 }


  68 # include <thread.h>
  69 # include <sys/stat.h>
  70 # include <sys/time.h>
  71 # include <sys/filio.h>
  72 # include <sys/utsname.h>
  73 # include <sys/systeminfo.h>
  74 # include <sys/socket.h>
  75 # include <sys/lwp.h>
  76 # include <poll.h>
  77 # include <sys/lwp.h>
  78 
  79 # define _STRUCTURED_PROC 1  //  this gets us the new structured proc interfaces of 5.6 & later
  80 # include <sys/procfs.h>     //  see comment in <sys/procfs.h>
  81 
  82 #define MAX_PATH (2 * K)
  83 
  84 // Minimum usable stack sizes required to get to user code. Space for
  85 // HotSpot guard pages is added later.
  86 size_t os::Posix::_compiler_thread_min_stack_allowed = 104 * K;
  87 size_t os::Posix::_java_thread_min_stack_allowed = 86 * K;

  88 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;



  89 
  90 int os::Solaris::max_register_window_saves_before_flushing() {
  91   // We should detect this at run time. For now, filling
  92   // in with a constant.
  93   return 8;
  94 }
  95 
  96 static void handle_unflushed_register_windows(gwindows_t *win) {
  97   int restore_count = win->wbcnt;
  98   int i;
  99 
 100   for(i=0; i<restore_count; i++) {
 101     address sp = ((address)win->spbuf[i]) + STACK_BIAS;
 102     address reg_win = (address)&win->wbuf[i];
 103     memcpy(sp,reg_win,sizeof(struct rwindow));
 104   }
 105 }
 106 
 107 char* os::non_memory_address_word() {
 108   // Must never look like an address returned by reserve_memory,


 299 // pointer.
 300 address os::current_stack_pointer() {
 301   volatile int dummy;
 302   address sp = (address)&dummy + 8;     // %%%% need to confirm if this is right
 303   return sp;
 304 }
 305 
 306 frame os::current_frame() {
 307   intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
 308   frame myframe(sp, frame::unpatchable,
 309                 CAST_FROM_FN_PTR(address, os::current_frame));
 310   if (os::is_first_C_frame(&myframe)) {
 311     // stack is not walkable
 312     return frame(NULL, NULL, false);
 313   } else {
 314     return os::get_sender_for_C_frame(&myframe);
 315   }
 316 }
 317 
 318 bool os::is_allocatable(size_t bytes) {

 319    return true;



 320 }
 321 
 322 extern "C" JNIEXPORT int
 323 JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
 324                           int abort_if_unrecognized) {
 325   ucontext_t* uc = (ucontext_t*) ucVoid;
 326 
 327   Thread* t = Thread::current_or_null_safe();
 328 
 329   // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
 330   // (no destructors can be run)
 331   os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
 332 
 333   SignalHandlerMark shm(t);
 334 
 335   if(sig == SIGPIPE || sig == SIGXFSZ) {
 336     if (os::Solaris::chained_handler(sig, info, ucVoid)) {
 337       return true;
 338     } else {
 339       // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219


 707   st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]);
 708   st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]);
 709   st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]);
 710   st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]);
 711   st->cr();
 712 
 713   st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]);
 714   st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]);
 715   st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]);
 716   st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]);
 717   st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]);
 718   st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]);
 719   st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]);
 720   st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]);
 721   st->cr();
 722 }
 723 
 724 void os::Solaris::init_thread_fpu_state(void) {
 725     // Nothing needed on Sparc.
 726 }















































































 727 
 728 #if defined(__sparc) && defined(COMPILER2) && defined(_GNU_SOURCE)
 729  // See file build/solaris/makefiles/$compiler.make
 730  // For compiler1 the architecture is v8 and frps isn't present in v8
 731  extern "C"  void _mark_fpu_nosave() {
 732    __asm__ __volatile__ ("wr %%g0, 0, %%fprs \n\t" : : :);
 733   }
 734 #endif //defined(__sparc) && defined(COMPILER2)
 735 
 736 #ifndef PRODUCT
 737 void os::verify_stack_alignment() {
 738 }
 739 #endif
 740 
 741 int os::extra_bang_size_in_bytes() {
 742   // SPARC does not require an additional stack bang.
 743   return 0;
 744 }
< prev index next >