X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fdriver.c;h=a6d2bd117b1f75181421b9e0b65ddb23265e5fd7;hb=0faf5367390e7d9323775ee8ef1f202533c3928c;hp=aa80289292431607f3c68cb9b344b3e5fa7fea28;hpb=8054793e5bc158015154fb8cdcdd56777a0c8351;p=mono.git diff --git a/mono/mini/driver.c b/mono/mini/driver.c index aa802892924..a6d2bd117b1 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -52,6 +52,7 @@ #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 "mini.h" #include "jit.h" @@ -399,11 +400,14 @@ mini_regression_step (MonoImage *image, int verbose, int *total_run, int *total, if (verbose >= 2) g_print ("Running '%s' ...\n", method->name); #ifdef MONO_USE_AOT_COMPILER - if ((func = (TestMethod)mono_aot_get_method (mono_get_root_domain (), method))) - ; - else -#endif + MonoError error; + func = (TestMethod)mono_aot_get_method_checked (mono_get_root_domain (), method, &error); + mono_error_cleanup (&error); + if (!func) + func = (TestMethod)(gpointer)cfg->native_code; +#else func = (TestMethod)(gpointer)cfg->native_code; +#endif func = (TestMethod)mono_create_ftnptr (mono_get_root_domain (), func); result = func (); if (result != expected) { @@ -1023,18 +1027,27 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[ } if (mono_llvm_only) { - MonoObject *exc; + MonoObject *exc = NULL; int res; - res = mono_runtime_run_main (method, argc, argv, &exc); + res = mono_runtime_try_run_main (method, argc, argv, &exc); if (exc) { mono_unhandled_exception (exc); mono_invoke_unhandled_exception_hook (exc); - return 1; + g_assert_not_reached (); } return res; } else { - return mono_runtime_run_main (method, argc, argv, NULL); + int res = mono_runtime_run_main_checked (method, argc, argv, &error); + if (!is_ok (&error)) { + MonoException *ex = mono_error_convert_to_exception (&error); + if (ex) { + mono_unhandled_exception (&ex->object); + mono_invoke_unhandled_exception_hook (&ex->object); + g_assert_not_reached (); + } + } + return res; } } @@ -1355,30 +1368,6 @@ static const char info[] = #define error_if_aot_unsupported() #endif -#ifdef HOST_WIN32 -BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved) -{ - if (!mono_gc_dllmain (module_handle, reason, reserved)) - return FALSE; - - switch (reason) - { - case DLL_PROCESS_ATTACH: - mono_install_runtime_load (mini_init); - break; - case DLL_PROCESS_DETACH: - if (coree_module_handle) - FreeLibrary (coree_module_handle); - break; - case DLL_THREAD_DETACH: - mono_thread_info_detach (); - break; - - } - return TRUE; -} -#endif - static gboolean enable_debugging; /* @@ -1759,6 +1748,7 @@ mono_main (int argc, char* argv[]) } else if (strcmp (argv [i], "--llvmonly") == 0) { mono_aot_only = TRUE; mono_llvm_only = TRUE; + } else if (strcmp (argv [i], "--hybrid-aot") == 0) { } else if (strcmp (argv [i], "--print-vtable") == 0) { mono_print_vtable = TRUE; } else if (strcmp (argv [i], "--stats") == 0) { @@ -1974,6 +1964,10 @@ mono_main (int argc, char* argv[]) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + /* Set rootdir before loading config */ mono_set_rootdir ();