In metadata:
authorRaja R Harinath <harinath@hurrynot.org>
Tue, 28 Feb 2006 14:24:45 +0000 (14:24 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Tue, 28 Feb 2006 14:24:45 +0000 (14:24 -0000)
* class.h (mono_class_inflate_generic_method): Revert to two
argument version.
* class-internals.h (MonoMethodInflated): Remove 'inflated' field.
(mono_class_inflate_generic_method_full): Add.
* class.c (mono_class_inflate_generic_method_full): Rename from
'mono_class_inflate_generic_method'.  Don't set 'inflated' field.
(mono_class_inflate_generic_method): New.  Wrapper around ..._full.
* loader.c, reflection.c: Update to changes.

In mini:
* jit-icalls.c (helper_compile_generic_method): Revert change from
2006-02-24.

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

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

index 1249b55fc86cef8e10151606a775f4ef25bb947b..e8b6e684e1661016b56d50ce5856c2804c746943 100644 (file)
@@ -1,3 +1,13 @@
+2006-02-28  Raja R Harinath  <rharinath@novell.com>
+
+       * class.h (mono_class_inflate_generic_method): Revert to two
+       argument version.
+       * class-internals.h (MonoMethodInflated): Remove 'inflated' field.
+       (mono_class_inflate_generic_method_full): Add.
+       * class.c (mono_class_inflate_generic_method_full): Rename from
+       'mono_class_inflate_generic_method'.  Don't set 'inflated' field.
+       (mono_class_inflate_generic_method): New.  Wrapper around ..._full.
+       * loader.c, reflection.c: Update to changes.
 
 Sat Feb 25 17:57:21 CET 2006 Paolo Molaro <lupus@ximian.com>
 
index 030944c4e0f48ba1a18a1fa4db27ad361ffed088..72a836dc4f3198f7d2521695f0a13b08100f4332 100644 (file)
@@ -109,17 +109,6 @@ struct _MonoMethodInflated {
        } method;
        MonoGenericContext *context;    /* The current context. */
        MonoMethod *declaring;          /* the generic method definition. */
-       /* This is a big performance optimization:
-        *
-        * mono_class_inflate_generic_method() just creates a copy of the method
-        * and computes its new context, but it doesn't actually inflate the
-        * method's signature and header.  Very often, we don't actually need them
-        * (for instance because the method is stored in a class'es vtable).
-        *
-        * If the `inflated' field in non-NULL, mono_get_inflated_method() already
-        * inflated the signature and header and stored it there.
-        */
-       MonoMethodInflated *inflated;
 };
 
 typedef struct {
@@ -631,6 +620,10 @@ mono_install_get_cached_class_info (MonoGetCachedClassInfo func);
 MonoInflatedGenericClass*
 mono_get_inflated_generic_class (MonoGenericClass *gclass);
 
+MonoMethod*
+mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
+
+
 typedef struct {
        MonoImage *corlib;
        MonoClass *object_class;
index 738326180fd77a7c06cde5dfc0534e75aa5006e4..aec749bd499416a18f95fc8dda2e789a98e70dd1 100644 (file)
@@ -576,6 +576,12 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat
        return res;
 }
 
+MonoMethod *
+mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context)
+{
+       return mono_class_inflate_generic_method_full (method, NULL, context);
+}
+
 /**
  * mono_class_inflate_generic_method:
  *
@@ -584,7 +590,7 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat
  *         Use mono_get_inflated_method (), mono_method_signature () and mono_method_get_header () to get the correct values.
  */
 MonoMethod*
-mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context)
+mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context)
 {
        MonoMethod *result;
        MonoMethodInflated *iresult;
@@ -619,8 +625,9 @@ mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, Mo
        iresult->context = context;
        iresult->declaring = method;
 
-       if (klass_hint && klass_hint->generic_class &&
-           (klass_hint->generic_class->container_class != method->klass || klass_hint->generic_class->inst != context->gclass->inst))
+       if (!klass_hint || !klass_hint->generic_class ||
+           klass_hint->generic_class->container_class != method->klass ||
+           klass_hint->generic_class->inst != context->gclass->inst)
                klass_hint = NULL;
 
        if (method->klass->generic_container)
@@ -643,8 +650,6 @@ mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, Mo
                iresult->context = context;
        }
 
-       iresult->inflated = result;
-
        return result;
 }
 
