[jit] Pass the type token index instead of the full type token to the throw corlib...
authorZoltan Varga <vargaz@gmail.com>
Mon, 28 Mar 2016 22:33:53 +0000 (18:33 -0400)
committerZoltan Varga <vargaz@gmail.com>
Mon, 28 Mar 2016 22:33:58 +0000 (18:33 -0400)
mono/mini/exceptions-arm.c
mono/mini/mini-arm.c
mono/mini/mini-llvm.c

index 73e0f4d1b6d3d24b78f0343ae4b67cca23dedeaa..4c2b5ce821db200b5cbb1765ac463eb54cde8463 100644 (file)
@@ -167,12 +167,13 @@ mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_
 }
 
 void
-mono_arm_throw_exception_by_token (guint32 type_token, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs)
+mono_arm_throw_exception_by_token (guint32 ex_token_index, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs)
 {
+       guint32 ex_token = MONO_TOKEN_TYPE_DEF | ex_token_index;
        /* Clear thumb bit */
        pc &= ~1;
 
-       mono_arm_throw_exception ((MonoObject*)mono_exception_from_token (mono_defaults.corlib, type_token), pc, sp, int_regs, fp_regs);
+       mono_arm_throw_exception ((MonoObject*)mono_exception_from_token (mono_defaults.corlib, ex_token), pc, sp, int_regs, fp_regs);
 }
 
 void
index c584d6c8b4249fc36ef7ddd76f8762dab64367e5..a7df6fc1c1b282990ba87401cf50423291a546f0 100644 (file)
@@ -6827,7 +6827,7 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
                        patch_info->ip.i = code - cfg->native_code;
                        ARM_BL (code, 0);
                        cfg->thunk_area += THUNK_SIZE;
-                       *(guint32*)(gpointer)code = exc_class->type_token;
+                       *(guint32*)(gpointer)code = exc_class->type_token - MONO_TOKEN_TYPE_DEF;
                        code += 4;
 #endif
                        break;
index 558db05357e9a8a6085d952badbdbb1b470e6339..82bb27358ededaa09de12f68c61240eff8bf9cd1 100644 (file)
@@ -2144,10 +2144,7 @@ emit_cond_system_exception (EmitContext *ctx, MonoBasicBlock *bb, const char *ex
                }
        }
 
-       if (IS_TARGET_X86 || IS_TARGET_AMD64)
-               args [0] = LLVMConstInt (LLVMInt32Type (), exc_class->type_token - MONO_TOKEN_TYPE_DEF, FALSE);
-       else
-               args [0] = LLVMConstInt (LLVMInt32Type (), exc_class->type_token, FALSE);
+       args [0] = LLVMConstInt (LLVMInt32Type (), exc_class->type_token - MONO_TOKEN_TYPE_DEF, FALSE);
 
        /*
         * The LLVM mono branch contains changes so a block address can be passed as an