Next: The Enabling Optimization Up: AN ENABLING OPTIMIZATION FOR Previous: INTRODUCTION


ENABLING OPTIMIZATION

This section describes our enabling optimization, discusses the optimization's implementation, and provides examples showing how it interacts with (enables) inlining and constant propagation. The code shown in Figure 1 is used in this section to illustrate various aspects of the optimization. Note that the virtual function call in function process() does not call the version of bar() declared in class Base as would be the case with static binding. Rather, the function called is determined at runtime by the type of the object pointed to by x, which may be Base or a subclass of Base. For more details on virtual functions see [6].

Figure 1: A C++ Class Hierarchy
\begin{figure*}\begin{verbatim}class Base { class Sub1 : public Base {
prote...
...val = 3; };
.... }
}\end{verbatim} \protect \rule[2em]{0pt}{2em}
\end{figure*}



Subsections

Copyright © 1995, 1996 Bradley M. Kuhn, David W. Binkley.

Verbatim copying and distribution of this entire paper is permitted in any medium, provided this notice is preserved.