2008-08-22 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / driver.c
index 68fd7570ae1c61059c04087d6e2235adcf1b2244..a3445c7f33a19e98b4f88a9b5933113c398aa6c5 100644 (file)
@@ -127,6 +127,8 @@ opt_funcs [sizeof (int) * 8] = {
        MONO_OPT_INTRINS |  \
        MONO_OPT_LOOP |  \
        MONO_OPT_EXCEPTION |  \
+    MONO_OPT_CMOV |  \
+       MONO_OPT_GSHARED |      \
        MONO_OPT_AOT)
 
 #define EXCLUDED_FROM_ALL (MONO_OPT_SHARED | MONO_OPT_PRECOMP)
@@ -301,6 +303,7 @@ opt_sets [] = {
        MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS,
        MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_SSA,
        MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_EXCEPTION,
+       MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_EXCEPTION | MONO_OPT_CMOV,
        MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_EXCEPTION | MONO_OPT_ABCREM,
        MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_EXCEPTION | MONO_OPT_ABCREM | MONO_OPT_SSAPRE,
        MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_ABCREM,
@@ -921,16 +924,29 @@ static void main_thread_handler (gpointer user_data)
        MainThreadArgs *main_args = user_data;
        MonoAssembly *assembly;
 
-       assembly = mono_domain_assembly_open (main_args->domain, main_args->file);
-       if (!assembly){
-               fprintf (stderr, "Can not open image %s\n", main_args->file);
-               exit (1);
-       }
-
        if (mono_compile_aot) {
-               int res = mono_compile_assembly (assembly, main_args->opts, main_args->aot_options);
-               printf ("AOT RESULT %d\n", res);
+               int i, res;
+
+               /* Treat the other arguments as assemblies to compile too */
+               for (i = 0; i < main_args->argc; ++i) {
+                       assembly = mono_domain_assembly_open (main_args->domain, main_args->argv [i]);
+                       if (!assembly) {
+                               fprintf (stderr, "Can not open image %s\n", main_args->argv [i]);
+                               exit (1);
+                       }
+                       res = mono_compile_assembly (assembly, main_args->opts, main_args->aot_options);
+                       if (res != 0) {
+                               fprintf (stderr, "AOT of image %s failed.\n", main_args->argv [i]);
+                               exit (1);
+                       }
+               }
        } else {
+               assembly = mono_domain_assembly_open (main_args->domain, main_args->file);
+               if (!assembly){
+                       fprintf (stderr, "Can not open image %s\n", main_args->file);
+                       exit (1);
+               }
+
                /* 
                 * This must be done in a thread managed by mono since it can invoke
                 * managed code.
@@ -959,10 +975,10 @@ mini_usage_jitdeveloper (void)
                 "    --regression           Runs the regression test contained in the assembly\n"
                 "    --statfile FILE        Sets the stat file to FILE\n"
                 "    --stats                Print statistics about the JIT operations\n"
-                "    --wapi=hps|semdel      IO-layer maintenance\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 methods\n"
-                "    --aot-only             Avoid JITting any code\n"
+                "    --full-aot             Avoid JITting any code\n"
                 "\n"
                 "Other options:\n" 
                 "    --graph[=TYPE] METHOD  Draws a graph of the specified method:\n");
@@ -1257,7 +1273,7 @@ mono_main (int argc, char* argv[])
                        mono_inject_async_exc_pos = atoi (argv [++i]);
                } else if (strcmp (argv [i], "--verify-all") == 0) {
                        mono_verifier_enable_verify_all ();
-               } else if (strcmp (argv [i], "--aot-only") == 0) {
+               } else if (strcmp (argv [i], "--full-aot") == 0) {
                        mono_aot_only = TRUE;
                } else if (strcmp (argv [i], "--print-vtable") == 0) {
                        mono_print_vtable = TRUE;
@@ -1582,7 +1598,7 @@ mono_main (int argc, char* argv[])
                if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
                        (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
                        MonoMethod *nm;
-                       nm = mono_marshal_get_native_wrapper (method, TRUE);
+                       nm = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
                        cfg = mini_method_compile (nm, opt, mono_get_root_domain (), FALSE, FALSE, part);
                }
                else
@@ -1639,7 +1655,7 @@ mono_main (int argc, char* argv[])
                        for (i = 0; i < count; ++i) {
                                if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
                                        (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
-                                       method = mono_marshal_get_native_wrapper (method, TRUE);
+                                       method = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
 
                                cfg = mini_method_compile (method, opt, mono_get_root_domain (), FALSE, FALSE, 0);
                                mono_destroy_compile (cfg);