[Mono-bugs] [Bug 54063][Maj] New - the switch instruction supposes an empty stack

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 9 Feb 2004 04:08:12 -0500 (EST)


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 manuel.serrano@inria.fr.

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

--- shadow/54063	2004-02-09 04:08:12.000000000 -0500
+++ shadow/54063.tmp.24190	2004-02-09 04:08:12.000000000 -0500
@@ -0,0 +1,70 @@
+Bug#: 54063
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: Linux 2.4, gcc 3.3.2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: Manuel.Serrano@inria.fr               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: the switch instruction supposes an empty stack
+
+The .NET switch instruction supposes an empty stack.
+
+We are developping a compiler that produces sequences of bytecode such as:
+
+.method public virtual hidebysig instance class System.Object
+funcall1(class System.Object) cil managed {
+	.maxstack	3
+	ldarg.0
+	ldarg.1
+	ldarg.0
+	ldfld	int32 bigloo.procedure::'index'
+	switch	(L0,L1,err)
+err:	call instance	class System.Object bigloo.procedure::'funcall1'(class
+System.Object)
+	ret
+L0:	call	class System.Object 'foo'::'BgL_zc3anonymousza31019ze3z83'(class
+'bigloo.procedure',class System.Object)
+	ret
+L1:	call	class System.Object 'foo'::'BgL_zc3anonymousza31007ze3z83'(class
+'bigloo.procedure',class System.Object)
+	ret
+}
+
+
+If this runs correctly with CLR, ROTOR and PNET, this crashes with
+MONO0.29. We have had to change of code generator for:
+
+.method public virtual hidebysig instance class System.Object
+funcall1(class System.Object) cil managed {
+	.maxstack	3
+	ldarg.0
+	ldfld	int32 bigloo.procedure::'index'
+	switch	(L0,L1,err)
+err:	ldarg.0
+	ldarg.1
+	call instance	class System.Object bigloo.procedure::'funcall1'(class
+System.Object)
+	ret
+L0:	ldarg.0
+	ldarg.1
+	call	class System.Object 'foo'::'BgL_zc3anonymousza31019ze3z83'(class
+'bigloo.procedure',class System.Object)
+	ret
+L1:	ldarg.0
+	ldarg.1
+	call	class System.Object 'foo'::'BgL_zc3anonymousza31007ze3z83'(class
+'bigloo.procedure',class System.Object)
+	ret
+}
+
+
+I hope that this bug report will help.