Author: raja
Date: 2008-01-23 15:18:02 -0500 (Wed, 23 Jan 2008)
New Revision: 93707

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/class.c
Log:
Fix some puzzling code

* class.c (mono_class_inflate_generic_method_full): Don't modify
iresult->context after cache check.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2008-01-23 20:15:12 UTC (rev 93706)
+++ trunk/mono/mono/metadata/ChangeLog  2008-01-23 20:18:02 UTC (rev 93707)
@@ -1,3 +1,8 @@
+2008-01-24  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * class.c (mono_class_inflate_generic_method_full): Don't modify
+       iresult->context after cache check.
+
 2008-01-23  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * class.c (mono_class_inflate_generic_method_full): Change the

Modified: trunk/mono/mono/metadata/class.c
===================================================================
--- trunk/mono/mono/metadata/class.c    2008-01-23 20:15:12 UTC (rev 93706)
+++ trunk/mono/mono/metadata/class.c    2008-01-23 20:18:02 UTC (rev 93707)
@@ -655,6 +655,9 @@
        iresult->context = *context;
        iresult->declaring = method;
 
+       if (!context->method_inst && method->generic_container)
+               iresult->context.method_inst = 
method->generic_container->context.method_inst;
+
        mono_loader_lock ();
        cached = mono_method_inflated_lookup (iresult, FALSE);
        if (cached) {
@@ -673,9 +676,13 @@
 
        result = (MonoMethod *) iresult;
        result->is_inflated = 1;
-       /* result->generic_container = NULL; */
        result->signature = NULL;
 
+       if (context->method_inst)
+               result->generic_container = NULL;
+
+       /* Due to the memcpy above, !context->method_inst => 
result->generic_container == method->generic_container */
+
        if (!klass_hint || !klass_hint->generic_class ||
            klass_hint->generic_class->container_class != method->klass ||
            klass_hint->generic_class->context.class_inst != 
context->class_inst)
@@ -691,12 +698,6 @@
                        mono_metadata_free_type (inflated);
        }
 
-       /* These are originally set by the memcpy above */
-       if (context->method_inst)
-               result->generic_container = NULL;
-       else if (method->generic_container)
-               iresult->context.method_inst = 
method->generic_container->context.method_inst;
-
        mono_method_inflated_lookup (iresult, TRUE);
        mono_loader_unlock ();
        return result;

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

Reply via email to