[Mono-list] mcs generates a "callvirt" where a "call" should be generated

Jeroen Frijters jeroen@sumatra.nl
Mon, 30 Sep 2002 09:05:51 +0200


It could do that, but it probably isn't worthwhile. The C# language
specification requires that a NullReferenceException is thrown when x is
null, callvirt does this check, but call doesn't so that is why, in
general, callvirt should be used. In this particular case, the compiler
could see that x is always non-null, but it probably isn't worthwhile to
optimize for this.

Regards,
Jeroen

> -----Original Message-----
> From: mono-list-admin@ximian.com 
> [mailto:mono-list-admin@ximian.com] On Behalf Of Holger Arnold
> Sent: Saturday, September 28, 2002 17:03
> To: mono-list@ximian.com
> Subject: [Mono-list] mcs generates a "callvirt" where a 
> "call" should be generated
> 
> 
> Hello,
> assume the following definitions:
> 
>   public class C {
> 
>     public static void M1() {
>       C x = new C();
>       x.M2();
>     }
> 
>     public void M2() {
>       ...
>     }
>   }
> 
> For this, mcs generates a "callvirt" for the call x.M2() in 
> M1, but a "call" 
> should be generated instead.
> 
> 
> Holger
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>