Simple and effective analysis of statically-typed object-oriented programs

To use modern hardware effectively, compilers need extensive control-flow information. Unfortunately, the frequent method invocations in object-oriented languages obscure control flow. In this paper, we describe and evaluate a range of analysis techniques to convert method invocations into direct calls for statically-typed object-oriented languages and thus improve control-flow information in object-oriented languages. We present simple algorithms for <i>type hierarchy analysis, aggregate analysis, and interprocedural and intraprocedural type propagation</i>. These algorithms are also fast, <i>O</i>(|procedures| * &sum;<inf>p</inf><sup>procedure</sup> <i>n</i><inf><i>p</i></inf> * <i>v</i><inf><i>p</i></inf>) worst case time (linear in practice) for our slowest analysis, where <i>n</i><inf><i>p</i></inf> is the size of procedure <i>p</i> and <i>v</i><inf><i>p</i></inf> is the number of variables in procedure <i>p</i>, and are thus practical for use in a compiler. When they fail, we introduce <i>cause analysis</i> to reveal the source of imprecision and suggest where more powerful algorithms may be warranted. We show that our simple analyses perform almost as well as an oracle that resolves all method invocations that invoke only a single procedure.

[1]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[2]  Barbara G. Ryder,et al.  Static Type Determination and Aliasing for C , 1990 .

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

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

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

[6]  Jens Palsberg,et al.  Object-oriented type inference , 1991, OOPSLA 1991.

[7]  Craig Chambers,et al.  The design and implementation of the self compiler, an optimizing compiler for object-oriented programming languages , 1992 .

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

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

[10]  Greg Nelson,et al.  Systems programming in modula-3 , 1991 .

[11]  Jeffrey D. Ullman,et al.  Global Data Flow Analysis and Iterative Algorithms , 1976, J. ACM.

[12]  David Grove,et al.  Profile-guided receiver class prediction , 1995, OOPSLA.

[13]  Craig Chambers,et al.  Making pure object-oriented languages practical , 1991, OOPSLA 1991.

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

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

[16]  Frank Manola,et al.  Generalizing Dispatching in a Distributed Object System , 1994, ECOOP.

[17]  Urs Hölzle,et al.  Optimizing dynamically-dispatched calls with run-time type feedback , 1994, PLDI '94.

[18]  David F. Bacon,et al.  Fast static analysis of C++ virtual function calls , 1996, OOPSLA '96.

[19]  Mary Hall Managing interprocedural optimization , 1992 .

[20]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .

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