article

A framework for call graph construction algorithms

Abstract

A large number of call graph construction algorithms for object-oriented and functional languages have been proposed, each embodying different tradeoffs between analysis cost and call graph precision. In this article we present a unifying framework for understanding call graph construction algorithms and an empirical comparison of a representative set of algorithms. We first present a general parameterized algorithm that encompasses many well-known and novel call graph construction algorithms. We have implemented this general algorithm in the Vortex compiler infrastructure, a mature, multilanguage, optimizing compiler. The Vortex implementation provides a "level playing field" for meaningful cross-algorithm performance comparisons. The costs and benefits of a number of call graph construction algorithms are empirically assessed by applying their Vortex implementation to a suite of sizeable (5,000 to 50,000 lines of code) Cecil and Java programs. For many of these applications, interprocedural analysis enabled substantial speed-ups over an already highly optimized baseline. Furthermore, a significant fraction of these speed-ups can be obtained through the use of a scalable, near-linear time call graph construction algorithm.

References

  1. Agesen, O. 1994. Constraint-based type inference and parametric polymorphism. In Proceedings of the First International Static Analysis Symposium. LNCS 864, Springer, New York, NY, 78--100.]]Google ScholarGoogle Scholar
  2. Agesen, O. 1995. The cartesian product algorithm: Simple and precise type inference of parametric polymorphism. In Proceedings of the 9th European Conference on Object-Oriented Programming. LNCS 952, Springer, New York, NY, 2--26.]] Google ScholarGoogle Scholar
  3. Agesen, O. 1996. Concrete type inference: Delivering object-oriented applications. Ph.D. thesis, SLMI Tech. Rep. 96--52, Stanford Univ., Stanford, CA.]] Google ScholarGoogle Scholar
  4. Agesen, O., Palsberg, J., and Schwartzbach, M. I. 1993. Type inference of Self: Analysis of objects with dynamic and multiple inheritance. In Proceedings of the 7th European Conference for Object-Oriented Programming. LNCS 707, New York, NY, 247--267.]] Google ScholarGoogle Scholar
  5. Aiken, A. 1994. Set constraints: Results, applications, and future directions. In Proceedings of the Second Workshop on the Principles and Practice of Constraint Programming (Orcas Island, WA), 171--179.]] Google ScholarGoogle Scholar
  6. Alt, M. and Martin, F. 1995. Generation of efficient interprocedural analyzers with PAG. In Proceedings of the Second International Symposium on Static Analysis. LNCS 983, Springer, New York, NY, 33--50.]] Google ScholarGoogle Scholar
  7. Ashley, J. M. 1996. A practical and flexible flow analysis for higher-order languages. In Conference Record of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, 184--194.]] Google ScholarGoogle Scholar
  8. Ashley, J. M. 1997. The effectiveness of flow analysis for inlining. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming. ACM SIGPLAN Not. 32, 8 (June), 99--111.]] Google ScholarGoogle Scholar
  9. Bacon, D. F. and Sweeney, P. F. 1996. Fast static analysis of C++ virtual function calls. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 31, 10 (Oct.), 324--341.]] Google ScholarGoogle Scholar
  10. Bairagi, D., Kumar, S., and Agrawal, D. P. 1997. Precise call graph construction for OO programs in the presence of virtual functions. In Proceedings of the 1997 International Conference on Parallel Processing. 412--416.]] Google ScholarGoogle Scholar
  11. Callahan, D., Carle, A., Hall, M. W., and Kennedy, K. 1990. Constructing the procedure call multigraph. IEEE Trans. Softw. Eng. 16, 4, 483--487.]] Google ScholarGoogle Scholar
  12. Chambers, C. 1993. The Cecil language: Specification and rationale. Tech. Rep. UW-CSE-93-03-05, Dept. Computer Science and Engineering. Univ. of Washington. Revised, March 1997.]]Google ScholarGoogle Scholar
  13. Chambers, C., Dean, J., and Grove, D. 1996. Whole-program optimization of object-oriented languages. Tech. Rep. UW-CSE-96-06-02, Dept. of Computer Science and Engineering. Univ. of Washington. June.]]Google ScholarGoogle Scholar
  14. Chambers, C. and Ungar, D. 1989. Customization: Optimizing compiler technology for SELF, a dynamically-typed object-oriented programming language. In Proceedings of the SIGPLAN '89 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 24, 7 (July), 146--160.]] Google ScholarGoogle Scholar
  15. Chambers, C. and Ungar, D. 1990. Iterative type analysis and extended message splitting: Optimizing dynamically-typed object-oriented programs. In Proceedings of the ACM SIGPLAN '90 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 25, 6 (June), 150--164.]] Google ScholarGoogle Scholar
  16. Cousot, P. and Cousot, R. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the Conference Record of the Fourth ACM Symposium on Principles of Programming Languages. ACM, New York, NY, 238--252.]] Google ScholarGoogle Scholar
  17. Dean, J. 1996. Whole program optimization of object-oriented languages. Ph.D. thesis, Tech. Rep. UW-CSE-96-11-05, Univ. of Washington.]] Google ScholarGoogle Scholar
  18. Dean, J., DeFouw, G., Grove, D., Litvinov, V., and Chambers, C. 1996. Vortex: An optimizing compiler for object-oriented languages. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 31, 10 (Oct.), 83--100.]] Google ScholarGoogle Scholar
  19. Dean, J., Grove, D., and Chambers, C. 1995. Optimization of object-oriented programs using static class hierarchy analysis. In Proceedings of the 9th European Conference for Object-Oriented Programming. LNCS 952, Springer, New York, NY.]] Google ScholarGoogle Scholar
  20. DeFouw, G., Grove, D., and Chambers, C. 1998. Fast interprocedural class analysis. In Proceedings of the Conference Record of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 222--236.]] Google ScholarGoogle Scholar
  21. Deutsch, L. P. and Schiffman, A. M. 1984. Efficient implementation of the Smalltalk-80 system. In Proceedings of the Conference Record of the Eleventh Annual ACM Symposium on Principles of Programming Languages. ACM, New York, NY, 297--302.]] Google ScholarGoogle Scholar
  22. Diwan, A., Moss, E., and McKinley, K. 1996. Simple and effective analysis of statically-typed object-oriented programs. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 31, 10 (Oct.), 292--305.]] Google ScholarGoogle Scholar
  23. Emami, M., Ghiya, R., and Hendren, L. J. 1994. Context-sensitive interprocedural points-to analysis in the presence of function pointers. In Proceedings of the ACM SIGPLAN '94 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 29, 6 (June), 242--256.]] Google ScholarGoogle Scholar
  24. Fernandez, M. F. 1995. Simple and effective link-time optimization of Modula-3 programs. In Proceedings of the ACM SIGPLAN '95 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 30, 6 (June), 103--115.]] Google ScholarGoogle Scholar
  25. Gosling, J., Joy, B., and Steele, G. 1996. The Java Language Specification. Addison-Wesley, Reading, MA.]] Google ScholarGoogle Scholar
  26. Grove, D. 1995. The impact of interprocedural class analysis on optimization. In Proceedings CASCON '95 (Toronto, Canada), 195--203.]] Google ScholarGoogle Scholar
  27. Grove, D. 1998. Effective interprocedural optimization of object-oriented languages. Ph.D. thesis, Univ. of Washington.]] Google ScholarGoogle Scholar
  28. Grove, D., Dean, J., Garrett, C., and Chambers, C. 1995. Profile-guided receiver class prediction. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 30, 10 (Oct.), 108--123.]] Google ScholarGoogle Scholar
  29. Grove, D., DeFouw, G., Dean, J., and Chambers, C. 1997. Call graph construction in object oriented languages. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 32, 10 (Oct.), 108--124.]] Google ScholarGoogle Scholar
  30. Hall, M. W. and Kennedy, K. 1992. Efficient call graph analysis. ACM Lett. Program. Lang. Syst. 1, 3 (Sept.), 227--242.]] Google ScholarGoogle Scholar
  31. Heintze, N. and McAllester, D. 1997. Linear-time subtransitive control flow analysis. In Proceedings of the ACM SIGPLAN '97 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 32, 6 (June), 261--272.]] Google ScholarGoogle Scholar
  32. Henglein, F. 1991. Efficient type inference for higher-order binding-time analysis. In Functional Programming and Computer Architecture.]] Google ScholarGoogle Scholar
  33. Hölzle, U. and Agesen, O. 1996. Dynamic vs. static optimization techniques for object-oriented languages. Theor. Pract. Object Syst. 1, 3.]] Google ScholarGoogle Scholar
  34. Hölzle, U. and Ungar, D. 1994. Optimizing dynamically-dispatched calls with run-time type feedback. In Proceedings of the ACM SIGPLAN '94 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 29, 6 (June), 326--336.]] Google ScholarGoogle Scholar
  35. Jagannathan, S. and Weeks, S. 1995. A unified treatment of flow analysis in higher-order languages. In Proceedings of the Conference Record of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 393--407.]] Google ScholarGoogle Scholar
  36. Johnson, R. E., Graver, J. O., and Zurawski, L. W. 1988. TS: An optimizing compiler for Smalltalk. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 23, 10 (Oct.).]] Google ScholarGoogle Scholar
  37. Kam, J. B. and Ullman, J. D. 1976. Global data flow analysis and iterative algorithms. J. ACM 23, 1 (Jan.), 158--171.]] Google ScholarGoogle Scholar
  38. Kildall, G. A. 1973. A unified approach to global program optimization. In Proceedings of the Conference Record of the First ACM Symposium on Principles of Programming Languages. ACM, New York, NY, 194--206.]] Google ScholarGoogle Scholar
  39. Kranz, D. 1988. Orbit: An optimizing compiler for scheme. Ph.D. thesis, Res. Rep. 632, Yale Univ., Dept. of Computer Science.]] Google ScholarGoogle Scholar
  40. Lakhotia, A. 1993. Constructing call multigraphs using dependence graphs. In Proceedings of the Conference Record of the Twentieth ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 273--284.]] Google ScholarGoogle Scholar
  41. Landi, W. and Ryder, B. G. 1991. Pointer-induced aliasing: A problem classification. In Proceedings of the Conference Record of the Eighteenth Annual ACM Symposium on Principles of Programming Languages. ACM, New York, NY, 93--103.]] Google ScholarGoogle Scholar
  42. Nielson, F. and Nielson, H. R. 1997. Infinitary control flow analysis: A collecting semantics for closure analysis. In Proceedings of the Conference Record of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 332--345.]] Google ScholarGoogle Scholar
  43. Oxhøj, N., Palsberg, J., and Schwartzbach, M. I. 1992. Making type inference practical. In Proceedings ECOOP '92, O. L. Madsen, Ed., LNCS 615, Springer, New York, NY, 329--349.]] Google ScholarGoogle Scholar
  44. Palsberg, J. and Pavlopoulou, C. 1998. From polyvariant flow information to intersection and union types. In Proceedings of the Conference Record of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 197--208.]] Google ScholarGoogle Scholar
  45. Palsberg, J. and Schwartzbach, M. I. 1991. Object-oriented type inference. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 26, 10 (Oct.), 146--161.]] Google ScholarGoogle Scholar
  46. Pande, H. D. and Ryder, B. G. 1994. Static type determination for C++. In Proceedings of Sixth USENIX C++ Technical Conference.]] Google ScholarGoogle Scholar
  47. Phillips, G. and Shepard, T. 1994. Static typing without explicit types. Unpublished report, Dept. of Electrical and Computer Engineering, Royal Military College of Canada, Kingston, Ont., Canada.]]Google ScholarGoogle Scholar
  48. Plevyak, J. 1996. Optimization of object-oriented and concurrent programs. Ph.D. thesis, Univ. of Illinois at Urbana-Champaign.]] Google ScholarGoogle Scholar
  49. Plevyak, J. and Chien, A. A. 1994. Precise concrete type inference for object-oriented languages. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 29, 10 (Oct.), 324--340.]] Google ScholarGoogle Scholar
  50. Ryder, B. 1979. Constructing the call graph of a program. IEEE Trans. Softw. Eng. 5, 3, 216--225.]]Google ScholarGoogle Scholar
  51. Shapiro, M. and Horwitz, S. 1997. Fast and accurate flow-insensitive points-to analysis. In Proceedings of the Conference Record of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 1--14.]] Google ScholarGoogle Scholar
  52. Sharir, M. and Pnueli, A. 1981. Two approaches to interprocedural data flow analysis. In Program Flow Analysis: Theory and Applications, S. S. Muchnick and N. D. Jones, Eds. Prentice-Hall, Englewood Cliffs, NJ, Ch. 7, 189--233.]]Google ScholarGoogle Scholar
  53. Shivers, O. 1988. Control-flow analysis in Scheme. In Proceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 23, 7 (June), 164--174.]] Google ScholarGoogle Scholar
  54. Shivers, O. 1991. Control-flow analysis of higher-order languages. Ph.D. thesis, Tech. Rep. CMU-CS-91-145, Carnegie Mellon Univ., Pittsburgh, PA.]] Google ScholarGoogle Scholar
  55. Steensgaard, B. 1994. A polyvariant closure analysis with dynamic abstraction. Unpublished manuscript.]]Google ScholarGoogle Scholar
  56. Steensgaard, B. 1996. Points-to analysis in almost linear time. In Proceedings of the Conference Record of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, 32--41.]] Google ScholarGoogle Scholar
  57. Stefanescu, D. and Zhou, Y. 1994. An equational framework for the flow analysis of higher-order functional programs. In Proceedings of the ACM Symposium on Lisp and Functional Programming. ACM, New York, NY, 190--198.]] Google ScholarGoogle Scholar
  58. Sundaresan, V., Hendren, L., Razafimahefa, C., Vallée-Rai, R., Lam, P., Gagnon, E., and Godin, C. 2000. Practical virtual method call resolution for Java. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 35, 10 (Oct.), 264--280.]] Google ScholarGoogle Scholar
  59. Tarjan, R. E. 1975. Efficiency of a good but not linear set union algorithm. J. ACM 22, 2, 215--225.]] Google ScholarGoogle Scholar
  60. Tip, F. and Palsberg, J. 2000. Scalable propagation-based call graph construction algorithms. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM SIGPLAN Not. 35, 10 (Oct.), 281--293.]] Google ScholarGoogle Scholar
  61. Vitek, J., Horspool, N., and Uhl, J. 1992. Compile time analysis of object-oriented programs. In Proceedings of the Fourth International Conference on Compiler Construction. LNCS 641, Springer, New York, NY, 237--250.]] Google ScholarGoogle Scholar
  62. Wilson, R. P. and Lam, M. S. 1995. Efficient context-sensitive pointer analysis for C programs. In Proceedings of the ACM SIGPLAN '95 Conference on Programming Language Design and Implementation. ACM SIGPLAN Not. 30, 6 (June), 1--12.]] Google ScholarGoogle Scholar
  63. Wright, A. K. and Jagannathan, S. 1998. Polymorphic splitting: an effective polyvariant flow analysis. ACM Trans. Program. Lang. Syst. 20, 1 (Jan.), 166--207.]] Google ScholarGoogle Scholar

Index Terms

  1. A framework for call graph construction algorithms

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            Full Access

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!