Second USENIX Conference on Object-Oriented Technologies (COOTS), 1996
Compiler Optimization of C++ Virtual Function Calls
Sara Porat, David Bernstein, Yaroslav Fedorov,
Joseph Rodrigue, and Eran Yahav
IBM Haifa Research Laboratory
Matam, Haifa, Israel
Abstract
We describe two generic optimization techniques to improve run-time
performance of C++ virtual function calls: type specification and type
prediction. Both involve program analysis that results in a set of
call sites to be optimized, and code transformations that replace the
original dispatching mechanism in these sites by more efficient call
expressions. We implement two special cases. The first is a type-
specification optimization, called unique name, that requires static
global view of the whole program in order to substitute indirect
virtual function call sites by direct calls. The other is a
type-prediction kind of optimization, referred to as single type
prediction, that uses type-profiling information to replace virtual
function calls by conditional expressions which involve direct
function calls. These optimizations were implemented in IBM's
compiler, the C Set ++ for AIX/6000, and evaluated on a set of C++
standard benchmarks. We received encouraging run-time results with
improvements in order of 20% that demonstrate the vitality of these
techniques.
These optimizations were implemented in IBM's compiler, the C Set ++
for AIX/6000, and evaluated on a set of C++ standard benchmarks. We
received encouraging run-time results with improvements in order of
20% that demonstrate the vitality of these techniques.
|