void traceDeltaFrame(frame& f) { if (f.is_compiled_frame()) { traceCompiledFrame(f); } else if (f.is_interpreted_frame()) { traceInterpretedFrame(f); } }
void FlatProfiler::record_tick_for_running_frame(frame fr) { // The tick happend in real code -> non VM code if (fr.is_interpreted_frame()) { methodOop method = fr.method(); if (method == NULL) return; assert(method->is_method(), "must be method"); FlatProfiler::interpreted_update(method, fr.receiver()->klass(), in_code); } else if (fr.is_compiled_frame()) { FlatProfiler::compiled_update(findNMethod(fr.pc()), in_code); } else if (PIC::in_heap(fr.pc())) { PIC* pic = PIC::find(fr.pc()); FlatProfiler::compiled_update(findNMethod((char*) pic->compiled_ic()), in_pic); } else if (StubRoutines::contains(fr.pc())) { FlatProfiler::stub_ticks++; } }
void FlatProfiler::record_tick_for_calling_frame(frame fr) { // The tick happend in VM code TickPosition where = other; if (theCompiler) { where = in_compiler; } if (fr.is_interpreted_frame()) { methodOop method = fr.method(); if (method == NULL) return; assert(method->is_method(), "must be method"); int bci = method->bci_from(fr.hp()); if (Bytecodes::code_type((Bytecodes::Code) *method->codes(bci)) == Bytecodes::primitive_call) { where = in_primitive; } FlatProfiler::interpreted_update(method, fr.receiver()->klass(), where); } else if (fr.is_compiled_frame()) { nmethod* nm = findNMethod(fr.pc()); relocIterator iter(nm); while (iter.next()) { if (iter.is_call() && iter.call_end() == fr.pc()) { if (iter.type() == relocInfo::prim_type) where = in_primitive; } } FlatProfiler::compiled_update(nm, where); } else { if (StubRoutines::contains(fr.pc())) { FlatProfiler::stub_ticks++; } else { FlatProfiler::unknown_ticks++; } } }
inline bool vframeStreamCommon::fill_from_frame() { // Interpreted frame if (_frame.is_interpreted_frame()) { fill_from_interpreter_frame(); return true; } // Compiled frame if (cb() != NULL && cb()->is_nmethod()) { if (nm()->is_native_method()) { // Do not rely on scopeDesc since the pc might be unprecise due to the _last_native_pc trick. fill_from_compiled_native_frame(); } else { PcDesc* pc_desc = nm()->pc_desc_at(_frame.pc()); int decode_offset; if (pc_desc == NULL) { // Should not happen, but let fill_from_compiled_frame handle it. // If we are trying to walk the stack of a thread that is not // at a safepoint (like AsyncGetCallTrace would do) then this is an // acceptable result. [ This is assuming that safe_for_sender // is so bullet proof that we can trust the frames it produced. ] // // So if we see that the thread is not safepoint safe // then simply produce the method and a bci of zero // and skip the possibility of decoding any inlining that // may be present. That is far better than simply stopping (or // asserting. If however the thread is safepoint safe this // is the sign of a compiler bug and we'll let // fill_from_compiled_frame handle it. JavaThreadState state = _thread->thread_state(); // in_Java should be good enough to test safepoint safety // if state were say in_Java_trans then we'd expect that // the pc would have already been slightly adjusted to // one that would produce a pcDesc since the trans state // would be one that might in fact anticipate a safepoint if (state == _thread_in_Java ) { // This will get a method a zero bci and no inlining. // Might be nice to have a unique bci to signify this // particular case but for now zero will do. fill_from_compiled_native_frame(); // There is something to be said for setting the mode to // at_end_mode to prevent trying to walk further up the // stack. There is evidence that if we walk any further // that we could produce a bad stack chain. However until // we see evidence that allowing this causes us to find // frames bad enough to cause segv's or assertion failures // we don't do it as while we may get a bad call chain the // probability is much higher (several magnitudes) that we // get good data. return true; } decode_offset = DebugInformationRecorder::serialized_null; } else { decode_offset = pc_desc->scope_decode_offset(); } fill_from_compiled_frame(decode_offset); } return true; } // End of stack? if (_frame.is_first_frame() || (_stop_at_java_call_stub && _frame.is_entry_frame())) { _mode = at_end_mode; return true; } return false; }
// Frame type bool is_interpreted_frame() const { return _frame.is_interpreted_frame(); }