struct _MethodInfo {
MonoMethod *method;
MonoJitInfo *ji;
+ uint64_t time;
};
#ifdef TLS_INIT
emit_time (LogBuffer *logbuffer, uint64_t value)
{
uint64_t tdiff = value - logbuffer->last_time;
- if (value < logbuffer->last_time)
- printf ("time went backwards\n");
+ //if (value < logbuffer->last_time)
+ // printf ("time went backwards\n");
//if (tdiff > 1000000)
// printf ("large time offset: %llu\n", tdiff);
encode_uleb128 (tdiff, logbuffer->data, &logbuffer->data);
assert (logbuffer->data <= logbuffer->data_end);
}
+/*
typedef struct {
MonoMethod *method;
MonoJitInfo *found;
if (ji)
search->found = ji;
}
+*/
static void
register_method_local (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *ji)
{
if (!mono_conc_hashtable_lookup (prof->method_table, method)) {
+ /*
+ * FIXME: In some cases, we crash while looking up JIT info for AOT'd methods.
+ * This usually happens for static constructors. This code is disabled for now
+ * as we don't need this info for anything critical.
+ *
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=35171
+ */
+ /*
if (!ji) {
MethodSearch search = { method, NULL };
ji = search.found;
}
+ */
- g_assert (ji);
+ /*
+ * FIXME: We can't always find JIT info for a generic shared method, especially
+ * if we obtained the MonoMethod during an async stack walk. For now, we deal
+ * with this by giving the generic shared method name and dummy code start/size
+ * information (i.e. zeroes).
+ */
+ //g_assert (ji);
MethodInfo *info = malloc (sizeof (MethodInfo));
info->method = method;
info->ji = ji;
+ info->time = current_time ();
g_ptr_array_add (TLS_GET (GPtrArray, tlsmethodlist), info);
}
char *name = mono_method_full_name (info->method, 1);
int nlen = strlen (name) + 1;
- uint64_t now = current_time ();
+ void *cstart = info->ji ? mono_jit_info_get_code_start (info->ji) : NULL;
+ int csize = info->ji ? mono_jit_info_get_code_size (info->ji) : 0;
method_buffer = ensure_logbuf_inner (method_buffer,
EVENT_SIZE /* event */ +
);
emit_byte (method_buffer, TYPE_JIT | TYPE_METHOD);
- emit_time (method_buffer, now);
+ emit_time (method_buffer, info->time);
emit_method_inner (method_buffer, info->method);
- emit_ptr (method_buffer, mono_jit_info_get_code_start (info->ji));
- emit_value (method_buffer, mono_jit_info_get_code_size (info->ji));
+ emit_ptr (method_buffer, cstart);
+ emit_value (method_buffer, csize);
memcpy (method_buffer->data, name, nlen);
method_buffer->data += nlen;
mono_profiler_install_context (context_loaded, context_unloaded);
mono_profiler_install_class (NULL, class_loaded, NULL, class_unloaded);
mono_profiler_install_module (NULL, image_loaded, NULL, image_unloaded);
- mono_profiler_install_assembly (NULL, assembly_loaded, NULL, assembly_unloaded);
+ mono_profiler_install_assembly (NULL, assembly_loaded, assembly_unloaded, NULL);
mono_profiler_install_thread (thread_start, thread_end);
mono_profiler_install_thread_name (thread_name);
mono_profiler_install_enter_leave (method_enter, method_leave);