Mon Jan 17 16:14:46 CET 2005 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Mon, 17 Jan 2005 15:07:06 +0000 (15:07 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Mon, 17 Jan 2005 15:07:06 +0000 (15:07 -0000)
* class.c, object.c, class-internals.h, marshal.c: rearrange
some fields and tweak some types to lower memory usage.

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

mono/metadata/ChangeLog
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/marshal.c
mono/metadata/object.c

index 35acd3d287aeb63d01f86d5b4497f2e1409c31ac..3b486ef710d4deb19bad62a89634122dfb930f01 100644 (file)
@@ -1,3 +1,9 @@
+
+Mon Jan 17 16:14:46 CET 2005 Paolo Molaro <lupus@ximian.com>
+
+       * class.c, object.c, class-internals.h, marshal.c: rearrange
+       some fields and tweak some types to lower memory usage.
+
 2005-01-17  Zoltan Varga  <vargaz@freemail.hu>
 
        * threads.c (signal_thread_state_change): Handle the case when the
index 239d4a201226f3e24bf24b178306de408f6504a4..c3668be77b73237c3bef55005f7b0ba8ede6f6ec 100644 (file)
@@ -183,7 +183,7 @@ struct _MonoClass {
        /* used for subtype checks */
        MonoClass *cast_class; 
        /* array dimension */
-       guint32    rank;          
+       guint    rank;          
 
        guint inited          : 1;
        /* We use init_pending to detect cyclic calls to mono_class_init */
@@ -224,15 +224,15 @@ struct _MonoClass {
        const char *name;
        const char *name_space;
        
-       guint       interface_count;
-       guint       interface_id;        /* unique inderface id (for interfaces) */
-       guint       max_interface_id;
-        gint       *interface_offsets;   
-       MonoClass **interfaces;
-
        /* for fast subtype checks */
-       guint       idepth;
        MonoClass **supertypes;
+       guint16     idepth;
+
+       guint16     interface_count;
+       guint16     interface_id;        /* unique inderface id (for interfaces) */
+       guint16     max_interface_id;
+        gint       *interface_offsets;   
+       MonoClass **interfaces;
 
        /*
         * Computed object instance size, total.
@@ -291,10 +291,11 @@ struct MonoVTable {
         */
        void *gc_descr;         
        MonoDomain *domain;  /* each object/vtable belongs to exactly one domain */
-       guint32       max_interface_id;
         gpointer   *interface_offsets;   
         gpointer    data; /* to store static class data */
         gpointer    type; /* System.Type type for klass */
+       guint16     max_interface_id;
+       guint8      rank;
        guint remote          : 1; /* class is remotely activated */
        guint initialized     : 1; /* cctor has been run */
        /* do not add any fields after vtable, the structure is dynamically extended */
index e36dbbe79976661e1d37efe07bd18b4171cb5dd2..56476418df21d29f29aa81d14bcb80229771f777 100644 (file)
@@ -919,6 +919,7 @@ mono_get_unique_iid (MonoClass *class)
 
        mono_loader_unlock ();
 
+       g_assert (iid <= 65535);
        return iid - 1;
 }
 
index d8e080a1fb12de5d612605b9a3f1179fd1b8b845..a1ec47a063612864a13d2e2f594cde5cb0fcdd6b 100644 (file)
@@ -6576,11 +6576,11 @@ mono_marshal_get_stelemref ()
        /* if (vklass->idepth < aklass->idepth) goto failue */
        mono_mb_emit_ldloc (mb, vklass);
        mono_mb_emit_ldflda (mb, G_STRUCT_OFFSET (MonoClass, idepth));
-       mono_mb_emit_byte (mb, CEE_LDIND_I4);
+       mono_mb_emit_byte (mb, CEE_LDIND_U2);
        
        mono_mb_emit_ldloc (mb, aklass);
        mono_mb_emit_ldflda (mb, G_STRUCT_OFFSET (MonoClass, idepth));
-       mono_mb_emit_byte (mb, CEE_LDIND_I4);
+       mono_mb_emit_byte (mb, CEE_LDIND_U2);
        
        b2 = mono_mb_emit_branch (mb, CEE_BLT_UN);
        
@@ -6591,7 +6591,7 @@ mono_marshal_get_stelemref ()
        
        mono_mb_emit_ldloc (mb, aklass);
        mono_mb_emit_ldflda (mb, G_STRUCT_OFFSET (MonoClass, idepth));
-       mono_mb_emit_byte (mb, CEE_LDIND_I4);
+       mono_mb_emit_byte (mb, CEE_LDIND_U2);
        mono_mb_emit_icon (mb, 1);
        mono_mb_emit_byte (mb, CEE_SUB);
        mono_mb_emit_icon (mb, sizeof (void*));
index cd5429be99bb16abce9da5fcaf7d5c352973335e..81ee2bea253451a74967cc22b9195aea8738388d 100644 (file)
@@ -635,6 +635,7 @@ mono_class_vtable (MonoDomain *domain, MonoClass *class)
        vt = mono_mempool_alloc0 (domain->mp,  vtable_size);
 
        vt->klass = class;
+       vt->rank = class->rank;
        vt->domain = domain;
 
 #if CREATION_SPEEDUP