From: Neale Ferguson Date: Mon, 15 Dec 2014 19:12:15 +0000 (-0500) Subject: Add per thread profiling support to s390x X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=e78a3c6857d8a8d9b59480940ac6cd4e2157fed0;p=mono.git Add per thread profiling support to s390x --- diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index 880aaae653c..58039b75d1d 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -300,7 +300,7 @@ MONO_SIG_HANDLER_FUNC (static, sigusr1_signal_handler) static int profiling_signal_in_use; -#if defined(__ia64__) || defined(__sparc__) || defined(sparc) || defined(__s390__) || defined(s390) +#if defined(__ia64__) || defined(__sparc__) || defined(sparc) MONO_SIG_HANDLER_FUNC (static, sigprof_signal_handler) { diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c index a1618c932eb..22e488ae810 100644 --- a/mono/mini/mini-s390x.c +++ b/mono/mini/mini-s390x.c @@ -5638,6 +5638,8 @@ get_delegate_invoke_impl (gboolean has_target, guint32 param_count, guint32 *cod mono_arch_flush_icache (start, size); } + mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, NULL); + if (code_len) *code_len = code - start; @@ -5912,8 +5914,9 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, } mono_arch_flush_icache ((guint8*)start, (code - start)); + mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL); - if (!fail_tramp) + if (!fail_tramp) mono_stats.imt_thunks_size += (code - start); g_assert (code - start <= size); diff --git a/mono/mini/tramp-s390x.c b/mono/mini/tramp-s390x.c index fa664e12e11..e6bbe8ccb7e 100644 --- a/mono/mini/tramp-s390x.c +++ b/mono/mini/tramp-s390x.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include "mini.h" @@ -108,6 +109,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *method, gpointer addr) g_assert ((code - start) <= 28); mono_arch_flush_icache (start, code - start); + mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE, method); return start; } @@ -134,9 +136,6 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr) S390_EMIT_CALL((orig_code - 14), addr); mono_arch_flush_icache (orig_code - 14, 12); } else { -fprintf(stderr, "%p %02x %02x %02x %02x\n", -&orig_code[-14], orig_code[-12], orig_code[-11], orig_code[-6], orig_code[-5]); -fflush(stderr); /* This is the 'brasl' instruction */ orig_code -= 4; displace = ((gssize) addr - (gssize) (orig_code - 2)) / 2; @@ -200,6 +199,9 @@ mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info) s390_br (code, s390_r14); + mono_arch_flush_icache (buf, code - buf); + mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL); + if (info) *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL); @@ -402,6 +404,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf /* Flush instruction cache, since we've generated code */ mono_arch_flush_icache (code, buf - code); + mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE, NULL); if (info) { tramp_name = mono_get_generic_trampoline_name (tramp_type); @@ -468,6 +471,8 @@ mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_ty /* Flush instruction cache, since we've generated code */ mono_arch_flush_icache (code, buf - code); + mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE, + (void *) mono_get_generic_trampoline_simple_name (tramp_type)); /* Sanity check */ g_assert ((buf - code) <= SPECIFIC_TRAMPOLINE_SIZE); @@ -583,6 +588,7 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info s390_jg (code, displace); mono_arch_flush_icache (buf, code - buf); + mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE, NULL); g_assert (code - buf <= tramp_size); @@ -631,6 +637,7 @@ mono_arch_get_static_rgctx_trampoline (MonoMethod *m, g_assert ((code - start) < buf_len); mono_arch_flush_icache (start, code - start); + mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_HELPER, NULL); return(start); } @@ -701,6 +708,7 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot) } mono_arch_flush_icache (buf, code - buf); + mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL); g_assert (code - buf <= tramp_size); if (info)