skip to main content
article
Open access

A framework for call graph construction algorithms

Published: 01 November 2001 Publication History

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.]]
[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.]]
[3]
Agesen, O. 1996. Concrete type inference: Delivering object-oriented applications. Ph.D. thesis, SLMI Tech. Rep. 96--52, Stanford Univ., Stanford, CA.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[17]
Dean, J. 1996. Whole program optimization of object-oriented languages. Ph.D. thesis, Tech. Rep. UW-CSE-96-11-05, Univ. of Washington.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[25]
Gosling, J., Joy, B., and Steele, G. 1996. The Java Language Specification. Addison-Wesley, Reading, MA.]]
[26]
Grove, D. 1995. The impact of interprocedural class analysis on optimization. In Proceedings CASCON '95 (Toronto, Canada), 195--203.]]
[27]
Grove, D. 1998. Effective interprocedural optimization of object-oriented languages. Ph.D. thesis, Univ. of Washington.]]
[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.]]
[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.]]
[30]
Hall, M. W. and Kennedy, K. 1992. Efficient call graph analysis. ACM Lett. Program. Lang. Syst. 1, 3 (Sept.), 227--242.]]
[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.]]
[32]
Henglein, F. 1991. Efficient type inference for higher-order binding-time analysis. In Functional Programming and Computer Architecture.]]
[33]
Hölzle, U. and Agesen, O. 1996. Dynamic vs. static optimization techniques for object-oriented languages. Theor. Pract. Object Syst. 1, 3.]]
[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.]]
[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.]]
[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.).]]
[37]
Kam, J. B. and Ullman, J. D. 1976. Global data flow analysis and iterative algorithms. J. ACM 23, 1 (Jan.), 158--171.]]
[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.]]
[39]
Kranz, D. 1988. Orbit: An optimizing compiler for scheme. Ph.D. thesis, Res. Rep. 632, Yale Univ., Dept. of Computer Science.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[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.]]
[46]
Pande, H. D. and Ryder, B. G. 1994. Static type determination for C++. In Proceedings of Sixth USENIX C++ Technical Conference.]]
[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.]]
[48]
Plevyak, J. 1996. Optimization of object-oriented and concurrent programs. Ph.D. thesis, Univ. of Illinois at Urbana-Champaign.]]
[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.]]
[50]
Ryder, B. 1979. Constructing the call graph of a program. IEEE Trans. Softw. Eng. 5, 3, 216--225.]]
[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.]]
[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.]]
[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.]]
[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.]]
[55]
Steensgaard, B. 1994. A polyvariant closure analysis with dynamic abstraction. Unpublished manuscript.]]
[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.]]
[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.]]
[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.]]
[59]
Tarjan, R. E. 1975. Efficiency of a good but not linear set union algorithm. J. ACM 22, 2, 215--225.]]
[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.]]
[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.]]
[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.]]
[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.]]

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 23, Issue 6
November 2001
112 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/506315
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 November 2001
Published in TOPLAS Volume 23, Issue 6

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Call graph construction
  2. control flow analysis
  3. interprocedural analysis

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)376
  • Downloads (Last 6 weeks)36
Reflects downloads up to 30 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media