Add a MONO_VERBOSE_HWCAP environment variable.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Thu, 18 Jul 2013 23:59:48 +0000 (01:59 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 20 Jul 2013 01:03:54 +0000 (03:03 +0200)
This causes detected hardware features to be printed to stdout.

man/mono.1
mono/utils/mono-hwcap-arm.c
mono/utils/mono-hwcap-empty.c
mono/utils/mono-hwcap-ia64.c
mono/utils/mono-hwcap-mips.c
mono/utils/mono-hwcap-ppc.c
mono/utils/mono-hwcap-s390x.c
mono/utils/mono-hwcap-sparc.c
mono/utils/mono-hwcap-x86.c
mono/utils/mono-hwcap.c
mono/utils/mono-hwcap.h

index bbb2e5025338947a70db0e2406d9d67271da066f..bd784cd85e86a4cd8bdff624ead49b66bac4f369 100644 (file)
@@ -1628,6 +1628,10 @@ for example, to see managed frame names on gdb backtraces.
 Enables the maximum JIT verbosity for the specified method. This is
 very helpfull to diagnose a miscompilation problems of a specific
 method.
+.TP
+\fBMONO_VERBOSE_HWCAP\fR
+If set, makes the JIT output information about detected CPU features
+(such as SSE, CMOV, FCMOV, etc) to stdout.
 .SH VALGRIND
 If you want to use Valgrind, you will find the file `mono.supp'
 useful, it contains the suppressions for the GC which trigger
index 32a7e10633339160978600b3eb6030a4f7a0797a..7059938fb575840c66a54f14b69663d36f8eb9d4 100644 (file)
@@ -141,3 +141,15 @@ mono_hwcap_arch_init (void)
        /* TODO: Find a way to detect features like Thumb and VFP. */
 #endif
 }
+
+void
+mono_hwcap_print(FILE *f)
+{
+       g_fprintf (f, "mono_hwcap_arm_is_v5 = %i\n", mono_hwcap_arm_is_v5);
+       g_fprintf (f, "mono_hwcap_arm_is_v6 = %i\n", mono_hwcap_arm_is_v6);
+       g_fprintf (f, "mono_hwcap_arm_is_v7 = %i\n", mono_hwcap_arm_is_v7);
+       g_fprintf (f, "mono_hwcap_arm_is_v7s = %i\n", mono_hwcap_arm_is_v7s);
+       g_fprintf (f, "mono_hwcap_arm_has_vfp = %i\n", mono_hwcap_arm_has_vfp);
+       g_fprintf (f, "mono_hwcap_arm_has_thumb = %i\n", mono_hwcap_arm_has_thumb);
+       g_fprintf (f, "mono_hwcap_arm_has_thumb2 = %i\n", mono_hwcap_arm_has_thumb2);
+}
index e93006974e603dfea81aef89e739f0e41b041cde..9e444f3431d00b1c7bf0433f5ba7f8c1f540391b 100644 (file)
@@ -31,3 +31,8 @@ mono_hwcap_arch_init (void)
         * mono-hwcap-$TARGET.c file in Makefile.am.
         */
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+}
index e77992fd21df9d4beb521e636ff40768e511afa4..226ab0d6a5702e53a9252788fcc6f07cce4ef90d 100644 (file)
@@ -25,3 +25,8 @@ mono_hwcap_arch_init (void)
 {
        /* Nothing needed here yet. */
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+}
index fce79387d0de66bd26f165d5299f619912a2498a..a768257ff8f0d503ecbd6cea20fde92c9067cdcf 100644 (file)
@@ -25,3 +25,8 @@ mono_hwcap_arch_init (void)
 {
        /* Nothing needed here yet. */
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+}
index a722d8ba7673891337e9adef9abd4226fa5084f7..30e4afb7588a846638adcf6ff23893d460e91f34 100644 (file)
@@ -65,3 +65,13 @@ mono_hwcap_arch_init (void)
        }
 #endif
 }
+
+void
+mono_hwcap_print (FILE* f)
+{
+       g_fprintf (f, "mono_hwcap_ppc_has_icache_snoop = %i\n", mono_hwcap_ppc_has_icache_snoop);
+       g_fprintf (f, "mono_hwcap_ppc_is_isa_2x = %i\n", mono_hwcap_ppc_is_isa_2x);
+       g_fprintf (f, "mono_hwcap_ppc_is_isa_64 = %i\n", mono_hwcap_ppc_is_isa_64);
+       g_fprintf (f, "mono_hwcap_ppc_has_move_fpr_gpr = %i\n", mono_hwcap_ppc_has_move_fpr_gpr);
+       g_fprintf (f, "mono_hwcap_ppc_has_multiple_ls_units = %i\n", mono_hwcap_ppc_has_multiple_ls_units);
+}
index 227873f4c1cd802ace33fa3f85f5fb4bc4800f04..597464964e66fd8ce5e47615c86bf1147490f4ad 100644 (file)
@@ -58,3 +58,9 @@ mono_hwcap_arch_init (void)
 
        sigaction (SIGILL, old_sa, NULL);
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+       g_fprintf (f, "mono_hwcap_s390x_has_ld = %i\n", mono_hwcap_s390x_has_ld);
+}
index 2cc8fa103e94773d4f0e8c3f56a00290d4a297d8..e3cc238054967baec5329c41627cd79de1354fb6 100644 (file)
@@ -50,3 +50,9 @@ mono_hwcap_arch_init (void)
 
        mono_hwcap_sparc_is_v9 = strstr (buf, "sparcv9");
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+       g_fprintf (f, "mono_hwcap_sparc_is_v9 = %i\n", mono_hwcap_sparc_is_v9);
+}
index 642613ba53c73e19761c5382245f3624eeafea36..c071ca46d276781d19959daeaa6f54ba3830a076 100644 (file)
@@ -158,3 +158,18 @@ mono_hwcap_arch_init (void)
        mono_hwcap_x86_is_xen = !access ("/proc/xen", F_OK);
 #endif
 }
+
+void
+mono_hwcap_print (FILE *f)
+{
+       g_fprintf (f, "mono_hwcap_x86_is_xen = %i\n", mono_hwcap_x86_is_xen);
+       g_fprintf (f, "mono_hwcap_x86_has_cmov = %i\n", mono_hwcap_x86_has_cmov);
+       g_fprintf (f, "mono_hwcap_x86_has_fcmov = %i\n", mono_hwcap_x86_has_fcmov);
+       g_fprintf (f, "mono_hwcap_x86_has_sse1 = %i\n", mono_hwcap_x86_has_sse1);
+       g_fprintf (f, "mono_hwcap_x86_has_sse2 = %i\n", mono_hwcap_x86_has_sse2);
+       g_fprintf (f, "mono_hwcap_x86_has_sse3 = %i\n", mono_hwcap_x86_has_sse3);
+       g_fprintf (f, "mono_hwcap_x86_has_ssse3 = %i\n", mono_hwcap_x86_has_ssse3);
+       g_fprintf (f, "mono_hwcap_x86_has_sse41 = %i\n", mono_hwcap_x86_has_sse41);
+       g_fprintf (f, "mono_hwcap_x86_has_sse42 = %i\n", mono_hwcap_x86_has_sse42);
+       g_fprintf (f, "mono_hwcap_x86_has_sse4a = %i\n", mono_hwcap_x86_has_sse4a);
+}
index d62be0b5ff537fc60a82cd6aea053fb54ea4e4ef..67787af09a5374faa0c9612be1189a7ede09c35f 100644 (file)
@@ -18,6 +18,8 @@
  * Copyright 2011-2013 Xamarin Inc
  */
 
+#include <stdlib.h>
+
 #include "mono/utils/mono-hwcap.h"
 
 static gboolean hwcap_inited = FALSE;
@@ -25,8 +27,13 @@ static gboolean hwcap_inited = FALSE;
 void
 mono_hwcap_init (void)
 {
+       const char *verbose = getenv ("MONO_VERBOSE_HWCAP");
+
        if (hwcap_inited)
                return;
 
        mono_hwcap_arch_init ();
+
+       if (verbose)
+               mono_hwcap_print (stdout);
 }
index 34101f1cd813ab43b714f0cd554d9af4dae6aecd..159701b44984a0218a4e079c746fbce1b968679d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __MONO_UTILS_HWCAP_H__
 #define __MONO_UTILS_HWCAP_H__
 
+#include <stdio.h>
 #include <glib.h>
 
 #include "config.h"
@@ -25,6 +26,9 @@ void mono_hwcap_init (void) MONO_INTERNAL;
 /* Implemented in mono-hwcap-$TARGET.c. Do not call. */
 void mono_hwcap_arch_init (void) MONO_INTERNAL;
 
+/* Print detected features to the given file. */
+void mono_hwcap_print (FILE *f) MONO_INTERNAL;
+
 /* Please note: If you're going to use the Linux auxiliary vector
  * to detect CPU features, don't use any of the constant names in
  * the hwcap.h header. This ties us to a particular version of the