src/share/vm/runtime/os.cpp

changeset 4535
9fae07c31641
parent 4299
f34d701e952e
child 4802
eca90b8a06eb
     1.1 --- a/src/share/vm/runtime/os.cpp	Fri Jan 25 16:09:14 2013 -0800
     1.2 +++ b/src/share/vm/runtime/os.cpp	Fri Jan 25 16:50:33 2013 -0800
     1.3 @@ -985,15 +985,28 @@
     1.4  // if C stack is walkable beyond current frame. The check for fp() is not
     1.5  // necessary on Sparc, but it's harmless.
     1.6  bool os::is_first_C_frame(frame* fr) {
     1.7 -#ifdef IA64
     1.8 -  // In order to walk native frames on Itanium, we need to access the unwind
     1.9 -  // table, which is inside ELF. We don't want to parse ELF after fatal error,
    1.10 -  // so return true for IA64. If we need to support C stack walking on IA64,
    1.11 -  // this function needs to be moved to CPU specific files, as fp() on IA64
    1.12 -  // is register stack, which grows towards higher memory address.
    1.13 +#if defined(IA64) && !defined(_WIN32)
    1.14 +  // On IA64 we have to check if the callers bsp is still valid
    1.15 +  // (i.e. within the register stack bounds).
    1.16 +  // Notice: this only works for threads created by the VM and only if
    1.17 +  // we walk the current stack!!! If we want to be able to walk
    1.18 +  // arbitrary other threads, we'll have to somehow store the thread
    1.19 +  // object in the frame.
    1.20 +  Thread *thread = Thread::current();
    1.21 +  if ((address)fr->fp() <=
    1.22 +      thread->register_stack_base() HPUX_ONLY(+ 0x0) LINUX_ONLY(+ 0x50)) {
    1.23 +    // This check is a little hacky, because on Linux the first C
    1.24 +    // frame's ('start_thread') register stack frame starts at
    1.25 +    // "register_stack_base + 0x48" while on HPUX, the first C frame's
    1.26 +    // ('__pthread_bound_body') register stack frame seems to really
    1.27 +    // start at "register_stack_base".
    1.28 +    return true;
    1.29 +  } else {
    1.30 +    return false;
    1.31 +  }
    1.32 +#elif defined(IA64) && defined(_WIN32)
    1.33    return true;
    1.34 -#endif
    1.35 -
    1.36 +#else
    1.37    // Load up sp, fp, sender sp and sender fp, check for reasonable values.
    1.38    // Check usp first, because if that's bad the other accessors may fault
    1.39    // on some architectures.  Ditto ufp second, etc.
    1.40 @@ -1023,6 +1036,7 @@
    1.41    if (old_fp - ufp > 64 * K) return true;
    1.42  
    1.43    return false;
    1.44 +#endif
    1.45  }
    1.46  
    1.47  #ifdef ASSERT

mercurial