[Mono-devel-list] ilasm questions
Marcus
mathpup at mylinuxisp.com
Thu Jan 15 17:05:29 EST 2004
Did you specify /optimize+ when compiling with csc? csc (at least on Rotor)
generates some very naive code when optimization is not requested.
On Thursday 15 January 2004 3:52 pm, Bart Van Rompaey wrote:
> I hope this is the right newsgroup.
> While looking into ilasm generated by Mono and ms.NET, I noticed two
> major differences:
> 1) Mono doesn't make use of the short branch instructions (ex. bge.s). I
> presume using this could mean some runtime performance improvement?
> 2) ms.net generates some weird code in case of branches. Let me give an
> example:
>
> public static int fib (int n) {
> if (n < 2)
> return 1;
> return fib(n-2)+fib(n-1);
> }
>
> The if structures translates to:
>
> ms.net:
>
> IL_0000: ldarg.0
> IL_0001: ldc.i4.2
> IL_0002: bge.s IL_0008
> IL_0004: ldc.i4.1
> IL_0005: stloc.0
> IL_0006: br.s IL_001c
> IL_0008: ldarg.0
> ...
> IL_001c: ldloc.0
> IL_001d: ret
>
> mono:
> IL_0000: ldarg.0
> IL_0001: ldc.i4.2
> IL_0002: bge IL_0009
> IL_0007: ldc.i4.1
> IL_0008: ret
> IL_0009: ldarg.0
> ... (rest of method)
>
> Why would ms.net compile into that sequence of instructions? It has an
> extra store/load and and an extra branch instruction? Does anyone see
> some advantages of that?
>
> Bart
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list