2004-02-09 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Mon, 9 Feb 2004 21:06:05 +0000 (21:06 -0000)
committerMartin Baulig <martin@novell.com>
Mon, 9 Feb 2004 21:06:05 +0000 (21:06 -0000)
* class.h (MonoGenericMethod): New type.
(MonoGenericInst): Remove `mtype_argc', `mtype_argv' and
`generic_method'.

* metadata.h (MonoMethodHeader): Replaced the `geninst' field with
a `MonoGenericMethod *gen_method' one.

* class.c (mono_class_inflate_generic_type): Take an additional
`MonoGenericMethod * argument.  This is only non-NULL if we're
inflating types for a generic method.
(mono_class_inflate_generic_signature): Renamed to
inflate_generic_signature() and made static; take a
`MonoGenericMethod *' argument instead of a `MonoGenericInst *'.
(inflate_generic_header): Take a `MonoGenericMethod *' argument
instead of a `MonoGenericInst *' one.
(mono_class_inflate_generic_method): Likewise.

* reflection.c (encode_generic_method_sig): Take a
`MonoGenericMethod *' argument instead of a `MonoGenericInst *'.
(method_encode_methodspec): Likewise.
(inflated_method_get_object): Likewise.

* reflection.h (MonoReflectionGenericInst): Replaced the `ginst'
field with a `MonoGenericMethod *gmethod' one.

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

mono/metadata/ChangeLog
mono/metadata/class.c
mono/metadata/class.h
mono/metadata/loader.c
mono/metadata/metadata.h
mono/metadata/reflection.c
mono/metadata/reflection.h
mono/mini/mini.c

index 12f4c3a0e65bc1cb8cf20668c535116f23fe7d45..af6951b54f62606e984a1ca0d1b572c33755c820 100644 (file)
@@ -1,3 +1,30 @@
+2004-02-09  Martin Baulig  <martin@ximian.com>
+
+       * class.h (MonoGenericMethod): New type.
+       (MonoGenericInst): Remove `mtype_argc', `mtype_argv' and
+       `generic_method'.
+
+       * metadata.h (MonoMethodHeader): Replaced the `geninst' field with
+       a `MonoGenericMethod *gen_method' one.
+
+       * class.c (mono_class_inflate_generic_type): Take an additional
+       `MonoGenericMethod * argument.  This is only non-NULL if we're
+       inflating types for a generic method.   
+       (mono_class_inflate_generic_signature): Renamed to
+       inflate_generic_signature() and made static; take a
+       `MonoGenericMethod *' argument instead of a `MonoGenericInst *'.
+       (inflate_generic_header): Take a `MonoGenericMethod *' argument
+       instead of a `MonoGenericInst *' one.
+       (mono_class_inflate_generic_method): Likewise.
+
+       * reflection.c (encode_generic_method_sig): Take a
+       `MonoGenericMethod *' argument instead of a `MonoGenericInst *'.
+       (method_encode_methodspec): Likewise.
+       (inflated_method_get_object): Likewise. 
+
+       * reflection.h (MonoReflectionGenericInst): Replaced the `ginst'
+       field with a `MonoGenericMethod *gmethod' one.  
+
 2004-02-08  Bernie Solomon  <bernard@ugsolutions.com>
 
        * class.h (mono_class_has_parent): add parens to expansion
index 1cb0b5cdc73667012de33c561245bf7f06f23e52..6b8d75728face562a7abdf015799acb7d0a052bf 100644 (file)
@@ -199,29 +199,32 @@ mono_class_is_open_constructed_type (MonoType *t)
 }
 
 MonoType*
-mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst)
+mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst,
+                                MonoGenericMethod *gmethod)
 {
        switch (type->type) {
        case MONO_TYPE_MVAR:
-               if (ginst && ginst->mtype_argv)
-                       return dup_type (ginst->mtype_argv [type->data.generic_param->num]);
+               if (gmethod && gmethod->mtype_argv)
+                       return dup_type (gmethod->mtype_argv [type->data.generic_param->num]);
                else
                        return type;
-       case MONO_TYPE_VAR: {
-               MonoType *t = ginst->type_argv [type->data.generic_param->num];
-
-               if ((t->type == MONO_TYPE_VAR) || (t->type == MONO_TYPE_MVAR))
+       case MONO_TYPE_VAR:
+               if (ginst) {
+                       MonoType *t = ginst->type_argv [type->data.generic_param->num];
+
+                       if ((t->type == MONO_TYPE_VAR) || (t->type == MONO_TYPE_MVAR))
+                               return type;
+                       else
+                               return dup_type (t);
+               } else
                        return type;
-               else
-                       return dup_type (t);
-       }
        case MONO_TYPE_SZARRAY: {
                MonoClass *eclass = type->data.klass;
                MonoClass *nclass;
                MonoType *nt;
-               if (eclass->byval_arg.type == MONO_TYPE_MVAR) {
-                       nclass = mono_class_from_mono_type (ginst->type_argv [eclass->byval_arg.data.generic_param->num]);
-               } else if (eclass->byval_arg.type == MONO_TYPE_VAR) {
+               if ((eclass->byval_arg.type == MONO_TYPE_MVAR) && gmethod) {
+                       nclass = mono_class_from_mono_type (gmethod->mtype_argv [eclass->byval_arg.data.generic_param->num]);
+               } else if ((eclass->byval_arg.type == MONO_TYPE_VAR) && ginst) {
                        nclass = mono_class_from_mono_type (ginst->type_argv [eclass->byval_arg.data.generic_param->num]);
                } else {
                        return type;
@@ -243,7 +246,7 @@ mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst)
 
                for (i = 0; i < oginst->type_argc; i++) {
                        MonoType *t = oginst->type_argv [i];
-                       nginst->type_argv [i] = mono_class_inflate_generic_type (t, ginst);
+                       nginst->type_argv [i] = mono_class_inflate_generic_type (t, ginst, gmethod);
                };
 
                nt = dup_type (type);
@@ -256,16 +259,18 @@ mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst)
        return type;
 }
 
-MonoMethodSignature*
-mono_class_inflate_generic_signature (MonoImage *image, MonoMethodSignature *sig, MonoGenericInst *ginst)
+static MonoMethodSignature*
+inflate_generic_signature (MonoImage *image, MonoMethodSignature *sig,
+                          MonoGenericMethod *gmethod)
 {
        MonoMethodSignature *res;
        int i;
        res = mono_metadata_signature_alloc (image, sig->param_count);
-       res->ret = mono_class_inflate_generic_type (sig->ret, ginst);
-       for (i = 0; i < sig->param_count; ++i) {
-               res->params [i] = mono_class_inflate_generic_type (sig->params [i], ginst);
-       }
+       res->ret = mono_class_inflate_generic_type (sig->ret, gmethod->generic_inst, gmethod);
+       for (i = 0; i < sig->param_count; ++i)
+               res->params [i] = mono_class_inflate_generic_type (sig->params [i],
+                                                                  gmethod->generic_inst,
+                                                                  gmethod);
        res->hasthis = sig->hasthis;
        res->explicit_this = sig->explicit_this;
        res->call_convention = sig->call_convention;
@@ -274,7 +279,7 @@ mono_class_inflate_generic_signature (MonoImage *image, MonoMethodSignature *sig
 }
 
 static MonoMethodHeader*
-inflate_generic_header (MonoMethodHeader *header, MonoGenericInst *ginst)
+inflate_generic_header (MonoMethodHeader *header, MonoGenericMethod *gmethod)
 {
        MonoMethodHeader *res;
        int i;
@@ -287,15 +292,16 @@ inflate_generic_header (MonoMethodHeader *header, MonoGenericInst *ginst)
        res->num_locals = header->num_locals;
        res->clauses = header->clauses;
        res->gen_params = header->gen_params;
-       res->geninst = ginst;
-       for (i = 0; i < header->num_locals; ++i) {
-               res->locals [i] = mono_class_inflate_generic_type (header->locals [i], ginst);
-       }
+       res->gen_method = gmethod;
+       for (i = 0; i < header->num_locals; ++i)
+               res->locals [i] = mono_class_inflate_generic_type (header->locals [i],
+                                                                  gmethod->generic_inst,
+                                                                  gmethod);
        return res;
 }
 
 MonoMethod*
-mono_class_inflate_generic_method (MonoMethod *method, MonoGenericInst *ginst)
+mono_class_inflate_generic_method (MonoMethod *method, MonoGenericMethod *gmethod)
 {
        MonoMethod *result;
        if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
@@ -307,11 +313,11 @@ mono_class_inflate_generic_method (MonoMethod *method, MonoGenericInst *ginst)
                *nmethod = *(MonoMethodNormal*)method;
                result = (MonoMethod*)nmethod;
                if (nmethod->header)
-                       nmethod->header = inflate_generic_header (nmethod->header, ginst);
+                       nmethod->header = inflate_generic_header (nmethod->header, gmethod);
        }
-       if (ginst->klass)
-               result->klass = ginst->klass;
-       result->signature = mono_class_inflate_generic_signature (method->klass->image, result->signature, ginst);
+       result->klass = gmethod->klass;
+       result->signature = inflate_generic_signature (
+               method->klass->image, result->signature, gmethod);
        return result;
 }
 
@@ -392,7 +398,7 @@ class_compute_field_layout (MonoClass *class)
                if (mono_field_is_deleted (field))
                        continue;
                if (class->generic_inst) {
-                       field->type = mono_class_inflate_generic_type (field->type, class->generic_inst);
+                       field->type = mono_class_inflate_generic_type (field->type, class->generic_inst, NULL);
                        field->type->attrs = cols [MONO_FIELD_FLAGS];
                }
 
@@ -1695,8 +1701,17 @@ mono_class_initialize_generic (MonoGenericInst *ginst, gboolean inflate_methods)
                klass->field = gklass->field;
                klass->method = gklass->method;
                klass->methods = g_new0 (MonoMethod *, klass->method.count);
-               for (i = 0; i < klass->method.count; i++)
-                       klass->methods [i] = mono_class_inflate_generic_method (gklass->methods [i], ginst);
+
+               for (i = 0; i < klass->method.count; i++) {
+                       MonoGenericMethod *gmethod = g_new0 (MonoGenericMethod, 1);
+
+                       gmethod->klass = klass;
+                       gmethod->generic_method = gklass->methods [i];
+                       gmethod->generic_inst = ginst;
+
+                       klass->methods [i] = mono_class_inflate_generic_method (
+                               gklass->methods [i], gmethod);
+               }
        }
 
        ginst->initialized = TRUE;
index d743bdd71459d3d16d366b06ec7f2fda4196ac3e..eff81ba62e878c3a11cc4ca8212416c1a05f0146 100644 (file)
@@ -221,16 +221,22 @@ struct _MonoGenericInst {
        MonoType *parent;
        MonoType **ifaces;
        MonoType *generic_type;
-       MonoMethod *generic_method;
        int type_argc;
        MonoType **type_argv;
-       int mtype_argc;
-       MonoType **mtype_argv;
        guint is_open       : 1;
        guint initialized   : 1;
        guint init_pending  : 1;
 };
 
+struct _MonoGenericMethod {
+       MonoGenericInst *generic_inst;
+       MonoClass *klass;
+       MonoMethod *generic_method;
+       int mtype_argc;
+       MonoType **mtype_argv;
+       guint is_open       : 1;
+};
+
 struct _MonoGenericParam {
        MonoClass *pklass;
        MonoMethod *method;
@@ -305,13 +311,10 @@ MonoClass*
 mono_class_from_generic    (MonoGenericInst *ginst);
 
 MonoType*
-mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst);
-
-MonoMethodSignature*
-mono_class_inflate_generic_signature (MonoImage *image, MonoMethodSignature *sig, MonoGenericInst *ginst);
+mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst, MonoGenericMethod *gmethod);
 
 MonoMethod*
