From: aclement Date: Wed, 15 Feb 2006 09:41:19 +0000 (+0000) Subject: optimization: made unpacking of the table lazy. With a minor change in AJ itself... X-Git-Tag: POST_MEMORY_CHANGES~78 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2dcda062d98090b2ca35f58f737dca4bc65f342b;p=aspectj.git optimization: made unpacking of the table lazy. With a minor change in AJ itself, this results in us only unpacking 15000 of the 39000 local variable table objects constructed during a build of shadows. Saving space and time. --- diff --git a/lib/bcel/bcel-src.zip b/lib/bcel/bcel-src.zip index 0dfc15ee9..162657a4e 100644 Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ diff --git a/lib/bcel/bcel.jar b/lib/bcel/bcel.jar index cf2a7826d..709d6194d 100644 Binary files a/lib/bcel/bcel.jar and b/lib/bcel/bcel.jar differ diff --git a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java index dbc48f125..5e3846e1a 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -33,7 +33,7 @@ import org.aspectj.bridge.ISourceLocation; */ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, AnnotatedElement, TypeVariableDeclaringElement, ResolvedMember { - public String[] parameterNames = null; + private String[] parameterNames = null; protected UnresolvedType[] checkedExceptions = UnresolvedType.NONE; /** * if this member is a parameterized version of a member in a generic type, @@ -490,7 +490,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno return getDeclaringType().resolve(world).getSourceContext(); } - public final String[] getParameterNames() { + public String[] getParameterNames() { + return parameterNames; } public final void setParameterNames(String[] pnames) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java index b54226745..beef22a4d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java @@ -81,10 +81,22 @@ final class BcelMethod extends ResolvedMemberImpl { ? UnresolvedType.NONE : UnresolvedType.forNames(exnTable.getExceptionNames()); + } + + public String[] getParameterNames() { + determineParameterNames(); + return super.getParameterNames(); + } + + private boolean parameterNamesInitialized = false; + + public void determineParameterNames() { + if (parameterNamesInitialized) return; + parameterNamesInitialized=true; LocalVariableTable varTable = method.getLocalVariableTable(); int len = getArity(); if (varTable == null) { - this.parameterNames = Utility.makeArgNames(len); + setParameterNames(Utility.makeArgNames(len)); } else { UnresolvedType[] paramTypes = getParameterTypes(); String[] paramNames = new String[len]; @@ -98,7 +110,7 @@ final class BcelMethod extends ResolvedMemberImpl { } index += paramTypes[i].getSize(); } - this.parameterNames = paramNames; + setParameterNames(paramNames); } } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index 2ec5740d4..a5dd60910 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -530,7 +530,7 @@ public class BcelShadow extends Shadow { UnresolvedType inType = enclosingMethod.getEnclosingClass().getType(); ResolvedMemberImpl sig = MemberImpl.makeExceptionHandlerSignature(inType, catchType); - sig.parameterNames = new String[] {findHandlerParamName(startOfHandler)}; + sig.setParameterNames(new String[] {findHandlerParamName(startOfHandler)}); BcelShadow s = new BcelShadow(