@@ -1237,28 +1242,28 @@ inflate_event (MonoClass *class, MonoEvent *event, MonoInflatedGenericClass *gcl
        event->parent = class;
 
        if (event->add) {
-               MonoMethod *inflated = mono_class_inflate_generic_method (
+               MonoMethod *inflated = mono_class_inflate_generic_method_full (
                        event->add, class, gclass->generic_class.context);
 
                event->add = mono_get_inflated_method (inflated);
        }
 
        if (event->remove) {
-               MonoMethod *inflated = mono_class_inflate_generic_method (
+               MonoMethod *inflated = mono_class_inflate_generic_method_full (
                        event->remove, class, gclass->generic_class.context);
 
                event->remove = mono_get_inflated_method (inflated);
        }
 
        if (event->raise) {
-               MonoMethod *inflated = mono_class_inflate_generic_method (
+               MonoMethod *inflated = mono_class_inflate_generic_method_full (
                        event->raise, class, gclass->generic_class.context);
 
                event->raise = mono_get_inflated_method (inflated);
        }
 
        if (event->other) {
-               MonoMethod *inflated = mono_class_inflate_generic_method (
+               MonoMethod *inflated = mono_class_inflate_generic_method_full (
                        event->other, class, gclass->generic_class.context);
 
                event->other = mono_get_inflated_method (inflated);
@@ -1597,7 +1602,7 @@ setup_generic_vtable (MonoClass *class)
                if (!m)
                        continue;
 
-               m = mono_class_inflate_generic_method (m, class, class->generic_class->context);
+               m = mono_class_inflate_generic_method_full (m, class, class->generic_class->context);
                class->vtable [i] = m;
        }
 
@@ -2140,7 +2145,7 @@ mono_class_init (MonoClass *class)
                class->methods = g_new0 (MonoMethod *, class->method.count);
 
                for (i = 0; i < class->method.count; i++) {
-                       MonoMethod *inflated = mono_class_inflate_generic_method (
+                       MonoMethod *inflated = mono_class_inflate_generic_method_full (
                                gklass->methods [i], class, gclass->generic_class.context);
 
                        class->methods [i] = mono_get_inflated_method (inflated);
@@ -2155,10 +2160,10 @@ mono_class_init (MonoClass *class)
                        *prop = gklass->properties [i];
 
                        if (prop->get)
-                               prop->get = mono_class_inflate_generic_method (
+                               prop->get = mono_class_inflate_generic_method_full (
                                        prop->get, class, gclass->generic_class.context);
                        if (prop->set)
-                               prop->set = mono_class_inflate_generic_method (
+                               prop->set = mono_class_inflate_generic_method_full (
                                        prop->set, class, gclass->generic_class.context);
 
                        prop->parent = class;
index 2ebebe701d6f460b91e70ca4dc9a162fe28b69cf..5dcf8d3dfe6d16bea02c5240256777d3a83e1e9d 100644 (file)
@@ -53,7 +53,7 @@ MonoType*
 mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context);
 
 MonoMethod*
-mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
+mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context);
 
 MonoMethod *
 mono_get_inflated_method (MonoMethod *method);
index 9b9e48da4cfa47184b20bfba8f0df3cc02256eb4..fb923e442f6313bf97bed5b543ecb8b588e869dd 100644 (file)
@@ -594,7 +594,7 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *typesp
                        method = find_method (in_class, NULL, mname, sig);
                        if (method && klass->generic_class) {
                                MonoClass *klass_hint = (in_class == method->klass) ? klass : NULL;
-                               method = mono_class_inflate_generic_method (method, klass_hint, klass->generic_class->context);
+                               method = mono_class_inflate_generic_method_full (method, klass_hint, klass->generic_class->context);
                                method = mono_get_inflated_method (method);
                        }
                        break;
@@ -771,7 +771,7 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
        mono_stats.generics_metadata_size += sizeof (MonoGenericMethod) +
                sizeof (MonoGenericContext) + param_count * sizeof (MonoType);
 
-       inflated = mono_class_inflate_generic_method (method, method->klass, new_context);
+       inflated = mono_class_inflate_generic_method_full (method, method->klass, new_context);
        g_hash_table_insert (container->method_hash, gmethod, inflated);
 
        return inflated;
@@ -1297,7 +1297,7 @@ mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constra
                           image->name, token);
 
        if (gclass)
-               result = mono_class_inflate_generic_method (result, NULL, gclass->context);
+               result = mono_class_inflate_generic_method (result, gclass->context);
 
        mono_loader_unlock ();
        return result;
index d5e17003d282ba03de23b6bd5b37fa3145a69aa2..b54d903ff8cdfa1f36f0c9473eb9b1e156a69870 100644 (file)
@@ -8899,7 +8899,7 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
        if (method->is_inflated)
                method = ((MonoMethodInflated *) method)->declaring;
 
-       inflated = mono_class_inflate_generic_method (method, NULL, context);
+       inflated = mono_class_inflate_generic_method (method, context);
        g_hash_table_insert (container->method_hash, gmethod, inflated);
 
        return mono_method_get_object (mono_object_domain (rmethod), inflated, NULL);
@@ -8944,7 +8944,7 @@ inflate_mono_method (MonoReflectionGenericClass *type, MonoMethod *method, MonoO
                context->gmethod = gmethod;
        }
 
-       return mono_class_inflate_generic_method (method, klass, context);
+       return mono_class_inflate_generic_method (method, context);
 }
 
 static MonoMethod *
index a054182d2ef5afa9bfb64d472228727cccf91906..a953eb1734b3507a63461ff249a703558b1c3711 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-28  Raja R Harinath  <rharinath@novell.com>
+
+       * jit-icalls.c (helper_compile_generic_method): Revert change from
+       2006-02-24.
 
 Mon Feb 27 18:58:19 GMT 2006 Paolo Molaro <lupus@ximian.com>
 
index c3d434851cf014cac7f7d1072fb2c1769467cf05..892082d0be128876544019055fd6a09d3adea4bd 100644 (file)
@@ -668,7 +668,7 @@ helper_compile_generic_method (MonoObject *obj, MonoMethod *method, MonoGenericC
        g_assert (!vmethod->klass->generic_container);
        g_assert (!vmethod->klass->generic_class || !vmethod->klass->generic_class->inst->is_open);
        g_assert (!context->gmethod || !context->gmethod->inst->is_open);
-       inflated = mono_class_inflate_generic_method (vmethod, vmethod->klass, context);
+       inflated = mono_class_inflate_generic_method (vmethod, context);
        inflated = mono_get_inflated_method (inflated);
        addr = mono_compile_method (inflated);