From 55cd615ec9a8d68653d45b0d7407f43d357c6ecd Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 17 Aug 2010 18:46:01 +0000 Subject: [PATCH] optimizations: working with Abraham on these: this one avoids trailing ':' which will create a CP hit more frequently. --- weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java | 12 ++++++++---- .../testdata/StaticEnclosingTjpBeforeHelloWorld.txt | 4 ++-- weaver/testdata/StaticTjpBeforeHelloWorld.txt | 8 ++++---- weaver/testdata/TjpAround2HelloWorld.txt | 8 ++++---- weaver/testdata/TjpAroundHelloWorld.txt | 8 ++++---- weaver/testdata/TjpBeforeHelloWorld.txt | 8 ++++---- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java index 018b45309..79ae0c6fc 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java @@ -1389,10 +1389,12 @@ public final class LazyClassGen { if (types == null) { return ""; } - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0, len = types.length; i < len; i++) { + if (i > 0) { + buf.append(':'); + } buf.append(makeString(types[i])); - buf.append(':'); } return buf.toString(); } @@ -1401,10 +1403,12 @@ public final class LazyClassGen { if (names == null) { return ""; } - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0, len = names.length; i < len; i++) { + if (i > 0) { + buf.append(':'); + } buf.append(names[i]); - buf.append(':'); } return buf.toString(); } diff --git a/weaver/testdata/StaticEnclosingTjpBeforeHelloWorld.txt b/weaver/testdata/StaticEnclosingTjpBeforeHelloWorld.txt index c9efdf94a..847ee5214 100644 --- a/weaver/testdata/StaticEnclosingTjpBeforeHelloWorld.txt +++ b/weaver/testdata/StaticEnclosingTjpBeforeHelloWorld.txt @@ -63,8 +63,8 @@ public class HelloWorld extends java.lang.Object: LDC "9" LDC "main" LDC "HelloWorld" - LDC "[Ljava.lang.String;:" - LDC "args:" + LDC "[Ljava.lang.String;" + LDC "args" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; diff --git a/weaver/testdata/StaticTjpBeforeHelloWorld.txt b/weaver/testdata/StaticTjpBeforeHelloWorld.txt index 419571043..587838f4f 100644 --- a/weaver/testdata/StaticTjpBeforeHelloWorld.txt +++ b/weaver/testdata/StaticTjpBeforeHelloWorld.txt @@ -76,8 +76,8 @@ public class HelloWorld extends java.lang.Object: LDC "1" LDC "println" LDC "java.io.PrintStream" - LDC "java.lang.String:" - LDC "arg0:" + LDC "java.lang.String" + LDC "arg0" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; @@ -90,8 +90,8 @@ public class HelloWorld extends java.lang.Object: LDC "9" LDC "main" LDC "HelloWorld" - LDC "[Ljava.lang.String;:" - LDC "args:" + LDC "[Ljava.lang.String;" + LDC "args" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; diff --git a/weaver/testdata/TjpAround2HelloWorld.txt b/weaver/testdata/TjpAround2HelloWorld.txt index 4d29b07c4..6a1affae8 100644 --- a/weaver/testdata/TjpAround2HelloWorld.txt +++ b/weaver/testdata/TjpAround2HelloWorld.txt @@ -272,8 +272,8 @@ public class HelloWorld extends java.lang.Object: LDC "1" LDC "println" LDC "java.io.PrintStream" - LDC "java.lang.String:" - LDC "arg0:" + LDC "java.lang.String" + LDC "arg0" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; @@ -286,8 +286,8 @@ public class HelloWorld extends java.lang.Object: LDC "9" LDC "main" LDC "HelloWorld" - LDC "[Ljava.lang.String;:" - LDC "args:" + LDC "[Ljava.lang.String;" + LDC "args" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; diff --git a/weaver/testdata/TjpAroundHelloWorld.txt b/weaver/testdata/TjpAroundHelloWorld.txt index 18b6e7572..3643d2c07 100644 --- a/weaver/testdata/TjpAroundHelloWorld.txt +++ b/weaver/testdata/TjpAroundHelloWorld.txt @@ -184,8 +184,8 @@ public class HelloWorld extends java.lang.Object: LDC "1" LDC "println" LDC "java.io.PrintStream" - LDC "java.lang.String:" - LDC "arg0:" + LDC "java.lang.String" + LDC "arg0" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; @@ -198,8 +198,8 @@ public class HelloWorld extends java.lang.Object: LDC "9" LDC "main" LDC "HelloWorld" - LDC "[Ljava.lang.String;:" - LDC "args:" + LDC "[Ljava.lang.String;" + LDC "args" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; diff --git a/weaver/testdata/TjpBeforeHelloWorld.txt b/weaver/testdata/TjpBeforeHelloWorld.txt index 9a73e5605..c8ed93a86 100644 --- a/weaver/testdata/TjpBeforeHelloWorld.txt +++ b/weaver/testdata/TjpBeforeHelloWorld.txt @@ -104,8 +104,8 @@ public class HelloWorld extends java.lang.Object: LDC "1" LDC "println" LDC "java.io.PrintStream" - LDC "java.lang.String:" - LDC "arg0:" + LDC "java.lang.String" + LDC "arg0" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; @@ -118,8 +118,8 @@ public class HelloWorld extends java.lang.Object: LDC "9" LDC "main" LDC "HelloWorld" - LDC "[Ljava.lang.String;:" - LDC "args:" + LDC "[Ljava.lang.String;" + LDC "args" LDC "" LDC "void" INVOKEVIRTUAL org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature; -- 2.39.5