From 00b1ceb8ff8d6f6c58134bdce8aa3f7fa5edf041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sun, 2 Oct 2016 21:53:09 +0200 Subject: [PATCH 1/2] Revert "[domain] Report domain unloads to the profiler when finalizing the domain." This reverts commit c8b20290808563f89d29b22d2fe35eb906cfe725. This caused ordering problems with app domain events: https://bugzilla.xamarin.com/show_bug.cgi?id=44552 Conflicts: mono/metadata/gc.c --- mono/metadata/domain.c | 6 ++++++ mono/metadata/gc.c | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index bb40725ac1f4..d280e3098214 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -1175,6 +1175,12 @@ mono_domain_free (MonoDomain *domain, gboolean force) g_slist_free (domain->domain_assemblies); domain->domain_assemblies = NULL; + /* + * Send this after the assemblies have been unloaded and the domain is still in a + * usable state. + */ + mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD); + if (free_domain_hook) free_domain_hook (domain); diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index 46eaf5e224af..ae4329be6668 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -560,8 +560,6 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout) mono_gc_finalize_threadpool_threads (); } - mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD); - done: if (InterlockedDecrement (&req->ref) == 0) { mono_coop_sem_destroy (&req->done); From fa4ea4cc557f274330a2de31aad858fccf75fd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sun, 2 Oct 2016 21:55:29 +0200 Subject: [PATCH 2/2] [profiler] Fix GC finalize object end event not getting invoked. --- mono/metadata/profiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c index 99c490fb75d1..0fd162dd98a8 100644 --- a/mono/metadata/profiler.c +++ b/mono/metadata/profiler.c @@ -968,7 +968,7 @@ mono_profiler_install_gc_finalize (MonoProfileGCFinalizeFunc begin, MonoProfileG prof_list->gc_finalize_begin = begin; prof_list->gc_finalize_object_begin = begin_obj; - prof_list->gc_finalize_object_begin = end_obj; + prof_list->gc_finalize_object_end = end_obj; prof_list->gc_finalize_end = end; }