-mono_class_inflate_generic_method (MonoMethod *method, MonoGenericInst *ginst);
+mono_class_inflate_generic_method (MonoMethod *method, MonoGenericMethod *gmethod);
 
 MonoClassField*
 mono_field_from_memberref  (MonoImage *image, guint32 token, MonoClass **retklass);
index 69d234f7887817f29f9e1062965e9e99e71f3b0c..bdc2d6de94a64f771a56a9edbb07657a530716e5 100644 (file)
@@ -339,7 +339,7 @@ mono_method_get_signature (MonoMethod *method, MonoImage *image, guint32 token)
                          !(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) &&
                          method->signature);
                mn = (MonoMethodNormal *) method;
-               g_assert (mn->header->geninst);
+               g_assert (mn->header->gen_method);
 
                return method->signature;
        }
@@ -416,8 +416,15 @@ method_from_memberref (MonoImage *image, guint32 idx)
                        method = find_method (klass, mname, sig);
                        if (!method)
                                g_warning ("Missing method %s in assembly %s typeref index %d", mname, image->name, nindex);
-                       else if (klass->generic_inst)
-                               method = mono_class_inflate_generic_method (method, klass->generic_inst);
+                       else if (klass->generic_inst) {
+                               MonoGenericMethod *gmethod = g_new0 (MonoGenericMethod, 1);
+
+                               gmethod->klass = klass;
+                               gmethod->generic_method = method;
+                               gmethod->generic_inst = klass->generic_inst;
+
+                               method = mono_class_inflate_generic_method (method, gmethod);
+                       }
                        mono_metadata_free_method_signature (sig);
                        return method;
                }
