2010-07-11 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sun, 11 Jul 2010 19:56:18 +0000 (19:56 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sun, 11 Jul 2010 19:56:18 +0000 (19:56 -0000)
* method-to-ir.c (mono_method_to_ir): Kill some duplicated code.

svn path=/trunk/mono/; revision=160207

mono/mini/ChangeLog
mono/mini/method-to-ir.c

index afbfd26ba8958a27e3498d7e394ede0e25fdee72..b8fc8310333aeec37ade6a8c04e44da8be44b8c8 100755 (executable)
@@ -1,5 +1,7 @@
 2010-07-11  Zoltan Varga  <vargaz@gmail.com>
 
+       * method-to-ir.c (mono_method_to_ir): Kill some duplicated code.
+
        * mini-<ARCH>.c (get_call_info): Call mini_type_get_underlying_type () before passing
        a type to MONO_TYPE_IS_REFERENCE (), since the latter can't handle VAR/MVAR.
        Fixes #620864.
index d997994f7a376a83c5876c43b022779e6bc0988c..960bd4f6c7829c897cdc416cc30d5cd824acacc6 100644 (file)
@@ -7843,18 +7843,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                        if (generic_class_is_reference_type (cfg, klass)) {
                                /* CASTCLASS FIXME kill this huge slice of duplicated code*/
-                               if (context_used) {
-                                       MonoInst *iargs [2];
-
-                                       /* obj */
-                                       iargs [0] = *sp;
-                                       /* klass */
-                                       iargs [1] = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS);
-                                       ins = mono_emit_jit_icall (cfg, mono_object_castclass, iargs);
-                                       *sp ++ = ins;
-                                       ip += 5;
-                                       inline_costs += 2;
-                               } else if (klass->marshalbyref || klass->flags & TYPE_ATTRIBUTE_INTERFACE) {                            
+                               if (!context_used && (klass->marshalbyref || klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
                                        MonoMethod *mono_castclass;
                                        MonoInst *iargs [1];
                                        int costs;
@@ -7874,7 +7863,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        *sp++ = iargs [0];
                                        inline_costs += costs;
                                } else {
-                                       ins = handle_castclass (cfg, klass, *sp, 0);
+                                       ins = handle_castclass (cfg, klass, *sp, context_used);
                                        CHECK_CFG_EXCEPTION;
                                        bblock = cfg->cbb;
                                        *sp ++ = ins;