Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2006-01-12 21:27:40 +0300
committerMartin Baulig <martin@novell.com>2006-01-12 21:27:40 +0300
commit0904346d1a47fbc888bb28d68689bb7516e489a2 (patch)
tree47e78eb592c3a49da08d4416d266883247fd27dc
parentbdc0050c26933a5b7e6df9263580dd6d806fbde6 (diff)
2006-01-12 Martin Baulig <martin@ximian.com>
* icall.c (ves_icall_MonoGenericClass_GetInterfaces): Inflate the interfaces on-the-fly; fixes #76625. * class-internals.h (MonoDynamicGenericClass): Removed `ifaces' and `count_ifaces'; we don't need that anymore. svn path=/trunk/mono/; revision=55441
-rw-r--r--mono/metadata/ChangeLog9
-rw-r--r--mono/metadata/class-internals.h2
-rw-r--r--mono/metadata/icall.c34
-rw-r--r--mono/metadata/reflection.c28
4 files changed, 37 insertions, 36 deletions
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index 4a764d85a66..18d33126a63 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,12 @@
+2006-01-12 Martin Baulig <martin@ximian.com>
+
+ * icall.c (ves_icall_MonoGenericClass_GetInterfaces): Inflate the
+ interfaces on-the-fly; fixes #76625.
+
+ * class-internals.h
+ (MonoDynamicGenericClass): Removed `ifaces' and `count_ifaces'; we
+ don't need that anymore.
+
2006-01-12 Miguel de Icaza <miguel@novell.com>
* socket-io.c
diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h
index 18c41bedb31..c49f668b433 100644
--- a/mono/metadata/class-internals.h
+++ b/mono/metadata/class-internals.h
@@ -406,8 +406,6 @@ struct _MonoInflatedGenericClass {
struct _MonoDynamicGenericClass {
MonoInflatedGenericClass generic_class;
MonoType *parent;
- int count_ifaces;
- MonoType **ifaces;
int count_methods;
MonoMethod **methods;
int count_ctors;
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
index 60123c5d96c..1b9dc454781 100644
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -2060,10 +2060,11 @@ ves_icall_MonoGenericClass_GetInterfaces (MonoReflectionGenericClass *type)
{
static MonoClass *System_Reflection_MonoGenericClass;
MonoDynamicGenericClass *gclass;
+ MonoReflectionTypeBuilder *tb = NULL;
+ MonoClass *klass = NULL;
MonoDomain *domain;
- MonoClass *klass;
MonoArray *res;
- int i;
+ int icount, i;
MONO_ARCH_SAVE_REGS;
@@ -2077,23 +2078,38 @@ ves_icall_MonoGenericClass_GetInterfaces (MonoReflectionGenericClass *type)
g_assert (type->type.type->data.generic_class->is_dynamic);
gclass = (MonoDynamicGenericClass *) type->type.type->data.generic_class;
- if (!gclass->ifaces)
- return mono_array_new (domain, System_Reflection_MonoGenericClass, 0);
- klass = gclass->generic_class.generic_class.container_class;
+ if (!strcmp (type->generic_type->object.vtable->klass->name, "TypeBuilder")) {
+ tb = (MonoReflectionTypeBuilder *) type->generic_type;
+ icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
+ } else {
+ klass = gclass->generic_class.generic_class.container_class;
+ mono_class_init (klass);
+ icount = klass->interface_count;
+ }
- res = mono_array_new (domain, System_Reflection_MonoGenericClass, gclass->count_ifaces);
+ res = mono_array_new (domain, System_Reflection_MonoGenericClass, icount);
- for (i = 0; i < gclass->count_ifaces; i++) {
- MonoReflectionType *iface = mono_type_get_object (domain, gclass->ifaces [i]);
+ for (i = 0; i < icount; i++) {
+ MonoReflectionType *iface;
+ MonoType *it;
+ if (tb) {
+ iface = mono_array_get (tb->interfaces, MonoReflectionType *, i);
+ it = iface->type;
+ } else
+ it = &klass->interfaces [i]->byval_arg;
+
+ it = mono_class_inflate_generic_type (
+ it, gclass->generic_class.generic_class.context);
+
+ iface = mono_type_get_object (domain, it);
mono_array_set (res, gpointer, i, iface);
}
return res;
}
-
static MonoReflectionMethod*
ves_icall_MonoGenericClass_GetCorrespondingInflatedMethod (MonoReflectionGenericClass *type,
MonoReflectionMethod* generic)
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index 41fb94b5cf6..ce5d784c22a 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -8481,7 +8481,7 @@ do_mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_a
gboolean is_dynamic = FALSE;
MonoDomain *domain;
MonoType *geninst;
- int icount, i;
+ int i;
klass = mono_class_from_mono_type (type->type);
if (!klass->generic_container && !klass->generic_class &&
@@ -8495,7 +8495,6 @@ do_mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_a
if (!strcmp (((MonoObject *) type)->vtable->klass->name, "TypeBuilder")) {
tb = (MonoReflectionTypeBuilder *) type;
- icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
is_dynamic = TRUE;
} else if (!strcmp (((MonoObject *) type)->vtable->klass->name, "MonoGenericClass")) {
MonoReflectionGenericClass *rgi = (MonoReflectionGenericClass *) type;
@@ -8504,15 +8503,11 @@ do_mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_a
g_assert (!strcmp (((MonoObject *) rgt)->vtable->klass->name, "TypeBuilder"));
tb = (MonoReflectionTypeBuilder *) rgt;
- icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
is_dynamic = TRUE;
} else if (klass->wastypebuilder) {
tb = (MonoReflectionTypeBuilder *) klass->reflection_info;
- icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
is_dynamic = TRUE;
- } else {
- icount = klass->interface_count;
}
if (is_dynamic) {
@@ -8608,23 +8603,8 @@ do_mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_a
gclass->context->container = gclass->container_class->generic_container;
gclass->context->gclass = gclass;
- if (is_dynamic) {
+ if (is_dynamic)
dgclass->parent = parent;
- dgclass->ifaces = g_new0 (MonoType *, icount);
- dgclass->count_ifaces = icount;
-
- for (i = 0; i < icount; i++) {
- MonoReflectionType *itype;
-
- if (tb)
- itype = mono_array_get (tb->interfaces, MonoReflectionType *, i);
- else
- itype = mono_type_get_object (domain, &klass->interfaces [i]->byval_arg);
- dgclass->ifaces [i] = mono_reflection_bind_generic_parameters (itype, type_argc, types);
- if (!dgclass->ifaces [i])
- dgclass->ifaces [i] = itype->type;
- }
- }
mono_loader_unlock ();
@@ -8691,7 +8671,7 @@ mono_class_bind_generic_parameters (MonoType *type, int type_argc, MonoType **ty
MonoGenericClass *gclass, *cached;
MonoInflatedGenericClass *igclass;
MonoType *geninst;
- int icount, i;
+ int i;
klass = mono_class_from_mono_type (type);
if (!klass->generic_container && !klass->generic_class &&
@@ -8700,8 +8680,6 @@ mono_class_bind_generic_parameters (MonoType *type, int type_argc, MonoType **ty
mono_loader_lock ();
- icount = klass->interface_count;
-
igclass = g_new0 (MonoInflatedGenericClass, 1);
gclass = &igclass->generic_class;
gclass->is_inflated = TRUE;