dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]ECMA doubt .. function overloading


From: Adam Treat
Subject: Re: [DotGNU]ECMA doubt .. function overloading
Date: Fri, 8 Nov 2002 13:16:06 -0500
User-agent: KMail/1.4.7

On Friday 08 November 2002 01:08 pm, Jonathan P Springer wrote:
> On Fri, Nov 08, 2002 at 12:54:56PM -0500, Adam Treat wrote:
> > On Friday 08 November 2002 12:38 pm, Fergus Henderson wrote:
> > When I compile the test with cscc and run with either ilrun OR mono I
> > get:
> >
> > Parent
> >
> > When I compile the test with mcs and run with either ilrun OR mono I get:
> >
> > Child
>
> Could you please forward disassembled IL for each of these modules?
>
> Thanks,
> -js

************ Here is the ildasm for child.cs compiled with cscc:

// Input: child.exe
// Image type: EXE
// Native code present: No
// 32-bit only: No
// Length of IL data: 1536

.assembly extern mscorlib
{
        .ver 0:0:0:0
}
.assembly child
{
        .hash algorithm 0x00008004
        .ver 0:0:0:0
}
.module child.exe
// MVID: {951FFE7A-670B-9F32-759F-6A7ADD9BB29D}
.class public auto ansi Parent extends [mscorlib]System.Object
{
        .method public hidebysig instance void Foo(int32 x) cil managed
        {
                // Start of method header: 2050
                .maxstack  8
        ?L2051:
                ldstr      "Parent"
                call       void [mscorlib]System.Console::WriteLine(class 
System.String)
                ret
        }
        .method public hidebysig specialname rtspecialname instance void 
.ctor() cil managed
        {
                // Start of method header: 205c
                .maxstack  8
        ?L205d:
                ldarg.0
                call       instance void [mscorlib]System.Object::.ctor()
                ret
        }
}
.class public auto ansi Child extends Parent
{
        .method public hidebysig instance void Foo(float32 x) cil managed
        {
                // Start of method header: 2064
                .maxstack  8
        ?L2065:
                ldstr      "Child"
                call       void [mscorlib]System.Console::WriteLine(class 
System.String)
                ret
        }
        .method public hidebysig specialname rtspecialname instance void 
.ctor() cil managed
        {
                // Start of method header: 2070
                .maxstack  8
        ?L2071:
                ldarg.0
                call       instance void Parent::.ctor()
                ret
        }
}
.class public auto ansi Test extends [mscorlib]System.Object
{
        .method public static hidebysig void Main() cil managed
        {
                // Start of method header: 2078
                .entrypoint
                .maxstack  2
                .locals    (class Child)
        ?L2084:
                newobj     instance void Child::.ctor()
                stloc.0
                ldloc.0
                ldc.i4.s   42
                call       instance void Parent::Foo(int32 x)
                ret
        }
        .method public hidebysig specialname rtspecialname instance void 
.ctor() cil managed
        {
                // Start of method header: 2094
                .maxstack  8
        ?L2095:
                ldarg.0
                call       instance void [mscorlib]System.Object::.ctor()
                ret
        }
}

************ And here is the ildasm for child.cs compiled with mcs:

// Input: child.exe
// Image type: EXE
// Native code present: No
// 32-bit only: No
// Length of IL data: 1536

.assembly extern mscorlib
{
        .ver 0:0:0:0
}
.assembly child
{
        .hash algorithm 0x00008004
        .ver 0:0:0:0
}
.module child.exe
// MVID: {68623911-989E-4307-89C8-B0BDE21A1300}
.class public auto ansi beforefieldinit Parent extends [mscorlib]System.Object
{
        .method public hidebysig specialname rtspecialname instance void 
.ctor() cil managed
        {
                // Start of method header: 20ec
                .maxstack  8
        ?L20ed:
                ldarg.0
                call       instance void [mscorlib]System.Object::.ctor()
                ret
        }
        .method public instance void Foo(int32 x) cil managed
        {
                // Start of method header: 20f4
                .maxstack  8
        ?L20f5:
                ldstr      "Parent"
                call       void [mscorlib]System.Console::WriteLine(class 
System.String)
                ret
        }
}
.class public auto ansi beforefieldinit Child extends Parent
{
        .method public hidebysig specialname rtspecialname instance void 
.ctor() cil managed
        {
                // Start of method header: 2100
                .maxstack  8
        ?L2101:
                ldarg.0
                call       instance void Parent::.ctor()
                ret
        }
        .method public instance void Foo(float32 x) cil managed
        {
                // Start of method header: 2108
                .maxstack  8
        ?L2109:
                ldstr      "Child"
                call       void [mscorlib]System.Console::WriteLine(class 
System.String)
                ret
        }
}
.class public auto ansi beforefieldinit Test extends [mscorlib]System.Object
{
        .method public hidebysig specialname rtspecialname instance void 
.ctor() cil managed
        {
                // Start of method header: 2114
                .maxstack  8
        ?L2115:
                ldarg.0
                call       instance void [mscorlib]System.Object::.ctor()
                ret
        }
        .method public static void Main() cil managed
        {
                // Start of method header: 211c
                .entrypoint
                .maxstack  3
                .locals    init (class Child)
        ?L2128:
                newobj     instance void Child::.ctor()
                stloc.0
                ldloc.0
                ldc.i4.s   42
                conv.r4
                callvirt   instance void Child::Foo(float32 x)
                ret
        }
}

Hope this helps,

Adam


reply via email to

[Prev in Thread] Current Thread [Next in Thread]