EMIT_NEW_STORE_MEMBASE (cfg, ins, OP_STORE_MEMBASE_REG, lmf_addr_reg, 0, prev_lmf_reg);
}
-static void
-emit_instrumentation_call (MonoCompile *cfg, void *func, gboolean entry)
-{
- MonoInst *iargs [1];
-
- /*
- * Avoid instrumenting inlined methods since it can
- * distort profiling results.
- */
- if (cfg->method != cfg->current_method)
- return;
-
- if (mono_profiler_should_instrument_method (cfg->method, entry)) {
- EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
- mono_emit_jit_icall (cfg, func, iargs);
- }
-}
-
static int
ret_type_to_call_opcode (MonoCompile *cfg, MonoType *type, int calli, int virt)
{
tail = FALSE;
if (tail) {
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
+ mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, NULL, NULL);
MONO_INST_NEW_CALL (cfg, call, OP_TAILCALL);
} else
if (g_list_find (cfg->dont_inline, method))
return FALSE;
+ if (mono_profiler_get_call_instrumentation_flags (method))
+ return FALSE;
+
return TRUE;
}
if (cfg->gshared && mono_method_check_context_used (cmethod))
GENERIC_SHARING_FAILURE (CEE_JMP);
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
+ mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, NULL, NULL);
fsig = mono_method_signature (cmethod);
n = fsig->param_count + fsig->hasthis;
/* Handle tail calls similarly to normal calls */
tail_call = TRUE;
} else {
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
+ mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, NULL, NULL);
MONO_INST_NEW_CALL (cfg, call, OP_JMP);
call->tail_call = TRUE;
break;
}
case CEE_RET:
+ mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, sp - 1, sig->ret);
+
if (cfg->method != method) {
/* return from inlined method */
/*
cfg->ret_var_set = TRUE;
}
} else {
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
-
if (cfg->lmf_var && cfg->cbb->in_count && !cfg->llvm_only)
emit_pop_lmf (cfg);
}
cfg->cbb = init_localsbb;
- emit_instrumentation_call (cfg, mono_profiler_raise_method_enter, TRUE);
+ mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_enter, TRUE, NULL, NULL);
if (seq_points) {
MonoBasicBlock *bb;