article

Sealed calls in Java packages

Abstract

Determining the potential targets of virtual method invocations is essential for inter-procedural optimizations of object-oriented programs. It is generally hard to determine such targets accurately. The problem is especially difficult for dynamic languages such as Java, because additional targets of virtual calls may appear at runtime. Current mechanisms that enable inter-procedural optimizations for dynamic languages, repeatedly validate the optimizations at runtime. This paper addresses this predicament by proposing a novel technique for conservative devirtualization analysis, which applies to a significant number of virtual calls in Java programs. Unlike previous work, our technique requires neither whole program analysis nor runtime information, and incurs no runtime overhead. Our solution is very efficient to compute and is based on a newly introduced, seemingly unrelated security feature of Java file archives. On average, our analysis "seals" (safely devirtualizes) about 39% of the virtual calls (to non-final methods) that appear in SPECjvm98 programs, and about 29% of the calls invoked while executing these programs. In the runtime library rt.jar, about 10% of the packages contain a significant percentage (20--60%) of sealed calls, with a total average of about 8.5%. Most of these calls are also shown to be monomorphic, a fact which can be safely exploited by aggressive inter-procedural optimizations such as direct inlining. These results indicate that our technique has a strong potential for enhancing the analysis and optimization of Java programs.

References

  1. 1 O. Agesen and U. Holzle. Type feedback vs. concrete type inference: A comparison of optimization techniques for object-oriented languages. In Proceedings of the 10th Annual Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 91-107, Oct 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 G. Aigner and U. Holzle. Eliminating virtual function calls in c++ programs. In Proceedings of the 10th European Conference on Object-Oriented Programming (ECOOP), pages 142-166, July 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 A. Azevedo, A. Nicolau, and J. Hummel. Java annotation-aware just-in-time (ajit) compilation system. In Proceedings of the ACM 1999 Conference on Java Grande, pages 142-151, June 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 D. F. Bacon and P. F. Sweeney. Fast static analysis of c++ virtual function calls. In Proceedings of the 11th Annual Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 324-341, Oct 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 S. J. Baylor, M. Devarakonda, S. Fink, E. Gluzberg, M. Kalantar, P. Muttineni, E. Barsness, S. Munroe, R. Arora, , and R. Dimpsey. Java server benchmarks. IBM Systems Journal, 39(1):21-56, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 B. Blanchet. Escape analysis for object oriented languages, application to java. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 20-34, Nov 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7 Z. Budimlic and K. Kennedy. Prospects for scientific computing in polymorphic, object-oriented style. In Proceedings of the 9th SIAM Conference on Parallel Processing for Scientific Computing, March 1999.]]Google ScholarGoogle Scholar
  8. 8 M. G. Burke, J. Choi, S. Fink, D. Grove, M. Hind, V. Sarkar, M. J. Serrano, V. C. Sreedhar, H. Srinivasan, and J. Whaley. The jalapeno dynamic optimizing compiler for java. In Proceedings of the ACM 1999 Conference on Java Grande, pages 129-141, June 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9 B. Calder and D. Grunwald. Reducing indirect function call overhead in c++ programs. In Conference Record of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 397-408, Jan 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 J. Choi, M. Gupta, M. Serrano, V. C. Sreedhar, and S. Midkiff. Escape analysis for java. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 1-19, Nov 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 11 J. Dean, D. Grove, and C. Chambers. Optimization of object-oriented programs using static class hierarchy analysis. In W. Olthoff, editor, Proceedings of the 9th European Conference on Object-Oriented Programming (ECOOP), pages 77-101. Springer-Verlag, Aug 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 12 G. DeFouw, D. Grove, and C. Chambers. Fast interprocedural class analysis. In Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 222-236, Jan 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 D. Detlefs and O. Agesen. Inlining of virtual methods. In R. Guerraoui, editor, Proceedings of the 13th European Conference on Object-Oriented Programming (ECOOP), pages 258-278. Springer-Verlag, June 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 14 J. Dolby. Automatic inline allocation of objects. In Proceedings of the 1997 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 7-16, May 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 15 K. Driesen and U. Holzle. The direct cost of virtual function calls in c++. In Proceedings of the 11th Annual Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 306-323, Oct 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16 N. Feinberg, S. E. Keene, R. O. Mathews, and P. T. Withington. The Dylan Programming Book. Addison-Wesley, 1997.]]Google ScholarGoogle Scholar
  17. 17 E. Gagnon and L. Hendren. Intra-procedural inference of static types for java bytecode. Technical Report 1999-1, Sable Research Group, McGill University, March 1999.]]Google ScholarGoogle Scholar
  18. 18 J. Gil and A. Itai. The complexity of type analysis of object oriented programs. In Proceedings of the 12th European Conference on Object-Oriented Programming (ECOOP), pages 601-634, July 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 19 J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Addison-Wesley, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 20 D. Grove, G. DeFouw, J. Dean, and C. Chambers. Call graph construction in object-oriented languages. In Proceedings of the 1997 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 108-124, Oct 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 21 D. P. Grove. Effective Interprocedural Optimization of Object-Oriented Languages. PhD thesis, University of Washington, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22 U. Holzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation (PLDI), pages 32-43, June 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23 The java hotspot performance engine architecture. Available at http://-www. javasoft.com/products/hotspot/whitepaper.html, April 1999.]]Google ScholarGoogle Scholar
  24. 24 K. Ishizaki, M. Kawahito, T. Yasue, M. Takeuchi, T. Ogasawara, T. Suganuma, T. Onodera, H. Komatsu, and T. Nakatani. Design, implementation, and evaluation of optimizations in a just-in-time compiler. In Proceedings of the ACM 1999 Conference on Java Grande, pages 119-128, June 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 25 Jigsaw - the w3c's web server. Available at http://www.w3c.org/Jigsaw.]]Google ScholarGoogle Scholar
  26. 26 Jove super optimizing deployment environment for java. Available at http://www.instantiations.com/jove/jovereport.htm.]]Google ScholarGoogle Scholar
  27. 27 S. S. Muchnick. Advanced Compiler Design and Implementation. Morgan Kaufmann, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 28 P. D. O'brien, D. C. Halbert, and M. F. Kilian. The trellis programming environment. In Conference Proceedings on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 91-102, Oct 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 29 H. D. Pande and B. G. Ryder. Static type determination for c++. In Proceedings of the Sixth Usenix C++ Technical Conference, pages 85-97, April 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. 30 S. Porat, D. Bernstein, Y. Fedorov, J. Rodrigue, and E. Yahav. Compiler optimization of c++ virtual function calls. In Proceedings of the Second Conference on Object-Oriented Technologies and Systems (COOTS), pages 3-14, Jun 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 31 S. Porat, B. Mendelson, and I. Shapira. Sharpening global static analysis to cope with java. In Proceedings of CASCON '98 Conference, pages 303-316, Nov 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. 32 Spec jvm98 benchmarks. Available at http://www.spec.org/osg/jvm98, August 1998.]]Google ScholarGoogle Scholar
  33. 33 V. C. Sreedhar, M. Burke, and J. Choi. A framework for interprocedural optimization in the presence of dynamic class loading. In Proceedings of the ACM SIGPLAN '00 Conference on Programming Language Design and Implementation (PLDI), pages 196-207, June 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 34 Sun Microsystems. Java 2 Software Development Kit version 1.2.2, July 1999. Available at http://java.sun.com/products/jdk/1.2/, See there docs/guide/extensions/spec.html#sealing.]]Google ScholarGoogle Scholar
  35. 35 V. Sundaresan, L. Hendren, C. Razafimahefa, R. Valle-Rai, P. Lam, E. Gagnon, and C. Godin. Practical virtual method call resolution for java. Technical Report 1999-4, Sable Research Group, McGill University, Nov 1999.]]Google ScholarGoogle Scholar
  36. 36 F. Tip, C. Laffra, P. F. Sweeney, and D. Streeter. Practical experience with an application extractor for java. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 292-305, Nov 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. 37 Towerj3 - a new generation native java compiler and runtime environment. Available at http://www.towerj.com/products/- whitepapergnj.shtml and also whitepapers3.shtml.]]Google ScholarGoogle Scholar
  38. 38 R. Vallee-Rai, P. Co, E. Gagnon, L. Hendren, P. Lam, and V. Sundaresan. Soot - a java bytecode optimization framework. In Proceedings of CASCON '99 Conference, Nov 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. 39 J. Whaley and M. Rinard. Compositional pointer and escape analysis for java programs. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 187-206, Nov 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Sealed calls in Java packages

      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!