« Ron Bodkin on Aspects and Security (AOSD 2005) | Main | Per-instance aspects »
March 19, 2005
Sam Pullara on VM-level AOP (AOSD 2005)
Sam's talk was a survey of different weaving times and strategies, concluding that VM based weaving is where we ultimately want to be (no disagreement with the audience on that point). However, it will take a long time to get there, and a lot of the issues are not technical...
Sam also gave a live demo of the new @AspectJ support running in IntelliJ having obtained a copy of the code from Alex. He's the very first person outside of the team to play with it, and his initial impressions were very favourable.
The current state of the art supports weaving at compile time, class load time, runtime hotswap, and runtime using OO methods. Weaving is done using either bytecode modification or dynamic proxies.
Compile-time weaving
Pros
- predictable runtime performance
- ide friendly
- bounded set of classes and effects
- most compatible with current vms
Cons
- must have classes available
- cannot dynamically change aspects
- can break the license of some sw
- large up-front cost
Class load-time weaving
Pros
- aspect decision deferred to deployment
- can be used with most hot deploy systems
- can apply to code unavailable at compile time
Cons
- startup time can be arbitrarily large
- some software incompatibilities
Hotswap weaving
Pros
- similar to class-load time...
- can be changed without reloading class
- deployment time configuration
Cons
- startup time
- some JVM incompatibility
- requires native code in pre Java 5 vms
- complicated command lines
- need to run in debug mode prior to JDK 5 - 10-30% performance degradation, complete retest required.
Runtime OO methods
Pros
- very dynamic
- easy to understand for OO programmers
- implementation is simpler
Cons
- often slow due to reflection
- supports many fewer pointcut types
- startup time is affected (proxy generation) - this can be significant (cited 200% increase in one example)
Bytecode modification weaving
Pros
- can be implemented on virtually any VM
- mostly invisible to end user
Cons
- can change the shape of the class
- some side-effects like serialization are exposed
- typically only one agent/weaver is possible
- class level only
Dynamic proxy weaving
Pros
- standard java
- very simple
Cons
- recursion is not easy
- often inefficient
- proxies need to be regenerated on each run
Issues with SOTA
- current AOP implementations are like working with generics implementations prior to the standardisation in java 5
- debugging of current systems often much more difficult than plain Java (eg. stack traces)
- without standard support, portability suffers between vms and platforms
- many target users will be unwilling to depend on a language feature that isn't "supported"
VM level AOP
- is not really weaving any more since no bytecode modification is needed
- debugging would be simplified as the debug apis would support aop
- performance:- could be tied into the vm optimizer more efficiently
- memory usage would be better since double analysis and storage would not be required
- works much better with reflection code
The JRockit team have a prototype of VM-level weaving. The SteamLoom project does VM weaving based on the Jikes RVM too.
Posted by adrian at March 19, 2005 03:40 AM [permalink]
Comments
Could you elaborate a little on the @AspectJ and Intellij comment? What is it, how do you use it, when will it be available, etc? Thanks...
Posted by: Peter Morelli at March 20, 2005 10:41 PM
@AspectJ is the short name we use for the annotation-style of declaring aspects supported by AspectJ5 (ie. @Aspect public class MyAspect {...}). You can find more details in the AspectJ5 Developers Notebook linked from the AspectJ doc page. Since AspectJ programs specified using this style are fully Java 5 compatible, and Java 5 compliant tools can be used to edit and compile them, including IntelliJ.
Posted by: Adrian Colyer at March 21, 2005 04:12 PM
Just curious, what happened to the much touted feature of AspectWerkz, "The Dynamic Deployment of AOP" ? Any time frame of that feature being available in AspectJ5 ?
Posted by: prasen at June 10, 2005 06:32 AM
Post a comment
Thanks for signing in, . Now you can comment. (sign out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)