@@ -490,7 +497,7 @@ method_from_methodspec (MonoImage *image, guint32 idx)
 {
        MonoMethod *method;
        MonoTableInfo *tables = image->tables;
-       MonoGenericInst *ginst;
+       MonoGenericMethod *gmethod;
        const char *ptr;
        guint32 cols [MONO_METHODSPEC_SIZE];
        guint32 token, param_count, i;
@@ -510,19 +517,20 @@ method_from_methodspec (MonoImage *image, guint32 idx)
        ptr++;
        param_count = mono_metadata_decode_value (ptr, &ptr);
 
-       ginst = g_new0 (MonoGenericInst, 1);
-       ginst->generic_method = method;
-       ginst->mtype_argc = param_count;
-       ginst->mtype_argv = g_new0 (MonoType *, param_count);
+       gmethod = g_new0 (MonoGenericMethod, 1);
+       gmethod->klass = method->klass;
+       gmethod->generic_method = method;
+       gmethod->mtype_argc = param_count;
+       gmethod->mtype_argv = g_new0 (MonoType *, param_count);
        
        for (i = 0; i < param_count; i++) {
-               ginst->mtype_argv [i] = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
+               gmethod->mtype_argv [i] = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
 
-               if (!ginst->is_open)
-                       ginst->is_open = mono_class_is_open_constructed_type (ginst->mtype_argv [i]);
+               if (!gmethod->is_open)
+                       gmethod->is_open = mono_class_is_open_constructed_type (gmethod->mtype_argv [i]);
        }
 
-       return mono_class_inflate_generic_method (method, ginst);
+       return mono_class_inflate_generic_method (method, gmethod);
 }
 
 typedef struct MonoDllMap MonoDllMap;
index 238295ad29a0051455f40090a51c3e2ab2b6450e..bc42f33285a88a2ebedd5397c4f8b3f36d3ce677 100644 (file)
@@ -261,6 +261,7 @@ typedef struct {
 
 typedef struct _MonoType MonoType;
 typedef struct _MonoGenericInst MonoGenericInst;
+typedef struct _MonoGenericMethod MonoGenericMethod;
 typedef struct _MonoGenericParam MonoGenericParam;
 typedef struct _MonoArrayType MonoArrayType;
 typedef struct _MonoMethodSignature MonoMethodSignature;
@@ -319,7 +320,7 @@ typedef struct {
        guint16      num_locals;
        MonoExceptionClause *clauses;
        MonoGenericParam *gen_params;
-       MonoGenericInst *geninst;
+       MonoGenericMethod *gen_method;
        MonoType    *locals [MONO_ZERO_LEN_ARRAY];
 } MonoMethodHeader;
 
index 1098d3c01fe01c399291cd6ea1f72c0b52fcb986..fe649ad5931e2ee47bd63264b6d22c768d02b3a0 100644 (file)
@@ -2150,12 +2150,12 @@ mono_image_get_inflated_field_token (MonoDynamicImage *assembly, MonoReflectionI
 }
 
 static guint32
-encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericInst *ginst)
+encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericMethod *gmethod)
 {
        char *buf;
        char *p;
        int i;
-       guint32 nparams =  ginst->mtype_argc;
+       guint32 nparams =  gmethod->mtype_argc;
        guint32 size = 10 + nparams * 10;
        guint32 idx;
        char blob_size [6];
@@ -2172,7 +2172,7 @@ encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericInst *ginst)
        mono_metadata_encode_value (nparams, p, &p);
 
        for (i = 0; i < nparams; i++)
-               encode_type (assembly, ginst->mtype_argv [i], p, &p);
+               encode_type (assembly, gmethod->mtype_argv [i], p, &p);
 
        /* store length */
        g_assert (p - buf < size);
@@ -2183,7 +2183,8 @@ encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericInst *ginst)
 }
 
 static guint32
