Re: virtual functions and optimization at compile time

"Stephen Sulzer" <sasulzer@seanet.com>
3 Dec 2003 17:52:55 -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: "Stephen Sulzer" <sasulzer@seanet.com>
Newsgroups: comp.compilers
Date: 3 Dec 2003 17:52:55 -0500
Organization: Compilers Central
References: 03-11-076
Keywords: OOP, optimize, comment
Posted-Date: 03 Dec 2003 17:52:55 EST

Given the complete class hierarchy of a program, a compiler can use a
technique called "class hierarchy analysis" to resolve a virtual function
call to a set of target functions. There may not be a single
target/destination of a virtual function call, of course. But if the set of
targets is small enough, the compiler can replace the virtual call with a
small set of if/then type tests and direct method calls.


A research paper on this topic is:


@article{ dean95optimization,
        author = "Jeffrey Dean and David Grove and Craig Chambers",
        title = "Optimization of Object-Oriented Programs Using Static Class
Hierarchy Analysis",
        journal = "Lecture Notes in Computer Science",
        volume = "952",
        pages = "77--101",
        year = "1995",
        url = "citeseer.nj.nec.com/article/dean95optimization.html" }


and available on the web at
http://www.ifs.uni-linz.ac.at/~ecoop/cd/papers/0952/09520077.pdf.


Google "class hierarchy analysis" and "whole program optimization" for
additional resources.


        Stephen




"preetham" <pdn@sasken.com> wrote in message
> Virtual Functions Are Supposed To Be Optimized Bcoz They R Supposedly
> Resolved At Run-Time. How Can Virtual Functions Be Resolved At
> Compile-Time???
>
> Rgrds,
> Preetham
> [By flow analysis that determines that it'll always call the same
> function, I suppose. -John]


Post a followup to this message

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