[mini] Remove CEE_MONO_CCASTCLASS. Could not remove from opcodes.def at it weirdly...
authorRodrigo Kumpera <kumpera@gmail.com>
Sun, 27 Nov 2016 02:04:21 +0000 (18:04 -0800)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 29 Nov 2016 00:01:25 +0000 (16:01 -0800)
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/mini/method-to-ir.c
mono/mini/mini.h
mono/mini/type-checking.c

index 1e194a283ef86dd781e797febc1bba5ed2966ca2..4459cb80496c900546775baffdb1ec438cf7a79d 100644 (file)
@@ -9075,91 +9075,6 @@ mono_marshal_get_isinst (MonoClass *klass)
        return res;
 }
 
-/*
- * mono_marshal_get_castclass:
- * @klass: the type of the field
- *
- * This method generates a function which can be used to cast an object to
- * an instance of the given type, icluding the case where the object is a proxy.
- * The generated function has the following signature:
- * MonoObject* __castclass_wrapper_ (MonoObject *obj)
- */
-MonoMethod *
-mono_marshal_get_castclass (MonoClass *klass)
-{
-       static MonoMethodSignature *castclass_sig = NULL;
-       GHashTable *cache;
-       MonoMethod *res;
-#ifndef DISABLE_REMOTING
-       int pos_was_ok, pos_was_ok2;
-#endif
-       char *name;
-       MonoMethodBuilder *mb;
-       WrapperInfo *info;
-
-       cache = get_cache (&klass->image->castclass_cache, mono_aligned_addr_hash, NULL);
-       if ((res = mono_marshal_find_in_cache (cache, klass)))
-               return res;
-
-       if (!castclass_sig) {
-               castclass_sig = mono_metadata_signature_alloc (mono_defaults.corlib, 1);
-               castclass_sig->params [0] = &mono_defaults.object_class->byval_arg;
-               castclass_sig->ret = &mono_defaults.object_class->byval_arg;
-               castclass_sig->pinvoke = 0;
-       }
-       
-       name = g_strdup_printf ("__castclass_wrapper_%s", klass->name); 
-       mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_CASTCLASS);
-       g_free (name);
-       
-       mb->method->save_lmf = 1;
-
-#ifndef DISABLE_JIT
-       /* check if the object is a proxy that needs special cast */
-       mono_mb_emit_ldarg (mb, 0);
-       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
-       mono_mb_emit_op (mb, CEE_MONO_CCASTCLASS, klass);
-
-       /* The result of MONO_CCASTCLASS can be:
-               0) the cast is valid
-               1) cast of unknown proxy type
-               or an exception if the cast is is invalid
-       */
-#ifndef DISABLE_REMOTING
-       pos_was_ok = mono_mb_emit_branch (mb, CEE_BRFALSE);
-
-       /* get the real proxy from the transparent proxy*/
-
-       mono_mb_emit_ldarg (mb, 0);
-       mono_mb_emit_managed_call (mb, mono_marshal_get_proxy_cancast (klass), NULL);
-       pos_was_ok2 = mono_mb_emit_branch (mb, CEE_BRTRUE);
-       
-       /* fail */
-       mono_mb_emit_exception (mb, "InvalidCastException", NULL);
-       
-       /* success */
-       mono_mb_patch_branch (mb, pos_was_ok);
-       mono_mb_patch_branch (mb, pos_was_ok2);
-#else
-       /* MONO_CCASTCLASS leaves an int in the stack with the result, pop it. */
-       mono_mb_emit_byte (mb, CEE_POP);
-#endif /* DISABLE_REMOTING */
-
-       mono_mb_emit_ldarg (mb, 0);
-       
-       /* the end */
-       mono_mb_emit_byte (mb, CEE_RET);
-#endif /* DISABLE_JIT */
-
-       info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE);
-
-       res = mono_mb_create_and_cache_full (cache, klass, mb, castclass_sig, castclass_sig->param_count + 16,
-                                                                                info, NULL);
-       mono_mb_free (mb);
-
-       return res;
-}
-
 /**
  * mono_marshal_get_struct_to_ptr:
  * @klass:
index e22653f2d5bd2f1538e4c02e1f451bca53a067b2..dd3fb2e8e4e75ff68d640cc603f52538bead6130 100644 (file)
@@ -371,9 +371,6 @@ mono_marshal_get_isinst_with_cache (void);
 MonoMethod *
 mono_marshal_get_isinst (MonoClass *klass);
 
-MonoMethod *
-mono_marshal_get_castclass (MonoClass *klass);
-
 MonoMethod *
 mono_marshal_get_stelemref (void);
 
index 6f1cebfdb57ebad28698808b0584df7bcfe862f3..5f1e987a572191aeea9c2fd7b8ed887b7afa5c1d 100644 (file)
@@ -11956,18 +11956,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                ip += 6;
                                break;
                        }
-                       case CEE_MONO_CISINST:
-                       case CEE_MONO_CCASTCLASS: {
+                       case CEE_MONO_CISINST: {
                                int token;
                                CHECK_STACK (1);
                                --sp;
                                CHECK_OPSIZE (6);
                                token = read32 (ip + 2);
                                klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                               if (ip [1] == CEE_MONO_CISINST)
-                                       ins = mini_emit_cisinst (cfg, klass, sp [0]);
-                               else
-                                       ins = mini_emit_ccastclass (cfg, klass, sp [0]);
+                               ins = mini_emit_cisinst (cfg, klass, sp [0]);
                                *sp++ = ins;
                                ip += 6;
                                break;
index 844b25c51a22aed15cd7a2b8fafed94656ec2593..bdb39efd872e53b0e4ae37ed210a5e5417de95e7 100644 (file)
@@ -2652,7 +2652,6 @@ void              mini_save_cast_details (MonoCompile *cfg, MonoClass *klass, in
 void              mini_reset_cast_details (MonoCompile *cfg);
 void              mini_emit_class_check (MonoCompile *cfg, int klass_reg, MonoClass *klass);
 
-MonoInst*         mini_emit_ccastclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src);
 MonoInst*         mini_emit_cisinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src);
 
 gboolean          mini_class_has_reference_variant_generic_argument (MonoCompile *cfg, MonoClass *klass, int context_used);
index d190436ea63e93e428c50fd6412de00fd33aee96..22058126c069978cd14061d89d1d0aed8b9ed5b4 100644 (file)
@@ -787,13 +787,6 @@ mini_emit_cisinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src)
        return ins;
 }
 
-MonoInst*
-mini_emit_ccastclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src)
-{
-       g_error ("not longer needed!");
-       return NULL;
-}
-
 //API used by method-to-ir.c
 void
 mini_emit_class_check (MonoCompile *cfg, int klass_reg, MonoClass *klass)