EGCS: pointer to member functions.
Alexandre Oliva
oliva@dcc.unicamp.br
Tue Jun 15 13:27:00 GMT 1999
On Jun 15, 1999, mrs@wrs.com (Mike Stump) wrote:
>> From: Alexandre Oliva <oliva@dcc.unicamp.br>
>> Date: 15 Jun 1999 03:54:56 -0300
>> On Jun 15, 1999, Brendan Simon <brendan@dgs.monash.edu.au> wrote:
>> > Why is there so much overhead in calling a function via a pointer as
>> > apposed to calling it directly?
>> Pointer-to-methods don't know whether they point to virtual methods or
>> not, so the caller must have code for both cases. Methinks this could
>> be improved by generating thunks that perform dynamic binding in the
>> case of invoking virtual methods, but maybe I'm missing something.
> Try it, lay it out, read up on C++ and what is required of the
> generated code. :-) I have, I think. :-) Hint, there is no separate
> type for pointer to virtual method and pointer to non-virtual member.
Yup, no problem. You can decide what to do when the pointer is
created. If the method is non-virtual, you can just take its address
directly. If not, you could take the address of an implicitly-defined
non-virtual method that works just like a thunk. This non-virtual
method could be handled just like template functions, in terms of
implicit instantiation, so I don't see a problem here. Is there any
flaw in my reasoning?
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists
More information about the Gcc
mailing list