#ifdef HOST_WIN32
" --mixed-mode Enable mixed-mode image support.\n"
#endif
+ " --handlers Install custom handlers, use --help-handlers for details.\n"
);
}
}
#endif
+
+ #define MONO_HANDLERS_ARGUMENT "--handlers="
+ #define MONO_HANDLERS_ARGUMENT_LEN G_N_ELEMENTS(MONO_HANDLERS_ARGUMENT)-1
+
/**
* mono_main:
* @argc: number of arguments in the argv array
} 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) {
} else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
nacl_null_checks_off = TRUE;
#endif
+ } 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]);
/* 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");
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);
+ }
}
/**
void *ptr;
if (mono_aot_only)
- g_error ("Attempting to allocate from the global code manager while running with --aot-only.\n");
+ g_error ("Attempting to allocate from the global code manager while running in aot-only mode.\n");
if (!global_codeman) {
/* This can happen during startup */
/* Not used */
g_assert_not_reached ();
}
+
+ // Custom handlers currently only implemented by Windows.
+ #ifndef HOST_WIN32
+ gboolean
+ mono_runtime_install_custom_handlers (const char *handlers)
+ {
+ return FALSE;
+ }
+
+ void
+ mono_runtime_install_custom_handlers_usage (void)
+ {
+ fprintf (stdout,
+ "Custom Handlers:\n"
+ " --handlers=HANDLERS Enable handler support, HANDLERS is a comma\n"
+ " separated list of available handlers to install.\n"
+ "\n"
+ "No handlers supported on current platform.\n");
+ }
+ #endif /* HOST_WIN32 */
guint8 *thunks;
/* Offset between the start of code and the thunks area */
int thunks_offset;
- guint32 exception_type; /* MONO_EXCEPTION_* */
+ MonoExceptionType exception_type; /* MONO_EXCEPTION_* */
guint32 exception_data;
char* exception_message;
gpointer exception_ptr;
* Per-OS implementation functions.
*/
void mono_runtime_install_handlers (void);
+ gboolean mono_runtime_install_custom_handlers (const char *handlers);
+ void mono_runtime_install_custom_handlers_usage (void);
void mono_runtime_cleanup_handlers (void);
void mono_runtime_setup_stat_profiler (void);
void mono_runtime_shutdown_stat_profiler (void);