summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2004-01-24 02:28:54 +0000
committerjhugunin <jhugunin>2004-01-24 02:28:54 +0000
commit0c833438dadeeb26659cd901870d18d2c103658b (patch)
treecbe369e1ea2e90cdfabf09f9b343da4e9a930621 /runtime
parent2b4e2512530a5d0a12e92071eb2e3198722dcd6b (diff)
downloadaspectj-0c833438dadeeb26659cd901870d18d2c103658b.tar.gz
aspectj-0c833438dadeeb26659cd901870d18d2c103658b.zip
Implemented feature for Bugzilla Bug 48091
Lazy instantiation of thisJoinPoint Speed-ups of 10-100X are measured even when running a small test case with minimal GC issues. The actual feature implemented is that thisJoinPoint objects are only created just before calling the method for advice that requires them. To take advantage of this feature you must use an if PCD or some other dynamic test that occurs in the PCD not the advice body to guard the expensive creation of the thisJoinPoint object. -XlazyTjp flag must be passed to compiler to enable this feature. If any around advice is present on the joinpoint then lazy instantiation will be disabled. An Xlint warning will be displayed in this case. As a related optimization, several helper methods were added to Factory.makeJP to reduce the code size when thisJoinPoint is used.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/org/aspectj/runtime/reflect/Factory.java30
1 files changed, 25 insertions, 5 deletions
diff --git a/runtime/src/org/aspectj/runtime/reflect/Factory.java b/runtime/src/org/aspectj/runtime/reflect/Factory.java
index 781286389..44f03d686 100644
--- a/runtime/src/org/aspectj/runtime/reflect/Factory.java
+++ b/runtime/src/org/aspectj/runtime/reflect/Factory.java
@@ -40,11 +40,31 @@ public final class Factory {
return new JoinPointImpl.StaticPartImpl(kind, sig, makeSourceLoc(l, -1));
}
- public static JoinPoint makeJP(JoinPoint.StaticPart staticPart,
- Object _this, Object target, Object[] args)
- {
- return new JoinPointImpl(staticPart, _this, target, args);
- }
+ private static Object[] NO_ARGS = new Object[0];
+ public static JoinPoint makeJP(JoinPoint.StaticPart staticPart,
+ Object _this, Object target)
+ {
+ return new JoinPointImpl(staticPart, _this, target, NO_ARGS);
+ }
+
+ public static JoinPoint makeJP(JoinPoint.StaticPart staticPart,
+ Object _this, Object target, Object arg0)
+ {
+ return new JoinPointImpl(staticPart, _this, target, new Object[] {arg0});
+ }
+
+ public static JoinPoint makeJP(JoinPoint.StaticPart staticPart,
+ Object _this, Object target, Object arg0, Object arg1)
+ {
+ return new JoinPointImpl(staticPart, _this, target, new Object[] {arg0, arg1});
+ }
+
+
+ public static JoinPoint makeJP(JoinPoint.StaticPart staticPart,
+ Object _this, Object target, Object[] args)
+ {
+ return new JoinPointImpl(staticPart, _this, target, args);
+ }
public MethodSignature makeMethodSig(String stringRep) {
MethodSignatureImpl ret = new MethodSignatureImpl(stringRep);