In dis:
authorRaja R Harinath <harinath@hurrynot.org>
Thu, 4 Jan 2007 12:53:37 +0000 (12:53 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Thu, 4 Jan 2007 12:53:37 +0000 (12:53 -0000)
* get.c (get_method_core): Pick generic container from the
declaring method.

In metadata:
Remove redundant field
* class-internals.h (_MonoGenericContext.container): Remove field.
* loader.c (mono_method_get_signature_full): Don't parse a
"container" for a signature parse when the signature is inflated
immediately.
(method_from_methodspec): Likewise, for a generic_inst.
* class.c, metadata.c, reflection.c: Update to changes.

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

mono/dis/ChangeLog
mono/dis/get.c
mono/metadata/ChangeLog
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/loader.c
mono/metadata/metadata.c
mono/metadata/reflection.c

index 6819c0ed59b2eed159b0dda5c6f43347064e4047..19bc99c25392f67b83006d79493d7defc3b0a1bc 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-04  Raja R Harinath  <rharinath@novell.com>
+
+       * get.c (get_method_core): Pick generic container from the
+       declaring method.
+
 2006-12-27  Raja R Harinath  <rharinath@novell.com>
 
        Avoid MonoGenericContext
index bad91e8502a83eb98f86f59d466f105d00a1307d..db64530b6115f99be468f75f82d79636bb63e871 100644 (file)
@@ -1854,7 +1854,7 @@ get_method_core (MonoImage *m, guint32 token, gboolean fullsig, MonoGenericConta
        if (mh) {
                mh = mono_get_inflated_method (mh);
                if (mono_method_signature (mh)->is_inflated)
-                       container = ((MonoMethodInflated *) mh)->context->container;
+                       container = ((MonoMethodInflated *) mh)->declaring->generic_container;
                esname = get_escaped_name (mh->name);
                sig = dis_stringify_type (m, &mh->klass->byval_arg, TRUE);
                if (show_tokens)
index a1d7e888d3e54a6af16ff80e7c69b8a42e55b1e2..d177948d770b9cfec12a6479585eaf9871e3ce50 100644 (file)
@@ -1,3 +1,13 @@
+2007-01-04  Raja R Harinath  <rharinath@novell.com>
+
+       Remove redundant field
+       * class-internals.h (_MonoGenericContext.container): Remove field.
+       * loader.c (mono_method_get_signature_full): Don't parse a
+       "container" for a signature parse when the signature is inflated
+       immediately.
+       (method_from_methodspec): Likewise, for a generic_inst.
+       * class.c, metadata.c, reflection.c: Update to changes.
+
 2006-01-04  Raja R Harinath  <rharinath@novell.com>
 
        * class-internals.h (_MonoGenericClass): Rename 'context' field to
index f36fe44fc07b05e2ce0bbbe7800dbbbea94a07df..126ba0441a2b8a3d181ebf66a2d6ad76582ed384 100644 (file)
@@ -439,16 +439,9 @@ struct _MonoGenericMethod {
 };
 
 /*
- * The generic context.
+ * The generic context: an instantiation of a set of class and method generic parameters.
  */
 struct _MonoGenericContext {
-       /*
-        * The container which has been instantiated.
-        *
-        * If we're in a generic method, the generic method definition's container.
-        * Otherwise the generic type's container.
-        */
-       MonoGenericContainer *container;
        /* The current generic class */
        MonoGenericClass *gclass;
        /* The current generic method */
index 846e44619b68b705621b183b53408bcbe15322a6..572b63c460172b20f7d7e5ddef4e6a4cab526901 100644 (file)
@@ -569,14 +569,12 @@ mono_generic_class_get_context (MonoGenericClass *gclass)
 {
        MonoGenericContext *context = gclass->cached_context;
        if (context) {
-              g_assert (context->container == gclass->container_class->generic_container);
               g_assert (context->gclass == gclass);
               g_assert (!context->gmethod);
               return context;
        }
        
        context = g_new0 (MonoGenericContext, 1);
-       context->container = gclass->container_class->generic_container;
        context->gclass = gclass;
 
        if (InterlockedCompareExchangePointer ((gpointer *)&gclass->cached_context, context, NULL))
@@ -637,7 +635,7 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat
                } else {
                        gmethod = g_new0 (MonoGenericMethod, 1);
                        gmethod->generic_class = gclass;
-                       gmethod->container = context->container;
+                       gmethod->container = context->gmethod->container;
                        gmethod->inst = ninst;
                }
        }
@@ -649,7 +647,6 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat
                return mono_generic_class_get_context (gclass);
 
        res = g_new0 (MonoGenericContext, 1);
-       res->container = gmethod->container;
        res->gclass = gclass;
        res->gmethod = gmethod;
 
@@ -732,7 +729,6 @@ mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hin
                gmethod->generic_class = result->klass->generic_class;
 
                context = g_new0 (MonoGenericContext, 1);
-               context->container = method->generic_container;
                context->gclass = result->klass->generic_class;
                context->gmethod = gmethod;
 
@@ -2307,7 +2303,6 @@ setup_generic_array_ifaces (MonoClass *class, MonoClass *iface, int pos)
        int i;
 
        context = g_new0 (MonoGenericContext, 1);
-       context->container = iface->generic_class->container_class->generic_container;
        context->gmethod = g_new0 (MonoGenericMethod, 1);
        context->gmethod->generic_class = iface->generic_class;
        context->gmethod->inst = iface->generic_class->inst;
@@ -2979,7 +2974,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
                class->generic_container->klass = class;
                context = &class->generic_container->context;
 
-               context->gclass = mono_get_shared_generic_class (context->container, FALSE);
+               context->gclass = mono_get_shared_generic_class (class->generic_container, FALSE);
        }
 
        if (cols [MONO_TYPEDEF_EXTENDS]) {
index 741f9e2f7dc77228bd4c93f45ed78b00f26aa197..4256cdfbb2ed7e6b525e6253ab017ff3c39369ac 100644 (file)
@@ -627,8 +627,7 @@ mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 to
 
                ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
                mono_metadata_decode_blob_size (ptr, &ptr);
-               sig = mono_metadata_parse_method_signature_full (
-                       image, context ? context->container : NULL, 0, ptr, NULL);
+               sig = mono_metadata_parse_method_signature (image, 0, ptr, NULL);
 
                mono_loader_lock ();
                prev_sig = g_hash_table_lookup (image->memberref_signatures, GUINT_TO_POINTER (token));
@@ -874,7 +873,6 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
        gmethod->container = container;
 
        new_context = g_new0 (MonoGenericContext, 1);
-       new_context->container = container;
        new_context->gmethod = gmethod;
        if (container->parent)
                new_context->gclass = container->parent->context.gclass;
@@ -900,7 +898,7 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
         * ie. instantiate the method as `Foo.Hello<float>.
         */
 
-       gmethod->inst = mono_metadata_parse_generic_inst (image, context ? context->container : NULL, param_count, ptr, &ptr);
+       gmethod->inst = mono_metadata_parse_generic_inst (image, NULL, param_count, ptr, &ptr);
 
        if (context && gmethod->inst->is_open)
                gmethod->inst = mono_metadata_inflate_generic_inst (gmethod->inst, context);
index 1c8039f4e21647e0dc605a06b23f298c76b5d465..6d64a722ba7255ed85d8e3f331cdf34b4c0182e6 100644 (file)
@@ -4602,8 +4602,6 @@ mono_metadata_load_generic_params (MonoImage *image, guint32 token, MonoGenericC
        if (mono_metadata_token_table (token) == MONO_TABLE_METHOD)
                container->is_method = 1;
 
-       container->context.container = container;
-
        return container;
 }
 
index 2b84bd2af8f892bfee81060d6ec9b9ec240d26bd..08f99cc35964c061a82e3238cfedb203d2d4935e 100644 (file)
@@ -8185,8 +8185,6 @@ mono_reflection_setup_generic_class (MonoReflectionTypeBuilder *tb)
 
        tb->generic_container = g_new0 (MonoGenericContainer, 1);
        tb->generic_container->klass = klass;
-
-       tb->generic_container->context.container = tb->generic_container;
 }
 
 /*
@@ -8504,7 +8502,6 @@ reflection_methodbuilder_to_mono_method (MonoClass *klass,
                }
 
                context = &container->context;
-               context->container = container;
                if (klass->generic_container) {
                        container->parent = klass->generic_container;
                        context->gclass = klass->generic_container->context.gclass;
@@ -8957,7 +8954,6 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        gmethod->reflection_info = rmethod;
 
        context = g_new0 (MonoGenericContext, 1);
-       context->container = container;
        context->gclass = method->klass->generic_class;
        context->gmethod = gmethod;
 
@@ -8984,7 +8980,6 @@ inflate_mono_method (MonoReflectionGenericClass *type, MonoMethod *method, MonoO
        n = mono_method_signature (method)->generic_param_count;
 
        context = mono_generic_class_get_context ((MonoGenericClass *) gclass);
-       g_assert (context && context->container);
        if (n) {
                gmethod = g_new0 (MonoGenericMethod, 1);
                gmethod->generic_class = &gclass->generic_class;
@@ -9002,10 +8997,9 @@ inflate_mono_method (MonoReflectionGenericClass *type, MonoMethod *method, MonoO
                        gmethod->inst->type_argv [i] = &gparam->pklass->byval_arg;
                }
 
-               g_assert (gmethod->container->parent == context->container);
+               g_assert (gmethod->container->parent == ((MonoGenericClass *)gclass)->container_class->generic_container);
 
                context = g_new0 (MonoGenericContext, 1);
-               context->container = gmethod->container;
                context->gclass = &gclass->generic_class;
                context->gmethod = gmethod;
        }