2009-01-23 Mark Probst <mark.probst@gmail.com>
authorMark Probst <mark.probst@gmail.com>
Fri, 23 Jan 2009 09:25:56 +0000 (09:25 -0000)
committerMark Probst <mark.probst@gmail.com>
Fri, 23 Jan 2009 09:25:56 +0000 (09:25 -0000)
Backport of r124022 and r124301.

* metadata.c (mono_metadata_generic_param_equal): Owner as well as
image must match.  Only compare the image if the owner is NULL.
Fixes the AOT failures.

svn path=/branches/mono-2-2/mono/; revision=124304

mono/metadata/ChangeLog
mono/metadata/metadata.c

index de37dd63716e26f4f2d638ac1bbd4be1dbedb651..25fdca978f4346ccc84ec4963493d5345fceb684 100644 (file)
@@ -1,3 +1,11 @@
+2009-01-23  Mark Probst  <mark.probst@gmail.com>
+
+       Backport of r124022 and r124301.
+
+       * metadata.c (mono_metadata_generic_param_equal): Owner as well as
+       image must match.  Only compare the image if the owner is NULL.
+       Fixes the AOT failures.
+
 2009-01-23  Zoltan Varga  <vargaz@gmail.com>
 
        Backport of r124268.
index ce475e5f67423b2b08ef67288fb2a32d4d58f5cb..35e4b315235a2aa5d15a805337a3dbd75491dd3f 100644 (file)
@@ -3952,7 +3952,19 @@ mono_metadata_generic_param_equal (MonoGenericParam *p1, MonoGenericParam *p2, g
        if (p1->num != p2->num)
                return FALSE;
 
-       if (p1->owner == p2->owner)
+       /*
+        * We have to compare the image as well because if we didn't,
+        * the generic_inst_cache lookup wouldn't care about the image
+        * of generic params, so what could happen is that a generic
+        * inst with params from image A is put into the cache, then
+        * image B gets that generic inst from the cache, image A is
+        * unloaded, so the inst is deleted, but image B still retains
+        * a pointer to it.
+        *
+        * The AOT runtime doesn't set the image when it's decoding
+        * types, so we only compare it when the owner is NULL.
+        */
+       if (p1->owner == p2->owner && (p1->owner || p1->image == p2->image))
                return TRUE;
 
        /*