Advertisement

The complexity of type analysis of object oriented programs

  • Joseph (Yossi) Gil
  • Alon Itai
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1445)

Abstract

One of the price tags attached to the blessings that OO brings about is a drop in efficiency due to dynamic method dispatch. Much research effort is being spent on the problem of eliminating it, by applying static analysis to predict the set of dynamic types which a variable might store at any given program location. It was previously shown that the problem is NP-hard even if the program under analysis has no multi-level pointers. In this work, we show that under similar conditions, the problem is P-SPACE complete, provided that the program is not recursive. In the presence of recursion, the problem becomes EXP-TIME complete. (These two results also give an exponential time algorithm for a family of type analysis problems.) If multi-level pointers are allowed then the problem becomes EXP-SPACE complete without recursion and DEXP-TIME with it. Further, if the program under analysis may use recursive data structures then the problem becomes undedicable. Despite these, somewhat discouraging, results, we can prove that the type analysis becomes tractable, as evident from past practical experience, if the program under analysis obeys some few simple software engineering rules, while the analysis algorithm makes a corresponding simplifying assumption.

Keywords

Turing Machine Global Variable Execution Path Instance Variable Dynamic Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [B78]
    Barth J., A Practical Interprocedural Data Flow Analysis Algorithm, CACM 21(9):724–736, 1978.Google Scholar
  2. [BS96]
    Bacon, D. F., and P. F. Sweeney, Fast Static Analysis of Virtual Function Calls in C++, OOPSLA'96, pp. 324–341.Google Scholar
  3. [C71]
    Cook S. A., Characterizations of Pushdown Machines in Terms of Time-Bounded Computers, JACM 18(1):4–18, Jan. 1971.MATHCrossRefGoogle Scholar
  4. [CH95]
    Carini P. R. and M. Hind, Flow-sensitive interprocedural constant propagation, PLDI'95, pp. 23–31.Google Scholar
  5. [CGDD97]
    Chambers C., Grove D., DeFouw G., and J. Dean, Call Graph Construction in Object-Oriented Languages, OOPSLA'97, pp. 108–124.Google Scholar
  6. [DGC95]
    Dean J., Grove D. and C. Chambers, Optimization of Object-Oriented Programs Using Static Class Hierachy Analysis, ECOOP'95, pp. 77–101.Google Scholar
  7. [DMM96]
    Diwan, A., Moss J. E. B. and K. S. McKinley, Simple and Effective Analysis of Statically-Typed Object-Oriented Programmes., OOPSLA'96, pp. 292–305.Google Scholar
  8. [J90]
    Johnson, D.S., A Catalog of Complexity Classes, in Handbook of Theoretical Computer Science, ed. J.van Leuuwen, MIT Press 1990.Google Scholar
  9. [G97]
    Golubski W., Data-Flow Analysis in Object-Oriented Programs, TOOLS USA'97.Google Scholar
  10. [GP97]
    Golubski W. and B. Pohlers, SOLAT — A Simple Object-Oriented Language Analysing Tool, TOOLS USA'97.Google Scholar
  11. [HLS97]
    Harrison, T. H., Levine D. L., and D. C. Schimdt., The Design and Performance of a Real-Time COBRA Event Service, OOPSLA'97, pp. 184–200.Google Scholar
  12. [H97]
    Horwitz S., Precise Flow-Insensitive May-Alias Analysis is NP-Hard, TOPLAS Jan. 1997.Google Scholar
  13. [HCU91]
    Holzle U., Chambers C. and D. Ungar., Optimizing Dynamically-Typed Object-Oriented Languages with Polymorphic Inline Caches. ECOOP'91.Google Scholar
  14. [HU79]
    Hopcroft, J.E., and J. D. Ullman, Introduction to Automata Theory, Languages and Computation, Addison-Wesley 1979.Google Scholar
  15. [L92]
    Landi W., Undecidability of Static Analysis, LOPLAS 1(4):323–337, Dec. 1992.CrossRefGoogle Scholar
  16. [M92]
    Meyer B., Eiffel-The Language, Prentice-Hall, 1992.Google Scholar
  17. [M95]
    Meyer B., Beware of Polymorphic Catcalls, White paper, Interactive Software Engineering, 1995. In http://www.eiffel.com/doc/manuals/technology/typing/cat.html Google Scholar
  18. [MJ81]
    Muchnick S. S., and N. D. Jones eds., Program Flow Analysis: Theory and Applications, Prentice Hall 1981.Google Scholar
  19. [ND81]
    Nygaard K. and O-J Dahl, Simula 1967, In History of Prog. Lang., ed. R. W. Wexelblat, 1981.Google Scholar
  20. [PBF96]
    Porat S., Bernstein D., Fedrov Y., and J. Rodrigue, Compiler Optimization of C++ Virtual Function Call, COOTS'96, pp. 3–14.Google Scholar
  21. [PR94]
    Pande H. D. and B. G. Ryder, Static Type Determination for C++, Usenix C++ Conf. 1994, pp. 85–97.Google Scholar
  22. [PS91]
    Palsberg J. and M. Schwartzbach, Object-Oriented Type Inference, OOSPLA'91,pp. 146–161.Google Scholar
  23. [S97]
    Stroustrup B., The C++ Programming Language. 3rd ed. Addison Wesley, 1997.Google Scholar
  24. [SP82]
    Sharir M. and A. Pnueli, Two Approaches to Interprocedural Data Flow Analysis, in [MJ81].Google Scholar
  25. [VCH96]
    Verbrugge, C., Phong C., and L. Hendren. Generalized Constant Propagation—A Study in C. In Proc. of the 6th International Conference on Compiler Construction (CC'96), pages 74–90, Link• ping, Sweden, Springer LNCS 1060, 1996.Google Scholar
  26. [WZ91]
    Wegman, M. N. and F. K. Zadek, Constant Propagation with Conditional Branches, ACM TOPLAS 13(2):181–210, Apr. 1991.CrossRefGoogle Scholar
  27. [ZCC97]
    Zendra O., Colnet C, and S. Collin, Efficient Dynamic Dispatch without Virtual Function Tables: The Small Eiffel Compiler, OOPSLA'97, pp. 125–141.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Joseph (Yossi) Gil
    • 1
  • Alon Itai
    • 2
  1. 1.IBM T.J. Watson Research CenterYorktown HeightsUSA
  2. 2.Department of Computer ScienceTechnion-Israel Institute of TechnologyHaifaIsrael

Personalised recommendations