[profiler] Remove class unload events.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Thu, 22 Jun 2017 08:40:58 +0000 (10:40 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Thu, 22 Jun 2017 19:02:18 +0000 (21:02 +0200)
These are never actually emitted by the profiler API because they make no sense
in the context of Mono's metadata layer.

mono/profiler/log.c
mono/profiler/log.h
mono/profiler/mprof-report.c

index 962413326a7e9b807a7cc486a6d40766ff54a517..17c68f592e637db8fdb0fa916bb833f4731a3dd8 100644 (file)
@@ -258,7 +258,8 @@ static MonoLinkedListSet profiler_thread_list;
  *
  * type metadata format:
  * type: TYPE_METADATA
- * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN)
+ * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN,
+ * doesn't occur for TYPE_CLASS)
  * [mtype: byte] metadata type, one of: TYPE_CLASS, TYPE_IMAGE, TYPE_ASSEMBLY, TYPE_DOMAIN,
  * TYPE_THREAD, TYPE_CONTEXT
  * [pointer: sleb128] pointer of the metadata type depending on mtype
@@ -2004,42 +2005,6 @@ class_loaded (MonoProfiler *prof, MonoClass *klass, int result)
                g_free (name);
 }
 
-static void
-class_unloaded (MonoProfiler *prof, MonoClass *klass)
-{
-       char *name;
-
-       if (InterlockedRead (&runtime_inited))
-               name = mono_type_get_name (mono_class_get_type (klass));
-       else
-               name = type_name (klass);
-
-       int nlen = strlen (name) + 1;
-       MonoImage *image = mono_class_get_image (klass);
-
-       ENTER_LOG (&class_unloads_ctr, logbuffer,
-               EVENT_SIZE /* event */ +
-               BYTE_SIZE /* type */ +
-               LEB128_SIZE /* klass */ +
-               LEB128_SIZE /* image */ +
-               nlen /* name */
-       );
-
-       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-       emit_byte (logbuffer, TYPE_CLASS);
-       emit_ptr (logbuffer, klass);
-       emit_ptr (logbuffer, image);
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-
-       EXIT_LOG;
-
-       if (runtime_inited)
-               mono_free (name);
-       else
-               g_free (name);
-}
-
 static void process_method_enter_coverage (MonoProfiler *prof, MonoMethod *method);
 
 static void
@@ -4756,7 +4721,7 @@ mono_profiler_startup (const char *desc)
 
        if (config.effective_mask & PROFLOG_CLASS_EVENTS) {
                events |= MONO_PROFILE_CLASS_EVENTS;
-               mono_profiler_install_class (NULL, class_loaded, class_unloaded, NULL);
+               mono_profiler_install_class (NULL, class_loaded, NULL, NULL);
        }
 
        if (config.effective_mask & PROFLOG_JIT_COMPILATION_EVENTS) {
index d1158da7c911b8c8721e22e210c26d441ddfe4ee..5029c26c70c92c287a3226b1de8fb7de6b8b3b06 100644 (file)
@@ -66,6 +66,7 @@
                changed address field in TYPE_SAMPLE_UBIN to be based on ptr_base
                added an image pointer field to assembly load events
                added an exception object field to TYPE_CLAUSE
+               class unload events no longer exist (they were never emitted)
  */
 
 enum {
index a687f4540a0a9a2554b07a09fe8ded82f5ba585a..00254414925e5b3ea342cd1d06327e3133c51daf 100644 (file)
@@ -2480,8 +2480,7 @@ decode_buffer (ProfContext *ctx)
                                        decode_uleb128 (p, &p); /* flags */
                                if (debug)
                                        fprintf (outfile, "%s class %p (%s in %p) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (void*)(ptr_base + imptrdiff), (unsigned long long) time_base);
-                               if (subtype == TYPE_END_LOAD)
-                                       add_class (ptr_base + ptrdiff, (char*)p);
+                               add_class (ptr_base + ptrdiff, (char*)p);
                                while (*p) p++;
                                p++;
                        } else if (mtype == TYPE_IMAGE) {