2006-01-03 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / inssel.brg
index 9aff26163d02990441a23fba6eafaded58109eac..ddeb206fb2deee101d2e13675f6618a7c0419b10 100644 (file)
@@ -408,6 +408,10 @@ stmt: OP_DUMMY_STORE {
 stmt: OP_NOT_REACHED {
 }
 
+stmt: OP_MEMORY_BARRIER {
+       mono_bblock_add_inst (s->cbb, tree);
+}
+
 #
 # load/store operations
 #
@@ -1064,6 +1068,10 @@ reg: CEE_ISINST (reg) {
                                /* the object_is_null target simply copies the input register to the output */
                                mini_emit_isninst_cast (s, eclass_reg, klass->cast_class, false_label, object_is_null);
                        }
+               } else if (mono_class_is_nullable (klass)) {
+                       MONO_EMIT_NEW_LOAD_MEMBASE (s, klass_reg, vtable_reg, G_STRUCT_OFFSET (MonoVTable, klass));
+                       /* the object_is_null target simply copies the input register to the output */
+                       mini_emit_isninst_cast (s, klass_reg, klass->cast_class, false_label, object_is_null);
                } else {
                        if (!s->compile_aot && !(s->opt & MONO_OPT_SHARED) && (klass->flags & TYPE_ATTRIBUTE_SEALED)) {
                                /* the remoting code is broken, access the class for now */
@@ -1818,42 +1826,6 @@ mini_emit_castclass_iface_class (MonoCompile *s, int klass_reg, MonoClass *klass
        MONO_EMIT_NEW_COND_EXC (s, EQ, "InvalidCastException");
 }
 
-static int
-size_to_load_u_membase (int size)
-{
-       switch (size) {
-       case 1:
-               return OP_LOADU1_MEMBASE;
-       case 2:
-               return OP_LOADU2_MEMBASE;
-       case 4:
-               return OP_LOADU4_MEMBASE;
-       case 8:
-               return OP_LOADI8_MEMBASE;
-       default:
-               g_assert_not_reached ();
-               return -1;
-       }
-}
-
-static int
-size_to_store_membase_reg (int size)
-{
-       switch (size) {
-       case 1:
-               return OP_STOREI1_MEMBASE_REG;
-       case 2:
-               return OP_STOREI2_MEMBASE_REG;
-       case 4:
-               return OP_STOREI4_MEMBASE_REG;
-       case 8:
-               return OP_STOREI8_MEMBASE_REG;
-       default:
-               g_assert_not_reached ();
-               return -1;
-       }
-}
-
 void 
 mini_emit_memcpy (MonoCompile *s, int destreg, int doffset, int srcreg, int soffset, int size, int align)
 {