The do_try_exec_main function is always called in contexts where any
exception from doing the invoke is going to be stored in the exc outarg.
That means any MonoError will be handled locally by do_try_exec_main.
So we don't need a MonoError argument, we just need an inner_error.
int
mono_runtime_try_run_main (MonoMethod *method, int argc, char* argv[],
int
mono_runtime_try_run_main (MonoMethod *method, int argc, char* argv[],
- MonoObject **exc, MonoError *error);
int
mono_runtime_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *error);
int
int
mono_runtime_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *error);
int
-mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoError *error);
+mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc);
#endif /* __MONO_OBJECT_INTERNALS_H__ */
#endif /* __MONO_OBJECT_INTERNALS_H__ */
MonoArray *args = prepare_run_main (method, argc, argv);
int res;
if (exc) {
MonoArray *args = prepare_run_main (method, argc, argv);
int res;
if (exc) {
- res = mono_runtime_try_exec_main (method, args, exc, &error);
- if (*exc == NULL && !is_ok (&error))
- *exc = (MonoObject*) mono_error_convert_to_exception (&error);
- else
- mono_error_cleanup (&error);
+ res = mono_runtime_try_exec_main (method, args, exc);
} else {
res = mono_runtime_exec_main_checked (method, args, &error);
mono_error_raise_exception (&error); /* OK to throw, external only without a better alternative */
} else {
res = mono_runtime_exec_main_checked (method, args, &error);
mono_error_raise_exception (&error); /* OK to throw, external only without a better alternative */
*/
int
mono_runtime_try_run_main (MonoMethod *method, int argc, char* argv[],
*/
int
mono_runtime_try_run_main (MonoMethod *method, int argc, char* argv[],
- MonoObject **exc, MonoError *error)
- mono_error_init (error);
MonoArray *args = prepare_run_main (method, argc, argv);
MonoArray *args = prepare_run_main (method, argc, argv);
- return mono_runtime_try_exec_main (method, args, exc, error);
+ return mono_runtime_try_exec_main (method, args, exc);
-do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoError *error)
+do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
{
MONO_REQ_GC_UNSAFE_MODE;
gpointer pa [1];
int rval;
{
MONO_REQ_GC_UNSAFE_MODE;
gpointer pa [1];
int rval;
- mono_error_init (error);
g_assert (args);
g_assert (exc);
g_assert (args);
g_assert (exc);
/* FIXME: check signature of method */
if (mono_method_signature (method)->ret->type == MONO_TYPE_I4) {
/* FIXME: check signature of method */
if (mono_method_signature (method)->ret->type == MONO_TYPE_I4) {
- res = mono_runtime_try_invoke (method, NULL, pa, exc, error);
- if (*exc == NULL && !mono_error_ok (error))
- *exc = (MonoObject*) mono_error_convert_to_exception (error);
+ res = mono_runtime_try_invoke (method, NULL, pa, exc, &inner_error);
+ if (*exc == NULL && !mono_error_ok (&inner_error))
+ *exc = (MonoObject*) mono_error_convert_to_exception (&inner_error);
- mono_error_cleanup (error);
+ mono_error_cleanup (&inner_error);
if (*exc == NULL)
rval = *(guint32 *)((char *)res + sizeof (MonoObject));
if (*exc == NULL)
rval = *(guint32 *)((char *)res + sizeof (MonoObject));
mono_environment_exitcode_set (rval);
} else {
mono_environment_exitcode_set (rval);
} else {
- mono_runtime_try_invoke (method, NULL, pa, exc, error);
- if (*exc == NULL && !mono_error_ok (error))
- *exc = (MonoObject*) mono_error_convert_to_exception (error);
+ MonoError inner_error;
+ mono_runtime_try_invoke (method, NULL, pa, exc, &inner_error);
+ if (*exc == NULL && !mono_error_ok (&inner_error))
+ *exc = (MonoObject*) mono_error_convert_to_exception (&inner_error);
- mono_error_cleanup (error);
+ mono_error_cleanup (&inner_error);
if (*exc == NULL)
rval = 0;
if (*exc == NULL)
rval = 0;
MonoError error;
prepare_thread_to_exec_main (mono_object_domain (args), method);
if (exc) {
MonoError error;
prepare_thread_to_exec_main (mono_object_domain (args), method);
if (exc) {
- int rval = do_try_exec_main (method, args, exc, &error);
- if (*exc == NULL && !is_ok (&error))
- *exc = (MonoObject*) mono_error_convert_to_exception (&error);
- else
- mono_error_cleanup (&error);
+ int rval = do_try_exec_main (method, args, exc);
return rval;
} else {
int rval = do_exec_main_checked (method, args, &error);
return rval;
} else {
int rval = do_exec_main_checked (method, args, &error);
* On failure sets @error if Main couldn't be executed, or @exc if it threw an exception.
*/
int
* On failure sets @error if Main couldn't be executed, or @exc if it threw an exception.
*/
int
-mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoError *error)
+mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
- mono_error_init (error);
prepare_thread_to_exec_main (mono_object_domain (args), method);
prepare_thread_to_exec_main (mono_object_domain (args), method);
- return do_try_exec_main (method, args, exc, error);
+ return do_try_exec_main (method, args, exc);
MonoObject *exc = NULL;
int res;
MonoObject *exc = NULL;
int res;
- res = mono_runtime_try_run_main (method, argc, argv, &exc, &error);
- if (exc == NULL && !is_ok (&error))
- exc = (MonoObject*) mono_error_convert_to_exception (&error);
- else
- mono_error_cleanup (&error);
+ res = mono_runtime_try_run_main (method, argc, argv, &exc);
if (exc) {
mono_unhandled_exception (exc);
mono_invoke_unhandled_exception_hook (exc);
if (exc) {
mono_unhandled_exception (exc);
mono_invoke_unhandled_exception_hook (exc);