X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fdriver.c;h=7d0716dad90c909c3d68fd2f59b0f2af827ad276;hb=bfc76bafbf72f8e10c4d2cc7b12e779715c527fa;hp=a6d2bd117b1f75181421b9e0b65ddb23265e5fd7;hpb=fcca9846c82626dd094b2ca0c5f35991f8afc3a5;p=mono.git diff --git a/mono/mini/driver.c b/mono/mini/driver.c index a6d2bd117b1..dbbb646297d 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -1,5 +1,6 @@ -/* - * driver.c: The new mono JIT compiler. +/** + * \file + * The new mono JIT compiler. * * Author: * Paolo Molaro (lupus@ximian.com) @@ -21,7 +22,7 @@ #include #endif -#include +#include #include #include #include @@ -33,11 +34,8 @@ #include #include #include -#include #include #include -#include -#include "mono/metadata/profiler.h" #include #include #include @@ -49,14 +47,17 @@ #include #include #include +#include #include "mono/utils/mono-counters.h" #include "mono/utils/mono-hwcap.h" #include "mono/utils/mono-logger-internals.h" -#include "mono/utils/w32handle.h" +#include "mono/metadata/w32handle.h" +#include "mono/metadata/callspec.h" #include "mini.h" #include "jit.h" #include "aot-compiler.h" +#include "interp/interp.h" #include #include @@ -120,15 +121,6 @@ opt_names [] = { #endif -static const OptFunc -opt_funcs [sizeof (int) * 8] = { - NULL -}; - -#ifdef __native_client__ -extern char *nacl_mono_path; -#endif - #define DEFAULT_OPTIMIZATIONS ( \ MONO_OPT_PEEPHOLE | \ MONO_OPT_CFOLD | \ @@ -154,7 +146,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 (); @@ -167,7 +160,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; @@ -176,24 +173,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; } } @@ -203,15 +187,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; } @@ -284,6 +269,9 @@ mono_parse_graph_options (const char* p) exit (1); } +/** + * mono_parse_default_optimizations: + */ int mono_parse_default_optimizations (const char* p) { @@ -525,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); @@ -548,7 +541,7 @@ mini_regression_list (int verbose, int count, char *images []) total_run = total = 0; for (i = 0; i < count; ++i) { - ass = mono_assembly_open (images [i], NULL); + ass = mono_assembly_open_predicate (images [i], FALSE, FALSE, NULL, NULL, NULL); if (!ass) { g_warning ("failed to load assembly: %s", images [i]); continue; @@ -934,7 +927,7 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args) (method->flags & METHOD_ATTRIBUTE_ABSTRACT)) continue; - if (method->klass->generic_container) + if (mono_class_is_gtd (method->klass)) continue; sig = mono_method_signature (method); if (!sig) { @@ -954,7 +947,7 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args) g_print ("Compiling %d %s\n", count, desc); g_free (desc); } - cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, args->opts), mono_get_root_domain (), (JitFlags)0, 0, -1); + cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, args->opts), mono_get_root_domain (), (JitFlags)JIT_FLAG_DISCARD_RESULTS, 0, -1); if (cfg->exception_type != MONO_EXCEPTION_NONE) { printf ("Compilation of %s failed with exception '%s':\n", mono_method_full_name (cfg->method, TRUE), cfg->exception_message); fail_count ++; @@ -997,10 +990,9 @@ compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recom /** * mono_jit_exec: - * @assembly: reference to an assembly - * @argc: argument count - * @argv: argument vector - * + * \param assembly reference to an assembly + * \param argc argument count + * \param argv argument vector * Start execution of a program. */ int @@ -1134,7 +1126,7 @@ load_agent (MonoDomain *domain, char *desc) args = NULL; } - agent_assembly = mono_assembly_open (agent, &open_status); + agent_assembly = mono_assembly_open_predicate (agent, FALSE, FALSE, NULL, NULL, &open_status); if (!agent_assembly) { fprintf (stderr, "Cannot open agent assembly '%s': %s.\n", agent, mono_image_strerror (open_status)); g_free (agent); @@ -1165,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); } @@ -1199,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" @@ -1210,7 +1206,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" @@ -1274,6 +1269,8 @@ mini_usage (void) #ifdef HOST_WIN32 " --mixed-mode Enable mixed-mode image support.\n" #endif + " --handlers Install custom handlers, use --help-handlers for details.\n" + " --aot-path=PATH List of additional directories to search for AOT images.\n" ); } @@ -1370,11 +1367,11 @@ static const char info[] = static gboolean enable_debugging; -/* +/** * mono_jit_parse_options: * - * Process the command line options in ARGV as done by the runtime executable. - * This should be called before mono_jit_init (). + * Process the command line options in \p argv as done by the runtime executable. + * This should be called before \c mono_jit_init. */ void mono_jit_parse_options (int argc, char * argv[]) @@ -1424,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"); @@ -1434,6 +1431,10 @@ mono_jit_parse_options (int argc, char * argv[]) if (!mono_debugger_insert_breakpoint (argv [++i], FALSE)) fprintf (stderr, "Error: invalid method name '%s'\n", argv [i]); + } else if (strncmp (argv[i], "--gc-params=", 12) == 0) { + mono_gc_params_set (argv[i] + 12); + } else if (strncmp (argv[i], "--gc-debug=", 11) == 0) { + mono_gc_debug_set (argv[i] + 11); } else if (strcmp (argv [i], "--llvm") == 0) { #ifndef MONO_ARCH_LLVM_SUPPORTED fprintf (stderr, "Mono Warning: --llvm not supported on this platform.\n"); @@ -1454,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); } @@ -1500,6 +1501,7 @@ switch_gc (char* argv[], const char* target_gc) #ifdef HAVE_EXECVP execvp (path->str, argv); + fprintf (stderr, "Error: Failed to switch to %s gc. mono-%s is not installed.\n", target_gc, target_gc); #else fprintf (stderr, "Error: --gc= option not supported on this platform.\n"); #endif @@ -1551,11 +1553,24 @@ switch_arch (char* argv[], const char* target_arch) } #endif + +#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: - * @argc: number of arguments in the argv array - * @argv: array of strings containing the startup arguments - * + * \param argc number of arguments in the argv array + * \param argv array of strings containing the startup arguments * Launches the Mono JIT engine and parses all the command line options * in the same way that the mono command line VM would. */ @@ -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); @@ -1678,6 +1689,10 @@ mono_main (int argc, char* argv[]) switch_gc (argv, "sgen"); } else if (strcmp (argv [i], "--gc=boehm") == 0) { switch_gc (argv, "boehm"); + } else if (strncmp (argv[i], "--gc-params=", 12) == 0) { + mono_gc_params_set (argv[i] + 12); + } else if (strncmp (argv[i], "--gc-debug=", 11) == 0) { + mono_gc_debug_set (argv[i] + 11); } #ifdef TARGET_OSX else if (strcmp (argv [i], "--arch=32") == 0) { @@ -1744,17 +1759,17 @@ mono_main (int argc, char* argv[]) } else if (strcmp (argv [i], "--verify-all") == 0) { mono_verifier_enable_verify_all (); } else if (strcmp (argv [i], "--full-aot") == 0) { - mono_aot_only = TRUE; + mono_jit_set_aot_mode (MONO_AOT_MODE_FULL); } else if (strcmp (argv [i], "--llvmonly") == 0) { - mono_aot_only = TRUE; - mono_llvm_only = TRUE; + mono_jit_set_aot_mode (MONO_AOT_MODE_LLVMONLY); } else if (strcmp (argv [i], "--hybrid-aot") == 0) { + mono_jit_set_aot_mode (MONO_AOT_MODE_HYBRID); } else if (strcmp (argv [i], "--print-vtable") == 0) { 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 (); @@ -1764,6 +1779,18 @@ 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; + + splitted = g_strsplit (argv [i] + 11, G_SEARCHPATH_SEPARATOR_S, 1000); + while (*splitted) { + char *tmp = *splitted; + mono_aot_paths = g_list_append (mono_aot_paths, g_strdup (tmp)); + g_free (tmp); + splitted++; + } } else if (strncmp (argv [i], "--compile-all=", 14) == 0) { action = DO_COMPILE; recompilation_times = atoi (argv [i] + 14); @@ -1774,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 (); @@ -1893,12 +1918,36 @@ mono_main (int argc, char* argv[]) #endif } else if (strcmp (argv [i], "--nollvm") == 0){ mono_use_llvm = FALSE; -#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 ((strcmp (argv [i], "--interpreter") == 0) || !strcmp (argv [i], "--interp")) { +#ifdef ENABLE_INTERPRETER + mono_use_interpreter = TRUE; +#else + fprintf (stderr, "Mono Warning: --interpreter not enabled in this runtime.\n"); #endif + } 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)) { + fprintf (stderr, "error: " MONO_HANDLERS_ARGUMENT ", one or more unknown handlers: '%s'\n", argv [i]); + return 1; + } + } else if (strcmp (argv [i], "--help-handlers") == 0) { + mono_runtime_install_custom_handlers_usage (); + return 0; } else if (argv [i][0] == '-' && argv [i][1] == '-' && mini_parse_debug_option (argv [i] + 2)) { } else { fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]); @@ -1906,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 { @@ -1933,15 +1975,15 @@ mono_main (int argc, char* argv[]) { char *runtime_path; - runtime_path = wapi_process_get_path (getpid ()); + runtime_path = mono_w32process_get_path (getpid ()); if (runtime_path) { - wapi_process_set_cli_launcher (runtime_path); + mono_w32process_set_cli_launcher (runtime_path); g_free (runtime_path); } } #endif - if (g_getenv ("MONO_XDEBUG")) + if (g_hasenv ("MONO_XDEBUG")) enable_debugging = TRUE; #ifdef MONO_CROSS_COMPILE @@ -1971,17 +2013,6 @@ mono_main (int argc, char* argv[]) /* Set rootdir before loading config */ mono_set_rootdir (); - /* - * We only set the native name of the thread since MS.NET leaves the - * managed thread name for the main thread as null. - */ - mono_native_thread_set_name (mono_native_thread_id_get (), "Main"); - - if (enable_profile) { - mono_profiler_load (profile_options); - mono_profiler_thread_name (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()), "Main"); - } - mono_attach_parse_options (attach_options); if (trace_options != NULL){ @@ -1989,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); } @@ -2042,6 +2073,17 @@ mono_main (int argc, char* argv[]) case DO_SINGLE_METHOD_REGRESSION: mono_do_single_method_regression = TRUE; case DO_REGRESSION: +#ifdef ENABLE_INTERPRETER + if (mono_use_interpreter) { + if (mono_interp_regression_list (2, argc -i, argv + i)) { + g_print ("Regression ERRORS!\n"); + // mini_cleanup (domain); + return 1; + } + // mini_cleanup (domain); + return 0; + } +#endif if (mini_regression_list (mini_verbose, argc -i, argv + i)) { g_print ("Regression ERRORS!\n"); mini_cleanup (domain); @@ -2088,15 +2130,18 @@ mono_main (int argc, char* argv[]) jit_info_table_test (domain); #endif - assembly = mono_assembly_open (aname, &open_status); + 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)); mini_cleanup (domain); 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; @@ -2112,7 +2157,7 @@ mono_main (int argc, char* argv[]) exit (1); } -#ifdef HOST_WIN32 +#if defined(HOST_WIN32) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) /* Detach console when executing IMAGE_SUBSYSTEM_WINDOWS_GUI on win32 */ if (!enable_debugging && !mono_compile_aot && ((MonoCLIImageInfo*)(mono_assembly_get_image (assembly)->image_info))->cli_header.nt.pe_subsys_required == IMAGE_SUBSYSTEM_WINDOWS_GUI) FreeConsole (); @@ -2254,6 +2299,9 @@ mono_main (int argc, char* argv[]) return 0; } +/** + * mono_jit_init: + */ MonoDomain * mono_jit_init (const char *file) { @@ -2262,22 +2310,22 @@ mono_jit_init (const char *file) /** * mono_jit_init_version: - * @domain_name: the name of the root domain - * @runtime_version: the version of the runtime to load + * \param domain_name the name of the root domain + * \param runtime_version the version of the runtime to load * * Use this version when you want to force a particular runtime * version to be used. By default Mono will pick the runtime that is - * referenced by the initial assembly (specified in @file), this + * referenced by the initial assembly (specified in \p file), this * routine allows programmers to specify the actual runtime to be used * as the initial runtime is inherited by all future assemblies loaded * (since Mono does not support having more than one mscorlib runtime * loaded at once). * - * The @runtime_version can be one of these strings: "v4.0.30319" for + * The \p runtime_version can be one of these strings: "v4.0.30319" for * desktop, "mobile" for mobile or "moonlight" for Silverlight compat. * If an unrecognized string is input, the vm will default to desktop. * - * Returns: the MonoDomain representing the domain where the assembly + * \returns the \c MonoDomain representing the domain where the assembly * was loaded. */ MonoDomain * @@ -2286,6 +2334,9 @@ mono_jit_init_version (const char *domain_name, const char *runtime_version) return mini_init (domain_name, runtime_version); } +/** + * mono_jit_cleanup: + */ void mono_jit_cleanup (MonoDomain *domain) { @@ -2300,29 +2351,56 @@ mono_jit_set_aot_only (gboolean val) mono_aot_only = val; } +/** + * mono_jit_set_aot_mode: + */ void mono_jit_set_aot_mode (MonoAotMode mode) { + /* we don't want to set mono_aot_mode twice */ + g_assert (mono_aot_mode == MONO_AOT_MODE_NONE); mono_aot_mode = mode; + if (mono_aot_mode == MONO_AOT_MODE_LLVMONLY) { mono_aot_only = TRUE; mono_llvm_only = TRUE; } + if (mono_aot_mode == MONO_AOT_MODE_FULL) { + mono_aot_only = TRUE; + } + if (mono_aot_mode == MONO_AOT_MODE_HYBRID) { + 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; } /** * mono_jit_set_trace_options: - * @options: string representing the trace options - * + * \param options string representing the trace options * Set the options of the tracing engine. This function can be called before initializing * the mono runtime. See the --trace mono(1) manpage for the options format. * - * Returns: #TRUE if the options where parsed and set correctly, #FALSE otherwise. + * \returns TRUE if the options were parsed and set correctly, FALSE otherwise. */ 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; @@ -2332,14 +2410,14 @@ mono_jit_set_trace_options (const char* options) /** * mono_set_signal_chaining: * - * Enable/disable signal chaining. This should be called before mono_jit_init (). + * Enable/disable signal chaining. This should be called before \c mono_jit_init. * If signal chaining is enabled, the runtime saves the original signal handlers before * installing its own handlers, and calls the original ones in the following cases: - * - a SIGSEGV/SIGABRT signal received while executing native (i.e. not JITted) code. - * - SIGPROF - * - SIGFPE - * - SIGQUIT - * - SIGUSR2 + * - a \c SIGSEGV / \c SIGABRT signal received while executing native (i.e. not JITted) code. + * - \c SIGPROF + * - \c SIGFPE + * - \c SIGQUIT + * - \c SIGUSR2 * Signal chaining only works on POSIX platforms. */ void @@ -2363,14 +2441,14 @@ mono_set_crash_chaining (gboolean chain_crashes) /** * mono_parse_options_from: - * @options: string containing strings - * @ref_argc: pointer to the argc variable that might be updated - * @ref_argv: pointer to the argv string vector variable that might be updated + * \param options string containing strings + * \param ref_argc pointer to the \c argc variable that might be updated + * \param ref_argv pointer to the \c argv string vector variable that might be updated * - * This function parses the contents of the `MONO_ENV_OPTIONS` + * This function parses the contents of the \c MONO_ENV_OPTIONS * environment variable as if they were parsed by a command shell * splitting the contents by spaces into different elements of the - * @argv vector. This method supports quoting with both the " and ' + * \p argv vector. This method supports quoting with both the " and ' * characters. Inside quoting, spaces and tabs are significant, * otherwise, they are considered argument separators. * @@ -2379,14 +2457,14 @@ mono_set_crash_chaining (gboolean chain_crashes) * inside quotes. If the quotes are not balanced, this method * * If the environment variable is empty, no changes are made - * to the values pointed by @ref_argc and @ref_argv. + * to the values pointed by \p ref_argc and \p ref_argv. * - * Otherwise the @ref_argv is modified to point to a new array that contains + * Otherwise the \p ref_argv is modified to point to a new array that contains * all the previous elements contained in the vector, plus the values parsed. - * The @argc is updated to match the new number of parameters. + * The \p argc is updated to match the new number of parameters. * - * Returns: The value NULL is returned on success, otherwise a g_strdup allocated - * string is returned (this is an alias to malloc under normal circumstances) that + * \returns The value NULL is returned on success, otherwise a \c g_strdup allocated + * string is returned (this is an alias to \c malloc under normal circumstances) that * contains the error message that happened during parsing. */ char * @@ -2470,13 +2548,13 @@ mono_parse_options_from (const char *options, int *ref_argc, char **ref_argv []) /** * mono_parse_env_options: - * @ref_argc: pointer to the argc variable that might be updated - * @ref_argv: pointer to the argv string vector variable that might be updated + * \param ref_argc pointer to the \c argc variable that might be updated + * \param ref_argv pointer to the \c argv string vector variable that might be updated * - * This function parses the contents of the `MONO_ENV_OPTIONS` + * This function parses the contents of the \c MONO_ENV_OPTIONS * environment variable as if they were parsed by a command shell * splitting the contents by spaces into different elements of the - * @argv vector. This method supports quoting with both the " and ' + * \p argv vector. This method supports quoting with both the " and ' * characters. Inside quoting, spaces and tabs are significant, * otherwise, they are considered argument separators. * @@ -2485,11 +2563,11 @@ mono_parse_options_from (const char *options, int *ref_argc, char **ref_argv []) * inside quotes. If the quotes are not balanced, this method * * If the environment variable is empty, no changes are made - * to the values pointed by @ref_argc and @ref_argv. + * to the values pointed by \p ref_argc and \p ref_argv. * - * Otherwise the @ref_argv is modified to point to a new array that contains + * Otherwise the \p ref_argv is modified to point to a new array that contains * all the previous elements contained in the vector, plus the values parsed. - * The @argc is updated to match the new number of parameters. + * The \p argc is updated to match the new number of parameters. * * If there is an error parsing, this method will terminate the process by * calling exit(1). @@ -2502,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);