414 } else { |
414 } else { |
415 PcDesc* pc_desc = nm()->pc_desc_at(_frame.pc()); |
415 PcDesc* pc_desc = nm()->pc_desc_at(_frame.pc()); |
416 int decode_offset; |
416 int decode_offset; |
417 if (pc_desc == NULL) { |
417 if (pc_desc == NULL) { |
418 // Should not happen, but let fill_from_compiled_frame handle it. |
418 // Should not happen, but let fill_from_compiled_frame handle it. |
|
419 |
|
420 // If we are trying to walk the stack of a thread that is not |
|
421 // at a safepoint (like AsyncGetCallTrace would do) then this is an |
|
422 // acceptable result. [ This is assuming that safe_for_sender |
|
423 // is so bullet proof that we can trust the frames it produced. ] |
|
424 // |
|
425 // So if we see that the thread is not safepoint safe |
|
426 // then simply produce the method and a bci of zero |
|
427 // and skip the possibility of decoding any inlining that |
|
428 // may be present. That is far better than simply stopping (or |
|
429 // asserting. If however the thread is safepoint safe this |
|
430 // is the sign of a compiler bug and we'll let |
|
431 // fill_from_compiled_frame handle it. |
|
432 |
|
433 |
|
434 JavaThreadState state = _thread->thread_state(); |
|
435 |
|
436 // in_Java should be good enough to test safepoint safety |
|
437 // if state were say in_Java_trans then we'd expect that |
|
438 // the pc would have already been slightly adjusted to |
|
439 // one that would produce a pcDesc since the trans state |
|
440 // would be one that might in fact anticipate a safepoint |
|
441 |
|
442 if (state == _thread_in_Java ) { |
|
443 // This will get a method a zero bci and no inlining. |
|
444 // Might be nice to have a unique bci to signify this |
|
445 // particular case but for now zero will do. |
|
446 |
|
447 fill_from_compiled_native_frame(); |
|
448 |
|
449 // There is something to be said for setting the mode to |
|
450 // at_end_mode to prevent trying to walk further up the |
|
451 // stack. There is evidence that if we walk any further |
|
452 // that we could produce a bad stack chain. However until |
|
453 // we see evidence that allowing this causes us to find |
|
454 // frames bad enough to cause segv's or assertion failures |
|
455 // we don't do it as while we may get a bad call chain the |
|
456 // probability is much higher (several magnitudes) that we |
|
457 // get good data. |
|
458 |
|
459 return true; |
|
460 } |
419 decode_offset = DebugInformationRecorder::serialized_null; |
461 decode_offset = DebugInformationRecorder::serialized_null; |
420 } else { |
462 } else { |
421 decode_offset = pc_desc->scope_decode_offset(); |
463 decode_offset = pc_desc->scope_decode_offset(); |
422 } |
464 } |
423 fill_from_compiled_frame(decode_offset); |
465 fill_from_compiled_frame(decode_offset); |