[Mono-bugs] [Bug 81091][Maj] New - Circular references in DynamicMethods do not work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Mar 9 09:23:49 EST 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 tomba at bat.org.

http://bugzilla.ximian.com/show_bug.cgi?id=81091

--- shadow/81091	2007-03-09 09:23:49.000000000 -0500
+++ shadow/81091.tmp.22711	2007-03-09 09:23:49.000000000 -0500
@@ -0,0 +1,124 @@
+Bug#: 81091
+Product: Mono: Runtime
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: Debian Etch x86
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: JIT
+AssignedTo: lupus at ximian.com                            
+ReportedBy: tomba at bat.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Circular references in DynamicMethods do not work
+
+When creating two or more DynamicMethods that refer to each other with jmp
+instructions, the runtime fails to create them.
+
+The following code does not work on Mono, but works on MS CLR:
+
+
+class Program
+{
+static void Main(string[] args)
+{
+DynamicMethod m1 = new DynamicMethod("f1", typeof(void), new Type[] { },
+typeof(Program));
+DynamicMethod m2 = new DynamicMethod("f2", typeof(void), new Type[] { },
+typeof(Program));
+
+ILGenerator il1 = m1.GetILGenerator();
+ILGenerator il2 = m2.GetILGenerator();
+
+il1.EmitWriteLine("f1");
+il1.Emit(OpCodes.Jmp, m2);
+
+il2.EmitWriteLine("f2");
+il2.Emit(OpCodes.Jmp, m1);
+
+m1.Invoke(null, new object[0]);
+}
+}
+
+
+
+Running this program gives the following output:
+
+
+
+$ mono Program.exe
+
+** ERROR **: file reflection.c: line 9783 (resolve_object): assertion
+failed: (method->mhandle)
+aborting...
+Stacktrace:
+
+  at (wrapper managed-to-native)
+System.Reflection.Emit.DynamicMethod.create_dynamic_method
+(System.Reflection.Emit.DynamicMethod) <0x00004>
+  at (wrapper managed-to-native)
+System.Reflection.Emit.DynamicMethod.create_dynamic_method
+(System.Reflection.Emit.DynamicMethod) <0xffffffff>
+  at System.Reflection.Emit.DynamicMethod.CreateDynMethod () <0x00116>
+  at System.Reflection.Emit.DynamicMethod.CreateDynMethod () <0x000e7>
+  at System.Reflection.Emit.DynamicMethod.Invoke (object,object[]) <0x00010>
+  at test.Program.Main (string[]) <0x0014c>
+  at (wrapper runtime-invoke) System.Object.runtime_invoke_void_string[]
+(object,intptr,intptr,intptr) <0xffffffff>
+
+Native stacktrace:
+
+        mono [0x815c84a]
+        [0xb7f22440]
+        /lib/tls/i686/cmov/libc.so.6(abort+0x109) [0xb7d29fb9]
+        /usr/lib/libglib-2.0.so.0(g_logv+0x454) [0xb7ea9074]
+        /usr/lib/libglib-2.0.so.0(g_log+0x29) [0xb7ea90a9]
+        /usr/lib/libglib-2.0.so.0(g_assert_warning+0x77) [0xb7ea9127]
+        mono [0x8163e0d]
+        mono [0x81658b0]
+        [0xb7374c99]
+        [0xb7374a27]
+        [0xb73749f8]
+        [0xb7374839]
+        [0xb737083d]
+        [0xb736c063]
+        mono(mono_runtime_exec_main+0x60) [0x8094080]
+        mono(mono_runtime_run_main+0x1b3) [0x8094363]
+        mono(mono_main+0xea7) [0x80590c7]
+        mono [0x8057d32]
+        /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xc8) [0xb7d14ea8]
+        mono [0x8057c81]
+
+Debug info from gdb:
+
+Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
+[Thread debugging using libthread_db enabled]
+[New Thread -1211111744 (LWP 10224)]
+[New Thread -1221157968 (LWP 10226)]
+[New Thread -1215390800 (LWP 10225)]
+0xb7f22410 in ?? ()
+  3 Thread -1215390800 (LWP 10225)  0xb7f22410 in ?? ()
+  2 Thread -1221157968 (LWP 10226)  0xb7f22410 in ?? ()
+  1 Thread -1211111744 (LWP 10224)  0xb7f22410 in ?? ()
+
+Thread 3 (Thread -1215390800 (LWP 10225)):
+#0  0xb7f22410 in ?? ()
+#1  0xb78e9458 in ?? ()
+#2  0x081f4c20 in ?? ()
+#3  0x00000000 in ?? ()
+
+Thread 2 (Thread -1221157968 (LWP 10226)):
+#0  0xb7f22410 in ?? ()
+#1  0xb73692a8 in ?? ()
+#2  0x00000001 in ?? ()
+#3  0x00000000 in ?? ()
+
+Thread 1 (Thread -1211111744 (LWP 10224)):
+#0  0xb7f22410 in ?? ()
+#1  0xbfcad648 in ?? ()
+#2  0x00000000 in ?? ()
+#0  0xb7f22410 in ?? ()


More information about the mono-bugs mailing list