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);