[Mono-dev] Having trouble getting tail. callvirt to work

Stefan O'Rear stefanor at cox.net
Sun Nov 14 03:31:37 EST 2010


The following small CIL demo blows the stack on Mono 2.9/78b8d38 with
both the LLVM and integrated JIT backends.  What am I doing wrong?

If callvirt is replaced with call, the program runs in constant stack
space.  If callvirt is replaced with calli (passing in the ldftn value
as a parameter), the program fails exactly as it does for callvirt.

-Stefan

.assembly extern mscorlib {}

.assembly 'test' { }

.class public auto C
{
    .method public hidebysig specialname rtspecialname
           instance default void '.ctor' ()  cil managed
    {
        .maxstack 8
        ldarg.0
        call instance void class [mscorlib]System.Object::'.ctor'()
        ret
    }

    .method public virtual instance void Fun()
    {
        ldarg.0
        tail.
        callvirt instance void class C::Fun()
        ret
    }
}

.method static public void main() cil managed
{
    .entrypoint
    .maxstack 1
    newobj instance void class C::'.ctor'()
    callvirt instance void class C::Fun()
    ret
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20101114/68c0f06c/attachment-0001.bin 


More information about the Mono-devel-list mailing list