Merge pull request #2716 from BrzVlad/fix-tramp-jinfo
[mono.git] / mono / mini / mini-sparc.c
index d64be482f1280c6bb10814d58dae25f97fdc5be8..b29563dcb0ac480f6e6f93651ebd654b5e3c3466 100644 (file)
@@ -1561,6 +1561,7 @@ else { \
 static guint32*
 emit_call (MonoCompile *cfg, guint32 *code, guint32 patch_type, gconstpointer data)
 {
+       MonoError error;
        gpointer target;
 
        /* FIXME: This only works if the target method is already compiled */
@@ -1570,7 +1571,8 @@ emit_call (MonoCompile *cfg, guint32 *code, guint32 patch_type, gconstpointer da
                patch_info.type = patch_type;
                patch_info.data.target = data;
 
-               target = mono_resolve_patch_target (cfg->method, cfg->domain, NULL, &patch_info, FALSE);
+               target = mono_resolve_patch_target (cfg->method, cfg->domain, NULL, &patch_info, FALSE, &error);
+               mono_error_raise_exception (&error); /* FIXME: don't raise here */
 
                /* FIXME: Add optimizations if the target is close enough */
                sparc_set (code, target, sparc_o7);
@@ -3624,7 +3626,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        sparc_srl_imm (code, sparc_o7, 4, sparc_o7);
                        sparc_and_imm (code, FALSE, sparc_o7, 2047, sparc_o7);
                        sparc_cmp_imm (code, sparc_o7, 2047);
-                       EMIT_COND_SYSTEM_EXCEPTION (ins, sparc_be, "ArithmeticException");
+                       EMIT_COND_SYSTEM_EXCEPTION (ins, sparc_be, "OverflowException");
 #ifdef SPARCV9
                        sparc_fmovd (code, ins->sreg1, ins->dreg);
 #else
@@ -3672,6 +3674,7 @@ mono_arch_register_lowlevel_calls (void)
 void
 mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
 {
+       MonoError error;
        MonoJumpInfo *patch_info;
 
        /* FIXME: Move part of this to arch independent code */
@@ -3679,7 +3682,8 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
                unsigned char *ip = patch_info->ip.i + code;
                gpointer target;
 
-               target = mono_resolve_patch_target (method, domain, code, patch_info, run_cctors);
+               target = mono_resolve_patch_target (method, domain, code, patch_info, run_cctors, &error);
+               mono_error_raise_exception (&error); /* FIXME: don't raise here */
 
                switch (patch_info->type) {
                case MONO_PATCH_INFO_NONE:
@@ -4204,8 +4208,7 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
 
                        sparc_patch ((guint32*)(cfg->native_code + patch_info->ip.i), code);
 
-                       exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
-                       g_assert (exc_class);
+                       exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
                        type_idx = exc_class->type_token - MONO_TOKEN_TYPE_DEF;
                        throw_ip = patch_info->ip.i;