skip to main content
research-article

Type-Based Call Graph Construction Algorithms for Scala

Published: 02 December 2015 Publication History

Abstract

Call graphs have many applications in software engineering. For example, they serve as the basis for code navigation features in integrated development environments and are at the foundation of static analyses performed in verification tools. While many call graph construction algorithms have been presented in the literature, we are not aware of any that handle Scala features such as traits and abstract type members. Applying existing algorithms to the JVM bytecodes generated by the Scala compiler produces very imprecise results because type information is lost during compilation. We adapt existing type-based call graph construction algorithms to Scala and present a formalization based on Featherweight Scala. An experimental evaluation shows that our most precise algorithm generates call graphs with 1.1--3.7 times fewer nodes and 1.5--17.3 times fewer edges than a bytecode-based RTA analysis.

References

[1]
Ole Agesen. 1994. Constraint-based type inference and parametric polymorphism. In Proceedings of the 1st International Static Analysis Symposium (SAS). 78--100.
[2]
Karim Ali. 2014. The Separate Compilation Assumption. Ph.D. Dissertation. University of Waterloo, Canada.
[3]
Karim Ali and Ondřej Lhoták. 2012. Application-only call graph construction. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 688--712.
[4]
Karim Ali and Ondrej Lhoták. 2013. Averroes: Whole-program analysis without the whole program. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 378--400.
[5]
Karim Ali, Marianna Rapoport, Ondrej Lhoták, Julian Dolby, and Frank Tip. 2014. Constructing call graphs of Scala programs. In Proceedings of the 28th European Conference Object-Oriented Programming. 54--79.
[6]
David Francis Bacon. 1997. Fast and Effective Optimization of Statically Typed Object-Oriented Languages. Ph.D. Dissertation. University of California, Berkeley.
[7]
David F. Bacon and Peter F. Sweeney. 1996. Fast static analysis of C++ virtual function calls. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA). 324--341.
[8]
Martin Bravenboer and Yannis Smaragdakis. 2009. Strictly declarative specification of sophisticated points-to analyses. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA). 243--262.
[9]
Vincent Cremet, François Garillot Sergueï Lenglet, and Martin Odersky. 2006. A core calculus for Scala type checking. In Proceedings of the International Symposium on Mathematical Foundations of Computer Science (MFCS). 1--23.
[10]
Jeffrey Dean, David Grove, and Craig Chambers. 1995. Optimization of object-oriented programs using static class hierarchy analysis. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 77--101.
[11]
Greg DeFouw, David Grove, and Craig Chambers. 1998. Fast interprocedural class analysis. In Proceedings of the ACM SIGPLAN SIGACT Symposium on Principles of Programming Languages (POPL). 222--236.
[12]
Gilles Dubochet and Martin Odersky. 2009. Compiling structural types on the JVM: A comparison of reflective and generative techniques from Scala's perspective. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS'09). ACM, New York, NY, 34--41.
[13]
David Grove and Craig Chambers. 2001. A framework for call graph construction algorithms. ACM Trans. Program. Lang. Syst. 23, 6 (2001), 685--746.
[14]
Nevin Heintze. 1994. Set-based analysis of ML programs. In Proceedings of the ACM Conference on LISP and Functional Programming. 306--317.
[15]
Nevin Heintze and Olivier Tardieu. 2001. Ultra-fast aliasing analysis using CLA: A million lines of C code in a second. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 254--263.
[16]
Fritz Henglein. 1992. Dynamic typing. In Proceedings of the 4th European Symposium on Programming (ESOP). 233--253.
[17]
IBM. 2013. T.J. Watson Libraries for analysis WALA. http://wala.sourceforge.net/. (Last accessed April 2013).
[18]
Etienne Kneuss, Philippe Suter, and Viktor Kuncak. 2010. Phantm: PHP analyzer for type mismatch. In Proceedings of the 18th ACM SIGSOFT International Symposium on Foundations of Software Engineering (SIGSOFT FSE). 373--374.
[19]
Ondřej Lhoták and Laurie J. Hendren. 2003. Scaling Java points-to analysis using SPARK. In Proceedings of the International Conference on Compiler Construction (CC). 153--169.
[20]
Ondřej Lhoták and Laurie J. Hendren. 2006. Context-sensitive points-to analysis: Is it worth it?. In Proceedings of the International Conference on Compiler Construction (CC). 47--64.
[21]
Martin Odersky. 2011. The Scala Language Specification Version 2.9. Technical Report. EPFL.
[22]
Martin Odersky, Lex Spoon, and Bill Venners. 2012. Programming in Scala (2nd ed.). Artima Press.
[23]
B. G. Ryder. 1979. Constructing the call graph of a program. IEEE Trans. Softw. Eng. 5, 3 (1979), 216--226.
[24]
Olivier Sallenave and Roland Ducourneau. 2012. Lightweight generics in embedded systems through static analysis. In Proceedings of the SIGPLAN/SIGBED Conference on Languages, Compilers and Tools for Embedded Systems (LCTES). 11--20.
[25]
Andreas Sewe, Mira Mezini, Aibek Sarimbekov, and Walter Binder. 2011. Da capo con scala: Design and analysis of a Scala benchmark suite for the Java virtual machine. In Proceedings of the ACM International Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA). 657--676.
[26]
Olin Shivers. 1991. Control-Flow Analysis of Higher-Order Languages. Ph.D. Dissertation. CMU.
[27]
Manu Sridharan, Julian Dolby, Satish Chandra, Max Schäfer, and Frank Tip. 2012. Correlation tracking for points-to analysis of JavaScript. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 435--458.
[28]
A. Srivastava. 1992. Unreachable procedures in object oriented programming. ACM Lett. Program. Lang. Syst. 1, 4 (December 1992), 355--364.
[29]
Vijay Sundaresan, Laurie J. Hendren, Chrislain Razafimahefa, Raja Vallée-Rai, Patrick Lam, Etienne Gagnon, and Charles Godin. 2000. Practical virtual method call resolution for Java. In Proceedings of the ACM International Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA). 264--280.
[30]
Frank Tip and Jens Palsberg. 2000. Scalable propagation-based call graph construction algorithms. In Proceedings of the ACM International Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA). 281--293.
[31]
Frank Tip, Peter F. Sweeney, Chris Laffra, Aldo Eisma, and David Streeter. 2002. Practical extraction techniques for Java. ACM Trans. Program. Lang. Syst. 24, 6 (2002), 625--666.
[32]
Raja Vallée-Rai, Etienne Gagnon, Laurie J. Hendren, Patrick Lam, Patrice Pominville, and Vijay Sundaresan. 2000. Optimizing Java bytecode using the Soot framework: Is it feasible?. In Proceedings of the International Conference on Compiler Construction (CC). 18--34. http://portal.acm.org/citation.cfm?id=647476.727758.

