}
static gpointer
-mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException **ex)
+mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *error)
{
MonoDomain *target_domain, *domain = mono_domain_get ();
MonoJitInfo *info;
MonoJitICallInfo *callinfo = NULL;
WrapperInfo *winfo = NULL;
+ mono_error_init (error);
+
/*
* ICALL wrappers are handled specially, since there is only one copy of them
* shared by all appdomains.
ctx = mono_method_get_context (method);
method = info->d.synchronized_inner.method;
if (ctx) {
- MonoError error;
- method = mono_class_inflate_generic_method_checked (method, ctx, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ method = mono_class_inflate_generic_method_checked (method, ctx, error);
+ g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */
}
}
}
mono_jit_stats.methods_lookups++;
vtable = mono_class_vtable (domain, method->klass);
g_assert (vtable);
- tmpEx = mono_runtime_class_init_full (vtable, ex == NULL);
+ tmpEx = mono_runtime_class_init_full (vtable, FALSE);
if (tmpEx) {
- *ex = tmpEx;
+ mono_error_set_exception_instance (error, tmpEx);
return NULL;
}
return mono_create_ftnptr (target_domain, info->code_start);
#endif
if (!code)
- code = mono_jit_compile_method_inner (method, target_domain, opt, ex);
+ code = mono_jit_compile_method_inner (method, target_domain, opt, error);
+ if (!mono_error_ok (error))
+ return NULL;
if (!code && mono_llvm_only) {
if (method->wrapper_type == MONO_WRAPPER_UNKNOWN) {
gpointer
mono_jit_compile_method (MonoMethod *method)
{
- MonoException *ex = NULL;
+ MonoError error;
gpointer code;
- code = mono_jit_compile_method_with_opt (method, mono_get_optimizations_for_method (method, default_opt), &ex);
+ mono_error_init (&error);
+ code = mono_jit_compile_method_with_opt (method, mono_get_optimizations_for_method (method, default_opt), &error);
if (!code) {
- g_assert (ex);
- mono_raise_exception (ex);
+ g_assert (!mono_error_ok (&error));
+ mono_error_raise_exception (&error);
}
return code;
}
if (callee) {
- MonoException *jit_ex = NULL;
+ MonoError error;
- compiled_method = mono_jit_compile_method_with_opt (callee, mono_get_optimizations_for_method (callee, default_opt), &jit_ex);
+ compiled_method = mono_jit_compile_method_with_opt (callee, mono_get_optimizations_for_method (callee, default_opt), &error);
if (!compiled_method) {
- g_assert (jit_ex);
+ g_assert (!mono_error_ok (&error));
if (exc) {
- *exc = (MonoObject*)jit_ex;
+ *exc = (MonoObject*)mono_error_convert_to_exception (&error);
return NULL;
} else {
- mono_raise_exception (jit_ex);
+ mono_error_raise_exception (&error);
/* coverity[unreachable] */
}
}
* Main entry point for the JIT.
*/
gpointer
-mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoException **jit_ex)
+mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoError *error)
{
MonoCompile *cfg;
gpointer code = NULL;
GTimer *jit_timer;
MonoMethod *prof_method, *shared;
+ mono_error_init (error);
+
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
MonoMethod *nm;
full_name = mono_method_full_name (method, TRUE);
msg = g_strdup_printf ("Unrecognizable runtime implemented method '%s'", full_name);
- *jit_ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", msg);
+ ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", msg);
+ mono_error_set_exception_instance (error, ex);
g_free (full_name);
g_free (msg);
return NULL;
char *fullname = mono_method_full_name (method, TRUE);
char *msg = g_strdup_printf ("Attempting to JIT compile method '%s' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.\n", fullname);
- *jit_ex = mono_get_exception_execution_engine (msg);
+ ex = mono_get_exception_execution_engine (msg);
+ mono_error_set_exception_instance (error, ex);
g_free (fullname);
g_free (msg);
break;
}
case MONO_EXCEPTION_MONO_ERROR:
+ // FIXME: MonoError has no copy ctor
g_assert (!mono_error_ok (&cfg->error));
ex = mono_error_convert_to_exception (&cfg->error);
break;
mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_FAILED);
mono_destroy_compile (cfg);
- *jit_ex = ex;
+ mono_error_set_exception_instance (error, ex);
return NULL;
}
if (!vtable) {
ex = mono_class_get_exception_for_failure (method->klass);
g_assert (ex);
- *jit_ex = ex;
+ mono_error_set_exception_instance (error, ex);
return NULL;
}
ex = mono_runtime_class_init_full (vtable, FALSE);
if (ex) {
- *jit_ex = ex;
+ mono_error_set_exception_instance (error, ex);
return NULL;
}
return code;
gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji);
gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method);
gpointer mono_jit_compile_method (MonoMethod *method);
-gpointer mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoException **jit_ex);
+gpointer mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoError *error);
MonoLMF * mono_get_lmf (void);
MonoLMF** mono_get_lmf_addr (void);
void mono_set_lmf (MonoLMF *lmf);