Tue Jul 24 15:15:19 CEST 2007 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Tue, 24 Jul 2007 13:02:17 +0000 (13:02 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Tue, 24 Jul 2007 13:02:17 +0000 (13:02 -0000)
* loader.c, class-internals.h, reflection.c: removed the per-method
generics hashtable: we use the global one through the call of
mono_class_inflate_generic_method ().

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

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

index 96707b3a86e679f78b0997ee3652b8d061a45296..8d309ca4c2ca9f81b94d8d249b438ef56cff2317 100644 (file)
@@ -1,4 +1,10 @@
 
+Tue Jul 24 15:15:19 CEST 2007 Paolo Molaro <lupus@ximian.com>
+
+       * loader.c, class-internals.h, reflection.c: removed the per-method
+       generics hashtable: we use the global one through the call of
+       mono_class_inflate_generic_method ().
+
 Mon Jul 23 19:43:14 CEST 2007 Paolo Molaro <lupus@ximian.com>
 
        * class.c, metadata.c, class-internals.h: introduce yet another
index baefd7d47a630eb6bad2a0943c76bc07874f4166..6ad6f321d0bac1b8378a21476e219fc0d6492d04 100644 (file)
@@ -429,8 +429,6 @@ struct _MonoGenericContainer {
        /* If we're a generic method definition in a generic type definition,
           the generic container of the containing class. */
        MonoGenericContainer *parent;
-       /* If we're a generic method definition, caches all their instantiations. */
-       GHashTable *method_hash;
        /* the generic type definition or the generic method definition corresponding to this container */
        union {
                MonoClass *klass;
index 07d51f096cea16332c162e0795f437afe32dda1c..2b5da6abcf828c20482356aa419f381628a04fe0 100644 (file)
@@ -827,7 +827,6 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
        MonoTableInfo *tables = image->tables;
        MonoGenericContext new_context;
        MonoGenericInst *inst;
-       MonoGenericContainer *container = NULL;
        const char *ptr;
        guint32 cols [MONO_METHODSPEC_SIZE];
        guint32 token, nindex, param_count;
@@ -884,9 +883,6 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
                method = ((MonoMethodInflated *) method)->declaring;
        }
 
-       container = method->generic_container;
-       g_assert (container);
-
        new_context.class_inst = klass->generic_class ? klass->generic_class->context.class_inst : NULL;
 
        /*
@@ -917,18 +913,7 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
 
        new_context.method_inst = inst;
 
-       if (!container->method_hash)
-               container->method_hash = g_hash_table_new (
-                       (GHashFunc)mono_metadata_generic_context_hash, (GEqualFunc)mono_metadata_generic_context_equal);
-
-       inflated = g_hash_table_lookup (container->method_hash, &new_context);
-       if (inflated)
-               return inflated;
-
-       mono_stats.generics_metadata_size += param_count * sizeof (MonoType);
-
        inflated = mono_class_inflate_generic_method_full (method, klass, &new_context);
-       g_hash_table_insert (container->method_hash, mono_method_get_context (inflated), inflated);
 
        return inflated;
 }
@@ -1313,6 +1298,9 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
        return piinfo->addr;
 }
 
+/*
+ * LOCKING: assumes the loader lock to be taken.
+ */
 static MonoMethod *
 mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass,
                            MonoGenericContext *context, gboolean *used_context)
index 844228c55a6166a3ac99237ee2d2bff11afa47a9..30c7cff7133a12578abd08d579b4dd299998e73e 100644 (file)
@@ -8815,7 +8815,6 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        MonoMethod *method, *inflated;
        MonoMethodInflated *imethod;
        MonoReflectionMethodBuilder *mb = NULL;
-       MonoGenericContainer *container;
        MonoGenericContext tmp_context;
        MonoGenericInst *ginst;
        MonoType **type_argv;
@@ -8844,14 +8843,6 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        if (count != mono_array_length (types))
                return NULL;
 
-       container = method->generic_container;
-       g_assert (container);
-
-       if (!container->method_hash)
-               container->method_hash = g_hash_table_new (
-                       (GHashFunc) mono_metadata_generic_context_hash,
-                       (GCompareFunc) mono_metadata_generic_context_equal);
-
        type_argv = g_new0 (MonoType *, count);
        for (i = 0; i < count; i++) {
                MonoReflectionType *garg = mono_array_get (types, gpointer, i);
@@ -8863,18 +8854,12 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        tmp_context.class_inst = klass->generic_class ? klass->generic_class->context.class_inst : NULL;
        tmp_context.method_inst = ginst;
 
-       inflated = g_hash_table_lookup (container->method_hash, &tmp_context);
-       if (inflated)
-               return mono_method_get_object (mono_object_domain (rmethod), inflated, NULL);
-
        inflated = mono_class_inflate_generic_method (method, &tmp_context);
        imethod = (MonoMethodInflated *) inflated;
 
        MOVING_GC_REGISTER (&imethod->reflection_info);
        imethod->reflection_info = rmethod;
 
-       g_hash_table_insert (container->method_hash, mono_method_get_context (inflated), inflated);
-
        return mono_method_get_object (mono_object_domain (rmethod), inflated, NULL);
 }