Example #1
0
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++;
    }
  }
}