Merge pull request #5292 from alexrp/profiler-symbol-fixes
authorAlex Rønne Petersen <alex@alexrp.com>
Tue, 1 Aug 2017 15:05:37 +0000 (17:05 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Aug 2017 15:05:37 +0000 (17:05 +0200)
[profiler] Move legacy profiler code to profiler.c.

CODEOWNERS
mono/metadata/Makefile.am
mono/metadata/profiler-legacy.c [deleted file]
mono/metadata/profiler.c
msvc/libmonoruntime.vcxproj
msvc/libmonoruntime.vcxproj.filters

index 4a0ef8ae08148a62b958c1d4174838ad14bf1b84..5f20375bb92b34b7c6e5ef37cbf1b3c2b42ff9c5 100644 (file)
@@ -29,11 +29,11 @@ mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
 mcs/class/Mono.Debugger.Soft @vargaz
 mcs/class/Mono.Options @jonpryor
 mcs/class/Mono.Profiler.Log @alexrp
-mono/metadata/profiler* @alexrp
+mono/metadata/*profiler* @alexrp
 mono/metadata/threads* @luhenry @kumpera
 mono/metadata/threadpool* @luhenry
 mono/metadata/w32* @luhenry
-mono/mini/profiler* @alexrp
+mono/mini/*profiler* @alexrp
 mono/profiler @alexrp
 mono/utils/atomic* @alexrp
 mono/utils/mono-hwcap* @alexrp
index 76abb73aaa7ac4e1350685934fd0e3b9b8baf009..d90f9200ab0417b4178689dd293208d5e47ace00 100644 (file)
@@ -224,7 +224,6 @@ common_sources = \
        w32process-internals.h          \
        profiler.c              \
        profiler-events.h       \
-       profiler-legacy.c       \
        profiler-private.h      \
        rand.h                  \
        rand.c                  \
diff --git a/mono/metadata/profiler-legacy.c b/mono/metadata/profiler-legacy.c
deleted file mode 100644 (file)
index 31ddd48..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the .NET Foundation under one or more agreements.
- * The .NET Foundation licenses this file to you under the MIT license.
- * See the LICENSE file in the project root for more information.
- */
-
-#include <mono/metadata/profiler-private.h>
-
-/*
- * The point of this file is to maintain compatibility with a few profiler API
- * functions used by Xamarin.{Android,iOS,Mac} so that they keep working
- * regardless of which system Mono version is used.
- *
- * TODO: Remove this some day if we're OK with breaking compatibility.
- */
-
-typedef void *MonoLegacyProfiler;
-
-typedef void (*MonoProfileFunc) (MonoLegacyProfiler *prof);
-typedef void (*MonoProfileThreadFunc) (MonoLegacyProfiler *prof, uintptr_t tid);
-typedef void (*MonoProfileGCFunc) (MonoLegacyProfiler *prof, MonoProfilerGCEvent event, int generation);
-typedef void (*MonoProfileGCResizeFunc) (MonoLegacyProfiler *prof, int64_t new_size);
-typedef void (*MonoProfileJitResult) (MonoLegacyProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
-
-struct _MonoProfiler {
-       MonoProfilerHandle handle;
-       MonoLegacyProfiler *profiler;
-       MonoProfileFunc shutdown_callback;
-       MonoProfileThreadFunc thread_start, thread_end;
-       MonoProfileGCFunc gc_event;
-       MonoProfileGCResizeFunc gc_heap_resize;
-       MonoProfileJitResult jit_end2;
-};
-
-static MonoProfiler *current;
-
-MONO_API void mono_profiler_install (MonoLegacyProfiler *prof, MonoProfileFunc callback);
-MONO_API void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end);
-MONO_API void mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback);
-MONO_API void mono_profiler_install_jit_end (MonoProfileJitResult end);
-MONO_API void mono_profiler_set_events (int flags);
-
-static void
-shutdown_cb (MonoProfiler *prof)
-{
-       prof->shutdown_callback (prof->profiler);
-}
-
-void
-mono_profiler_install (MonoLegacyProfiler *prof, MonoProfileFunc callback)
-{
-       current = g_new0 (MonoProfiler, 1);
-       current->handle = mono_profiler_create (current);
-       current->profiler = prof;
-       current->shutdown_callback = callback;
-
-       if (callback)
-               mono_profiler_set_runtime_shutdown_end_callback (current->handle, shutdown_cb);
-}
-
-static void
-thread_start_cb (MonoProfiler *prof, uintptr_t tid)
-{
-       prof->thread_start (prof->profiler, tid);
-}
-
-static void
-thread_stop_cb (MonoProfiler *prof, uintptr_t tid)
-{
-       prof->thread_end (prof->profiler, tid);
-}
-
-void
-mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end)
-{
-       current->thread_start = start;
-       current->thread_end = end;
-
-       if (start)
-               mono_profiler_set_thread_started_callback (current->handle, thread_start_cb);
-
-       if (end)
-               mono_profiler_set_thread_stopped_callback (current->handle, thread_stop_cb);
-}
-
-static void
-gc_event_cb (MonoProfiler *prof, MonoProfilerGCEvent event, uint32_t generation)
-{
-       prof->gc_event (prof->profiler, event, generation);
-}
-
-static void
-gc_resize_cb (MonoProfiler *prof, uintptr_t size)
-{
-       prof->gc_heap_resize (prof->profiler, size);
-}
-
-void
-mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback)
-{
-       current->gc_event = callback;
-       current->gc_heap_resize = heap_resize_callback;
-
-       if (callback)
-               mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
-
-       if (heap_resize_callback)
-               mono_profiler_set_gc_resize_callback (current->handle, gc_resize_cb);
-}
-
-static void
-jit_done_cb (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
-{
-       prof->jit_end2 (prof->profiler, method, jinfo, 0);
-}
-
-static void
-jit_failed_cb (MonoProfiler *prof, MonoMethod *method)
-{
-       prof->jit_end2 (prof->profiler, method, NULL, 1);
-}
-
-void
-mono_profiler_install_jit_end (MonoProfileJitResult end)
-{
-       current->jit_end2 = end;
-
-       if (end) {
-               mono_profiler_set_jit_done_callback (current->handle, jit_done_cb);
-               mono_profiler_set_jit_failed_callback (current->handle, jit_failed_cb);
-       }
-}
-
-void
-mono_profiler_set_events (int flags)
-{
-       /* Do nothing. */
-}
index 36b864a60e1284849cb371d681efda1aa37b4421..fa3f4eec9d1a6dfff683034165b8f94baaaba0b8 100644 (file)
@@ -567,3 +567,134 @@ update_callback (volatile gpointer *location, gpointer new_, volatile gint32 *co
 #undef MONO_PROFILER_EVENT_3
 #undef MONO_PROFILER_EVENT_4
 #undef _MONO_PROFILER_EVENT
+
+/*
+ * The following code is here to maintain compatibility with a few profiler API
+ * functions used by Xamarin.{Android,iOS,Mac} so that they keep working
+ * regardless of which system Mono version is used.
+ *
+ * TODO: Remove this some day if we're OK with breaking compatibility.
+ */
+
+typedef void *MonoLegacyProfiler;
+
+typedef void (*MonoLegacyProfileFunc) (MonoLegacyProfiler *prof);
+typedef void (*MonoLegacyProfileThreadFunc) (MonoLegacyProfiler *prof, uintptr_t tid);
+typedef void (*MonoLegacyProfileGCFunc) (MonoLegacyProfiler *prof, MonoProfilerGCEvent event, int generation);
+typedef void (*MonoLegacyProfileGCResizeFunc) (MonoLegacyProfiler *prof, int64_t new_size);
+typedef void (*MonoLegacyProfileJitResult) (MonoLegacyProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
+
+struct _MonoProfiler {
+       MonoProfilerHandle handle;
+       MonoLegacyProfiler *profiler;
+       MonoLegacyProfileFunc shutdown_callback;
+       MonoLegacyProfileThreadFunc thread_start, thread_end;
+       MonoLegacyProfileGCFunc gc_event;
+       MonoLegacyProfileGCResizeFunc gc_heap_resize;
+       MonoLegacyProfileJitResult jit_end2;
+};
+
+static MonoProfiler *current;
+
+MONO_API void mono_profiler_install (MonoLegacyProfiler *prof, MonoLegacyProfileFunc callback);
+MONO_API void mono_profiler_install_thread (MonoLegacyProfileThreadFunc start, MonoLegacyProfileThreadFunc end);
+MONO_API void mono_profiler_install_gc (MonoLegacyProfileGCFunc callback, MonoLegacyProfileGCResizeFunc heap_resize_callback);
+MONO_API void mono_profiler_install_jit_end (MonoLegacyProfileJitResult end);
+MONO_API void mono_profiler_set_events (int flags);
+
+static void
+shutdown_cb (MonoProfiler *prof)
+{
+       prof->shutdown_callback (prof->profiler);
+}
+
+void
+mono_profiler_install (MonoLegacyProfiler *prof, MonoLegacyProfileFunc callback)
+{
+       current = g_new0 (MonoProfiler, 1);
+       current->handle = mono_profiler_create (current);
+       current->profiler = prof;
+       current->shutdown_callback = callback;
+
+       if (callback)
+               mono_profiler_set_runtime_shutdown_end_callback (current->handle, shutdown_cb);
+}
+
+static void
+thread_start_cb (MonoProfiler *prof, uintptr_t tid)
+{
+       prof->thread_start (prof->profiler, tid);
+}
+
+static void
+thread_stop_cb (MonoProfiler *prof, uintptr_t tid)
+{
+       prof->thread_end (prof->profiler, tid);
+}
+
+void
+mono_profiler_install_thread (MonoLegacyProfileThreadFunc start, MonoLegacyProfileThreadFunc end)
+{
+       current->thread_start = start;
+       current->thread_end = end;
+
+       if (start)
+               mono_profiler_set_thread_started_callback (current->handle, thread_start_cb);
+
+       if (end)
+               mono_profiler_set_thread_stopped_callback (current->handle, thread_stop_cb);
+}
+
+static void
+gc_event_cb (MonoProfiler *prof, MonoProfilerGCEvent event, uint32_t generation)
+{
+       prof->gc_event (prof->profiler, event, generation);
+}
+
+static void
+gc_resize_cb (MonoProfiler *prof, uintptr_t size)
+{
+       prof->gc_heap_resize (prof->profiler, size);
+}
+
+void
+mono_profiler_install_gc (MonoLegacyProfileGCFunc callback, MonoLegacyProfileGCResizeFunc heap_resize_callback)
+{
+       current->gc_event = callback;
+       current->gc_heap_resize = heap_resize_callback;
+
+       if (callback)
+               mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
+
+       if (heap_resize_callback)
+               mono_profiler_set_gc_resize_callback (current->handle, gc_resize_cb);
+}
+
+static void
+jit_done_cb (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
+{
+       prof->jit_end2 (prof->profiler, method, jinfo, 0);
+}
+
+static void
+jit_failed_cb (MonoProfiler *prof, MonoMethod *method)
+{
+       prof->jit_end2 (prof->profiler, method, NULL, 1);
+}
+
+void
+mono_profiler_install_jit_end (MonoLegacyProfileJitResult end)
+{
+       current->jit_end2 = end;
+
+       if (end) {
+               mono_profiler_set_jit_done_callback (current->handle, jit_done_cb);
+               mono_profiler_set_jit_failed_callback (current->handle, jit_failed_cb);
+       }
+}
+
+void
+mono_profiler_set_events (int flags)
+{
+       /* Do nothing. */
+}
index a5dcc676a18464f773cdbdf0910a7009c1ed4d68..d2e5ad512cd78a353af0e1e05eb4308b9bd287b6 100644 (file)
@@ -82,7 +82,6 @@
     <ClCompile Include="..\mono\metadata\number-ms.c" />\r
     <ClCompile Include="..\mono\metadata\object.c" />\r
     <ClCompile Include="..\mono\metadata\opcodes.c" />\r
-    <ClCompile Include="..\mono\metadata\profiler-legacy.c" />\r
     <ClCompile Include="..\mono\metadata\profiler.c" />\r
     <ClCompile Include="..\mono\metadata\rand.c" />\r
     <ClCompile Include="..\mono\metadata\reflection.c" />\r
index 1655d562e23610215c7d9f051e0bb5e99db3b582..554e61985bdb1745ac9df6d44d0c7d1423bdd6f3 100644 (file)
     <ClCompile Include="..\mono\metadata\w32process-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\profiler-legacy.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\mono\metadata\profiler.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r