-method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method, MonoGenericInst *ginst)
+method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method,
+                         MonoGenericMethod *gmethod)
 {
        MonoDynamicTable *table;
        guint32 *values;
@@ -2192,8 +2193,8 @@ method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method, MonoGe
 
        table = &assembly->tables [MONO_TABLE_METHODSPEC];
 
-       g_assert (ginst);
-       k = ginst->klass ? ginst->klass : method->klass;
+       g_assert (gmethod);
+       k = gmethod->klass ? gmethod->klass : method->klass;
 
        sig = method_encode_signature (assembly, method->signature);
        mtoken = mono_image_get_memberref_token (assembly, &k->byval_arg, method->name, sig);
@@ -2212,7 +2213,7 @@ method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method, MonoGe
                g_assert_not_reached ();
        }
 
-       sig = encode_generic_method_sig (assembly, ginst);
+       sig = encode_generic_method_sig (assembly, gmethod);
 
        if (assembly->save) {
                alloc_table (table, table->rows + 1);
@@ -2236,17 +2237,17 @@ mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoReflectionInfla
        if (token)
                return token;
        if (m->declaring->method->signature->generic_param_count)
-               token = method_encode_methodspec (assembly, m->declaring->method, m->ginst);
+               token = method_encode_methodspec (assembly, m->declaring->method, m->gmethod);
        else {
                MonoClass *k;
                guint32 sig;
 
-               g_assert (m->ginst);
-               k = m->ginst->klass ? m->ginst->klass : m->ginst->generic_method->klass;
+               g_assert (m->gmethod);
+               k = m->gmethod->klass ? m->gmethod->klass : m->gmethod->generic_method->klass;
 
                sig = method_encode_signature (assembly, m->declaring->method->signature);
                token = mono_image_get_memberref_token (
-                       assembly, &k->byval_arg, m->ginst->generic_method->name, sig);
+                       assembly, &k->byval_arg, m->gmethod->generic_method->name, sig);
        }
 
        g_hash_table_insert (assembly->handleref, m->rmethod.method, GUINT_TO_POINTER(token));
@@ -6816,7 +6817,7 @@ fieldbuilder_to_mono_class_field (MonoClass *klass, MonoReflectionFieldBuilder*
 
 static MonoReflectionInflatedMethod*
 inflated_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass,
-                           MonoReflectionMethod *declaring, MonoGenericInst *ginst)
+                           MonoReflectionMethod *declaring, MonoGenericMethod *gmethod)
 {
        const char *cname;
        MonoClass *klass;
@@ -6838,7 +6839,7 @@ inflated_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *r
        ret->rmethod.name = mono_string_new (domain, method->name);
        ret->rmethod.reftype = mono_type_get_object (domain, &refclass->byval_arg);
        ret->declaring = declaring;
-       ret->ginst = ginst;
+       ret->gmethod = gmethod;
        CACHE_OBJECT (method, ret, refclass);
        return ret;
 }
@@ -6948,7 +6949,7 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        MonoMethod *method, *inflated;
        MonoReflectionMethodBuilder *mb = NULL;
        MonoReflectionMethod *declaring;
-       MonoGenericInst *ginst;
+       MonoGenericMethod *gmethod;
        int count, i;
 
        MONO_ARCH_SAVE_REGS;
@@ -6975,26 +6976,22 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        if (count != mono_array_length (types))
                return NULL;
 
-       ginst = g_new0 (MonoGenericInst, 1);
-       ginst->generic_method = method;
-       ginst->mtype_argc = count;
-       ginst->mtype_argv = g_new0 (MonoType *, count);
+       gmethod = g_new0 (MonoGenericMethod, 1);
+       gmethod->generic_method = method;
+       gmethod->mtype_argc = count;
+       gmethod->mtype_argv = g_new0 (MonoType *, count);
        for (i = 0; i < count; i++) {
                MonoReflectionType *garg = mono_array_get (types, gpointer, i);
-               ginst->mtype_argv [i] = garg->type;
+               gmethod->mtype_argv [i] = garg->type;
        }
 
-       if (method->klass->generic_inst) {
-               MonoGenericInst *kginst = method->klass->generic_inst;
-
-               ginst->type_argc = kginst->type_argc;
-               ginst->type_argv = kginst->type_argv;
-       }
+       gmethod->generic_inst = method->klass->generic_inst;
+       gmethod->klass = method->klass;
 
-       inflated = mono_class_inflate_generic_method (method, ginst);
+       inflated = mono_class_inflate_generic_method (method, gmethod);
 
        return inflated_method_get_object (
-               mono_object_domain (rmethod), inflated, NULL, declaring, ginst);
+               mono_object_domain (rmethod), inflated, NULL, declaring, gmethod);
 }
 
 MonoReflectionInflatedMethod*
