Re: virtual functions and optimization at compile time

Alex Colvin <alexc@std.com>
3 Dec 2003 20:32:04 -0500

          From comp.compilers

Related articles
virtual functions and optimization at compile time pdn@sasken.com (preetham) (2003-11-21)
Re: virtual functions and optimization at compile time sasulzer@seanet.com (Stephen Sulzer) (2003-12-03)
Re: virtual functions and optimization at compile time joachim.durchholz@web.de (Joachim Durchholz) (2003-12-03)
Re: virtual functions and optimization at compile time hannah@schlund.de (2003-12-03)
Re: virtual functions and optimization at compile time tmk@netvision.net.il (2003-12-03)
Re: virtual functions and optimization at compile time alexc@std.com (Alex Colvin) (2003-12-03)
| List of all articles for this month |

From: Alex Colvin <alexc@std.com>
Newsgroups: comp.compilers
Date: 3 Dec 2003 20:32:04 -0500
Organization: The World : www.TheWorld.com : Since 1989
References: 03-11-076
Keywords: OOP, optimize
Posted-Date: 03 Dec 2003 20:32:04 EST

>Virtual Functions Are Supposed To Be Optimized Bcoz They R Supposedly
>Resolved At Run-Time. How Can Virtual Functions Be Resolved At
>Compile-Time???


>[By flow analysis that determines that it'll always call the same
>function, I suppose. -John]


A common optimization (at least in cfront) is when the object's class
is known becaause its declaration is visible. For example,


class C { virtual f(); };
C a;
a.f();


the class of a is known to be (C), so the implementation of f is C::f
Doesn't even require flow analysis.


--
mac the naïf


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.