skip to main content
research-article

Safe and atomic run-time code evolution for Java and its application to dynamic AOP

Published:22 October 2011Publication History
Skip Abstract Section

Abstract

Dynamic updates to running programs improve development productivity and reduce downtime of long-running applications. This feature is however severely limited in current virtual machines for object-oriented languages. In particular, changes to classes often apply only to methods invoked after a class change, but not to active methods on the call stack of threads. Additionally, adding and removing methods as well as fields is often not supported.

We present a novel programming model for safe and atomic code updates of Java programs that also updates methods that are currently executed. We introduce safe update regions and pause threads only there before an update. We automatically convert the stack frames to suit the new versions of the methods. Our implementation is based on a production-quality Java virtual machine.

Additionally, we present SafeWeave, a dynamic aspect-oriented programming system that exposes the atomic code updates through a high-level programming model. AspectJ advice can be added to and removed from a running application.Changes are atomic and correctness is guaranteed even though weaving happens in parallel to program execution, and the system fully supports the dynamic class loading of Java. We show that the enhanced evolution features do not incur any performance penalty before and after version changes.

References

  1. B. Alpern, C. R. Attanasio, J. J. Barton, B. Burke, P. Cheng, J.-D. Choi, A. Cocchi, S. J. Fink, D. Grove, M. Hind, S. F. Hummel, D. Lieber, V. Litvinov, M. F. Mergen, N. Ngo, J. R. Russell, V. Sarkar, M. J. Serrano, J. C. Shepherd, S. E. Smith, V. C. Sreedhar, H. Srinivasan, and J. Whaley. The Jalapeno virtual machine. IBM Systems Journal, 39 (1): 211--238, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. J. Andersson and T. Ritzau. Dynamic code update in JDrums. In Workshop on Software Engineering for Wearable and Pervasive Computing, 2000.Google ScholarGoogle Scholar
  3. P. Avgustinov, A. S. Christensen, L. J. Hendren, S. Kuzins, J. Lhoták, O. Lhoták, O. de Moor, D. Sereni, G. Sittampalam, and J. Tibble. abc: An extensible AspectJ compiler. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 87--98. ACM Press, 2005. 10.1145/1052898.1052906. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. L. D. Benavides, R. Douence, and M. Südholt. Debugging and testing middleware with aspect-based control-flow and causal patterns. In Proceedings of the International Conference on Middleware, pages 183--202. Springer-Verlag, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. Bergel. FacetS: First class entities for an open dynamic AOP language. In Proceedings of the Open and Dynamic Aspect Languages Workshop, 2006.Google ScholarGoogle Scholar
  6. S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 169--190. ACM Press, 2006. 10.1145/1167473.1167488. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Bockisch, M. Haupt, M. Mezini, and K. Ostermann. Virtual machine support for dynamic join points. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 83--92. ACM Press, 2004. 10.1145/976270.976282. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. S. Chiba, Y. Sato, and M. Tatsubori. Using HotSwap for implementing dynamic AOP systems. In Proceedings of the Workshop on Advancing the State-of-the-Art in Run-time Inspection, 2003.Google ScholarGoogle Scholar
  9. R. P. Cook and I. Lee. DYMOS: A dynamic modification system. In Proceedings of the Symposium on High-level Debugging, pages 201--202. ACM Press, 1983. 10.1145/1006147.1006188. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Dmitriev. Safe Class and Data Evolution in Large and Long-Lived Java Applications. PhD thesis, University of Glasgow, 2001.Google ScholarGoogle Scholar
  11. O. Frieder and M. E. Segal. On dynamically updating a computer program: From concept to prototype. Journal on System Software, 14: 111--128, February 1991. 10.1016/0164--1212(91)90096-O. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. Haupt, M. Mezini, C. Bockisch, T. Dinkelaker, M. Eichberg, and M. Krebs. An execution layer for aspect-oriented programming languages. In Proceedings of the ACM/USENIX International Conference on Virtual Execution Environments, pages 142--152. ACM Press, 2005. 10.1145/1064979.1065000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. E. Hilsdale and J. Hugunin. Advice weaving in AspectJ. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 26--35. ACM Press, 2004. 10.1145/976270.976276. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Hirschfeld. AspectS - aspect-oriented programming with Squeak. In Revised Papers from the International Conference NetObjectDays on Objects, Components, Architectures, Services, and Applications for a Networked World, pages 216--232. Springer-Verlag, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 32--43. ACM Press, 1992. 10.1145/143095.143114. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Dynamic Code Evolution VM. Institute for System Software, Johannes Kepler University Linz, 2011. http://ssw.jku.at/dcevm/.Google ScholarGoogle Scholar
  17. JBoss AOP. JBoss, 2011. http://labs.jboss.com/jbossaop/.Google ScholarGoogle Scholar
  18. G. Kiczales, J. Lamping, A. Menhdhekar, C. Maeda, C. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-Oriented Programming. In Proceedings of the European Conference on Object-Oriented Programming, pages 220--242. Springer-Verlag, 1997.Google ScholarGoogle Scholar
  19. G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of AspectJ. In Proceedings of the European Conference on Object-Oriented Programming, pages 327--353. Springer-Verlag, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. Lindholm and F. Yellin. The Java#8482; Virtual Machine Specification. Addison-Wesley, 2nd edition, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. K. Makris and R. Bazzi. Immediate multi-threaded dynamic software updates using stack reconstruction. In Proceedings of the USENIX Annual Technical Conference. USENIX Association, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. Malabarba, R. Pandey, J. Gragg, E. Barr, and J. F. Barnes. Runtime support for type-safe dynamic Java classes. In Proceedings of the European Conference on Object-Oriented Programming, pages 337--361. Springer-Verlag, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. P. Moret, W. Binder, and É. Tanter. Polymorphic bytecode instrumentation. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 129--140. ACM Press, 2011. 10.1145/1960275.1960292. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. I. Neamtiu, M. Hicks, G. Stoyle, and M. Oriol. Practical dynamic software updating for C. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM Press, 2006. 10.1145/1133981.1133991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. A. Nicoara and G. Alonso. Making applications persistent at run-time. Proceedings of the International Conference on Data Engineering, pages 1368--1372, 2007. 10.1109/ICDE.2007.369013.Google ScholarGoogle ScholarCross RefCross Ref
  26. A. Nicoara, G. Alonso, and T. Roscoe. Controlled, systematic, and efficient code replacement for running Java programs. In Proceedings of the European Conference on Computer Systems, pages 233--246. ACM Press, 2008. 10.1145/1352592.1352617. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Java Platform Debugger Architecture. Oracle Corporation, 2011. http://java.sun.com/javase/technologies/core/toolsapis/jpda/.Google ScholarGoogle Scholar
  28. A. Orso, A. Rao, and M. J. Harrold. A technique for dynamic updating of Java software. In Proceedings of the International Conference on Software Maintenance, pages 649--658. IEEE Computer Society, 2002. 10.1109/ICSM.2002.1167829. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. D. J. Pearce, M. Webster, R. Berry, and P. H. J. Kelly. Profiling with AspectJ. Software: Practice and Experience, 37 (7): 747--777, 2007. 10.1002/spe.788. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Popovici, T. Gross, and G. Alonso. Dynamic weaving for aspect-oriented programming. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 141--147. ACM Press, 2002. 10.1145/508386.508404. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. A. Popovici, G. Alonso, and T. Gross. Just-in-time aspects: efficient dynamic weaving for Java. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 100--109. ACM Press, 2003. 10.1145/643603.643614. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. Pukall, C. Kastner, and G. Saake. Towards unanticipated runtime adaptation of Java applications. In Proceedings of the Asia-Pacific Software Engineering Conference, pages 85--92. IEEE Computer Society, 2008. 10.1109/APSEC.2008.66. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. B. Redmond and V. Cahill. Supporting unanticipated dynamic adaptation of application behaviour. In Proceedings of the European Conference on Object-Oriented Programming, pages 205--230. Springer-Verlag, 2002. 10.1007/3--540--47993--7_9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. M. E. Segal and O. Frieder. On-the-fly program modification: Systems for dynamic updating. IEEE Software, 10: 53--65, 1993. 10.1109/52.199735. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. G. Stoyle, M. Hicks, G. Bierman, P. Sewell, and I. Neamtiu. Mutatis mutandis: Safe and predictable dynamic software updating. ACM Transactions on Programming Languages and Systems, 29 (4), 2007. 10.1145/1255450.1255455. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. S. Subramanian, M. Hicks, and K. S. McKinley. Dynamic software updates: a VM-centric approach. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 1--12. ACM Press, 2009. 10.1145/1542476.1542478. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. D. Suvée, W. Vanderperren, and V. Jonckers. JAsCo: an aspect-oriented approach tailored for component based software development. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 21--29. ACM Press, 2003. 10.1145/643603.643606. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. W. Vanderperren, D. Suvée, B. Verheecke, M. A. Cibrán, and V. Jonckers. Adaptive programming in JAsCo. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 75--86. ACM Press, 2005. 10.1145/1052898.1052905. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. A. Vasseur. Dynamic AOP and runtime weaving for Java -- How does AspectWerkz address it? In Dynamic Aspects Workshop, 2004.Google ScholarGoogle Scholar
  40. A. Villazón, W. Binder, D. Ansaloni, and P. Moret. Advanced runtime adaptation for Java. In Proceedings of the International Conference on Generative Programming and Component Engineering, pages 85--94. ACM Press, 2009. 10.1145/1621607.1621621. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. A. Villazón, W. Binder, and P. Moret. Flexible calling context reification for aspect-oriented programming. In Proceedings of the International Conference on Aspect-Oriented Software Development, pages 63--74. ACM Press, 2009. 10.1145/1509239.1509249. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. T. Würthinger, W. Binder, D. Ansaloni, P. Moret, and H. Mössenböck. Improving aspect-oriented programming with dynamic code evolution in an enhanced Java virtual machine. In Proceedings of the Workshop on Reflection, AOP and Meta-Data for Software Evolution, pages 5:1--5:5. ACM Press, 2010. 10.1145/1890683.1890688. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. T. Würthinger, W. Binder, D. Ansaloni, P. Moret, and H. Mössenböck. Applications of enhanced dynamic code evolution for Java in GUI development and dynamic aspect-oriented programming. In Proceedings of the International Conference on Generative Programming and Component Engineering, pages 123--126. ACM Press, 2010. 10.1145/1868294.1868312. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. T. Würthinger, C. Wimmer, and L. Stadler. Dynamic code evolution for java. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 10--19. ACM Press, 2010. 10.1145/1852761.1852764. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Safe and atomic run-time code evolution for Java and its application to dynamic AOP

    Recommendations

    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!