@@ -7002,17 +6999,18 @@ mono_reflection_inflate_method_or_ctor (MonoReflectionGenericInst *declaring_typ
                                        MonoReflectionGenericInst *reflected_type,
                                        MonoObject *obj)
 {
-       MonoGenericInst *ginst, *type_ginst;
        MonoMethod *method = NULL, *inflated;
        MonoReflectionInflatedMethod *res;
        MonoReflectionMethod *declaring;
        MonoClass *klass, *refclass;
+       MonoGenericMethod *gmethod;
+       MonoGenericInst *ginst;
 
        MONO_ARCH_SAVE_REGS;
 
        klass = mono_class_from_mono_type (declaring_type->type.type);
        refclass = mono_class_from_mono_type (reflected_type->type.type);
-       type_ginst = declaring_type->type.type->data.generic_inst;
+       ginst = declaring_type->type.type->data.generic_inst;
 
        if (!strcmp (obj->vtable->klass->name, "MethodBuilder")) {
                method = methodbuilder_to_mono_method (klass, (MonoReflectionMethodBuilder *) obj);
@@ -7031,19 +7029,15 @@ mono_reflection_inflate_method_or_ctor (MonoReflectionGenericInst *declaring_typ
        } else
                g_assert_not_reached ();
 
-       ginst = g_new0 (MonoGenericInst, 1);
-       ginst->generic_method = method;
-       ginst->generic_type = declaring_type->type.type;
-       ginst->type_argc = type_ginst->type_argc;
-       ginst->type_argv = type_ginst->type_argv;
-       ginst->is_open = type_ginst->is_open;
-
-       ginst->klass = type_ginst->klass;
+       gmethod = g_new0 (MonoGenericMethod, 1);
+       gmethod->generic_method = method;
+       gmethod->generic_inst = ginst;
+       gmethod->klass = ginst->klass;
 
-       inflated = mono_class_inflate_generic_method (method, ginst);
+       inflated = mono_class_inflate_generic_method (method, gmethod);
 
        res = inflated_method_get_object (
-               mono_object_domain (declaring_type), inflated, refclass, declaring, ginst);
+               mono_object_domain (declaring_type), inflated, refclass, declaring, gmethod);
 
        return res;
 }
@@ -7085,7 +7079,7 @@ mono_reflection_inflate_field (MonoReflectionGenericInst *declaring_type,
 
        inflated = g_new0 (MonoClassField, 1);
        *inflated = *field;
-       inflated->type = mono_class_inflate_generic_type (field->type, ginst);
+       inflated->type = mono_class_inflate_generic_type (field->type, ginst, NULL);
 
        domain = mono_object_domain (obj);
 
index 94fcb3096d0c56a42f826dab79ec8056f04134ec..c7bee3faeddcb62880fe78810b678890fe384c6b 100644 (file)
@@ -457,7 +457,7 @@ struct _MonoReflectionGenericInst {
 typedef struct {
        MonoReflectionMethod rmethod;
        MonoReflectionMethod *declaring;
-       MonoGenericInst *ginst;
+       MonoGenericMethod *gmethod;
 } MonoReflectionInflatedMethod;
 
 typedef struct {
index 75a8e43a6219b91c74baf22602b9440bbb748ff5..c5022b6bbb6f5cf7d6b002b3bcf9eaafdcb862c0 100644 (file)
@@ -2481,7 +2481,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
 #define TYPE_PARAM_TO_TYPE(num) (method->klass->generic_inst->type_argv [(num)])
 #define TYPE_PARAM_TO_CLASS(num) (mono_class_from_mono_type (TYPE_PARAM_TO_TYPE ((num))))
 
-#define MTYPE_PARAM_TO_TYPE(num) (((MonoMethodNormal *) method)->header->geninst->mtype_argv [(num)])
+#define MTYPE_PARAM_TO_TYPE(num) (((MonoMethodNormal *) method)->header->gen_method->mtype_argv [(num)])
 #define MTYPE_PARAM_TO_CLASS(num) (mono_class_from_mono_type (MTYPE_PARAM_TO_TYPE ((num))))
 
 
@@ -2584,7 +2584,7 @@ inflate_generic_field (MonoClassField *field, MonoClass *klass, MonoClass **retc
        res = g_new0 (MonoClassField, 1);
        *res = *field;
        ginst = klass->generic_inst;
-       res->type = mono_class_inflate_generic_type (field->type, ginst);
+       res->type = mono_class_inflate_generic_type (field->type, ginst, NULL);
        return res;
 }