Fast static analysis of C++ virtual function calls

Virtual functions make code easier for programmers to reuse but also make it harder for compilers to analyze. We investigate the ability of three static analysis algorithms to improve C++ programs by resolving virtual function calls, thereby reducing compiled code size and reducing program complexity so as to improve both human and automated program understanding and analysis. In measurements of seven programs of significant size (5000 to 20000 lines of code each) we found that on average the most precise of the three algorithms resolved 71% of the virtual function calls and reduced compiled code size by 25%. This algorithm is very fast: it analyzes 3300 source lines per second on an 80 MHz PowerPC 601. Because of its accuracy and speed, this algorithm is an excellent candidate for inclusion in production C++ compilers.

[1]  Craig Chambers,et al.  An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes , 1989, OOPSLA 1989.

[2]  Craig Chambers,et al.  An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes , 1989, OOPSLA '89.

[3]  Craig Chambers,et al.  Iterative type analysis and extended message splitting; optimizing dynamically-typed object-oriented programs , 1990, PLDI '90.

[4]  Craig Chambers,et al.  Iterative type analysis and extended message splitting: Optimizing dynamically-typed object-oriented programs , 1991, PLDI 1991.

[5]  Craig Chambers,et al.  Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches , 1991, ECOOP.

[6]  Jens Palsberg,et al.  Making Type Inference Practical , 1992, ECOOP.

[7]  Amitabh Srivastava,et al.  Unreachable procedures in object-oriented programming , 1992, LOPL.

[8]  Craig Chambers,et al.  Object, message, and performance: how they coexist in Self , 1992, Computer.

[9]  Barbara G. Ryder,et al.  Interprocedural modification side effect analysis with pointer aliasing , 1993, PLDI '93.

[10]  Jong-Deok Choi,et al.  Efficient flow-sensitive interprocedural computation of pointer-induced aliases and side effects , 1993, POPL '93.

[11]  Jong-Deok Choi,et al.  Flow-Insensitive Interprocedural Alias Analysis in the Presence of Pointers , 1994, LCPC.

[12]  Dirk Grunwald,et al.  Reducing indirect function call overhead in C++ programs , 1994, POPL '94.

[13]  Andrew A. Chien,et al.  Precise concrete type inference for object-oriented languages , 1994, OOPSLA 1994.

[14]  Ole Agesen Constraint-Based Type Inference and Parametric Polymorphism , 1994, SAS.

[15]  Barbara G. Ryder,et al.  Static Type Determination for C++ , 1994, C++ Conference.

[16]  Mary F. Fernández,et al.  Simple and effective link-time optimization of Modula-3 programs , 1995, PLDI '95.

[17]  Urs Hölzle,et al.  Type feedback vs. concrete type inference: a comparison of optimization techniques for object-oriented languages , 1995, OOPSLA.

[18]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[19]  Jong-Deok Choi,et al.  Slicing class hierarchies in C++ , 1996, OOPSLA '96.

[20]  Urs Hölzle,et al.  Eliminating Virtual Function Calls in C++ Programs , 1996, ECOOP.

[21]  Amer Diwan,et al.  Simple and effective analysis of statically-typed object-oriented programs , 1996, OOPSLA '96.

[22]  J. Moss,et al.  Simple and E ective Analysis ofStatically-Typed Object-Oriented ProgramsAmer , 1996 .

[23]  Eran Yahav,et al.  Compiler Optimization of C++ Virtual Function Calls , 1996, COOTS.

[24]  Barbara G. Ryder,et al.  Data-Flow-Based Virtual Function Resolution , 1996, SAS.