Abstract
The performance of contemporary object oriented languages depends on optimizations such as devirtualization, inlining, and specialization, and these in turn depend on precise call graph analysis. Existing call graph analyses do not take advantage of the information provided by the rich type systems of contemporary languages, in particular generic type arguments. Many existing approaches analyze Java bytecode, in which generic types have been erased. This paper shows that this discarded information is actually very useful as the context in a context-sensitive analysis, where it significantly improves precision and keeps the running time small. Specifically, we propose and evaluate call graph construction algorithms in which the contexts of a method are (i) the type arguments passed to its type parameters, and (ii) the static types of the arguments passed to its term parameters. The use of static types from the caller as context is effective because it allows more precise dispatch of call sites inside the callee.
Our evaluation indicates that the average number of contexts required per method is small. We implement the analysis in the Dotty compiler for Scala, and evaluate it on programs that use the type-parametric Scala collections library and on the Dotty compiler itself. The context-sensitive analysis runs 1.4x faster than a context-insensitive one and discovers 20% more monomorphic call sites at the same time. When applied to method specialization, the imprecision in a context-insensitive call graph would require the average method to be cloned 22 times, whereas the context-sensitive call graph indicates a much more practical 1.00 to 1.50 clones per method.
We applied the proposed analysis to automatically specialize generic methods. The resulting automatic transformation achieves the same performance as state-of-the-art techniques requiring manual annotations, while reducing the size of the generated bytecode by up to 5x.
- O. Agesen. The Cartesian product algorithm. In ECOOP ’95, Object-Oriented Programming: 9th European Conference, volume 952 of Lecture Notes in Computer Science, pages 2–51, 1995. Google Scholar
Digital Library
- K. Ali and O. Lhoták. Application-only call graph construction. In J. Noble, editor, ECOOP 2012 - Object-Oriented Programming - 26th European Conference, Beijing, China, June 11-16, 2012. Proceedings, volume 7313 of Lecture Notes in Computer Science, pages 688–712. Springer, 2012. ISBN 978-3-642-31056-0. K. Ali and O. Lhoták. Averroes: Whole-program analysis without the whole program. In G. Castagna, editor, ECOOP 2013 - Object-Oriented Programming - 27th European Conference, Montpellier, France, July 1-5, 2013. Proceedings, volume 7920 of Lecture Notes in Computer Science, pages 378–400. Springer, 2013. ISBN 978-3-642-39037-1. doi: 10. 1007/978-3-642-39038-8. Google Scholar
Digital Library
- 286957.Google Scholar
- I. Dragos. Compiling Scala for Performance. PhD thesis, IC, Lausanne, 2010.Google Scholar
- I. Dragos and M. Odersky. Compiling generics through userdirected type specialization. In Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 42–47. ACM, 2009. Google Scholar
Digital Library
- Y. Feng, X. Wang, I. Dillig, and C. Lin. EXPLORER : query- and demand-driven exploration of interprocedural control flow properties. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2015, part of SLASH 2015, Pittsburgh, PA, USA, October 25-30, 2015, pages 520– 534. ACM, 2015. doi: 10.1145/2814270.2814284. Google Scholar
Digital Library
- F. Henglein and J. Jørgensen. Formally optimal boxing. In Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 213–226. ACM, 1994. Google Scholar
Digital Library
- T. Johnsson. Lambda lifting: Transforming programs to recursive equations. In Functional programming languages and computer architecture, pages 190–203. Springer, 1985. Google Scholar
Digital Library
- G. Kastrinis and Y. Smaragdakis. Hybrid context-sensitivity for points-to analysis. In H. Boehm and C. Flanagan, editors, ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’13, Seattle, WA, USA, June 16-19, 2013, pages 423–434. ACM, 2013. ISBN 9781-450-3201-4- 6. doi: 10.1145/2462156.2462191. Google Scholar
Digital Library
- O. Lhoták and L. Hendren. Context-sensitive points-to analysis: is it worth it? In A. Mycroft and A. Zeller, editors, Compiler Construction, 15th International Conference, volume 3923 of LNCS, pages 47–64, Vienna, Mar. 2006. Springer. Google Scholar
Digital Library
- O. Lhoták and L. Hendren. Evaluating the benefits of contextsensitive points-to analysis using a BDD-based implementation. ACM Trans. Softw. Eng. Methodol., 18(1):1–53, 2008. ISSN 1049-331X. doi: http://doi.acm.org/10.1145/1391984.1391987. Google Scholar
Digital Library
- A. Milanova, A. Rountev, and B. G. Ryder. Parameterized object sensitivity for points-to and side-effect analyses for Java. In Proceedings of the 2002 ACM SIGSOFT International Symposium on Software Testing and Analysis, pages 1–11. ACM Press, 2002. Google Scholar
Digital Library
- ISBN 1-58113-562-9. doi: http://doi.acm.org/10.1145/566172.Google Scholar
- 566174.Google Scholar
- A. Milanova, A. Rountev, and B. G. Ryder. Parameterized object sensitivity for points-to analysis for Java. ACM Trans. Softw. Eng. Methodol., 14(1):1–41, 2005. ISSN 1049-331X. doi: http://doi.acm.org/10.1145/1044834.1044835. Google Scholar
Digital Library
- R. Morrison, A. Dearle, R. C. H. Connor, and A. L. Brown. An Ad Hoc Approach to the Implementation of Polymorphism. ACM Trans. Program. Lang. Syst., 13(3):342–371, July 1991. ISSN 0164-0925. doi: 10.1145/117009.117017. Google Scholar
Digital Library
- O. Sallenave and R. Ducournau. Lightweight generics in embedded systems through static analysis. In R. Wilhelm, H. Falk, and W. Yi, editors, SIGPLAN/SIGBED Conference on Languages, Compilers and Tools for Embedded Systems 2012, LCTES ’12, Beijing, China - June 12 - 13, 2012, pages 11–20. ACM, 2012. ISBN 9781-450-3121-2-7. doi: 10.1145/2248418.2248421. Google Scholar
Digital Library
- ISBN 0-89791-269-1. doi: http://doi.acm.org/10.1145/53990.Google Scholar
- 54007.Google Scholar
- ISBN 1-59593-320-4. doi: http: //doi.acm.org/10.1145/1133981.1134027.Google Scholar
- V. Ureche, C. Talau, and M. Odersky. Miniboxing: improving the speed to code size tradeoff in parametric polymorphism translations. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2013, part of SPLASH 2013, Indianapolis, IN, USA, October 26-31, 2013, pages 73– 92, 2013. doi: 10.1145/2509136.2509537. Google Scholar
Digital Library
Index Terms
Call graphs for languages with parametric polymorphism
Recommendations
Call graphs for languages with parametric polymorphism
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsThe performance of contemporary object oriented languages depends on optimizations such as devirtualization, inlining, and specialization, and these in turn depend on precise call graph analysis. Existing call graph analyses do not take advantage of the ...
Type-Based Call Graph Construction Algorithms for Scala
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 ...
Precise static analysis for generic programs in object oriented languages
Genericity enriched with multiple data types and classes is becoming a common feature of object oriented languages. Therefore, static analysis of such generic programs is gaining importance. Unfortunately such work does not exist. In this work, we ...







Comments