Compiler optimization of C++ virtual function calls

  • Authors:
  • Sara Porat;David Bernstein;Yaroslav Fedorov;Joseph Rodrigue;Eran Yahav

  • Affiliations:
  • IBM Haifa Research Laboratory, Matam, Haifa, Israel;IBM Haifa Research Laboratory, Matam, Haifa, Israel;IBM Haifa Research Laboratory, Matam, Haifa, Israel;IBM Haifa Research Laboratory, Matam, Haifa, Israel;IBM Haifa Research Laboratory, Matam, Haifa, Israel

  • Venue:
  • COOTS'96 Proceedings of the 2nd conference on USENIX Conference on Object-Oriented Technologies (COOTS) - Volume 2
  • Year:
  • 1996

Quantified Score

Hi-index 0.00

Visualization

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.