Compiling Conditional Pointcuts for User-Level Semantic Pointcuts

We propose a compilation framework that compiles conditional pointcuts (i.e., if pointcuts) in AspectJ for allowing the programmer to define expressive pointcuts without runtime overheads. The framework automatically finds conditional pointcuts that are static with respect to join point shadows, evaluates them at compile-time, and generates compiled code that performs no runtime tests for those pointcuts. By writing conditions that examine static properties of a program, the programmer can simulate many semantic pointcuts within current AspectJ’s semantics yet without runtime overheads. Our compiler implementation identifies static conditional pointcuts by using a technique similar to the binding-time analysis in partial evaluation, and employs double-compilation scheme to guarantee the same behavior to the code generated by the existing AspectJ compilers. Our experiments confirmed that the compiler is capable of compiling several semantic pointcuts, such as the ones testing class membership (e.g., has and hasfield), testing join point location (e.g., withinstaticinitialization), matching by using regular expressions, and checking high-level coding rules (e.g., the Law of Demeter).

[1]  Shigeru Chiba,et al.  Josh: an open AspectJ-like language , 2004, AOSD '04.

[2]  Ankit Shah,et al.  XAspects: an extensible system for domain-specific aspect languages , 2003, OOPSLA '03.

[3]  William G. Griswold,et al.  Getting started with ASPECTJ , 2001, CACM.

[4]  Kris Gybels,et al.  Arranging language features for more robust pattern-based crosscuts , 2003, AOSD '03.

[5]  Rémi Douence,et al.  Trace-Based Aspects , 2004 .

[6]  Vivek Sarkar,et al.  Dynamic optimistic interprocedural analysis: a framework and an application , 2001, OOPSLA '01.

[7]  Hidehiko Masuhara,et al.  A Value Profiler for Assisting Object-Oriented Program Specialization , 2004 .

[8]  Editors , 1986, Brain Research Bulletin.

[9]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[10]  Karl J. Lieberherr,et al.  A case for statically executable advice: checking the law of demeter with AspectJ , 2003, AOSD '03.

[11]  Robert J. Walker,et al.  Implicit context: easing software evolution and reuse , 2000, SIGSOFT '00/FSE-8.

[12]  Kris De Volder Aspect-Oriented Logic Meta Programming , 1998, ECOOP Workshops.

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

[14]  Michael Eichberg,et al.  Pointcuts as Functional Queries , 2004, APLAS.

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

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

[17]  Karl J. Lieberherr,et al.  Assuring good style for object-oriented programs , 1989, IEEE Software.

[18]  Matthew Alexander Webster,et al.  An aspect oriented performance analysis environment , 2003 .

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

[20]  Jacques Noyé,et al.  Towards partially evaluating reflection in Java , 1999, PEPM '00.

[21]  Shigeru Chiba,et al.  Load-Time Structural Reflection in Java , 2000, ECOOP.

[22]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.