hotspot/src/share/vm/runtime/os.cpp
changeset 15475 73896d91270c
parent 14583 d70ee55535f4
child 16428 1b55a8d558b8
equal deleted inserted replaced
15474:62425bb6b9e3 15475:73896d91270c
   983 
   983 
   984 // Looks like all platforms except IA64 can use the same function to check
   984 // Looks like all platforms except IA64 can use the same function to check
   985 // if C stack is walkable beyond current frame. The check for fp() is not
   985 // if C stack is walkable beyond current frame. The check for fp() is not
   986 // necessary on Sparc, but it's harmless.
   986 // necessary on Sparc, but it's harmless.
   987 bool os::is_first_C_frame(frame* fr) {
   987 bool os::is_first_C_frame(frame* fr) {
   988 #ifdef IA64
   988 #if defined(IA64) && !defined(_WIN32)
   989   // In order to walk native frames on Itanium, we need to access the unwind
   989   // On IA64 we have to check if the callers bsp is still valid
   990   // table, which is inside ELF. We don't want to parse ELF after fatal error,
   990   // (i.e. within the register stack bounds).
   991   // so return true for IA64. If we need to support C stack walking on IA64,
   991   // Notice: this only works for threads created by the VM and only if
   992   // this function needs to be moved to CPU specific files, as fp() on IA64
   992   // we walk the current stack!!! If we want to be able to walk
   993   // is register stack, which grows towards higher memory address.
   993   // arbitrary other threads, we'll have to somehow store the thread
       
   994   // object in the frame.
       
   995   Thread *thread = Thread::current();
       
   996   if ((address)fr->fp() <=
       
   997       thread->register_stack_base() HPUX_ONLY(+ 0x0) LINUX_ONLY(+ 0x50)) {
       
   998     // This check is a little hacky, because on Linux the first C
       
   999     // frame's ('start_thread') register stack frame starts at
       
  1000     // "register_stack_base + 0x48" while on HPUX, the first C frame's
       
  1001     // ('__pthread_bound_body') register stack frame seems to really
       
  1002     // start at "register_stack_base".
       
  1003     return true;
       
  1004   } else {
       
  1005     return false;
       
  1006   }
       
  1007 #elif defined(IA64) && defined(_WIN32)
   994   return true;
  1008   return true;
   995 #endif
  1009 #else
   996 
       
   997   // Load up sp, fp, sender sp and sender fp, check for reasonable values.
  1010   // Load up sp, fp, sender sp and sender fp, check for reasonable values.
   998   // Check usp first, because if that's bad the other accessors may fault
  1011   // Check usp first, because if that's bad the other accessors may fault
   999   // on some architectures.  Ditto ufp second, etc.
  1012   // on some architectures.  Ditto ufp second, etc.
  1000   uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1);
  1013   uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1);
  1001   // sp on amd can be 32 bit aligned.
  1014   // sp on amd can be 32 bit aligned.
  1021   // is not walkable beyond current frame.
  1034   // is not walkable beyond current frame.
  1022   if (old_fp < ufp) return true;
  1035   if (old_fp < ufp) return true;
  1023   if (old_fp - ufp > 64 * K) return true;
  1036   if (old_fp - ufp > 64 * K) return true;
  1024 
  1037 
  1025   return false;
  1038   return false;
       
  1039 #endif
  1026 }
  1040 }
  1027 
  1041 
  1028 #ifdef ASSERT
  1042 #ifdef ASSERT
  1029 extern "C" void test_random() {
  1043 extern "C" void test_random() {
  1030   const double m = 2147483647;
  1044   const double m = 2147483647;