X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fdriver.c;h=dbbb646297d7850c260d5732a98a05be25753627;hb=bfc76bafbf72f8e10c4d2cc7b12e779715c527fa;hp=9e09e7a944eb5d7a64fc7f6ef9c1f030ea93ea99;hpb=2099acf5f4a80c46bf4e75e9d67b8db4f2c86bbd;p=mono.git diff --git a/mono/mini/driver.c b/mono/mini/driver.c index 9e09e7a944e..dbbb646297d 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -36,7 +36,6 @@ #include #include #include -#include "mono/metadata/profiler.h" #include #include #include @@ -53,6 +52,7 @@ #include "mono/utils/mono-hwcap.h" #include "mono/utils/mono-logger-internals.h" #include "mono/metadata/w32handle.h" +#include "mono/metadata/callspec.h" #include "mini.h" #include "jit.h" @@ -121,10 +121,6 @@ opt_names [] = { #endif -#ifdef __native_client__ -extern char *nacl_mono_path; -#endif - #define DEFAULT_OPTIMIZATIONS ( \ MONO_OPT_PEEPHOLE | \ MONO_OPT_CFOLD | \ @@ -517,6 +513,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); @@ -1156,8 +1157,11 @@ load_agent (MonoDomain *domain, char *desc) if (args) { main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, 1, &error); - if (main_args) - mono_array_set (main_args, MonoString*, 0, mono_string_new (domain, args)); + if (main_args) { + MonoString *str = mono_string_new_checked (domain, args, &error); + if (str) + mono_array_set (main_args, MonoString*, 0, str); + } } else { main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, 0, &error); } @@ -1190,6 +1194,7 @@ mini_usage_jitdeveloper (void) fprintf (stdout, "Runtime and JIT debugging options:\n" + " --apply-bindings=FILE Apply assembly bindings from FILE (only for AOT)\n" " --breakonex Inserts a breakpoint on exceptions\n" " --break METHOD Inserts a breakpoint at METHOD entry\n" " --break-at-bb METHOD N Inserts a breakpoint in METHOD at BB N\n" @@ -1416,8 +1421,8 @@ 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; - mono_jit_stats.enabled = TRUE; + InterlockedWriteBool (&mono_stats.enabled, TRUE); + InterlockedWriteBool (&mono_jit_stats.enabled, TRUE); } else if (strcmp (argv [i], "--break") == 0) { if (i+1 >= argc){ fprintf (stderr, "Missing method name in --break command line option\n"); @@ -1450,7 +1455,7 @@ mono_jit_parse_options (int argc, char * argv[]) * Need to call this before mini_init () so we can trace methods * compiled there too. */ - mono_jit_trace_calls = mono_trace_parse_options (trace_options); + mono_jit_trace_calls = mono_trace_set_options (trace_options); if (mono_jit_trace_calls == NULL) exit (1); } @@ -1552,6 +1557,16 @@ switch_arch (char* argv[], const char* target_arch) #define MONO_HANDLERS_ARGUMENT "--handlers=" #define MONO_HANDLERS_ARGUMENT_LEN G_N_ELEMENTS(MONO_HANDLERS_ARGUMENT)-1 +static void +apply_root_domain_configuration_file_bindings (MonoDomain *domain, char *root_domain_configuration_file) +{ + g_assert (domain->setup == NULL || domain->setup->configuration_file == NULL); + g_assert (!domain->assembly_bindings_parsed); + + mono_domain_parse_assembly_bindings (domain, 0, 0, root_domain_configuration_file); + +} + /** * mono_main: * \param argc number of arguments in the argv array @@ -1575,22 +1590,18 @@ 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; char *attach_options = NULL; + char *extra_bindings_config_file = NULL; #ifdef MONO_JIT_INFO_TABLE_TEST int test_jit_info_table = FALSE; #endif #ifdef HOST_WIN32 int mixed_mode = FALSE; #endif -#ifdef __native_client__ - gboolean nacl_null_checks_off = FALSE; -#endif #ifdef MOONLIGHT #ifndef HOST_WIN32 @@ -1607,7 +1618,7 @@ mono_main (int argc, char* argv[]) darwin_change_default_file_handles (); #endif - if (g_getenv ("MONO_NO_SMP")) + if (g_hasenv ("MONO_NO_SMP")) mono_set_use_smp (FALSE); g_log_set_always_fatal (G_LOG_LEVEL_ERROR); @@ -1757,8 +1768,8 @@ 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; - mono_jit_stats.enabled = TRUE; + InterlockedWriteBool (&mono_stats.enabled, TRUE); + InterlockedWriteBool (&mono_jit_stats.enabled, TRUE); #ifndef DISABLE_AOT } else if (strcmp (argv [i], "--aot") == 0) { error_if_aot_unsupported (); @@ -1768,6 +1779,8 @@ mono_main (int argc, char* argv[]) mono_compile_aot = TRUE; aot_options = &argv [i][6]; #endif + } else if (strncmp (argv [i], "--apply-bindings=", 17) == 0) { + extra_bindings_config_file = &argv[i][17]; } else if (strncmp (argv [i], "--aot-path=", 11) == 0) { char **splitted; @@ -1788,11 +1801,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 (); @@ -1907,17 +1918,27 @@ mono_main (int argc, char* argv[]) #endif } else if (strcmp (argv [i], "--nollvm") == 0){ mono_use_llvm = FALSE; + } else if ((strcmp (argv [i], "--interpreter") == 0) || !strcmp (argv [i], "--interp")) { #ifdef ENABLE_INTERPRETER - } else if (strcmp (argv [i], "--interpreter") == 0) { mono_use_interpreter = TRUE; +#else + fprintf (stderr, "Mono Warning: --interpreter 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; + } else if (strncmp (argv [i], "--interp=", 9) == 0) { +#ifdef ENABLE_INTERPRETER + mono_use_interpreter = TRUE; + mono_interp_parse_options (argv [i] + 9); +#else + fprintf (stderr, "Mono Warning: --interp= not enabled in this runtime.\n"); #endif + } else if (strncmp (argv [i], "--assembly-loader=", strlen("--assembly-loader=")) == 0) { + gchar *arg = argv [i] + strlen ("--assembly-loader="); + if (strcmp (arg, "strict") == 0) + mono_loader_set_strict_strong_names (TRUE); + else if (strcmp (arg, "legacy") == 0) + mono_loader_set_strict_strong_names (FALSE); + else + fprintf (stderr, "Warning: unknown argument to --assembly-loader. Should be \"strict\" or \"legacy\"\n"); } else if (strncmp (argv [i], MONO_HANDLERS_ARGUMENT, MONO_HANDLERS_ARGUMENT_LEN) == 0) { //Install specific custom handlers. if (!mono_runtime_install_custom_handlers (argv[i] + MONO_HANDLERS_ARGUMENT_LEN)) { @@ -1934,13 +1955,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 { @@ -1969,7 +1983,7 @@ mono_main (int argc, char* argv[]) } #endif - if (g_getenv ("MONO_XDEBUG")) + if (g_hasenv ("MONO_XDEBUG")) enable_debugging = TRUE; #ifdef MONO_CROSS_COMPILE @@ -1999,10 +2013,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){ @@ -2010,7 +2020,7 @@ mono_main (int argc, char* argv[]) * Need to call this before mini_init () so we can trace methods * compiled there too. */ - mono_jit_trace_calls = mono_trace_parse_options (trace_options); + mono_jit_trace_calls = mono_trace_set_options (trace_options); if (mono_jit_trace_calls == NULL) exit (1); } @@ -2040,9 +2050,6 @@ mono_main (int argc, char* argv[]) } mono_set_defaults (mini_verbose, opt); -#ifdef ENABLE_INTERPRETER - mono_interp_init (); -#endif domain = mini_init (argv [i], forced_version); mono_gc_set_stack_end (&domain); @@ -2123,6 +2130,10 @@ mono_main (int argc, char* argv[]) jit_info_table_test (domain); #endif + if (mono_compile_aot && extra_bindings_config_file != NULL) { + apply_root_domain_configuration_file_bindings (domain, extra_bindings_config_file); + } + assembly = mono_assembly_open_predicate (aname, FALSE, FALSE, NULL, NULL, &open_status); if (!assembly) { fprintf (stderr, "Cannot open assembly '%s': %s.\n", aname, mono_image_strerror (open_status)); @@ -2130,8 +2141,7 @@ mono_main (int argc, char* argv[]) return 2; } - if (trace_options != NULL) - mono_trace_set_assembly (assembly); + mono_callspec_set_assembly (assembly); if (mono_compile_aot || action == DO_EXEC) { const char *error; @@ -2362,6 +2372,21 @@ 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; + } + if (mono_aot_mode == MONO_AOT_MODE_INTERP_LLVMONLY) { + mono_aot_only = TRUE; + mono_use_interpreter = TRUE; + mono_llvm_only = TRUE; + } +} + +mono_bool +mono_jit_aot_compiling (void) +{ + return mono_compile_aot; } /** @@ -2375,7 +2400,7 @@ mono_jit_set_aot_mode (MonoAotMode mode) gboolean mono_jit_set_trace_options (const char* options) { - MonoTraceSpec *trace_opt = mono_trace_parse_options (options); + MonoCallSpec *trace_opt = mono_trace_set_options (options); if (trace_opt == NULL) return FALSE; mono_jit_trace_calls = trace_opt; @@ -2555,10 +2580,11 @@ mono_parse_env_options (int *ref_argc, char **ref_argv []) { char *ret; - const char *env_options = g_getenv ("MONO_ENV_OPTIONS"); + char *env_options = g_getenv ("MONO_ENV_OPTIONS"); if (env_options == NULL) return; ret = mono_parse_options_from (env_options, ref_argc, ref_argv); + g_free (env_options); if (ret == NULL) return; fprintf (stderr, "%s", ret);