Cited By

View all
  • (2024)Unleashing the power of type-based call graph construction by using regional pointer informationProceedings of the 33rd USENIX Conference on Security Symposium10.5555/3698900.3698978(1383-1400)Online publication date: 14-Aug-2024
  • (2023)A Cocktail Approach to Practical Call Graph ConstructionProceedings of the ACM on Programming Languages10.1145/36228337:OOPSLA2(1001-1033)Online publication date: 16-Oct-2023
  • (2020)Towards Reduction of Software Maintenance Cost through Assignment of Critical Functionality Scores2020 5th International Conference on Communication and Electronics Systems (ICCES)10.1109/ICCES48766.2020.9138071(199-204)Online publication date: Jun-2020
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Software Engineering and Methodology
ACM Transactions on Software Engineering and Methodology  Volume 25, Issue 1
December 2015
339 pages
ISSN:1049-331X
EISSN:1557-7392
DOI:10.1145/2852270
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 02 December 2015
Accepted: 01 September 2015
Revised: 01 July 2015
Received: 01 March 2015
Published in TOSEM Volume 25, Issue 1

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Call graphs
  2. Scala
  3. static analysis

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • Natural Sciences and Engineering Research Council of Canada
  • Ontario Ministry of Research and Innovation

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

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

Other Metrics

Citations

Cited By

View all
  • (2024)Unleashing the power of type-based call graph construction by using regional pointer informationProceedings of the 33rd USENIX Conference on Security Symposium10.5555/3698900.3698978(1383-1400)Online publication date: 14-Aug-2024
  • (2023)A Cocktail Approach to Practical Call Graph ConstructionProceedings of the ACM on Programming Languages10.1145/36228337:OOPSLA2(1001-1033)Online publication date: 16-Oct-2023
  • (2020)Towards Reduction of Software Maintenance Cost through Assignment of Critical Functionality Scores2020 5th International Conference on Communication and Electronics Systems (ICCES)10.1109/ICCES48766.2020.9138071(199-204)Online publication date: Jun-2020
  • (2019)Judge: identifying, understanding, and evaluating sources of unsoundness in call graphsProceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3293882.3330555(251-261)Online publication date: 10-Jul-2019
  • (2018)Code2graph: automatic generation of static call graphs for Python source codeProceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering10.1145/3238147.3240484(880-883)Online publication date: 3-Sep-2018
  • (2018)Scalable concurrency debugging with distributed graph processingProceedings of the 2018 International Symposium on Code Generation and Optimization10.1145/3168817(188-199)Online publication date: 24-Feb-2018

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media