[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]callvirt change to cscc
From: |
Fergus Henderson |
Subject: |
Re: [DotGNU]callvirt change to cscc |
Date: |
Sat, 16 Nov 2002 00:39:23 +1100 |
User-agent: |
Mutt/1.3.28i |
On 15-Nov-2002, Gopal V <address@hidden> wrote:
> If memory serves me right, Rhys Weatherley wrote:
> > I just changed cscc and ilrun to use "callvirt" instructions for
> > non-virtual instance methods, as all the other C# compilers do that.
> > (Personally, I think the previous behaviour was better).
>
> <rational>
> Appeal to ECMA to rename call to callstatic ? ....
>
> IIRC this is very similar to Java's invokestatic and invokevirtual ...
> But ECMA should name it correctly...
> </rational>
ECMA's current names for these operations are quite reasonable, IMHO.
Naming "call" as "callstatic" would be misleading since "call" can be
used to call non-static member functions. C# is not the only language
which gets compiled to IL.
> > This change will cause calls on instance methods to always throw
> > NullReferenceException when null is supplied as "this", even if
> > the method isn't virtual.
>
> <rant>
> this totally destroys the efficency of using non-virtual methods ...
Only if the CLR implementation doesn't optimize it. But any decent CLR
implementation will avoid a vtable lookup in such cases (because it's
an easy optimization to do).
> The correct NullReferenceException will be thrown when the called
> method accesses 'this' anyway...
But the method might not access `this', or might only access `this'
after performing other side effects.
--
Fergus Henderson <address@hidden> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.