Ensure exception out argument is initialized to NULL. (#5424)
[mono.git] / mono / mini / driver.c
index 8719a12994c8e3fa936f5c34277412141aa72953..297179bf86cabaa76b112108bb7a977d9c65db1f 100644 (file)
@@ -36,7 +36,6 @@
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/debug-helpers.h>
-#include "mono/metadata/profiler.h"
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/environment.h>
@@ -121,10 +120,6 @@ opt_names [] = {
 
 #endif
 
-#ifdef __native_client__
-extern char *nacl_mono_path;
-#endif
-
 #define DEFAULT_OPTIMIZATIONS (        \
        MONO_OPT_PEEPHOLE |     \
        MONO_OPT_CFOLD |        \
@@ -517,6 +512,11 @@ mini_regression (MonoImage *image, int verbose, int *total_run)
                }
        } else {
                for (opt = 0; opt < G_N_ELEMENTS (opt_sets); ++opt) {
+                       /* builtin-types.cs needs OPT_INTRINS enabled */
+                       if (!strcmp ("builtin-types", image->assembly_name))
+                               if (!(opt_sets [opt] & MONO_OPT_INTRINS))
+                                       continue;
+
                        mini_regression_step (image, verbose, total_run, &total,
                                        opt_sets [opt] & ~exclude,
                                        timer, domain);
@@ -1420,7 +1420,7 @@ mono_jit_parse_options (int argc, char * argv[])
                        opt->break_on_exc = TRUE;
                } else if (strcmp (argv [i], "--stats") == 0) {
                        mono_counters_enable (-1);
-                       mono_stats.enabled = TRUE;
+                       InterlockedWriteBool (&mono_stats.enabled, TRUE);
                        mono_jit_stats.enabled = TRUE;
                } else if (strcmp (argv [i], "--break") == 0) {
                        if (i+1 >= argc){
@@ -1589,9 +1589,7 @@ mono_main (int argc, char* argv[])
        guint32 opt, action = DO_EXEC, recompilation_times = 1;
        MonoGraphOptions mono_graph_options = (MonoGraphOptions)0;
        int mini_verbose = 0;
-       gboolean enable_profile = FALSE;
        char *trace_options = NULL;
-       char *profile_options = NULL;
        char *aot_options = NULL;
        char *forced_version = NULL;
        GPtrArray *agents = NULL;
@@ -1603,9 +1601,6 @@ mono_main (int argc, char* argv[])
 #ifdef HOST_WIN32
        int mixed_mode = FALSE;
 #endif
-#ifdef __native_client__
-       gboolean nacl_null_checks_off = FALSE;
-#endif
 
 #ifdef MOONLIGHT
 #ifndef HOST_WIN32
@@ -1772,7 +1767,7 @@ mono_main (int argc, char* argv[])
                        mono_print_vtable = TRUE;
                } else if (strcmp (argv [i], "--stats") == 0) {
                        mono_counters_enable (-1);
-                       mono_stats.enabled = TRUE;
+                       InterlockedWriteBool (&mono_stats.enabled, TRUE);
                        mono_jit_stats.enabled = TRUE;
 #ifndef DISABLE_AOT
                } else if (strcmp (argv [i], "--aot") == 0) {
@@ -1805,11 +1800,9 @@ mono_main (int argc, char* argv[])
                } else if (strcmp (argv [i], "--jitmap") == 0) {
                        mono_enable_jit_map ();
                } else if (strcmp (argv [i], "--profile") == 0) {
-                       enable_profile = TRUE;
-                       profile_options = NULL;
+                       mini_add_profiler_argument (NULL);
                } else if (strncmp (argv [i], "--profile=", 10) == 0) {
-                       enable_profile = TRUE;
-                       profile_options = argv [i] + 10;
+                       mini_add_profiler_argument (argv [i] + 10);
                } else if (strncmp (argv [i], "--agent=", 8) == 0) {
                        if (agents == NULL)
                                agents = g_ptr_array_new ();
@@ -1937,13 +1930,6 @@ mono_main (int argc, char* argv[])
 #else
                        fprintf (stderr, "Mono Warning: --interp= not enabled in this runtime.\n");
 #endif
-
-#ifdef __native_client__
-               } else if (strcmp (argv [i], "--nacl-mono-path") == 0){
-                       nacl_mono_path = g_strdup(argv[++i]);
-               } else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
-                       nacl_null_checks_off = TRUE;
-#endif
                } else if (strncmp (argv [i], "--assembly-loader=", strlen("--assembly-loader=")) == 0) {
                        gchar *arg = argv [i] + strlen ("--assembly-loader=");
                        if (strcmp (arg, "strict") == 0)
@@ -1968,13 +1954,6 @@ mono_main (int argc, char* argv[])
                }
        }
 
-#ifdef __native_client_codegen__
-       if (!nacl_null_checks_off) {
-               MonoDebugOptions *opt = mini_get_debug_options ();
-               opt->explicit_null_checks = TRUE;
-       }
-#endif
-
 #if defined(DISABLE_HW_TRAPS) || defined(MONO_ARCH_DISABLE_HW_TRAPS)
        // Signal handlers not available
        {
@@ -2033,10 +2012,6 @@ mono_main (int argc, char* argv[])
        /* Set rootdir before loading config */
        mono_set_rootdir ();
 
-       if (enable_profile) {
-               mini_profiler_enable_with_options (profile_options);
-       }
-
        mono_attach_parse_options (attach_options);
 
        if (trace_options != NULL){
@@ -2397,6 +2372,16 @@ mono_jit_set_aot_mode (MonoAotMode mode)
                mono_set_generic_sharing_vt_supported (TRUE);
                mono_set_partial_sharing_supported (TRUE);
        }
+       if (mono_aot_mode == MONO_AOT_MODE_INTERP) {
+               mono_aot_only = TRUE;
+               mono_use_interpreter = TRUE;
+       }
+}
+
+mono_bool
+mono_jit_aot_compiling (void)
+{
+       return mono_compile_aot;
 }
 
 /**