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: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Holger Arnold > Sent: Saturday, September 28, 2002 17:03 > To: [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list > _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
