[interp] refactor Array::Address, so that readonly. prefix is respected properly
[mono.git] / mono / mini / driver.c
index 40de446bc05907dfe1468965c7c7e47e9e3d8745..9674a350f904aa1434741540ab3db5f58c94ab10 100644 (file)
@@ -35,7 +35,6 @@
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/debug-helpers.h>
-#include <mono/io-layer/io-layer.h>
 #include "mono/metadata/profiler.h"
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/mono-config.h>
@@ -57,7 +56,7 @@
 #include "mini.h"
 #include "jit.h"
 #include "aot-compiler.h"
-#include "interpreter/interp.h"
+#include "interp/interp.h"
 
 #include <string.h>
 #include <ctype.h>
@@ -121,11 +120,6 @@ opt_names [] = {
 
 #endif
 
-static const OptFunc
-opt_funcs [sizeof (int) * 8] = {
-       NULL
-};
-
 #ifdef __native_client__
 extern char *nacl_mono_path;
 #endif
@@ -155,7 +149,8 @@ parse_optimizations (guint32 opt, const char* p, gboolean cpu_opts)
 {
        guint32 exclude = 0;
        const char *n;
-       int i, invert, len;
+       int i, invert;
+       char **parts, **ptr;
 
        /* Initialize the hwcap module if necessary. */
        mono_hwcap_init ();
@@ -168,7 +163,11 @@ parse_optimizations (guint32 opt, const char* p, gboolean cpu_opts)
        if (!p)
                return opt;
 
-       while (*p) {
+       parts = g_strsplit (p, ",", -1);
+       for (ptr = parts; ptr && *ptr; ptr ++) {
+               char *arg = *ptr;
+               char *p = arg;
+
                if (*p == '-') {
                        p++;
                        invert = TRUE;
@@ -177,24 +176,11 @@ parse_optimizations (guint32 opt, const char* p, gboolean cpu_opts)
                }
                for (i = 0; i < G_N_ELEMENTS (opt_names) && optflag_get_name (i); ++i) {
                        n = optflag_get_name (i);
-                       len = strlen (n);
-                       if (strncmp (p, n, len) == 0) {
+                       if (!strcmp (p, n)) {
                                if (invert)
                                        opt &= ~ (1 << i);
                                else
                                        opt |= 1 << i;
-                               p += len;
-                               if (*p == ',') {
-                                       p++;
-                                       break;
-                               } else if (*p == '=') {
-                                       p++;
-                                       if (opt_funcs [i])
-                                               opt_funcs [i] (p);
-                                       while (*p && *p++ != ',');
-                                       break;
-                               }
-                               /* error out */
                                break;
                        }
                }
@@ -204,15 +190,16 @@ parse_optimizations (guint32 opt, const char* p, gboolean cpu_opts)
                                        opt = 0;
                                else
                                        opt = ~(EXCLUDED_FROM_ALL | exclude);
-                               p += 3;
-                               if (*p == ',')
-                                       p++;
                        } else {
                                fprintf (stderr, "Invalid optimization name `%s'\n", p);
                                exit (1);
                        }
                }
+
+               g_free (arg);
        }
+       g_free (parts);
+
        return opt;
 }
 
@@ -1211,7 +1198,6 @@ mini_usage_jitdeveloper (void)
                 "    --single-method=OPTS   Runs regressions with only one method optimized with OPTS at any time\n"
                 "    --statfile FILE        Sets the stat file to FILE\n"
                 "    --stats                Print statistics about the JIT operations\n"
-                "    --wapi=hps|semdel|seminfo IO-layer maintenance\n"
                 "    --inject-async-exc METHOD OFFSET Inject an asynchronous exception at METHOD\n"
                 "    --verify-all           Run the verifier on all assemblies and methods\n"
                 "    --full-aot             Avoid JITting any code\n"
@@ -2052,10 +2038,8 @@ mono_main (int argc, char* argv[])
        }
 
        mono_set_defaults (mini_verbose, opt);
-#if ENABLE_INTERPRETER
-       if (mono_use_interpreter)
-               domain = mono_interp_init (argv [i]);
-       else
+#ifdef ENABLE_INTERPRETER
+       mono_interp_init ();
 #endif
        domain = mini_init (argv [i], forced_version);
 
@@ -2082,7 +2066,7 @@ mono_main (int argc, char* argv[])
        case DO_REGRESSION:
 #ifdef ENABLE_INTERPRETER
                if (mono_use_interpreter) {
-                       if (interp_regression_list (2, argc -i, argv + i)) {
+                       if (mono_interp_regression_list (2, argc -i, argv + i)) {
                                g_print ("Regression ERRORS!\n");
                                // mini_cleanup (domain);
                                return 1;
@@ -2123,10 +2107,6 @@ mono_main (int argc, char* argv[])
                aname = argv [i];
                break;
        default:
-#ifdef ENABLE_INTERPRETER
-               if (mono_use_interpreter)
-                       g_error ("not yet");
-#endif
                if (argc - i < 1) {
                        mini_usage ();
                        mini_cleanup (domain);