RFC: New C++ Attribute: final
Daniel Berlin
dberlin@dberlin.org
Tue Mar 2 23:24:00 GMT 2004
> Certainly not. But if such a pointer to member was final and bound to
> a known function, GCC might be able to short-curcuit function calls
> through it, and even inline them. But since, for a virtual function,
> it is not possible to know the exact function that is going to be
> called unless you happen to know the dynamic type of the object, you
> lose. With final, you'd win.
>
Compilers besides GCC have started to get good at determining the
dynamic types of objects and "devirtualizing calls". Some also
implement more trivial methods (see if it must-alias a certain
component of the virtual table object, and thus, must be pointing to
that call) as a backup.
It's somewhere down on my list to implement some form of analysis
(RTA/CHA/whatever) to be able to a determine a small set of actual
calls a given virtual call can make.
No clue when i'll get to it. Probably around the same time we start
doing other IPA things.
More information about the Gcc
mailing list