diff options
author | jhugunin <jhugunin> | 2004-01-24 02:28:54 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2004-01-24 02:28:54 +0000 |
commit | 0c833438dadeeb26659cd901870d18d2c103658b (patch) | |
tree | cbe369e1ea2e90cdfabf09f9b343da4e9a930621 /weaver/testdata | |
parent | 2b4e2512530a5d0a12e92071eb2e3198722dcd6b (diff) | |
download | aspectj-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 'weaver/testdata')
-rw-r--r-- | weaver/testdata/TjpAround2HelloWorld.txt | 92 | ||||
-rw-r--r-- | weaver/testdata/TjpAroundHelloWorld.txt | 92 | ||||
-rw-r--r-- | weaver/testdata/TjpBeforeHelloWorld.txt | 48 |
3 files changed, 83 insertions, 149 deletions
diff --git a/weaver/testdata/TjpAround2HelloWorld.txt b/weaver/testdata/TjpAround2HelloWorld.txt index 7f43db752..3531db917 100644 --- a/weaver/testdata/TjpAround2HelloWorld.txt +++ b/weaver/testdata/TjpAround2HelloWorld.txt @@ -9,27 +9,23 @@ public class HelloWorld extends java.lang.Object: GETSTATIC HelloWorld.ajc$tjp_0 Lorg/aspectj/lang/JoinPoint$StaticPart; ALOAD_0 ALOAD_0 - BIPUSH 0 - ANEWARRAY java.lang.Object - ASTORE_2 - ALOAD_2 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE_1 constructor-execution(void HelloWorld.<init>()) | BIPUSH 2 | ANEWARRAY java.lang.Object - | ASTORE 4 - | ALOAD 4 + | ASTORE_3 + | ALOAD_3 | BIPUSH 0 | ALOAD_0 | AASTORE - | ALOAD 4 + | ALOAD_3 | BIPUSH 1 | ALOAD_1 | AASTORE | NEW HelloWorld$AjcClosure3 | DUP - | ALOAD 4 + | ALOAD_3 | INVOKESPECIAL HelloWorld$AjcClosure3.<init> ([Ljava/lang/Object;)V | ALOAD_1 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; @@ -40,37 +36,30 @@ public class HelloWorld extends java.lang.Object: public static void main(String[]): ALOAD_0 - ASTORE 11 + ASTORE 9 GETSTATIC HelloWorld.ajc$tjp_3 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL ACONST_NULL - BIPUSH 1 - ANEWARRAY java.lang.Object - ASTORE 13 - ALOAD 13 - BIPUSH 0 - ALOAD 11 - AASTORE - ALOAD 13 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 12 + ALOAD 9 + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + ASTORE 10 method-execution(void HelloWorld.main(java.lang.String[])) | BIPUSH 2 | ANEWARRAY java.lang.Object - | ASTORE 15 - | ALOAD 15 + | ASTORE 12 + | ALOAD 12 | BIPUSH 0 - | ALOAD 11 + | ALOAD 9 | AASTORE - | ALOAD 15 - | BIPUSH 1 | ALOAD 12 + | BIPUSH 1 + | ALOAD 10 | AASTORE | NEW HelloWorld$AjcClosure15 | DUP - | ALOAD 15 - | INVOKESPECIAL HelloWorld$AjcClosure15.<init> ([Ljava/lang/Object;)V | ALOAD 12 + | INVOKESPECIAL HelloWorld$AjcClosure15.<init> ([Ljava/lang/Object;)V + | ALOAD 10 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; | POP | RETURN @@ -208,65 +197,54 @@ public class HelloWorld extends java.lang.Object: GETSTATIC HelloWorld.ajc$tjp_1 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL ACONST_NULL - BIPUSH 0 - ANEWARRAY java.lang.Object + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE_2 - ALOAD_2 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 4 field-get(java.io.PrintStream java.lang.System.out) | BIPUSH 1 | ANEWARRAY java.lang.Object - | ASTORE 6 - | ALOAD 6 - | BIPUSH 0 + | ASTORE 4 | ALOAD 4 + | BIPUSH 0 + | ALOAD_2 | AASTORE | NEW HelloWorld$AjcClosure7 | DUP - | ALOAD 6 - | INVOKESPECIAL HelloWorld$AjcClosure7.<init> ([Ljava/lang/Object;)V | ALOAD 4 + | INVOKESPECIAL HelloWorld$AjcClosure7.<init> ([Ljava/lang/Object;)V + | ALOAD_2 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; | CHECKCAST java.io.PrintStream field-get(java.io.PrintStream java.lang.System.out) LDC "hello world" (line 9) + ASTORE 6 ASTORE 8 - ASTORE 10 GETSTATIC HelloWorld.ajc$tjp_2 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL - ALOAD 10 - BIPUSH 1 - ANEWARRAY java.lang.Object - ASTORE 12 - ALOAD 12 - BIPUSH 0 ALOAD 8 - AASTORE - ALOAD 12 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 14 + ALOAD 6 + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + ASTORE 10 method-call(void java.io.PrintStream.println(java.lang.String)) | BIPUSH 3 | ANEWARRAY java.lang.Object - | ASTORE 16 - | ALOAD 16 + | ASTORE 12 + | ALOAD 12 | BIPUSH 0 - | ALOAD 10 + | ALOAD 8 | AASTORE - | ALOAD 16 + | ALOAD 12 | BIPUSH 1 - | ALOAD 8 + | ALOAD 6 | AASTORE - | ALOAD 16 + | ALOAD 12 | BIPUSH 2 - | ALOAD 14 + | ALOAD 10 | AASTORE | NEW HelloWorld$AjcClosure11 | DUP - | ALOAD 16 + | ALOAD 12 | INVOKESPECIAL HelloWorld$AjcClosure11.<init> ([Ljava/lang/Object;)V - | ALOAD 14 + | ALOAD 10 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; | POP method-call(void java.io.PrintStream.println(java.lang.String)) diff --git a/weaver/testdata/TjpAroundHelloWorld.txt b/weaver/testdata/TjpAroundHelloWorld.txt index 90581cd64..65ca8bc5e 100644 --- a/weaver/testdata/TjpAroundHelloWorld.txt +++ b/weaver/testdata/TjpAroundHelloWorld.txt @@ -9,27 +9,23 @@ public class HelloWorld extends java.lang.Object: GETSTATIC HelloWorld.ajc$tjp_0 Lorg/aspectj/lang/JoinPoint$StaticPart; ALOAD_0 ALOAD_0 - BIPUSH 0 - ANEWARRAY java.lang.Object - ASTORE_2 - ALOAD_2 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE_1 constructor-execution(void HelloWorld.<init>()) | BIPUSH 2 | ANEWARRAY java.lang.Object - | ASTORE_3 - | ALOAD_3 + | ASTORE_2 + | ALOAD_2 | BIPUSH 0 | ALOAD_0 | AASTORE - | ALOAD_3 + | ALOAD_2 | BIPUSH 1 | ALOAD_1 | AASTORE | NEW HelloWorld$AjcClosure1 | DUP - | ALOAD_3 + | ALOAD_2 | INVOKESPECIAL HelloWorld$AjcClosure1.<init> ([Ljava/lang/Object;)V | ALOAD_1 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; @@ -40,37 +36,30 @@ public class HelloWorld extends java.lang.Object: public static void main(String[]): ALOAD_0 - ASTORE 9 + ASTORE 7 GETSTATIC HelloWorld.ajc$tjp_3 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL ACONST_NULL - BIPUSH 1 - ANEWARRAY java.lang.Object - ASTORE 11 - ALOAD 11 - BIPUSH 0 - ALOAD 9 - AASTORE - ALOAD 11 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 10 + ALOAD 7 + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + ASTORE 8 method-execution(void HelloWorld.main(java.lang.String[])) | BIPUSH 2 | ANEWARRAY java.lang.Object - | ASTORE 12 - | ALOAD 12 - | BIPUSH 0 + | ASTORE 9 | ALOAD 9 + | BIPUSH 0 + | ALOAD 7 | AASTORE - | ALOAD 12 + | ALOAD 9 | BIPUSH 1 - | ALOAD 10 + | ALOAD 8 | AASTORE | NEW HelloWorld$AjcClosure7 | DUP - | ALOAD 12 + | ALOAD 9 | INVOKESPECIAL HelloWorld$AjcClosure7.<init> ([Ljava/lang/Object;)V - | ALOAD 10 + | ALOAD 8 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; | POP | RETURN @@ -142,65 +131,54 @@ public class HelloWorld extends java.lang.Object: GETSTATIC HelloWorld.ajc$tjp_1 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL ACONST_NULL - BIPUSH 0 - ANEWARRAY java.lang.Object + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE_2 - ALOAD_2 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 4 field-get(java.io.PrintStream java.lang.System.out) | BIPUSH 1 | ANEWARRAY java.lang.Object - | ASTORE 6 - | ALOAD 6 - | BIPUSH 0 + | ASTORE 4 | ALOAD 4 + | BIPUSH 0 + | ALOAD_2 | AASTORE | NEW HelloWorld$AjcClosure3 | DUP - | ALOAD 6 - | INVOKESPECIAL HelloWorld$AjcClosure3.<init> ([Ljava/lang/Object;)V | ALOAD 4 + | INVOKESPECIAL HelloWorld$AjcClosure3.<init> ([Ljava/lang/Object;)V + | ALOAD_2 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; | CHECKCAST java.io.PrintStream field-get(java.io.PrintStream java.lang.System.out) LDC "hello world" (line 9) + ASTORE 6 ASTORE 8 - ASTORE 10 GETSTATIC HelloWorld.ajc$tjp_2 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL - ALOAD 10 - BIPUSH 1 - ANEWARRAY java.lang.Object - ASTORE 12 - ALOAD 12 - BIPUSH 0 ALOAD 8 - AASTORE - ALOAD 12 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 14 + ALOAD 6 + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + ASTORE 10 method-call(void java.io.PrintStream.println(java.lang.String)) | BIPUSH 3 | ANEWARRAY java.lang.Object - | ASTORE 16 - | ALOAD 16 + | ASTORE 12 + | ALOAD 12 | BIPUSH 0 - | ALOAD 10 + | ALOAD 8 | AASTORE - | ALOAD 16 + | ALOAD 12 | BIPUSH 1 - | ALOAD 8 + | ALOAD 6 | AASTORE - | ALOAD 16 + | ALOAD 12 | BIPUSH 2 - | ALOAD 14 + | ALOAD 10 | AASTORE | NEW HelloWorld$AjcClosure5 | DUP - | ALOAD 16 + | ALOAD 12 | INVOKESPECIAL HelloWorld$AjcClosure5.<init> ([Ljava/lang/Object;)V - | ALOAD 14 + | ALOAD 10 | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;Lorg/aspectj/lang/JoinPoint;)Ljava/lang/Object; | POP method-call(void java.io.PrintStream.println(java.lang.String)) diff --git a/weaver/testdata/TjpBeforeHelloWorld.txt b/weaver/testdata/TjpBeforeHelloWorld.txt index 07649f713..ce462ec68 100644 --- a/weaver/testdata/TjpBeforeHelloWorld.txt +++ b/weaver/testdata/TjpBeforeHelloWorld.txt @@ -9,11 +9,7 @@ public class HelloWorld extends java.lang.Object: GETSTATIC HelloWorld.ajc$tjp_0 Lorg/aspectj/lang/JoinPoint$StaticPart; ALOAD_0 ALOAD_0 - BIPUSH 0 - ANEWARRAY java.lang.Object - ASTORE_2 - ALOAD_2 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE_1 constructor-execution(void HelloWorld.<init>()) | ALOAD_1 @@ -24,31 +20,20 @@ public class HelloWorld extends java.lang.Object: public static void main(String[]): ALOAD_0 - ASTORE 9 + ASTORE 6 GETSTATIC HelloWorld.ajc$tjp_3 Lorg/aspectj/lang/JoinPoint$StaticPart; ACONST_NULL ACONST_NULL - BIPUSH 1 - ANEWARRAY java.lang.Object - ASTORE 8 - ALOAD 8 - BIPUSH 0 - ALOAD 9 - AASTORE - ALOAD 8 - INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - ASTORE 7 + ALOAD 6 + INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + ASTORE 5 method-execution(void HelloWorld.main(java.lang.String[])) - | ALOAD 7 + | ALOAD 5 | INVOKESTATIC Aspect.ajc_before (Lorg/aspectj/lang/JoinPoint;)V | GETSTATIC HelloWorld.ajc$tjp_1 Lorg/aspectj/lang/JoinPoint$StaticPart; | ACONST_NULL | ACONST_NULL - | BIPUSH 0 - | ANEWARRAY java.lang.Object - | ASTORE_2 - | ALOAD_2 - | INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + | INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; | ASTORE_1 | field-get(java.io.PrintStream java.lang.System.out) | | ALOAD_1 @@ -56,26 +41,19 @@ public class HelloWorld extends java.lang.Object: | | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 8) | field-get(java.io.PrintStream java.lang.System.out) | LDC "hello world" (line 9) + | ASTORE_3 | ASTORE 4 - | ASTORE 5 | GETSTATIC HelloWorld.ajc$tjp_2 Lorg/aspectj/lang/JoinPoint$StaticPart; | ACONST_NULL - | ALOAD 5 - | BIPUSH 1 - | ANEWARRAY java.lang.Object - | ASTORE 6 - | ALOAD 6 - | BIPUSH 0 | ALOAD 4 - | AASTORE - | ALOAD 6 - | INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; - | ASTORE_3 + | ALOAD_3 + | INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; + | ASTORE_2 | method-call(void java.io.PrintStream.println(java.lang.String)) - | | ALOAD_3 + | | ALOAD_2 | | INVOKESTATIC Aspect.ajc_before (Lorg/aspectj/lang/JoinPoint;)V - | | ALOAD 5 | | ALOAD 4 + | | ALOAD_3 | | INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V | method-call(void java.io.PrintStream.println(java.lang.String)) | RETURN (line 11) |