Dependent advice: a general approach to optimizing history-based aspects

Many aspects for runtime monitoring are history-based: they contain pieces of advice that execute conditionally, based on the observed execution history. History-based aspects are notorious for causing high runtime overhead. Compilers can apply powerful optimizations to history-based aspects using domain knowledge. Unfortunately, current aspect languages like AspectJ impede optimizations, as they provide no means to express this domain knowledge. In this paper we present dependent advice, a novel AspectJ language extension. A dependent advice contains dependency annotations that preserve crucial domain knowledge: a dependent advice needs to execute only when its dependencies are fulfilled. Optimizations can exploit this knowledge: we present a whole-program analysis that removes advice-dispatch code from program locations at which an advice's dependencies cannot be fulfilled. Programmers often opt to have history-based aspects generated automatically, from formal specifications from model-driven development or runtime monitoring. As we show using code-generation tools for two runtime-monitoring approaches, tracematches and JavaMOP, such tools can use knowledge contained in the specification to automatically generate dependency annotations as well. Our extensive evaluation using the DaCapo benchmark suite shows that the use of dependent advice can significantly lower, sometimes even completely eliminate, the runtime overhead caused by history-based aspects, independently of the specification formalism.

[1]  Clark Verbrugge,et al.  Component-Based Lock Allocation , 2007, 16th International Conference on Parallel Architecture and Compilation Techniques (PACT 2007).

[2]  David Harel,et al.  LSCs: Breathing Life into Message Sequence Charts , 1999, Formal Methods Syst. Des..

[3]  Naoyasu Ubayashi,et al.  Association aspects , 2004, AOSD '04.

[4]  Ondrej Lhoták,et al.  A Staged Static Program Analysis to Improve the Performance of Runtime Monitoring , 2007, ECOOP.

[5]  Volker Stolz,et al.  Temporal Assertions using AspectJ , 2006, Electron. Notes Theor. Comput. Sci..

[6]  Hidehiko Masuhara,et al.  Dataflow Pointcut in Aspect-Oriented Programming , 2003, APLAS.

[7]  Eric Bodden,et al.  Relational aspects as tracematches , 2008, AOSD.

[8]  Eric Bodden,et al.  Racer: effective race detection using aspectj , 2008, ISSTA '08.

[9]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[10]  Mizuhito Ogawa,et al.  An Ahead-of-time Yet Context-Sensitive Points-to Analysis for Java , 2009, Electron. Notes Theor. Comput. Sci..

[11]  David Harel,et al.  From multi-modal scenarios to code: compiling LSCs into aspectJ , 2006, SIGSOFT '06/FSE-14.

[12]  Monica S. Lam,et al.  Finding Application Errors Using PQL: a Program Query Language , 2004 .

[13]  Ondrej Lhoták,et al.  Typestate-like analysis of multiple interacting objects , 2008, OOPSLA.

[14]  Stefan Hanenberg,et al.  Evolvable Pattern Implementations Need Generic Aspects , 2004, RAM-SE.

[15]  Benjamin Livshits,et al.  Finding application errors and security flaws using PQL: a program query language , 2005, OOPSLA '05.

[16]  Alexander Aiken,et al.  Relational queries over program traces , 2005, OOPSLA '05.

[17]  Ondrej Lhoták,et al.  Scaling Java Points-to Analysis Using SPARK , 2003, CC.

[18]  Oege de Moor,et al.  Making trace monitors feasible , 2007, OOPSLA.

[19]  Hidehiko Masuhara,et al.  A Compilation and Optimization Model for Aspect-Oriented Programs , 2003, CC.

[20]  Manu Sridharan,et al.  Refinement-based context-sensitive points-to analysis for Java , 2006, PLDI '06.

[21]  David H. Lorenz,et al.  Coupling Aspect-Oriented and Adaptive Programming , 2004 .

[22]  Ondrej Lhoták,et al.  Adding trace matching with free variables to AspectJ , 2005, OOPSLA '05.

[23]  Grigore Rosu,et al.  Mop: an efficient and generic runtime verification framework , 2007, OOPSLA.

[24]  William F. Clocksin,et al.  Programming in Prolog , 1981, Springer Berlin Heidelberg.

[25]  Jim Hugunin,et al.  Advice weaving in AspectJ , 2004, AOSD '04.

[26]  Grigore Rosu,et al.  Towards Monitoring-Oriented Programming: A Paradigm Combining Specification and Implementation , 2003, RV@CAV.

[27]  Eric Bodden,et al.  Finding programming errors earlier by evaluating runtime monitors ahead-of-time , 2008, SIGSOFT '08/FSE-16.

[28]  Ingolf H. Krüger,et al.  Automating software architecture exploration with M2Aspects , 2006, SCESM '06.

[29]  Ondrej Lhoták,et al.  abc : An Extensible AspectJ Compiler , 2006, LNCS Trans. Aspect Oriented Softw. Dev..