Merge pull request #3262 from lindenlab/add_continuations_test
[mono.git] / mono / mini / mini-sparc.c
index d64be482f1280c6bb10814d58dae25f97fdc5be8..022f8a5e790b8ea9334d4fa61bb7f92c99229c9f 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
@@ -3670,16 +3672,19 @@ mono_arch_register_lowlevel_calls (void)
 }
 
 void
-mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors, MonoError *error)
 {
        MonoJumpInfo *patch_info;
 
+       mono_error_init (error);
+
        /* FIXME: Move part of this to arch independent code */
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
                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);
+               return_if_nok (error);
 
                switch (patch_info->type) {
                case MONO_PATCH_INFO_NONE:
@@ -4204,8 +4209,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;