Mark it external only. Runtime should use mono_compile_method_checked.
wrapper_method = mono_mb_create_method (mb, m.csig, m.csig->param_count + 16);
mono_cominterop_unlock ();
- vtable [vtable_index--] = mono_compile_method (wrapper_method);
+ vtable [vtable_index--] = mono_compile_method_checked (wrapper_method, error);
+ // cleanup, then error out if compile_method failed
for (param_index = sig_adjusted->param_count; param_index >= 0; param_index--)
if (mspecs [param_index])
mono_metadata_free_marshal_spec (mspecs [param_index]);
g_free (mspecs);
+ return_val_if_nok (error, NULL);
}
ccw_entry = g_new0 (MonoCCWInterface, 1);
if (!domain->finalize_runtime_invoke) {
MonoMethod *invoke = mono_marshal_get_runtime_invoke (mono_class_get_method_from_name_flags (mono_defaults.object_class, "Finalize", 0, 0), TRUE);
- domain->finalize_runtime_invoke = mono_compile_method (invoke);
+ domain->finalize_runtime_invoke = mono_compile_method_checked (invoke, &error);
+ mono_error_assert_ok (&error); /* expect this not to fail */
}
runtime_invoke = (RuntimeInvokeFunction)domain->finalize_runtime_invoke;
if (method_is_dynamic (method)) {
/* Creating a trampoline would leak memory */
- func = mono_compile_method (method);
+ func = mono_compile_method_checked (method, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
} else {
if (target && method->flags & METHOD_ATTRIBUTE_VIRTUAL && method->klass != mono_object_class (target))
method = mono_object_get_virtual_method (target, method);
ICALL_EXPORT gpointer
ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method)
{
- return mono_compile_method (method);
+ MonoError error;
+ gpointer result = mono_compile_method_checked (method, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
}
ICALL_EXPORT MonoString *
static void
delegate_hash_table_add (MonoDelegate *d);
+static void
+delegate_hash_table_remove (MonoDelegate *d);
+
static void
emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object);
register_icall (mono_struct_delete_old, "mono_struct_delete_old", "void ptr ptr", FALSE);
register_icall (mono_delegate_begin_invoke, "mono_delegate_begin_invoke", "object object ptr", FALSE);
register_icall (mono_delegate_end_invoke, "mono_delegate_end_invoke", "object object ptr", FALSE);
- register_icall (mono_compile_method, "mono_compile_method", "ptr ptr", FALSE);
register_icall (mono_context_get, "mono_context_get", "object", FALSE);
register_icall (mono_context_set, "mono_context_set", "void object", FALSE);
register_icall (mono_gc_wbarrier_generic_nostore, "wb_generic", "void ptr", FALSE);
wrapper = mono_marshal_get_managed_wrapper (method, klass, target_handle);
- delegate->delegate_trampoline = mono_compile_method (wrapper);
+ delegate->delegate_trampoline = mono_compile_method_checked (wrapper, &error);
+ if (!is_ok (&error))
+ goto fail;
// Add the delegate to the delegate hash table
delegate_hash_table_add (delegate);
/* when the object is collected, collect the dynamic method, too */
mono_object_register_finalizer ((MonoObject*)delegate, &error);
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return NULL;
- }
+ if (!is_ok (&error))
+ goto fail2;
return delegate->delegate_trampoline;
+
+fail2:
+ delegate_hash_table_remove (delegate);
+fail:
+ mono_gchandle_free (target_handle);
+ mono_error_set_pending_exception (&error);
+ return NULL;
}
/*
mono_error_set_pending_exception (&error);
return NULL;
}
- mono_delegate_ctor_with_method ((MonoObject*)d, this_obj, mono_compile_method (wrapper), wrapper);
+ gpointer compiled_ptr = mono_compile_method_checked (wrapper, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
+ mono_delegate_ctor_with_method ((MonoObject*)d, this_obj, compiled_ptr, wrapper);
}
if (d->object.vtable->domain != mono_domain_get ()) {
mono_metadata_free_marshal_spec (mspecs [i]);
g_free (mspecs);
- return mono_compile_method (method);
+ gpointer compiled_ptr = mono_compile_method_checked (method, &error);
+ mono_error_assert_ok (&error);
+ return compiled_ptr;
}
sig = mono_method_signature (method);
method = mono_mb_create (mb, sig, param_count, NULL);
mono_mb_free (mb);
- return mono_compile_method (method);
+ gpointer compiled_ptr = mono_compile_method_checked (method, &error);
+ mono_error_assert_ok (&error);
+ return compiled_ptr;
}
#ifndef DISABLE_JIT
MonoObject*
mono_runtime_invoke_checked (MonoMethod *method, void *obj, void **params, MonoError *error);
+void*
+mono_compile_method_checked (MonoMethod *method, MonoError *error);
MonoArray*
mono_runtime_get_main_args_checked (MonoError *error);
gpointer
mono_compile_method (MonoMethod *method)
{
- gpointer res;
MonoError error;
+ gpointer result = mono_compile_method_checked (method, &error);
+ mono_error_cleanup (&error);
+ return result;
+}
+
+/**
+ * mono_compile_method:
+ * @method: The method to compile.
+ * @error: set on error.
+ *
+ * This JIT-compiles the method, and returns the pointer to the native code
+ * produced. On failure returns NULL and sets @error.
+ */
+gpointer
+mono_compile_method_checked (MonoMethod *method, MonoError *error)
+{
+ gpointer res;
MONO_REQ_GC_NEUTRAL_MODE
+ mono_error_init (error);
+
if (!callbacks.compile_method) {
g_error ("compile method called on uninitialized runtime");
return NULL;
}
- res = callbacks.compile_method (method, &error);
- if (!mono_error_ok (&error))
- mono_error_raise_exception (&error);
+ res = callbacks.compile_method (method, error);
return res;
}
MONO_REQ_GC_NEUTRAL_MODE;
MONO_REQ_API_ENTRYPOINT;
+ MonoError error;
gpointer res;
g_assert (!mono_threads_is_coop_enabled ());
MONO_ENTER_GC_UNSAFE;
method = mono_marshal_get_thunk_invoke_wrapper (method);
- res = mono_compile_method (method);
+ res = mono_compile_method_checked (method, &error);
+ mono_error_cleanup (&error);
MONO_EXIT_GC_UNSAFE;
return res;
static MonoObject*
-mono_runtime_capture_context (MonoDomain *domain)
+mono_runtime_capture_context (MonoDomain *domain, MonoError *error)
{
MONO_REQ_GC_UNSAFE_MODE;
RuntimeInvokeFunction runtime_invoke;
+ mono_error_init (error);
+
if (!domain->capture_context_runtime_invoke || !domain->capture_context_method) {
MonoMethod *method = mono_get_context_capture_method ();
MonoMethod *wrapper;
if (!method)
return NULL;
wrapper = mono_marshal_get_runtime_invoke (method, FALSE);
- domain->capture_context_runtime_invoke = mono_compile_method (wrapper);
- domain->capture_context_method = mono_compile_method (method);
+ domain->capture_context_runtime_invoke = mono_compile_method_checked (wrapper, error);
+ return_val_if_nok (error, NULL);
+ domain->capture_context_method = mono_compile_method_checked (method, error);
+ return_val_if_nok (error, NULL);
}
runtime_invoke = (RuntimeInvokeFunction)domain->capture_context_runtime_invoke;
MonoError error;
MonoAsyncResult *res = (MonoAsyncResult *)mono_object_new_checked (domain, mono_defaults.asyncresult_class, &error);
mono_error_raise_exception (&error); /* FIXME don't raise here */
- MonoObject *context = mono_runtime_capture_context (domain);
+ MonoObject *context = mono_runtime_capture_context (domain, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
/* we must capture the execution context from the original thread */
if (context) {
MONO_OBJECT_SETREF (res, execution_context, context);
{
MONO_REQ_GC_UNSAFE_MODE;
+ MonoError error;
MonoDelegate *delegate = (MonoDelegate *)this_obj;
g_assert (this_obj);
if (target && target->vtable->klass == mono_defaults.transparent_proxy_class) {
g_assert (method);
method = mono_marshal_get_remoting_invoke (method);
- delegate->method_ptr = mono_compile_method (method);
+ delegate->method_ptr = mono_compile_method_checked (method, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
MONO_OBJECT_SETREF (delegate, target, target);
} else
#endif
MONO_API void
mono_print_unhandled_exception (MonoObject *exc);
+MONO_RT_EXTERNAL_ONLY
MONO_API void*
mono_compile_method (MonoMethod *method);
static MonoMethod *method_set_call_context, *method_needs_context_sink, *method_rs_serialize_exc;
#endif
+static gpointer
+mono_compile_method_icall (MonoMethod *method);
+
static void
register_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
{
register_icall (mono_marshal_xdomain_copy_out_value, "mono_marshal_xdomain_copy_out_value", "void object object", FALSE);
register_icall (mono_remoting_wrapper, "mono_remoting_wrapper", "object ptr ptr", FALSE);
register_icall (mono_upgrade_remote_class_wrapper, "mono_upgrade_remote_class_wrapper", "void object object", FALSE);
+ register_icall (mono_compile_method_icall, "mono_compile_method_icall", "ptr ptr", FALSE);
/* mono_load_remote_field_new_icall registered by mini-runtime.c */
/* mono_store_remote_field_new_icall registered by mini-runtime.c */
mono_mb_emit_icall (mb, mono_marshal_set_domain_by_id);
}
+gpointer
+mono_compile_method_icall (MonoMethod *method)
+{
+ MonoError error;
+ gpointer result = mono_compile_method_checked (method, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
+}
+
/* mono_marshal_emit_load_domain_method ()
* Loads into the stack a pointer to the code of the provided method for
* the current domain.
* that compiles the method).
*/
mono_mb_emit_ptr (mb, method);
- mono_mb_emit_icall (mb, mono_compile_method);
+ mono_mb_emit_icall (mb, mono_compile_method_icall);
}
#endif
G_GNUC_UNUSED static gpointer
mono_marshal_load_remoting_wrapper (MonoRealProxy *rp, MonoMethod *method)
{
+ MonoError error;
+ MonoMethod *marshal_method = NULL;
if (rp->target_domain_id != -1)
- return mono_compile_method (mono_marshal_get_xappdomain_invoke (method));
+ marshal_method = mono_marshal_get_xappdomain_invoke (method);
else
- return mono_compile_method (mono_marshal_get_remoting_invoke (method));
+ marshal_method = mono_marshal_get_remoting_invoke (method);
+ gpointer compiled_ptr = mono_compile_method_checked (marshal_method, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
+ return compiled_ptr;
}
MonoMethod *
if (mono_llvm_only) {
// FIXME: No error handling
- addr = mono_compile_method (method);
+ addr = mono_compile_method_checked (method, &error);
+ mono_error_assert_ok (&error);
g_assert (addr);
if (mono_method_needs_static_rgctx_invoke (method, FALSE))
gpointer
mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg)
{
+ MonoError error;
MonoMethod *vmethod;
gpointer addr;
MonoGenericContext *context = mono_method_get_context (method);
g_assert (!vmethod->klass->generic_class || !vmethod->klass->generic_class->context.class_inst->is_open);
g_assert (!context->method_inst || !context->method_inst->is_open);
- addr = mono_compile_method (vmethod);
+ addr = mono_compile_method_checked (vmethod, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
addr = mini_add_method_trampoline (vmethod, addr, mono_method_needs_static_rgctx_invoke (vmethod, FALSE), FALSE);
gpointer
mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpointer func)
{
+ MonoError error;
MonoMarshalSpec **mspecs;
MonoMethodPInvoke piinfo;
MonoMethod *m;
m = mono_marshal_get_native_func_wrapper (image, sig, &piinfo, mspecs, func);
- return mono_compile_method (m);
+ gpointer compiled_ptr = mono_compile_method_checked (m, &error);
+ mono_error_set_pending_exception (&error);
+ return compiled_ptr;
}
static MonoMethod*
static gpointer
resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method, gpointer *out_arg, gboolean caller_gsharedvt)
{
+ MonoError error;
MonoVTable *vt;
gpointer *imt, *vtable_slot;
MonoMethod *impl_method, *generic_virtual = NULL, *variant_iface = NULL;
vtable_slot = mini_resolve_imt_method (vt, imt + imt_slot, imt_method, &impl_method, &aot_addr, &need_rgctx_tramp, &variant_iface);
// FIXME: This can throw exceptions
- addr = compiled_method = mono_compile_method (impl_method);
+ addr = compiled_method = mono_compile_method_checked (impl_method, &error);
+ mono_error_assert_ok (&error);
g_assert (addr);
if (imt_method->is_inflated && ((MonoMethodInflated*)imt_method)->context.method_inst)
static gpointer
resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_arg, gboolean gsharedvt)
{
+ MonoError error;
MonoMethod *m, *generic_virtual = NULL;
gpointer addr, compiled_method;
gboolean need_unbox_tramp = FALSE;
m = mono_class_get_vtable_entry (vt->klass, slot);
if (is_generic_method_definition (m)) {
- MonoError error;
MonoGenericContext context = { NULL, NULL };
MonoMethod *declaring;
context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst;
m = mono_class_inflate_generic_method_checked (declaring, &context, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ mono_error_assert_ok (&error); /* FIXME don't swallow the error */
}
if (generic_virtual) {
}
// FIXME: This can throw exceptions
- addr = compiled_method = mono_compile_method (m);
+ addr = compiled_method = mono_compile_method_checked (m, &error);
+ mono_error_assert_ok (&error);
g_assert (addr);
addr = mini_add_method_wrappers_llvmonly (m, addr, gsharedvt, need_unbox_tramp, out_arg);
need_unbox_tramp = TRUE;
// FIXME: This can throw exceptions
- addr = compiled_method = mono_compile_method (m);
+ addr = compiled_method = mono_compile_method_checked (m, &error);
+ mono_error_assert_ok (&error);
g_assert (addr);
addr = mini_add_method_wrappers_llvmonly (m, addr, FALSE, need_unbox_tramp, &arg);
MonoFtnDesc*
mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMethod *generic_virtual)
{
+ MonoError error;
MonoMethod *m, *variant_iface;
gpointer addr, aot_addr, compiled_method;
gboolean need_unbox_tramp = FALSE;
need_unbox_tramp = TRUE;
// FIXME: This can throw exceptions
- addr = compiled_method = mono_compile_method (m);
+ addr = compiled_method = mono_compile_method_checked (m, &error);
+ mono_error_assert_ok (&error);
g_assert (addr);
addr = mini_add_method_wrappers_llvmonly (m, addr, FALSE, need_unbox_tramp, &arg);
void
mono_llvmonly_init_delegate (MonoDelegate *del)
{
+ MonoError error;
MonoFtnDesc *ftndesc = *(MonoFtnDesc**)del->method_code;
/*
* but we don't have a a structure which could own its memory.
*/
if (G_UNLIKELY (!ftndesc)) {
- gpointer addr = mono_compile_method (del->method);
+ gpointer addr = mono_compile_method_checked (del->method, &error);
+ if (mono_error_set_pending_exception (&error))
+ return;
if (del->method->klass->valuetype && mono_method_signature (del->method)->hasthis)
addr = mono_aot_get_unbox_trampoline (del->method);
void
mono_llvmonly_init_delegate_virtual (MonoDelegate *del, MonoObject *target, MonoMethod *method)
{
+ MonoError error;
+
g_assert (target);
method = mono_object_get_virtual_method (target, method);
del->method = method;
- del->method_ptr = mono_compile_method (method);
+ del->method_ptr = mono_compile_method_checked (method, &error);
+ if (mono_error_set_pending_exception (&error))
+ return;
if (method->klass->valuetype)
del->method_ptr = mono_aot_get_unbox_trampoline (method);
del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
memcpy_method [size] = m;
}
if (!domain_info->memcpy_addr [size]) {
- gpointer addr = mono_compile_method (memcpy_method [size]);
+ gpointer addr = mono_compile_method_checked (memcpy_method [size], error);
mono_memory_barrier ();
domain_info->memcpy_addr [size] = (gpointer *)addr;
+ mono_error_assert_ok (error);
}
return domain_info->memcpy_addr [size];
} else {
bzero_method [size] = m;
}
if (!domain_info->bzero_addr [size]) {
- gpointer addr = mono_compile_method (bzero_method [size]);
+ gpointer addr = mono_compile_method_checked (bzero_method [size], error);
mono_memory_barrier ();
domain_info->bzero_addr [size] = (gpointer *)addr;
+ mono_error_assert_ok (error);
}
return domain_info->bzero_addr [size];
}
{
static gboolean inited = FALSE;
static int num_trampolines;
+ MonoError error;
gpointer res, info;
MonoDomain *domain = mono_domain_get ();
MonoJitDomainInfo *domain_info;
wrapper = mini_get_gsharedvt_in_sig_wrapper (normal_sig);
else
wrapper = mini_get_gsharedvt_out_sig_wrapper (normal_sig);
- res = mono_compile_method (wrapper);
+ res = mono_compile_method_checked (wrapper, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
return res;
}
if (!tramp_addr) {
wrapper = mono_marshal_get_gsharedvt_in_wrapper ();
- addr = mono_compile_method (wrapper);
+ addr = mono_compile_method_checked (wrapper, &error);
mono_memory_barrier ();
+ mono_error_assert_ok (&error);
tramp_addr = addr;
}
addr = tramp_addr;
if (!tramp_addr) {
wrapper = mono_marshal_get_gsharedvt_out_wrapper ();
- addr = mono_compile_method (wrapper);
+ addr = mono_compile_method_checked (wrapper, &error);
mono_memory_barrier ();
+ mono_error_assert_ok (&error);
tramp_addr = addr;
}
addr = tramp_addr;
gpointer arg = NULL;
if (mono_llvm_only) {
- addr = mono_compile_method (m);
+ addr = mono_compile_method_checked (m, error);
+ return_val_if_nok (error, NULL);
addr = mini_add_method_wrappers_llvmonly (m, addr, FALSE, FALSE, &arg);
/* Returns an ftndesc */
return mini_create_llvmonly_ftndesc (domain, addr, arg);
} else {
- addr = mono_compile_method ((MonoMethod *)data);
+ addr = mono_compile_method_checked ((MonoMethod *)data, error);
+ return_val_if_nok (error, NULL);
return mini_add_method_trampoline ((MonoMethod *)data, addr, mono_method_needs_static_rgctx_invoke ((MonoMethod *)data, FALSE), FALSE);
}
}
g_assert (mono_llvm_only);
- addr = mono_compile_method (m);
+ addr = mono_compile_method_checked (m, error);
+ return_val_if_nok (error, NULL);
MonoJitInfo *ji;
gboolean callee_gsharedvt;
method = info->klass->vtable [ioffset + slot];
method = mono_class_inflate_generic_method_checked (method, context, error);
- if (!mono_error_ok (error))
- return NULL;
- addr = mono_compile_method (method);
+ return_val_if_nok (error, NULL);
+ addr = mono_compile_method_checked (method, error);
+ return_val_if_nok (error, NULL);
return mini_add_method_trampoline (method, addr, mono_method_needs_static_rgctx_invoke (method, FALSE), FALSE);
}
case MONO_RGCTX_INFO_VIRT_METHOD_BOX_TYPE: {
}
#ifndef DISABLE_REMOTING
case MONO_RGCTX_INFO_REMOTING_INVOKE_WITH_CHECK:
- return mono_compile_method (mono_marshal_get_remoting_invoke_with_check ((MonoMethod *)data));
+ return mono_compile_method_checked (mono_marshal_get_remoting_invoke_with_check ((MonoMethod *)data), error);
#endif
case MONO_RGCTX_INFO_METHOD_DELEGATE_CODE:
return mono_domain_alloc0 (domain, sizeof (gpointer));
g_assert (method->is_inflated);
- if (!virtual_)
- addr = mono_compile_method (method);
- else
+ if (!virtual_) {
+ addr = mono_compile_method_checked (method, error);
+ return_val_if_nok (error, NULL);
+ } else
addr = NULL;
if (virtual_) {
gconstpointer
mono_icall_get_wrapper_full (MonoJitICallInfo* callinfo, gboolean do_compile)
{
+ MonoError error;
char *name;
MonoMethod *wrapper;
gconstpointer trampoline;
g_free (name);
if (do_compile) {
- trampoline = mono_compile_method (wrapper);
+ trampoline = mono_compile_method_checked (wrapper, &error);
+ mono_error_assert_ok (&error);
} else {
- MonoError error;
trampoline = mono_create_jit_trampoline (domain, wrapper, &error);
mono_error_assert_ok (&error);
static gpointer
mono_jit_create_remoting_trampoline (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target)
{
+ MonoError error;
MonoMethod *nm;
guint8 *addr = NULL;
if ((method->flags & METHOD_ATTRIBUTE_ABSTRACT) ||
(mono_method_signature (method)->hasthis && (mono_class_is_marshalbyref (method->klass) || method->klass == mono_defaults.object_class))) {
nm = mono_marshal_get_remoting_invoke_for_target (method, target);
- addr = (guint8 *)mono_compile_method (nm);
+ addr = (guint8 *)mono_compile_method_checked (nm, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
} else
{
- addr = (guint8 *)mono_compile_method (method);
+ addr = (guint8 *)mono_compile_method_checked (method, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
}
return mono_get_addr_from_ftnptr (addr);
}
g_print ("Compiling %d %s\n", count, desc);
g_free (desc);
}
- mono_compile_method (method);
+ mono_compile_method_checked (method, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
+ continue;
+ }
if (strcmp (method->name, "Finalize") == 0) {
invoke = mono_marshal_get_runtime_invoke (method, FALSE);
- mono_compile_method (invoke);
+ mono_compile_method_checked (invoke, &error);
+ mono_error_assert_ok (&error);
}
#ifndef DISABLE_REMOTING
if (mono_class_is_marshalbyref (method->klass) && mono_method_signature (method)->hasthis) {
invoke = mono_marshal_get_remoting_invoke_with_check (method);
- mono_compile_method (invoke);
+ mono_compile_method_checked (invoke, &error);
+ mono_error_assert_ok (&error);
}
#endif
}
mono_lookup_pinvoke_call (method, NULL, NULL);
}
nm = mono_marshal_get_native_wrapper (method, TRUE, mono_aot_only);
- code = mono_get_addr_from_ftnptr (mono_compile_method (nm));
+ gpointer compiled_method = mono_compile_method_checked (nm, error);
+ return_val_if_nok (error, NULL);
+ code = mono_get_addr_from_ftnptr (compiled_method);
jinfo = mono_jit_info_table_find (target_domain, (char *)code);
if (!jinfo)
jinfo = mono_jit_info_table_find (mono_domain_get (), (char *)code);
} else if (*name == 'I' && (strcmp (name, "Invoke") == 0)) {
if (mono_llvm_only) {
nm = mono_marshal_get_delegate_invoke (method, NULL);
- return mono_get_addr_from_ftnptr (mono_compile_method (nm));
+ gpointer compiled_ptr = mono_compile_method_checked (nm, error);
+ mono_error_assert_ok (error);
+ return mono_get_addr_from_ftnptr (compiled_ptr);
}
return mono_create_delegate_trampoline (target_domain, method->klass);
} else if (*name == 'B' && (strcmp (name, "BeginInvoke") == 0)) {
nm = mono_marshal_get_delegate_begin_invoke (method);
- return mono_get_addr_from_ftnptr (mono_compile_method (nm));
+ gpointer compiled_ptr = mono_compile_method_checked (nm, error);
+ mono_error_assert_ok (error);
+ return mono_get_addr_from_ftnptr (compiled_ptr);
} else if (*name == 'E' && (strcmp (name, "EndInvoke") == 0)) {
nm = mono_marshal_get_delegate_end_invoke (method);
- return mono_get_addr_from_ftnptr (mono_compile_method (nm));
+ gpointer compiled_ptr = mono_compile_method_checked (nm, error);
+ mono_error_assert_ok (error);
+ return mono_get_addr_from_ftnptr (compiled_ptr);
}
}