#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"
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) {
}
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;
}
}
#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;
/*
} 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) {
mono_counters_init ();
+#ifndef HOST_WIN32
+ mono_w32handle_init ();
+#endif
+
/* Set rootdir before loading config */
mono_set_rootdir ();