Nu: a Dynamic Aspect-Oriented Intermediate Language Model and - - PowerPoint PPT Presentation
Nu: a Dynamic Aspect-Oriented Intermediate Language Model and - - PowerPoint PPT Presentation
Nu: a Dynamic Aspect-Oriented Intermediate Language Model and Virtual Machine for Flexible Runtime Adaptation Robert Dyer and Hridesh Rajan Department of Computer Science Iowa State University { rdyer,hridesh } @cs.iastate.edu 7 th
Overview Motivation Our Approach Evaluation Summary
◮ Motivation: Supporting dynamic aspect-oriented constructs ◮ Approach: Nu ◮ Evaluation: Expressiveness and performance ◮ Technical Contributions:
◮ Flexible, dynamic AO intermediate language model ◮ Implementation in industrial strength VM (Sun Hotspot) ◮ Dedicated AO caching mechanism Robert Dyer and Hridesh Rajan 2 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
Need For a Dynamic IL Model
◮ Currently: Dynamic, high-level AO constructs → low-level
OO representation
◮ AO compilers need “building blocks”! ◮ Perhaps an example...
Robert Dyer and Hridesh Rajan 3 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts
◮ History-based pointcuts [Douence, Fradet, and S¨
udholt]
◮ Temporal constructs in AspectJ [Stolz and Bodden]
Robert Dyer and Hridesh Rajan 4 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts
◮ History-based pointcuts [Douence, Fradet, and S¨
udholt]
◮ Temporal constructs in AspectJ [Stolz and Bodden]
- Robert Dyer and Hridesh Rajan
5 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts - Static Translation
Robert Dyer and Hridesh Rajan 6 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts - Static Translation
Robert Dyer and Hridesh Rajan 7 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts - Dynamic Support
Robert Dyer and Hridesh Rajan 8 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts - Dynamic Support
Robert Dyer and Hridesh Rajan 9 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts - Dynamic Support
Robert Dyer and Hridesh Rajan 10 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
History-based Pointcuts - Dynamic Support
Robert Dyer and Hridesh Rajan 11 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
Need For a Dynamic IL Model
◮ Inadequate support for dynamic use cases in current ILs
◮ Dynamic deployment, ◮ Dynamic adaptation, ◮ Policy changes, etc
◮ Dynamically adapting set of advised join points
◮ Morphing aspects [Hanenberg et al.] ◮ Open Aspects [Hirschfeld and Hanenberg] Robert Dyer and Hridesh Rajan 12 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Overview of the Nu Model
◮ JPM: Point-in-time model [Masuhara et al.] ◮ New primitives: bind and remove ◮ Advice as delegate methods ◮ Library of patterns
◮ First-class, immutable objects Robert Dyer and Hridesh Rajan 13 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Two New Primitives: Bind and Remove
Stack Transition Exceptions bind ..., Pattern, Delegate → ..., BindHandle NullPointerEx remove ..., BindHandle → ... IllegalArgumentEx This talk uses source representation for ease.
Robert Dyer and Hridesh Rajan 14 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Bind and Remove Example
public class AuthLogger { }
Robert Dyer and Hridesh Rajan 15 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Bind and Remove Example
public class AuthLogger { protected static Pattern p; protected static Delegate d; static { p = new Execution(new Method("*.login")); d = new Delegate(AuthLogger.class, "log"); } public static void log() { // record the time of login } }
Robert Dyer and Hridesh Rajan 16 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Bind and Remove Example
public class AuthLogger { protected static Pattern p; protected static Delegate d; static { p = new Execution(new Method("*.login")); d = new Delegate(AuthLogger.class, "log"); } public static void log() { // record the time of login } }
Robert Dyer and Hridesh Rajan 17 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Bind and Remove Example
public class AuthLogger { protected static Pattern p; protected static Delegate d; static { p = new Execution(new Method("*.login")); d = new Delegate(AuthLogger.class, "log"); } public static void log() { // record the time of login } }
Robert Dyer and Hridesh Rajan 18 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Bind and Remove Example
public class AuthLogger { protected static Pattern p; protected static Delegate d; protected static BindHandle id = null; static { p = new Execution(new Method("*.login")); d = new Delegate(AuthLogger.class, "log"); } public static void enable() { id = bind(p, d); } public static void log() { // record the time of login } }
Robert Dyer and Hridesh Rajan 19 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Bind and Remove Example
public class AuthLogger { protected static Pattern p; protected static Delegate d; protected static BindHandle id = null; static { p = new Execution(new Method("*.login")); d = new Delegate(AuthLogger.class, "log"); } public static void enable() { id = bind(p, d); } public static void disable() { remove(id); } public static void log() { // record the time of login } }
Robert Dyer and Hridesh Rajan 20 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Implementation Overview
◮ Built on top of Sun Hotspot VM ◮ Adds code to the interpreter for join point dispatch ◮ bind and remove implemented as native methods
Robert Dyer and Hridesh Rajan 21 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Implementation Overview
Robert Dyer and Hridesh Rajan 22 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Implementation Overview
Robert Dyer and Hridesh Rajan 23 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Novel AO Caching Mechanism
Robert Dyer and Hridesh Rajan 24 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Caching Mechanism
- !
- Robert Dyer and Hridesh Rajan
25 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary The Nu Intermediate Language Model The Nu Virtual Machine
Caching Mechanism
- !
- Robert Dyer and Hridesh Rajan
26 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance
Expressing Constructs
◮ Supports multiple language constructs:
◮ AspectJ aspects, pointcuts and advice ◮ cflow, cflowbelow ◮ History-based pointcuts ◮ CaesarJ’s deploy Robert Dyer and Hridesh Rajan 27 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance
Expressing Constructs
◮ Supports multiple language constructs:
◮ AspectJ aspects, pointcuts and advice ◮ cflow, cflowbelow ◮ History-based pointcuts ◮ CaesarJ’s deploy Robert Dyer and Hridesh Rajan 28 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance
cflow(execution(setWord)) && execution(setBit)
Robert Dyer and Hridesh Rajan 29 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance
cflow(execution(setWord)) && execution(setBit)
Robert Dyer and Hridesh Rajan 30 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance
cflow(execution(setWord)) && execution(setBit)
Robert Dyer and Hridesh Rajan 31 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance
Performance Evaluation Overview
◮ Java Grande, SPEC JVM98, and custom
micro-benchmarks
◮ Unmodified VM, Nu VM (caching), Nu VM (no caching) ◮ Only about 1.5% overhead
Robert Dyer and Hridesh Rajan 32 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance Robert Dyer and Hridesh Rajan 33 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance Robert Dyer and Hridesh Rajan 34 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary Expressiveness Performance Robert Dyer and Hridesh Rajan 35 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
Related Work
◮ Steamloom - Bockisch, Haupt, Mezini, and Ostermann ◮ Prose - Popovici, Alonso, and Gross ◮ Delegation-based Machine Model - Haupt and Schippers ◮ Morphing Aspects and Continuous Weaving - Hanenberg,
Hirschfeld, and Unland
Robert Dyer and Hridesh Rajan 36 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
Future Work
Robert Dyer and Hridesh Rajan 37 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
◮ Motivation: Supporting dynamic aspect-oriented constructs
◮ cflow, deploy, history-based, etc ◮ Compiled into static constructs ◮ Lower-level support may yield run-time benefits
◮ Approach: Nu
◮ IL-level primitives for dynamic deployment ◮ Dedicated caching mechanism (low overhead)
◮ Evaluation: Expressiveness and performance
◮ Supports large subset of dynamic AO constructs ◮ Only about 1.5% overhead
◮ Technical Contributions:
◮ Flexible, dynamic AO intermediate language model ◮ Implementation in industrial strength VM (Sun Hotspot) ◮ Dedicated AO caching mechanism Robert Dyer and Hridesh Rajan 38 Nu: Dynamic AO IL Model and VM
Overview Motivation Our Approach Evaluation Summary
Questions?
http://www.cs.iastate.edu/˜nu/
Robert Dyer and Hridesh Rajan 39 Nu: Dynamic AO IL Model and VM