src/share/vm/runtime/vframe.hpp

changeset 544
9f4457a14b58
parent 542
93b6525e3b82
child 631
d1605aabd0a1
     1.1 --- a/src/share/vm/runtime/vframe.hpp	Wed Apr 09 10:38:30 2008 -0400
     1.2 +++ b/src/share/vm/runtime/vframe.hpp	Wed Apr 09 15:10:22 2008 -0700
     1.3 @@ -416,6 +416,48 @@
     1.4        int decode_offset;
     1.5        if (pc_desc == NULL) {
     1.6          // Should not happen, but let fill_from_compiled_frame handle it.
     1.7 +
     1.8 +        // If we are trying to walk the stack of a thread that is not
     1.9 +        // at a safepoint (like AsyncGetCallTrace would do) then this is an
    1.10 +        // acceptable result. [ This is assuming that safe_for_sender
    1.11 +        // is so bullet proof that we can trust the frames it produced. ]
    1.12 +        //
    1.13 +        // So if we see that the thread is not safepoint safe
    1.14 +        // then simply produce the method and a bci of zero
    1.15 +        // and skip the possibility of decoding any inlining that
    1.16 +        // may be present. That is far better than simply stopping (or
    1.17 +        // asserting. If however the thread is safepoint safe this
    1.18 +        // is the sign of a compiler bug  and we'll let
    1.19 +        // fill_from_compiled_frame handle it.
    1.20 +
    1.21 +
    1.22 +        JavaThreadState state = _thread->thread_state();
    1.23 +
    1.24 +        // in_Java should be good enough to test safepoint safety
    1.25 +        // if state were say in_Java_trans then we'd expect that
    1.26 +        // the pc would have already been slightly adjusted to
    1.27 +        // one that would produce a pcDesc since the trans state
    1.28 +        // would be one that might in fact anticipate a safepoint
    1.29 +
    1.30 +        if (state == _thread_in_Java ) {
    1.31 +          // This will get a method a zero bci and no inlining.
    1.32 +          // Might be nice to have a unique bci to signify this
    1.33 +          // particular case but for now zero will do.
    1.34 +
    1.35 +          fill_from_compiled_native_frame();
    1.36 +
    1.37 +          // There is something to be said for setting the mode to
    1.38 +          // at_end_mode to prevent trying to walk further up the
    1.39 +          // stack. There is evidence that if we walk any further
    1.40 +          // that we could produce a bad stack chain. However until
    1.41 +          // we see evidence that allowing this causes us to find
    1.42 +          // frames bad enough to cause segv's or assertion failures
    1.43 +          // we don't do it as while we may get a bad call chain the
    1.44 +          // probability is much higher (several magnitudes) that we
    1.45 +          // get good data.
    1.46 +
    1.47 +          return true;
    1.48 +        }
    1.49          decode_offset = DebugInformationRecorder::serialized_null;
    1.50        } else {
    1.51          decode_offset = pc_desc->scope_decode_offset();

mercurial