[Mono-bugs] [Bug 80969][Nor] Changed - [PATCH] Generics multidimensional arrays problem

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 23 10:13:18 EDT 2007

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by martin at ximian.com.


--- shadow/80969	2007-04-23 09:28:25.000000000 -0400
+++ shadow/80969.tmp.24126	2007-04-23 10:13:18.000000000 -0400
@@ -83,6 +83,47 @@
 Attached potential patch. It's fixes this bug and it's duplicate. It
 is overly agressive in that it doesn't cache multidimensional array
 methods when in the presence of a generic context, even if the context
 has nothing to do with the array type. But, I ran some performance
 tests and it didn't seem to have much effect. This is very simple but
 perhaps incorrect if I am missing something.
+------- Additional Comments From martin at ximian.com  2007-04-23 10:13 -------
+I don't think this patch is complete as it doesn't cover all the
+possible cases.
+Key problem is this:
+  .method /*06000002*/ public hidebysig instance void
+          Test() cil managed
+  {
+    // Code size       20 (0x14)
+    .maxstack  7
+    .locals /*11000001*/ init (!T[,] V_0)
+    IL_0000:  ldc.i4.0
+    IL_0001:  ldc.i4.0
+    IL_0002:  newobj     instance void !T[,]/*1B000001*/::.ctor(int32,
+                                                                int32)
+/* 0A000002 */
+    IL_0007:  stloc.0
+    IL_0008:  ldloc.0
+    IL_0009:  callvirt   instance class
+[mscorlib/*23000001*/]System.Object/*01000001*/::GetType() /* 0A000003 */
+    IL_000e:  call       void
+[mscorlib/*23000001*/]System.Console/*01000003*/::WriteLine(object) /*
+0A000004 */
+    IL_0013:  ret
+  } // end of method C`1::Test
+Look at IL_0002: here mono_get_method_full() is called to decode a
+MemberRef 0A000003.
+This MemberRef has a MONO_MEMBERREF_PARENT_TYPESPEC pointing to the
+generic class T[,].  However, this class is fully inflated in
+method_from_memberref() to System.String[,] so we search the method in
+that class and thus it's not inflated.
+So I think for a correct fix, we need to check whether we actually
+used the context or not.

More information about the mono-bugs mailing list