ABSTRACT
This paper addresses the problem of resolving virtual method and interface calls in Java bytecode. The main focus is on a new practical technique that can be used to analyze large applications. Our fundamental design goal was to develop a technique that can be solved with only one iteration, and thus scales linearly with the size of the program, while at the same time providing more accurate results than two popular existing linear techniques, class hierarchy analysis and rapid type analysis.We present two variations of our new technique, variable-type analysis and a coarser-grain version called declared-type analysis. Both of these analyses are inexpensive, easy to implement, and our experimental results show that they scale linearly in the size of the program.We have implemented our new analyses using the Soot frame-work, and we report on empirical results for seven benchmarks. We have used our techniques to build accurate call graphs for complete applications (including libraries) and we show that compared to a conservative call graph built using class hierarchy analysis, our new variable-type analysis can remove a significant number of nodes (methods) and call edges. Further, our results show that we can improve upon the compression obtained using rapid type analysis.We also provide dynamic measurements of monomorphic call sites, focusing on the benchmark code excluding libraries. We demonstrate that when considering only the benchmark code, both rapid type analysis and our new declared-type analysis do not add much precision over class hierarchy analysis. However, our finer-grained variable-type analysis does resolve significantly more call sites, particularly for programs with more complex uses of objects.
- 1.URL: http://www.sable.mcgill.ca/soot/.]]Google Scholar
- 2.URL: http://www.transvirtual.com/kaffe.html.]]Google Scholar
- 3.URL: http://www.sable.mcgill.ca/sablecc/.]]Google Scholar
- 4.URL: http://wwwipd.ira.uka.de/~pizza/.]]Google Scholar
- 5.O. Agesen. Constraint-based type inference and parametric polymorphism. In B. L. Charlier, editor, SAS'94|Proceedings of the First International Static Analysis Symposium, volume 864 of Lecture Notes in Computer Science, pages 78-100. Springer, 28-30 Sep. 1994.]]Google Scholar
- 6.O. Agesen. The Cartesian product algorithm: Simple and precise type inference of parametric polymorphism. In W. G. Olthofi, editor, ECOOP'95|Object-Oriented Programming, 9th European Conference, volume 952 of Lecture Notes in Computer Science, pages 2-26, - Aarhus, Denmark, 7-11 Aug. 1995. Springer.]] Google Scholar
- 7.G. Aigner and U. H.olzle. Eliminating virtual function calls in C++ programs. In P. Cointe, editor, ECOOP'96|Object-Oriented Programming, 10th European Conference, volume 1098 of Lecture Notes in Computer Science, pages 142-166, Linz, Austria, 8-12 Jul. 1996. Springer.]] Google ScholarDigital Library
- 8.D. F. Bacon and P. F. Sweeney. Fast static analysis of C++ virtual function calls. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications, volume 31, 10 of ACM SIGPLAN Notices, pages 324-341, New York, Oct. 6-10 1996. ACM Press.]] Google ScholarDigital Library
- 9.B. Calder and D. Grunwald. Reducing indirect function call overhead in C++ programs. In 21st Symposium on Principles of Programming Languages, pages 397-408, Jan. 1994.]] Google ScholarDigital Library
- 10.C. Chambers, D. Grove, G. DeFouw, and J. Dean. Call graph construction in object-oriented languages. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA-97), volume 32, 10 of ACM SIGPLAN Notices, pages 108-124, New York, Oct. 5-9 1997. ACM Press.]] Google ScholarDigital Library
- 11.P. Chang, E. Hao, and Y. Patt. Target prediction for indirect jumps. In Proceedings of the International Symposium on Computer Architecture, pages 274-283, June 1997.]] Google ScholarDigital Library
- 12.R. Chatterjee, B. G. Ryder, and W. A. Landi. Relevant context inference. In ACM, editor, POPL '99. Proceedings of the 26th ACM SIGPLAN-SIGACT on Principles of programming languages, January 20-22, 1999, San Antonio, TX, pages 133-146, New York, NY, USA, 1999. ACM Press.]] Google ScholarDigital Library
- 13.J. Dean, G. DeFouw, D. Grove, V. Litvinov, and C. Chambers. VORTEX: An optimizing compiler for object-oriented languages. In Proceedings OOPSLA '96 Conference on Object-Oriented Programming Systems, Languages, and Applications, volume 31 of ACM SIGPLAN Notices, pages 83-100. ACM, Oct. 1996.]] Google ScholarDigital Library
- 14.J. Dean, D. Grove, and C. Chambers. Optimization of object-oriented programs using static class hierarchy analysis. In W. G. Oltho, editor, ECOOP'95|Object-Oriented Programming, 9th European Conference, volume 952 of Lecture Notes in Computer Science, pages 77-101, - Aarhus, Denmark, 7-11 Aug. 1995. Springer.]] Google ScholarDigital Library
- 15.G. DeFouw, D. Grove, and C. Chambers. Fast interprocedural class analysis. Technical Report TR-97-07-02, University ofWashington, Department of Computer Science and Engineering, Jul. 1997.]]Google Scholar
- 16.G. DeFouw, D. Grove, and C. Chambers. Fast interprocedural class analysis. In Conference Record of POPL '98: The 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 222-236, San Diego, California, 19-21 Jan. 1998.]] Google ScholarDigital Library
- 17.L. P. Deutsch. Effcient implementation of the Smalltalk-80 system. In Conference record of the 11th ACM Symposium on Principles of Programming Languages (POPL), pages 297-302, 1984.]] Google ScholarDigital Library
- 18.A. Diwan, J. E. B. Moss, and K. S. McKinley. Simple and effective analysis of statically-typed object-oriented programs. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications, volume 31, 10 of ACM SIGPLAN Notices, pages 292-305, New York, Oct. 6-10 1996. ACM Press.]] Google ScholarDigital Library
- 19.K. Driesen and U. H.olzle. The direct cost of virtual function calls in C. In Proceedings of OOPSLA-1996, pages 306-323, October 1996.]] Google ScholarDigital Library
- 20.K. Driesen and U. H.olzle. Multi-stage cascaded prediction. In EuroPar '99 Conference Proceedings, LNCS 1685, pages 1312-1321, September 1999.]] Google ScholarDigital Library
- 21.M. F. Fernandez. Simple and effective link-time optimization of Modula-3 programs. In Proceedings of the ACM SIGPLAN'95 Conference onProgramming Language Design and Implementation (PLDI), pages 103-115, La Jolla, California, 18-21 Jun. 1995.]] Google ScholarDigital Library
- 22.E. M. Gagnon, L. J. Hendren, and G. Marceau. Efficient inference of static types for Java bytecode. In Static Analysis Symposium 2000, Lecture Notes in Computer Science, pages 199-219, Santa Barbara, June 2000.]] Google ScholarDigital Library
- 23.M. W. Hall and K. Kennedy. Eficient call graph analysis. ACM Letters on Programming Languages and Systems, 1(3):227-242, Sep. 1992.]] Google ScholarDigital Library
- 24.U. H.olzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. In Proceedings of the Conference on Programming Language Design and Implementation, pages 326-336, New York, NY, USA, Jun. 1994. ACM Press.]] Google ScholarDigital Library
- 25.K. Ishizaki, M. Kawahito, T. Yasue, H. Komatsu, and T. Nakatani. A study of devirtualization techniques for Java Just-In-Time compiler. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA-2000), 2000.]] Google ScholarDigital Library
- 26.A. Lakhotia. Constructing call multigraphs using dependence graphs. In Conference Record of the Twentieth ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 273-284, Charleston, South Carolina, Jan. 10-13, 1993. ACM Press.]] Google ScholarDigital Library
- 27.G. Muller, B. Moura, F. Bellard, and C. Consel. Harissa: A exible and efficient Java environment mixing bytecode and compiled code. In Proceedings of the 3rd Conference on Object-Oriented Technologies and Systems, pages 1-20, Berkeley, Jun.16-20 1997. Usenix Association.]] Google ScholarDigital Library
- 28.J. Palsberg and M. I. Schwartzbach. Object-Oriented Type Inference. In Proceedings of the OOPSLA '91 Conference on Object-oriented Programming Systems, Languages and Applications, pages 146-161, Nov. 1991. Published as ACM SIGPLAN Notices, volume 26, number 11.]] Google ScholarDigital Library
- 29.H. Pande and B. Ryder. Static type determination for C++. In USENIX Association, editor, Proceedings of the 1994 USENIX C++ Conference: April 11-14, 1994, Cambridge, MA, pages 85-97, Berkeley, CA, USA, Apr. 1994. USENIX.]] Google ScholarDigital Library
- 30.J. Plevyak and A. A. Chien. Precise concrete type inference for object-oriented languages. ACM SIGPLAN Notices, 29(10):324-324, Oct. 1994.]] Google ScholarDigital Library
- 31.B. G. Ryder. Constructing the call graph of a program. IEEE Transactions on Software Engineering, 5(3):216-226, May 1979.]]Google ScholarDigital Library
- 32.O. Shivers. Control- ow analysis in Scheme. ACM SIGPLAN Notices, 23(7):164-174, Jul. 1988. Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation.]] Google ScholarDigital Library
- 33.O. Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie-Mellon University, May 1991.]] Google ScholarDigital Library
- 34.V. Sundaresan. Practical techniques for virtual call resolution in Java. Master's thesis, McGill University, Montreal, Canada, Sep. 1999.]]Google Scholar
- 35.F. Tip, C. Laffra, P. F.Sweeney, and D. Streeter. Practical experience with an application extractor for Java. In Proceedings of the Fourteenth Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'99), pages 292-305, Denver, CO), 1999. SIGPLAN Notices 34(10).]] Google ScholarDigital Library
- 36.F. Tip and J. Palsberg. Scalable propagation-based call graph construction algorithms. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA-2000), 2000.]] Google ScholarDigital Library
- 37.R. Vallee-Rai, E. Gagnon, L. Hendren, P. Lam, P. Pominville, and V. Sundaresan. Optimizing Java bytecode using the Soot framework: Is it feasible? In D. A. Watt, editor, Compiler Construction, 9th International Conference, volume 1781 of Lecture Notes in Computer Science, pages 18-34, Berlin, Germany, March 2000. Springer.]] Google ScholarDigital Library
Index Terms
- Practical virtual method call resolution for Java
Recommendations
Practical virtual method call resolution for Java
This paper addresses the problem of resolving virtual method and interface calls in Java bytecode. The main focus is on a new practical technique that can be used to analyze large applications. Our fundamental design goal was to develop a technique that ...
Comments