2004-09-01 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Wed, 1 Sep 2004 06:52:55 +0000 (06:52 -0000)
committerMartin Baulig <martin@novell.com>
Wed, 1 Sep 2004 06:52:55 +0000 (06:52 -0000)
* metadata.c (mono_type_size): If we're a generic instance, call
mono_class_value_size() for value types.

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

mono/metadata/ChangeLog
mono/metadata/metadata.c

index 1711d1f0d4de406e7dd75414421a1d78994e723f..6348109f859681a81f18436b788c20c3a5321eb2 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-01  Martin Baulig  <martin@ximian.com>
+
+       * metadata.c (mono_type_size): If we're a generic instance, call
+       mono_class_value_size() for value types.
+
 2004-08-31  Zoltan Varga  <vargaz@freemail.hu>
 
        * marshal.c: Implement more custom marshalling functionality. Fixes
index 6b7d46b5c86d4f89c98f92762b673bec72f0484e..be2e65f6fe35a1193058319a0cfb3a66b35d3d3f 100644 (file)
@@ -2365,8 +2365,13 @@ mono_type_size (MonoType *t, gint *align)
                return mono_class_value_size (mono_defaults.typed_reference_class, align);
        case MONO_TYPE_GENERICINST: {
                MonoGenericInst *ginst = t->data.generic_inst;
-               MonoClass *iclass = mono_class_from_mono_type (ginst->generic_type);
-               return mono_type_size (&iclass->byval_arg, align);
+
+               if (MONO_TYPE_ISSTRUCT (ginst->generic_type))
+                       return mono_class_value_size (ginst->klass, align);
+               else {
+                       *align = __alignof__(gpointer);
+                       return sizeof (gpointer);
+               }
        }
        case MONO_TYPE_VAR:
        case MONO_TYPE_MVAR: