Author: mprobst
Date: 2007-10-08 12:47:32 -0400 (Mon, 08 Oct 2007)
New Revision: 87105
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/class-internals.h
trunk/mono/mono/metadata/object.c
Log:
2007-10-08 Mark Probst <[EMAIL PROTECTED]>
* class-internals.h: Runtime generic context data structure
definition.
* object.c: Initialization of runtime generic context at runtime
vtable creation time.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-10-08 16:27:43 UTC (rev 87104)
+++ trunk/mono/mono/metadata/ChangeLog 2007-10-08 16:47:32 UTC (rev 87105)
@@ -1,3 +1,11 @@
+2007-10-08 Mark Probst <[EMAIL PROTECTED]>
+
+ * class-internals.h: Runtime generic context data structure
+ definition.
+
+ * object.c: Initialization of runtime generic context at runtime
+ vtable creation time.
+
2007-10-08 Massimiliano Mantione <[EMAIL PROTECTED]>
* class.c (mono_class_create_from_typedef,
mono_class_from_generic_parameter, mono_ptr_class_get,
Modified: trunk/mono/mono/metadata/class-internals.h
===================================================================
--- trunk/mono/mono/metadata/class-internals.h 2007-10-08 16:27:43 UTC (rev
87104)
+++ trunk/mono/mono/metadata/class-internals.h 2007-10-08 16:47:32 UTC (rev
87105)
@@ -324,6 +324,18 @@
#define MONO_CLASS_IMPLEMENTS_INTERFACE(k,uiid) (((uiid) <=
(k)->max_interface_id) && ((k)->interface_bitmap [(uiid) >> 3] & (1 <<
((uiid)&7))))
int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
+typedef struct {
+ gpointer static_data;
+} MonoRuntimeGenericSuperInfo;
+
+typedef struct {
+ MonoVTable *vtable;
+} MonoRuntimeGenericArgInfo;
+
+typedef struct {
+ MonoRuntimeGenericArgInfo arg_infos [MONO_ZERO_LEN_ARRAY];
+} MonoRuntimeGenericContext;
+
/* the interface_offsets array is stored in memory before this struct */
struct MonoVTable {
MonoClass *klass;
@@ -342,6 +354,7 @@
guint initialized : 1; /* cctor has been run */
guint init_failed : 1; /* cctor execution failed */
guint32 imt_collisions_bitmap;
+ MonoRuntimeGenericContext *runtime_generic_context;
/* do not add any fields after vtable, the structure is dynamically
extended */
gpointer vtable [MONO_ZERO_LEN_ARRAY];
};
Modified: trunk/mono/mono/metadata/object.c
===================================================================
--- trunk/mono/mono/metadata/object.c 2007-10-08 16:27:43 UTC (rev 87104)
+++ trunk/mono/mono/metadata/object.c 2007-10-08 16:47:32 UTC (rev 87105)
@@ -1215,6 +1215,31 @@
}
static void
+mono_class_setup_runtime_generic_context (MonoClass *class, MonoDomain *domain)
+{
+ MonoVTable *vtable = mono_class_vtable (domain, class);
+ int depth = class->idepth;
+ MonoClass *super;
+ MonoRuntimeGenericSuperInfo *super_infos;
+
+ /* We don't allocate arg_infos because we don't use it yet.
+ */
+ super_infos = mono_mempool_alloc0 (domain->mp,
+ sizeof (MonoRuntimeGenericSuperInfo) * depth + sizeof
(MonoRuntimeGenericContext));
+
+ vtable->runtime_generic_context = (MonoRuntimeGenericContext*)
(super_infos + depth);
+
+ depth = 0;
+ for (super = class; super; super = super->parent) {
+ vtable = mono_class_vtable (domain, super);
+
+ super_infos [depth].static_data = vtable->data;
+
+ depth++;
+ }
+}
+
+static void
build_imt (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
imt, GSList *extra_interfaces) {
build_imt_slots (klass, vt, domain, imt, extra_interfaces, -1);
}
@@ -1518,6 +1543,9 @@
}
}
+ if (class->generic_class)
+ mono_class_setup_runtime_generic_context (class, domain);
+
mono_domain_unlock (domain);
/* Initialization is now complete, we can throw if the
InheritanceDemand aren't satisfied */
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches