Abstract
Dynamic aspect-oriented programming (AOP) enables runtime adaptation of programs. It enables sophisticated, aspect-based software engineering tools, such as adaptive profilers or debuggers, which dynamically modify instrumentation code in response to user interactions. Today, many AOP frameworks for Java, notably AspectJ, focus on aspect weaving at build-time or at load-time, and offer only limited support for program adaptation by (re)weaving aspects at runtime. In this article, we present HotWave, an AOP framework based on AspectJ for standard Java Virtual Machines (JVMs). HotWave supports dynamic (re)weaving of previously loaded classes, and it ensures that all classes loaded in a JVM can be (re)woven, including the classes of the standard Java class library. HotWave features inter-advice communication, a mechanism that allows for efficient data passing between advice that are woven into the same method. We explain HotWave’s programming model and discuss our implementation techniques. As a case study, we present an adaptive, aspect-based profiler that leverages HotWave’s distinguishing features. A performance evaluation shows that HotWave does not introduce any overhead when no aspect is woven and explores the overhead of runtime weaving. While the duration of runtime weaving can be significant, the execution of woven code with HotWave does not incur any extra overhead when compared to the execution of code woven at build-time or at load-time.
This work has been supported by the Swiss National Science Foundation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Alpern, B., Attanasio, C.R., Barton, J.J., Burke, B., 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, N., Russell, J.R., Sarkar, V., Serrano, M.J., Shepherd, J.C., Smith, S.E., Sreedhar, V.C., Srinivasan, H., Whaley, J.: The Jalapeño virtual machine. IBM Systems Journal 39(1), 211–238 (2000)
Ammons, G., Ball, T., Larus, J.R.: Exploiting hardware performance counters with flow and context sensitive profiling. In: PLDI 1997: Proceedings of the ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation, pp. 85–96. ACM (1997)
Ansaloni, D., Binder, W., Villazón, A., Moret, P.: Rapid development of extensible profilers for the Java virtual machine with aspect-oriented programming. In: WOSP/SIPEW 2010: Proceedings of the 1st Joint International Conference on Performance Engineering, pp. 57–62. ACM Press (January 2010)
Avgustinov, P., Christensen, A.S., Hendren, L.J., Kuzins, S., Lhoták, J., Lhoták, O., de Moor, O., Sereni, D., Sittampalam, G., Tibble, J.: abc: An extensible AspectJ compiler. In: AOSD 2005: Proceedings of the 4th International Conference on Aspect-Oriented Software Development, pp. 87–98. ACM (2005)
Benavides Navarro, L.D., Douence, R., Südholt, M.: Debugging and Testing Middleware with Aspect-Based Control-Flow and Causal Patterns. In: Issarny, V., Schantz, R. (eds.) Middleware 2008. LNCS, vol. 5346, pp. 183–202. Springer, Heidelberg (2008)
Bergel, A.: FacetS: First class entities for an open dynamic AOP language. In: Proceedings of the Open and Dynamic Aspect Languages Workshop (March 2006), http://bergel.eu/download/papers/Berg06a-FacetS.pdf
Binder, W., Ansaloni, D., Villazón, A., Moret, P.: Flexible and efficient profiling with aspect-oriented programming. Concurrency and Computation: Practice and Experience 23(15), 1749–1773 (2011)
Binder, W., Hulaas, J.: Flexible and efficient measurement of dynamic bytecode metrics. In: Fifth International Conference on Generative Programming and Component Engineering (GPCE 2006), pp. 171–180. ACM, Portland (2006)
Binder, W., Hulaas, J., Moret, P.: Advanced Java Bytecode Instrumentation. In: PPPJ 2007: Proceedings of the 5th International Symposium on Principles and Practice of Programming in Java, pp. 135–144. ACM Press, New York (2007)
Binder, W., Hulaas, J., Moret, P., Villazón, A.: Platform-independent profiling in a virtual execution environment. Software: Practice and Experience 39(1), 47–79 (2009)
Blackburn, S.M., Garner, R., Hoffman, C., Khan, A.M., McKinley, K.S., Bentzur, R., Diwan, A., Feinberg, D., Frampton, D., Guyer, S.Z., Hirzel, M., Hosking, A., Jump, M., Lee, H., Moss, J.E.B., Phansalkar, A., Stefanović, D., Van Drunen, T., von Dincklage, D., Wiedermann, B.: The DaCapo benchmarks: Java benchmarking development and analysis. In: OOPSLA 2006: Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications, pp. 169–190. ACM Press, New York (2006)
Bockisch, C., Haupt, M., Mezini, M., Ostermann, K.: Virtual machine support for dynamic join points. In: AOSD 2004: Proceedings of the 3rd International Conference on Aspect-Oriented Software Development, pp. 83–92. ACM (2004)
Chiba, S.: Load-Time Structural Reflection in Java. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, pp. 313–336. Springer, Heidelberg (2000)
Chiba, S., Sato, Y., Tatsubori, M.: Using Hotswap for Implementing Dynamic AOP Systems. In: 1st Workshop on Advancing the State-of-the-Art in Run-time Inspection (2003)
Dmitriev, M.: Profiling Java applications using code hotswapping and dynamic call graph revelation. In: WOSP 2004: Proceedings of the Fourth International Workshop on Software and Performance, pp. 139–150. ACM Press (2004)
Goetz, B., Peierls, T., Bloch, J., Bowbeer, J., Holmes, D., Lea, D.: Java Concurrency in Practice. Addison-Wesley (2006)
Gosling, J., Joy, B., Steele, G.L., Bracha, G.: The Java Language Specification, 3rd edn. The Java Series. Addison-Wesley (2005)
Haupt, M., Mezini, M., Bockisch, C., Dinkelaker, T., Eichberg, M., Krebs, M.: An execution layer for aspect-oriented programming languages. In: VEE 2005: Proceedings of the 1st ACM/USENIX International Conference on Virtual Execution Environments, pp. 142–152. ACM (2005)
Hilsdale, E., Hugunin, J.: Advice weaving in AspectJ. In: AOSD 2004: Proceedings of the 3rd International Conference on Aspect-Oriented Software Development, pp. 26–35. ACM (2004)
Hirschfeld, R.: AspectS - Aspect-Oriented Programming with Squeak. In: Aksit, M., Awasthi, P., Unland, R. (eds.) NODe 2002. LNCS, vol. 2591, pp. 216–232. Springer, Heidelberg (2003)
JBoss: Open source middleware software, Web pages at http://labs.jboss.com/jbossaop/
Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An Overview of AspectJ. In: Lindskov Knudsen, J. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–353. Springer, Heidelberg (2001)
Kiczales, G., Lamping, J., Menhdhekar, A., Maeda, C., Lopes, C., Loingtier, J.M., Irwin, J.: Aspect-Oriented Programming. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)
Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Addison-Wesley, Reading (1999)
Manson, J., Pugh, W., Adve, S.V.: The Java Memory Model. In: POPL 2005: Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 378–391. ACM, New York (2005)
Moret, P., Binder, W., Ansaloni, D., Villazón, A.: Visualizing Calling Context Profiles with Ring Charts. In: VISSOFT 2009: 5th IEEE International Workshop on Visualizing Software for Understanding and Analysis, pp. 33–36. IEEE Computer Society, Edmonton (2009)
Moret, P., Binder, W., Ansaloni, D., Villazón, A.: Exploring Large Profiles with Calling Context Ring Charts. In: WOSP/SIPEW 2010: Proceedings of the First Joint International Conference on Performance Engineering, pp. 63–68. ACM Press (January 2010)
Moret, P., Binder, W., Tanter, É.: Polymorphic bytecode instrumentation. In: AOSD 2011: Proceedings of the 10th International Conference on Aspect-Oriented Software Development, pp. 129–140. ACM (March 2011)
Moret, P., Binder, W., Villazón, A.: CCCP: Complete calling context profiling in virtual execution environments. In: PEPM 2009: Proceedings of the 2009 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pp. 151–160. ACM, Savannah (2009)
Moret, P., Binder, W., Villazón, A., Ansaloni, D., Heydarnoori, A.: Visualizing and exploring profiles with calling context ring charts. Software: Practice and Experience 40, 825–847 (2010)
NetBeans: The NetBeans Profiler Project, Web pages at http://profiler.netbeans.org/
Nicoara, A., Alonso, G.: Making applications persistent at run-time. In: International Conference on Data Engineering, vol. 15, pp. 1368–1372 (2007)
Nicoara, A., Alonso, G., Roscoe, T.: Controlled, Systematic, and Efficient Code Replacement for Running Java Programs. In: Eurosys 2008: Proceedings of the 3rd ACM SIGOPS/EuroSys European Conference on Computer Systems 2008, pp. 233–246. ACM, New York (2008)
Oracle Corporation: Java Platform Debugger Architecture (2011), web pages at http://java.sun.com/javase/technologies/core/toolsapis/jpda/
OSGi Alliance: OSGi Alliance Specifications, Web pages at http://www.osgi.org/Specifications/
Pawlak, R., Seinturier, L., Duchien, L., Florin, G., Legond-Aubry, F., Martelli, L.: JAC: An Aspect-based Distributed Dynamic Framework. Software: Practice and Experience 34(12), 1119–1148 (2004)
Pearce, D.J., Webster, M., Berry, R., Kelly, P.H.J.: Profiling with AspectJ. Software: Practice and Experience 37(7), 747–777 (2007)
Popovici, A., Alonso, G., Gross, T.: Just-in-time aspects: efficient dynamic weaving for Java. In: AOSD 2003: Proceedings of the 2nd International Conference on Aspect-Oriented Software Development, pp. 100–109. ACM Press, New York (2003)
Popovici, A., Gross, T., Alonso, G.: Dynamic weaving for aspect-oriented programming. In: AOSD 2002: Proceedings of the 1st International Conference on Aspect-Oriented Software Development, pp. 141–147. ACM Press, New York (2002)
Rothlisberger, D., Harry, M., Binder, W., Moret, P., Ansaloni, D., Villazon, A., Nierstrasz, O.: Exploiting dynamic information in ides improves speed and correctness of software maintenance tasks. IEEE Transactions on Software Engineering 38(3), 579–591 (2012)
Röthlisberger, D., Härry, M., Villazón, A., Ansaloni, D., Binder, W., Nierstrasz, O., Moret, P.: Augmenting static source views in IDEs with dynamic metrics. In: ICSM 2009: Proceedings of the 25th IEEE International Conference on Software Maintenance, pp. 253–262. IEEE Computer Society, Edmonton (2009)
Röthlisberger, D., Härry, M., Villazón, A., Ansaloni, D., Binder, W., Nierstrasz, O., Moret, P.: Senseo: Enriching Eclipse’s Static Source View with Dynamic Metrics. In: ICSM 2009: Proceedings of the 2009 IEEE International Conference on Software Maintenance, pp. 383–384. IEEE Computer Society, Edmonton (2009)
Sun Microsystems, Inc.: JVM Tool Interface (JVMTI) version 1.1, Web pages at http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html
Suvée, D., Vanderperren, W., Jonckers, V.: JAsCo: an aspect-oriented approach tailored for component based software development. In: AOSD 2003: Proceedings of the 2nd International Conference on Aspect-Oriented Software Development, pp. 21–29. ACM, New York (2003)
The Apache Jakarta Project: The Byte Code Engineering Library (BCEL), Web pages at http://jakarta.apache.org/bcel/
Vanderperren, W., Suvée, D., Verheecke, B., Cibrán, M.A., Jonckers, V.: Adaptive Programming in JAsCo. In: AOSD 2005: Proceedings of the 4th International Conference on Aspect-Oriented Software Development, pp. 75–86. ACM, New York (2005)
Vasseur, A.: Dynamic AOP and Runtime Weaving for Java – How does AspectWerkz address it? In: Dynamic Aspects Workshop (DAW 2004), Lancaster, England (March 2004)
Villazón, A., Ansaloni, D., Binder, W., Moret, P.: HotWave: Creating Adaptive Tools with Dynamic Aspect-Oriented Programming in Java. In: Proceedings of the Eighth International Conference on Generative Programming and Component Engineering, GPCE 2009, pp. 95–98. ACM (October 2009)
Villazón, A., Binder, W., Ansaloni, D., Moret, P.: Advanced Runtime Adaptation for Java. In: Proceedings of the Eighth International Conference on Generative Programming and Component Engineering, GPCE 2009, pp. 85–94. ACM (October 2009)
Villazón, A., Binder, W., Moret, P.: Aspect Weaving in Standard Java Class Libraries. In: PPPJ 2008: Proceedings of the 6th International Symposium on Principles and Practice of Programming in Java, pp. 159–167. ACM, New York (2008)
Villazón, A., Binder, W., Moret, P.: Flexible Calling Context Reification for Aspect-Oriented Programming. In: Proceedings of the 8th International Conference on Aspect-oriented Software Development, AOSD 2009, pp. 63–74. ACM Press, Charlottesville (2009)
Villazón, A., Binder, W., Moret, P., Ansaloni, D.: Comprehensive Aspect Weaving for Java. Science of Computer Programming 76, 1015–1036 (2011)
Würthinger, T., Ansaloni, D., Binder, W., Wimmer, C., Mössenböck, H.: Safe and atomic run-time code evolution for java and its application to dynamic aop. In: Proceedings of the 2011 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2011, pp. 825–844. ACM, New York (2011)
Zhuang, X., Serrano, M.J., Cain, H.W., Choi, J.D.: Accurate, efficient, and adaptive calling context profiling. In: PLDI 2006: Proceedings of the 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 263–271. ACM, New York (2006)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Ansaloni, D., Binder, W., Moret, P., Villazón, A. (2012). Dynamic Aspect-Oriented Programming in Java: The HotWave Experience. In: Leavens, G.T., Chiba, S., Haupt, M., Ostermann, K., Wohlstadter, E. (eds) Transactions on Aspect-Oriented Software Development IX. Lecture Notes in Computer Science, vol 7271. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35551-6_3
Download citation
DOI: https://doi.org/10.1007/978-3-642-35551-6_3
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-35550-9
Online ISBN: 978-3-642-35551-6
eBook Packages: Computer ScienceComputer Science (R0)