2003-10-16 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Thu, 16 Oct 2003 06:32:46 +0000 (06:32 -0000)
committerMartin Baulig <martin@novell.com>
Thu, 16 Oct 2003 06:32:46 +0000 (06:32 -0000)
* class.c (inflate_generic_signature): Copy `generic_param_count'.
(inflate_generic_header): Copy `gen_params'.

* icall.c (ves_icall_MethodInfo_get_IsGenericMethodDefinition):
New interncall.

* metadata.c (mono_metadata_parse_method_signature): Actually set
the `method->generic_param_count' here.
(mono_metadata_load_generic_params): Initialize `pklass' to NULL.

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

mono/metadata/ChangeLog
mono/metadata/class.c
mono/metadata/icall.c
mono/metadata/metadata.c

index 4da52264aac3fb2d60809469c452047fdd6d6f03..6a476a9ae00ff8f8e68bc447b5543f22d2359144 100644 (file)
@@ -1,3 +1,15 @@
+2003-10-16  Martin Baulig  <martin@ximian.com>
+
+       * class.c (inflate_generic_signature): Copy `generic_param_count'.
+       (inflate_generic_header): Copy `gen_params'.
+
+       * icall.c (ves_icall_MethodInfo_get_IsGenericMethodDefinition):
+       New interncall.
+
+       * metadata.c (mono_metadata_parse_method_signature): Actually set
+       the `method->generic_param_count' here.
+       (mono_metadata_load_generic_params): Initialize `pklass' to NULL.
+
 2003-10-15  Zoltan Varga  <vargaz@freemail.hu>
 
        * object.h: Add a new field to TypedRef to simplify the implementation
index 36941f155c9f91fc940570a66302aa83db2d8852..50baeeeba02baba9e79f7e260280c218259ad60b 100644 (file)
@@ -225,6 +225,7 @@ inflate_generic_signature (MonoImage *image, MonoMethodSignature *sig, MonoGener
        res->hasthis = sig->hasthis;
        res->explicit_this = sig->explicit_this;
        res->call_convention = sig->call_convention;
+       res->generic_param_count = sig->generic_param_count;
        return res;
 }
 
@@ -241,6 +242,7 @@ inflate_generic_header (MonoMethodHeader *header, MonoGenericInst *tgen, MonoGen
        res->init_locals = header->init_locals;
        res->num_locals = header->num_locals;
        res->clauses = header->clauses;
+       res->gen_params = header->gen_params;
        for (i = 0; i < header->num_locals; ++i) {
                res->locals [i] = inflate_generic_type (header->locals [i], tgen, mgen);
        }
index 40f668e1d7b6d2f7a296d164c2917c4c28b70d73..0cbd61dff9f82ab18d0324cff7f3617201956fe7 100644 (file)
@@ -1581,6 +1581,20 @@ ves_icall_MonoType_get_DeclaringMethod (MonoReflectionType *type)
        return mono_method_get_object (mono_object_domain (type), method, klass);
 }
 
+static gboolean
+ves_icall_MethodInfo_get_IsGenericMethodDefinition (MonoReflectionMethod *method)
+{
+       MonoMethodNormal *mn;
+
+       MONO_ARCH_SAVE_REGS;
+
+       if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+           (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
+               return FALSE;
+
+       mn = (MonoMethodNormal *) method->method;
+       return mn->header->gen_params != NULL;
+}
 
 static MonoObject *
 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) 
@@ -4137,6 +4151,9 @@ static gconstpointer icall_map [] = {
        "System.MonoType::get_IsGenericParameter", ves_icall_MonoType_get_IsGenericParameter,
        "System.MonoType::get_DeclaringMethod", ves_icall_MonoType_get_DeclaringMethod,
 
+       /* Method generics icalls */
+       "System.Reflection.MethodInfo::get_IsGenericMethodDefinition", ves_icall_MethodInfo_get_IsGenericMethodDefinition,
+
 
        /*
         * System.Reflection.FieldInfo
index 23acc4fd411fc13ad7596703d68bfd2030daf0e2..628fa4d7a98d718e86a07b6f74c6b851c1f197e4 100644 (file)
@@ -1367,6 +1367,7 @@ mono_metadata_parse_method_signature (MonoImage *m, int def, const char *ptr, co
        method->hasthis = hasthis;
        method->explicit_this = explicit_this;
        method->call_convention = call_convention;
+       method->generic_param_count = gen_param_count;
        if (call_convention != 0xa)
                method->ret = mono_metadata_parse_type (m, MONO_PARSE_RET, ret_attrs, ptr, &ptr);
 
@@ -3233,6 +3234,7 @@ mono_metadata_load_generic_params (MonoImage *image, guint32 token, guint32 *num
        n = 1;
        do {
                params = g_realloc (params, sizeof (MonoGenericParam) * n);
+               params [n - 1].pklass = NULL;
                params [n - 1].method = method;
                params [n - 1].flags = cols [MONO_GENERICPARAM_FLAGS];
                params [n - 1].num = cols [MONO_GENERICPARAM_NUMBER];