Skip to main content

Type-Safe Optimisation of Plugin Architectures

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3672))

Abstract

Programmers increasingly implement plugin architectures in type-safe object-oriented languages such as Java. A virtual machine can dynamically load class files containing plugins, and a JIT compiler can do optimisations such as method inlining. Until now, the best known approach to type-safe method inlining in the presence of dynamic class loading is based on Class Hierarchy Analysis. Flow analyses that are more powerful than Class Hierarchy Analysis lead to more inlining but are more time consuming and not known to be type safe. In this paper we present and justify a new approach to type-safe method inlining in the presence of dynamic class loading. First we present experimental results that show that there are major advantages to analysing all locally available plugins at start-up time. If we analyse the locally available plugins at start-up time, then flow analysis is only needed at start-up time and when downloading plugins from the Internet, that is, when long pauses are expected anyway. Second, inspired by the experimental results, we design a new framework for type-safe method inlining which is based on a new type system and an existing flow analysis. In the new type system, a type is a pair of Java types, one from the original program and one that reflects the flow analysis. We prove that method inlining preserves typability, and the experimental results show that the new approach inlines considerably more call sites than Class Hierarchy Analysis.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Alpern, B., Attanasio, C.R., Barton, J.J., Burke, M.G., Cheng, P., Choi, J.-D., Cocchi, A., Fink, S.J., Grove, D., Hind, M., Hummel, S.F., Lieber, D., Litvinov, V., Mergen, M.F., Ngo, T., Russell, J.R., Sarkar, V., Serrano, M.J., Shepherd, J.C., Smith, S.E., Sreedhar, V.C., Srinivasan, H., Whaley, J.: The Jalapeno virtual machine. IBM System Journal 39(1) (February 2000)

    Google Scholar 

  2. Bacon, D.F., Sweeney, P.F.: Fast static analysis of C++ virtual function calls. In: Proceedings of OOPSLA 1996, ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 324–341 (1996)

    Google Scholar 

  3. Bacon, D.F.: Fast and Effective Optimization of Statically Typed Object-Oriented Languages. PhD thesis, Computer Science Division, University of California, Berkeley, Report No. UCB/CSD-98-1017 (December 1997)

    Google Scholar 

  4. Bogda, J., Singh, A.K.: Can a shape analysis work at run-time? In: Java Virtual Machine Research and Technology Symposium (2001)

    Google Scholar 

  5. Cierniak, M., Eng, M., Glew, N., Lewis, B., Stichnoth, J.: The open runtime platform: A flexible high-performance managed runtime environment. Intel. Technical Journal 7(1) (February 2003)

    Google Scholar 

  6. Cierniak, M., Lueh, G.-Y., Stichnoth, J.: Practicing judo: Java under dynamic optimizations. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, June 2000, pp. 13–26 (2000)

    Google Scholar 

  7. Dean, J., Chambers, C.: Optimization of object-oriented programs using static class hierarchy analysis. Technical Report 94-12-01, Department of Computer Science, University of Washington at Seattle (December 1994)

    Google Scholar 

  8. Dean, J., Grove, D., Chambers, C.: Optimization of object-oriented programs using static class hierarchy analysis. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 77–101. Springer, Heidelberg (1995)

    Google Scholar 

  9. Glew, N.: An efficient class and object encoding. In: Proceedings of OOPSLA 2000, ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, pp. 311–324 (2000)

    Google Scholar 

  10. Glew, N., Palsberg, J.: Method inlining, dynamic class loading, and type soundness. In: Preliminary version in Sixth Workshop on Formal Techniques for Java-like Programs, Oslo, Norway (June 2004); Journal of Object Technology

    Google Scholar 

  11. Glew, N., Palsberg, J.: Type-safe method inlining. Science of Computer Programming 52, 281–306 (2004); Glew, N., Palsberg, J.: Type-safe method inlining. In: Magnusson, B. (ed.) ECOOP 2002. LNCS, vol. 2374, p. 525. Springer, Heidelberg (2002)

    Google Scholar 

  12. Hirzel, M., Diwan, A., Hind, M.: Pointer analysis in the presence of dynamic class loading. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 96–122. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  13. Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. In: ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, Denver, CO, USA, October 1999, pp. 132–146 (1999)

    Google Scholar 

  14. Ishizaki, K., Kawahito, M., Yasue, T., Komatsu, H., Nakatani, T.: A study of devirtualization techniques for a Java just-in-time compiler. In: Proceedings of OOPSLA 2000, ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 294–310 (2000)

    Google Scholar 

  15. League, C., Shao, Z., Trifonov, V.: Representing Java classes in a typed intermediate language. In: Proceedings of ICFP 1999, ACM SIGPLAN International Conference on Functional Programming, pp. 183–196 (1999)

    Google Scholar 

  16. Morrisett, G., Tarditi, D., Cheng, P., Stone, C., Harper, R., Lee, P.: The TIL/ML compiler: Performance and safety through types. In: ACM SIGPLAN Workshop on Compiler Support for System Software (1996)

    Google Scholar 

  17. Morrisett, G., Walker, D., Crary, K., Glew, N.: From System F to typed assembly language. ACM Transactions on Programming Languages and Systems 21(3), 528–569 (1999)

    Article  Google Scholar 

  18. Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: Proceedings of OOPSLA 1991, ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, pp. 146–161 (1991)

    Google Scholar 

  19. Pechtchanski, I., Sarkar, V.: Dynamic optimistic interprocedural analysis: A framework and an application. In: Proceedings of OOPSLA 2001, ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, pp. 195–210 (2001)

    Google Scholar 

  20. Qian, F., Hendren, L.J.: Towards dynamic interprocedural analysis in JVMs. In: Virtual Machine Research and Technology Symposium, pp. 139–150 (2004)

    Google Scholar 

  21. Shivers, O.: Control-Flow Analysis of Higher-Order Languages. PhD thesis, CMU, CMU–CS–91–145 (May 1991)

    Google Scholar 

  22. Sreedhar, V., Burke, M., Choi, J.-D.: A framework for interprocedural optimization in the presence of dynamic class loading. In: Proceedings of PLDI 2000, ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 196–207 (2000)

    Google Scholar 

  23. Stoyle, G., Hicks, M.W., Bierman, G.M., Sewell, P., Neamtiu, I.: Mutatis mutandis: Safe and predictable dynamic software updating. In: Proceedings of POPL 2005, SIGPLAN–SIGACT Symposium on Principles of Programming Languages, pp. 183–194 (2005)

    Google Scholar 

  24. Tarditi, D., Morrisett, G., Cheng, P., Stone, C., Harper, R., Lee, P.: TIL: A type-directed optimizing compiler for ML. In: 1996 ACM SIGPLAN Conference on Programming Language Design and Implementation, Philadelphia, PA, USA, pp. 181–192. ACM Press, New York (1996)

    Chapter  Google Scholar 

  25. Wei, P.Y.: A brief overview of the VIOLA engine, and its applications (1994), http://www.xcf.berkeley.edu/~wei/viola/violaIntro.html

  26. Wright, A., Jagannathan, S., Ungureanu, C., Hertzmann, A.: Compiling Java to a typed lambda-calculus: A preliminary report. In: ACM Workshop on Types in Compilation, Kyoto, Japan (March 1998)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Glew, N., Palsberg, J., Grothoff, C. (2005). Type-Safe Optimisation of Plugin Architectures. In: Hankin, C., Siveroni, I. (eds) Static Analysis. SAS 2005. Lecture Notes in Computer Science, vol 3672. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11547662_11

Download citation

  • DOI: https://doi.org/10.1007/11547662_11

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-28584-7

  • Online ISBN: 978-3-540-31971-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics