Author: raja
Date: 2007-06-11 16:19:31 -0400 (Mon, 11 Jun 2007)
New Revision: 79207

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/class-internals.h
   trunk/mono/mono/metadata/icall.c
   trunk/mono/mono/metadata/reflection.c
Log:
MonoGenericMethod on a diet
* class-internals.h (_MonoMethodInflated::reflection_info): Move here ...
(_MonoGenericMethod::reflection_info): ... from here.
* icall.c (ves_icall_MonoMethod_GetGenericMethodDefinition): Update to changes.
* reflection.c (inflate_mono_method): Likewise.
(mono_reflection_bind_generic_method_parameters): Likewise.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-06-11 19:50:46 UTC (rev 79206)
+++ trunk/mono/mono/metadata/ChangeLog  2007-06-11 20:19:31 UTC (rev 79207)
@@ -1,3 +1,14 @@
+2007-06-11  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       MonoGenericMethod on a diet
+       * class-internals.h (_MonoMethodInflated::reflection_info): Move
+       here ...
+       (_MonoGenericMethod::reflection_info): ... from here.
+       * icall.c (ves_icall_MonoMethod_GetGenericMethodDefinition):
+       Update to changes.
+       * reflection.c (inflate_mono_method): Likewise.
+       (mono_reflection_bind_generic_method_parameters): Likewise.
+
 2007-06-11  Rodrigo Kumpera  <[EMAIL PROTECTED]>
 
        *verify.c: all debu printf statements are now guarded by VERIFY_DEBUG

Modified: trunk/mono/mono/metadata/class-internals.h
===================================================================
--- trunk/mono/mono/metadata/class-internals.h  2007-06-11 19:50:46 UTC (rev 
79206)
+++ trunk/mono/mono/metadata/class-internals.h  2007-06-11 20:19:31 UTC (rev 
79207)
@@ -89,6 +89,7 @@
        } method;
        MonoGenericContext *context;    /* The current context. */
        MonoMethod *declaring;          /* the generic method definition. */
+       gpointer reflection_info;
 };
 
 typedef struct {
@@ -409,7 +410,6 @@
        MonoGenericInst *inst;                  /* the instantiation */
        MonoGenericInst *class_inst;            /* if we're in a generic type, 
the instantiation of that type */
        MonoGenericContainer *container;        /* type parameters */
-       gpointer reflection_info;
 };
 
 /*

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c    2007-06-11 19:50:46 UTC (rev 79206)
+++ trunk/mono/mono/metadata/icall.c    2007-06-11 20:19:31 UTC (rev 79207)
@@ -2592,7 +2592,6 @@
 static MonoReflectionMethod *
 ves_icall_MonoMethod_GetGenericMethodDefinition (MonoReflectionMethod *method)
 {
-       MonoGenericContext *context;
        MonoMethodInflated *imethod;
 
        MONO_ARCH_SAVE_REGS;
@@ -2606,10 +2605,8 @@
 
        imethod = (MonoMethodInflated *) method->method;
 
-       /* FIXME: should reflection_info be part of imethod? */
-       context = mono_method_get_context (method->method);
-       if (context->gmethod && context->gmethod->reflection_info)
-               return context->gmethod->reflection_info;
+       if (imethod->reflection_info)
+               return imethod->reflection_info;
        else
                return mono_method_get_object (
                        mono_object_domain (method), imethod->declaring, NULL);

Modified: trunk/mono/mono/metadata/reflection.c
===================================================================
--- trunk/mono/mono/metadata/reflection.c       2007-06-11 19:50:46 UTC (rev 
79206)
+++ trunk/mono/mono/metadata/reflection.c       2007-06-11 20:19:31 UTC (rev 
79207)
@@ -8806,6 +8806,7 @@
 mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, 
MonoArray *types)
 {
        MonoMethod *method, *inflated;
+       MonoMethodInflated *imethod;
        MonoReflectionMethodBuilder *mb = NULL;
        MonoGenericContainer *container;
        MonoGenericMethod *gmethod;
@@ -8869,9 +8870,6 @@
                return mono_method_get_object (mono_object_domain (rmethod), 
inflated, NULL);
        }
 
-       MOVING_GC_REGISTER (&gmethod->reflection_info);
-       gmethod->reflection_info = rmethod;
-
        context = g_new0 (MonoGenericContext, 1);
        context->class_inst = gmethod->class_inst;
        context->gmethod = gmethod;
@@ -8880,6 +8878,11 @@
                method = ((MonoMethodInflated *) method)->declaring;
 
        inflated = mono_class_inflate_generic_method (method, context);
+       imethod = (MonoMethodInflated *) inflated;
+
+       MOVING_GC_REGISTER (&imethod->reflection_info);
+       imethod->reflection_info = rmethod;
+
        g_hash_table_insert (container->method_hash, gmethod, inflated);
 
        return mono_method_get_object (mono_object_domain (rmethod), inflated, 
NULL);
@@ -8888,6 +8891,7 @@
 static MonoMethod *
 inflate_mono_method (MonoReflectionGenericClass *type, MonoMethod *method, 
MonoObject *obj)
 {
+       MonoMethodInflated *imethod;
        MonoGenericMethod *gmethod = NULL;
        MonoGenericContext *context;
        MonoClass *klass;
@@ -8902,8 +8906,6 @@
                gmethod = g_new0 (MonoGenericMethod, 1);
                gmethod->class_inst = klass->generic_class->inst;
                gmethod->container = method->generic_container;
-               MOVING_GC_REGISTER (&gmethod->reflection_info);
-               gmethod->reflection_info = obj;
                gmethod->inst = 
method->generic_container->context.gmethod->inst;
 
                context = g_new0 (MonoGenericContext, 1);
@@ -8911,7 +8913,12 @@
                context->gmethod = gmethod;
        }
 
-       return mono_class_inflate_generic_method_full (method, klass, context);
+       imethod = (MonoMethodInflated *) mono_class_inflate_generic_method_full 
(method, klass, context);
+       if (method->generic_container) {
+               MOVING_GC_REGISTER (&imethod->reflection_info);
+               imethod->reflection_info = obj;
+       }
+       return (MonoMethod *) imethod;
 }
 
 static MonoMethod *

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to