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

Martin Baulig martin@gnome.org
01 Oct 2002 20:54:08 +0200


"Jeroen Frijters" <jeroen@sumatra.nl> writes:

> 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.

The problem here is that we do not track this in mcs's definite assignment checks: MCS
checks whether `x' has been assigned (which it must be), but it doesn't know which value
`x' has because it could have been initialized to `null'.

-- 
Martin Baulig
martin@gnome.org