[Mono-bugs] [Bug 79557][Blo] New - Tailcalls still broken on Mono 1.1.17.1
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Mon Oct 2 14:34:35 EDT 2006
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 bbjamey at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=79557
--- shadow/79557 2006-10-02 14:34:35.000000000 -0400
+++ shadow/79557.tmp.3959 2006-10-02 14:34:35.000000000 -0400
@@ -0,0 +1,150 @@
+Bug#: 79557
+Product: Mono: Runtime
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Blocker
+Component: JIT
+AssignedTo: lupus at ximian.com
+ReportedBy: bbjamey at gmail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Tailcalls still broken on Mono 1.1.17.1
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem: Tailcalls don't work correctly in conjunction
+with "starg". The problem seems to be that a ldarg is being optimized to
+a load on the original rather than the modified value as part of some
+optimization related to tailcalls (e.g. an optimization that attempts to
+preserve part of the original stack frame).
+
+
+
+Steps to reproduce the problem:
+1. assemble the IL
+
+
+------------------------------begin IL ------------------------------
+
+// Metadata version: v1.0.3705
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0
+89 ) // .z\V.4..
+ .ver 1:0:3300:0
+}
+
+.assembly bug2 { }
+
+.method assembly static void M2(object o1) cil managed
+ {
+ ldstr "++++++++ M2" call void [mscorlib]System.Console::WriteLine
+(string)
+ ldstr "THIS SHOULD NOT BE NULL: o1 = " call void [mscorlib]
+System.Console::Write(string) ldarg 0 call void [mscorlib]
+System.Console::WriteLine(object)
+ ret
+
+ }
+
+.method assembly static void M1(object o1) cil managed
+ {
+
+IL_0000:
+ ldstr "++++++++ M1" call void [mscorlib]System.Console::WriteLine
+(string)
+ ldarg 0 call void [mscorlib]System.Console::WriteLine(object)
+ ldstr "o1 = " call void [mscorlib]System.Console::Write(string) ldarg
+0 ldnull ceq box [mscorlib]System.Int32 call void [mscorlib]
+System.Console::WriteLine(object)
+
+
+ ldarg.0
+ brfalse.s IL_0041
+
+IL_0002:
+
+ ldarg.0 // This appears to be loading the original arguments
+and not the modified arguments
+ tail. // If you take this tail. out the results change
+ call void M2(object)
+ ret
+
+IL_0041:
+
+ newobj void System.Object::.ctor()
+ starg.s o1
+ br IL_0002
+
+ }
+
+
+.method assembly static void Main()
+{
+ .entrypoint
+ ldnull
+ call void M1(object)
+ ret
+}
+------------------------------end IL ------------------------------
+
+
+
+Expected Results:
+
+
+++++++++ M1
+
+o1 = 1
+++++++++ M2
+THIS SHOULD NOT BE NULL: o1 = System.Object
+
+
+Actual Results:
+
+
+
+On Mono 1.1.17.1 it gives:
+
+
+++++++++ M1
+
+o1 = 1
+++++++++ M2
+THIS SHOULD NOT BE NULL: o1 =
+
+
+
+
+
+How often does this happen? Always
+
+
+Additional Information:
+
+This sample is a trimmed down version of real code used in the
+implementation of the F# compiler (fscp10.exe in F# 1.1.12.5). This
+means the F# compiler doesn't work correctly on Mono. It would be great
+if you could add a snapshot verbatim copy the F# compiler binaries
+(fslib10.dll, mllib10.dll, FSharp.Compiler10.dll, fscp10.dll) to your
+tests and make sure it can compile a simple program such as the one
+below. This will greatly improve your coverage for tailcalls.
+
+---------- begin sample F# program --------------------
+#light
+open System
+
+let rec fib a =
+ match a with
+ | 1 -> 1
+ | 2 -> 1
+ | a -> fib(a-1) + fib(a-2)
+
+print_endline(fib 5 |> any_to_string)
+---------- end sample F# program --------------------
More information about the mono-bugs
mailing list