aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2004-01-27 19:51:08 +0000
committerjhugunin <jhugunin>2004-01-27 19:51:08 +0000
commitab413c4bfabc94a47ced0bcae39517d02fc06afe (patch)
tree7e6efcde68a9ac1673ce526f51a5dde92836fd5d
parent47e2459b15269743f137bc15245c7dfc3a4d6907 (diff)
downloadaspectj-ab413c4bfabc94a47ced0bcae39517d02fc06afe.tar.gz
aspectj-ab413c4bfabc94a47ced0bcae39517d02fc06afe.zip
Picked lowest hanging weave-time performance optimization fruit.
-rw-r--r--weaver/src/org/aspectj/weaver/Shadow.java7
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java63
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java32
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java9
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java98
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/AndPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/FastMatchInfo.java43
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/IfPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java11
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/NotPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/OrPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/PerCflow.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/PerObject.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/PerSingleton.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/Pointcut.java4
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java4
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java2
24 files changed, 232 insertions, 69 deletions
diff --git a/weaver/src/org/aspectj/weaver/Shadow.java b/weaver/src/org/aspectj/weaver/Shadow.java
index 3fbd92ab3..ade65de83 100644
--- a/weaver/src/org/aspectj/weaver/Shadow.java
+++ b/weaver/src/org/aspectj/weaver/Shadow.java
@@ -180,6 +180,13 @@ public abstract class Shadow {
public static final Kind AdviceExecution = new Kind(JoinPoint.ADVICE_EXECUTION, 9, false);
public static final Kind Initialization = new Kind(JoinPoint.INITIALIZATION, 10, false);
public static final Kind ExceptionHandler = new Kind(JoinPoint.EXCEPTION_HANDLER, 11, true);
+
+ public static final int MAX_SHADOW_KIND = 11;
+ public static final Kind[] SHADOW_KINDS = new Kind[] {
+ MethodCall, ConstructorCall, MethodExecution, ConstructorExecution,
+ FieldGet, FieldSet, StaticInitialization, PreInitialization,
+ AdviceExecution, Initialization, ExceptionHandler,
+ };
/** A type-safe enum representing the kind of shadows
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
index 8ef653f87..052cef1fa 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
@@ -62,6 +62,8 @@ import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
+import org.aspectj.weaver.Shadow.Kind;
+import org.aspectj.weaver.patterns.FastMatchInfo;
class BcelClassWeaver implements IClassWeaver {
@@ -127,12 +129,48 @@ class BcelClassWeaver implements IClassWeaver {
this.ty = clazz.getBcelObjectType();
this.cpg = clazz.getConstantPoolGen();
this.fact = clazz.getFactory();
+
+ fastMatchShadowMungers(shadowMungers);
+
initializeSuperInitializerMap(ty.getResolvedTypeX());
}
- // --------------------------------------------
-
- private void initializeSuperInitializerMap(ResolvedTypeX child) {
+ private List[] perKindShadowMungers;
+ private boolean canMatchBodyShadows = false;
+ private boolean canMatchInitialization = false;
+ private void fastMatchShadowMungers(List shadowMungers) {
+ perKindShadowMungers = new List[Shadow.MAX_SHADOW_KIND+1];
+ for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) {
+ Shadow.Kind kind = Shadow.SHADOW_KINDS[i];
+ ArrayList mungers = new ArrayList(0);
+ perKindShadowMungers[kind.getKey()] = mungers;
+ fastMatchShadowMungers(shadowMungers, mungers, kind);
+ if (mungers.isEmpty()) {
+ perKindShadowMungers[kind.getKey()] = null;
+ } else {
+ if (kind == Shadow.Initialization) {
+ canMatchInitialization = true;
+ } else if (!kind.isEnclosingKind()) {
+ canMatchBodyShadows = true;
+ }
+ }
+ }
+ }
+
+ private boolean canMatch(Shadow.Kind kind) {
+ return perKindShadowMungers[kind.getKey()] != null;
+ }
+
+ private void fastMatchShadowMungers(List shadowMungers, ArrayList mungers, Kind kind) {
+ FastMatchInfo info = new FastMatchInfo(clazz.getType(), kind);
+ for (Iterator i = shadowMungers.iterator(); i.hasNext();) {
+ ShadowMunger munger = (ShadowMunger) i.next();
+ if (munger.getPointcut().fastMatch(info).maybeTrue()) mungers.add(munger);
+ }
+ }
+
+
+ private void initializeSuperInitializerMap(ResolvedTypeX child) {
ResolvedTypeX[] superInterfaces = child.getDeclaredInterfaces();
for (int i=0, len=superInterfaces.length; i < len; i++) {
if (ty.getResolvedTypeX().isTopmostImplementor(superInterfaces[i])) {
@@ -287,6 +325,7 @@ class BcelClassWeaver implements IClassWeaver {
List methodGens = new ArrayList(clazz.getMethodGens());
for (Iterator i = methodGens.iterator(); i.hasNext();) {
LazyMethodGen mg = (LazyMethodGen)i.next();
+ //mg.getBody();
if (! mg.hasBody()) continue;
isChanged |= match(mg);
}
@@ -786,7 +825,7 @@ class BcelClassWeaver implements IClassWeaver {
} else {
AjAttribute.EffectiveSignatureAttribute effective = mg.getEffectiveSignature();
if (effective == null) {
- enclosingShadow = BcelShadow.makeMethodExecution(world, mg);
+ enclosingShadow = BcelShadow.makeMethodExecution(world, mg, !canMatchBodyShadows);
} else if (effective.isWeaveBody()) {
enclosingShadow =
BcelShadow.makeShadowForMethod(
@@ -799,18 +838,22 @@ class BcelClassWeaver implements IClassWeaver {
}
}
- for (InstructionHandle h = mg.getBody().getStart();
- h != null;
- h = h.getNext()) {
- match(mg, h, enclosingShadow, shadowAccumulator);
+ if (canMatchBodyShadows) {
+ for (InstructionHandle h = mg.getBody().getStart();
+ h != null;
+ h = h.getNext()) {
+ match(mg, h, enclosingShadow, shadowAccumulator);
+ }
+ }
+ if (match(enclosingShadow, shadowAccumulator)) {
+ enclosingShadow.init();
}
- match(enclosingShadow, shadowAccumulator);
mg.matchedShadows = shadowAccumulator;
return !shadowAccumulator.isEmpty();
}
}
- private boolean shouldWeaveBody(LazyMethodGen mg) {
+ private boolean shouldWeaveBody(LazyMethodGen mg) {
if (mg.isAjSynthetic()) return mg.getName().equals("<clinit>");
AjAttribute.EffectiveSignatureAttribute a = mg.getEffectiveSignature();
if (a != null) return a.isWeaveBody();
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index 9069c915e..41a84491a 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -515,12 +515,42 @@ public class BcelShadow extends Shadow {
}
+ public static BcelShadow makeMethodExecution(
+ BcelWorld world,
+ LazyMethodGen enclosingMethod,
+ boolean lazyInit)
+ {
+ if (!lazyInit) return makeMethodExecution(world, enclosingMethod);
+
+ BcelShadow s =
+ new BcelShadow(
+ world,
+ MethodExecution,
+ enclosingMethod.getMemberView(),
+ enclosingMethod,
+ null);
+
+ return s;
+ }
+
+
+ public void init() {
+ if (range != null) return;
+
+ final InstructionList body = enclosingMethod.getBody();
+ ShadowRange r = new ShadowRange(body);
+ r.associateWithShadow(this);
+ r.associateWithTargets(
+ Range.genStart(body),
+ Range.genEnd(body));
+ }
+
public static BcelShadow makeMethodExecution(
BcelWorld world,
LazyMethodGen enclosingMethod)
{
return makeShadowForMethod(world, enclosingMethod, MethodExecution,
- world.makeMethodSignature(enclosingMethod));
+ enclosingMethod.getMemberView()); //world.makeMethodSignature(enclosingMethod));
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index 3d7611d73..7dea8184b 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -47,6 +47,7 @@ import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.patterns.DeclareParents;
+import org.aspectj.weaver.patterns.FastMatchInfo;
public class BcelWeaver implements IWeaver {
private BcelWorld world;
@@ -487,7 +488,7 @@ public class BcelWeaver implements IWeaver {
}
} catch (RuntimeException re) {
System.err.println("trouble in: ");
- clazz.print(System.err);
+ //XXXclazz.print(System.err);
throw re;
} catch (Error re) {
System.err.println("trouble in: ");
@@ -552,11 +553,15 @@ public class BcelWeaver implements IWeaver {
private List fastMatch(List list, ResolvedTypeX type) {
if (list == null) return Collections.EMPTY_LIST;
+ // here we do the coarsest grained fast match with no kind constraints
+ // this will remove all obvious non-matches and see if we need to do any weaving
+ FastMatchInfo info = new FastMatchInfo(type, null);
+
List result = new ArrayList();
Iterator iter = list.iterator();
while (iter.hasNext()) {
ShadowMunger munger = (ShadowMunger)iter.next();
- if (munger.getPointcut().fastMatch(type).maybeTrue()) {
+ if (munger.getPointcut().fastMatch(info).maybeTrue()) {
result.add(munger);
}
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
index c0b125143..8cb337b35 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
+++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
@@ -56,6 +56,7 @@ import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.TypeX;
/**
@@ -74,13 +75,13 @@ import org.aspectj.weaver.ResolvedTypeX;
public final class LazyMethodGen {
private int accessFlags;
- private final Type returnType;
+ private Type returnType;
private final String name;
- private final Type[] argumentTypes;
+ private Type[] argumentTypes;
//private final String[] argumentNames;
- private final String[] declaredExceptions;
- private final InstructionList body; // leaving null for abstracts
- private final Attribute[] attributes;
+ private String[] declaredExceptions;
+ private InstructionList body; // leaving null for abstracts
+ private Attribute[] attributes;
/* private */ final LazyClassGen enclosingClass;
private final BcelMethod memberView;
int highestLineNumber = 0;
@@ -116,6 +117,7 @@ public final class LazyMethodGen {
String[] declaredExceptions,
LazyClassGen enclosingClass)
{
+ //System.err.println("raw create of: " + name + ", " + enclosingClass.getName() + ", " + returnType);
this.memberView = null; // ??? should be okay, since constructed ones aren't woven into
this.accessFlags = accessFlags;
this.returnType = returnType;
@@ -143,8 +145,11 @@ public final class LazyMethodGen {
return ret;
}
- // build from an existing method
+ private Method savedMethod = null;
+ // build from an existing method, lazy build saves most work for initialization
public LazyMethodGen(Method m, LazyClassGen enclosingClass) {
+ savedMethod = m;
+
this.enclosingClass = enclosingClass;
if (!(m.isAbstract() || m.isNative()) && m.getCode() == null) {
throw new RuntimeException("bad non-abstract method with no code: " + m + " on " + enclosingClass);
@@ -152,25 +157,47 @@ public final class LazyMethodGen {
if ((m.isAbstract() || m.isNative()) && m.getCode() != null) {
throw new RuntimeException("bad abstract method with code: " + m + " on " + enclosingClass);
}
- MethodGen gen = new MethodGen(m, enclosingClass.getName(), enclosingClass.getConstantPoolGen());
this.memberView = new BcelMethod(enclosingClass.getBcelObjectType(), m);
- this.accessFlags = gen.getAccessFlags();
- this.returnType = gen.getReturnType();
- this.name = gen.getName();
- this.argumentTypes = gen.getArgumentTypes();
- //this.argumentNames = gen.getArgumentNames();
- this.declaredExceptions = gen.getExceptions();
- this.attributes = gen.getAttributes();
- this.maxLocals = gen.getMaxLocals();
+
+ this.accessFlags = m.getAccessFlags();
+ this.name = m.getName();
+ }
+
+ private void initialize() {
+ if (returnType != null) return;
+
+ //System.err.println("initializing: " + getName() + ", " + enclosingClass.getName() + ", " + returnType + ", " + savedMethod);
+
+ MethodGen gen = new MethodGen(savedMethod, enclosingClass.getName(), enclosingClass.getConstantPoolGen());
+
+ this.returnType = gen.getReturnType();
+ this.argumentTypes = gen.getArgumentTypes();
+
+ this.declaredExceptions = gen.getExceptions();
+ this.attributes = gen.getAttributes();
+ this.maxLocals = gen.getMaxLocals();
+
+// this.returnType = BcelWorld.makeBcelType(memberView.getReturnType());
+// this.argumentTypes = BcelWorld.makeBcelTypes(memberView.getParameterTypes());
+//
+// this.declaredExceptions = TypeX.getNames(memberView.getExceptions()); //gen.getExceptions();
+// this.attributes = new Attribute[0]; //gen.getAttributes();
+// this.maxLocals = savedMethod.getCode().getMaxLocals();
+
+
if (gen.isAbstract() || gen.isNative()) {
body = null;
} else {
+ //body = new InstructionList(savedMethod.getCode().getCode());
body = gen.getInstructionList();
+
unpackHandlers(gen);
unpackLineNumbers(gen);
unpackLocals(gen);
}
assertGoodBody();
+
+ //System.err.println("initialized: " + this.getClassName() + "." + this.getName());
}
// XXX we're relying on the javac promise I've just made up that we won't have an early exception
@@ -293,6 +320,8 @@ public final class LazyMethodGen {
}
public Method getMethod() {
+ if (savedMethod != null) return savedMethod; //??? this relies on gentle treatment of constant pool
+
try {
MethodGen gen = pack();
return gen.getMethod();
@@ -303,7 +332,11 @@ public final class LazyMethodGen {
this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null);
throw e;
}
-
+ }
+
+ public void markAsChanged() {
+ initialize();
+ savedMethod = null;
}
// =============================
@@ -656,13 +689,10 @@ public final class LazyMethodGen {
}
public Type[] getArgumentTypes() {
+ initialize();
return argumentTypes;
}
-// public String[] getArgumentNames() {
-// return argumentNames;
-// }
-
public LazyClassGen getEnclosingClass() {
return enclosingClass;
}
@@ -676,6 +706,7 @@ public final class LazyMethodGen {
}
public Type getReturnType() {
+ initialize();
return returnType;
}
@@ -684,11 +715,14 @@ public final class LazyMethodGen {
}
public InstructionList getBody() {
+ markAsChanged();
return body;
}
- public boolean hasBody() { return body != null; }
-
+ public boolean hasBody() {
+ if (savedMethod != null) return savedMethod.getCode() != null;
+ return body != null;
+ }
public Attribute[] getAttributes() {
return attributes;
@@ -998,8 +1032,7 @@ public final class LazyMethodGen {
// }
// }
l.add(0, fresh);
- }
-
+ }
public boolean isPrivate() {
@@ -1035,13 +1068,12 @@ public final class LazyMethodGen {
*/
public void assertGoodBody() {
- // XXX this is REALLY slow since we get the string first...
- assertGoodBody(getBody(), toString());
+ if (true) return; // only enable for debugging, consider using cheaper toString()
+ assertGoodBody(getBody(), toString()); //definingType.getNameAsIdentifier() + "." + getName()); //toString());
}
- // XXX we might not want to release with any calls to this incredibly inefficient method.
public static void assertGoodBody(InstructionList il, String from) {
- if (true) return;
+ if (true) return; // only to be enabled for debugging
if (il == null) return;
Set body = new HashSet();
Stack ranges = new Stack();
@@ -1217,8 +1249,9 @@ public final class LazyMethodGen {
}
public String getSignature() {
- return Member.typesToSignature(BcelWorld.fromBcel(getReturnType()),
- BcelWorld.fromBcel(getArgumentTypes()));
+ return memberView.getSignature();
+// return Member.typesToSignature(BcelWorld.fromBcel(getReturnType()),
+// BcelWorld.fromBcel(getArgumentTypes()));
}
public BcelMethod getMemberView() {
@@ -1226,6 +1259,7 @@ public final class LazyMethodGen {
}
public void forcePublic() {
+ markAsChanged();
accessFlags = Utility.makePublic(accessFlags);
}
@@ -1236,8 +1270,4 @@ public final class LazyMethodGen {
public void setCanInline(boolean canInline) {
this.canInline = canInline;
}
- public boolean hasExceptionHandlers() {
- return hasExceptionHandlers;
- }
-
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
index b3202774a..aea40a3e3 100644
--- a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
@@ -34,7 +34,7 @@ public class AndPointcut extends Pointcut {
setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return left.fastMatch(type).and(right.fastMatch(type));
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
index ce79c5608..382ace4ad 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
@@ -41,7 +41,7 @@ public class ArgsPointcut extends NameBindingPointcut {
this.arguments = arguments;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java b/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
index 3a0a8acf2..6aa5f7fc3 100644
--- a/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
@@ -59,7 +59,7 @@ public class CflowPointcut extends Pointcut {
this.freeVars = freeVars;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java
index 3354dbbbf..cbb65f37e 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java
@@ -40,7 +40,7 @@ public class ConcreteCflowPointcut extends Pointcut {
this.slots = slots;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/FastMatchInfo.java b/weaver/src/org/aspectj/weaver/patterns/FastMatchInfo.java
new file mode 100644
index 000000000..c2b6121d0
--- /dev/null
+++ b/weaver/src/org/aspectj/weaver/patterns/FastMatchInfo.java
@@ -0,0 +1,43 @@
+/* *******************************************************************
+ * Copyright (c) 2004 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Jim Hugunin initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.weaver.patterns;
+
+import org.aspectj.weaver.ResolvedTypeX;
+import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.Shadow.Kind;
+
+
+public class FastMatchInfo {
+ private Kind kind;
+ private ResolvedTypeX type;
+
+ public FastMatchInfo(ResolvedTypeX type, Shadow.Kind kind) {
+ this.type = type;
+ this.kind = kind;
+ }
+
+ /**
+ * kind can be null to indicate that all kinds should be considered.
+ * This is usually done as a first pass
+ * @return
+ */
+ public Kind getKind() {
+ return kind;
+ }
+
+ public ResolvedTypeX getType() {
+ return type;
+ }
+
+}
diff --git a/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java b/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java
index 258c8ac80..aa50bd7b6 100644
--- a/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java
@@ -38,7 +38,7 @@ public class HandlerPointcut extends Pointcut {
this.exceptionType = exceptionType;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
//??? should be able to do better by finding all referenced types in type
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java b/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
index 9fd8a73ec..df4fdb6b5 100644
--- a/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
@@ -50,7 +50,7 @@ public class IfPointcut extends Pointcut {
this.extraParameterFlags = extraParameterFlags;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java
index 1dca9d036..43e53724b 100644
--- a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java
@@ -51,9 +51,14 @@ public class KindedPointcut extends Pointcut {
this.munger = munger;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo info) {
+ if (info.getKind() != null) {
+ if (info.getKind() != kind) return FuzzyBoolean.NO;
+ }
+
return FuzzyBoolean.MAYBE;
}
+
public FuzzyBoolean match(Shadow shadow) {
if (shadow.getKind() != kind) return FuzzyBoolean.NO;
@@ -61,10 +66,10 @@ public class KindedPointcut extends Pointcut {
if(kind == Shadow.MethodCall) {
warnOnConfusingSig(shadow);
}
- return FuzzyBoolean.NO;
+ return FuzzyBoolean.NO;
}
- return FuzzyBoolean.YES;
+ return FuzzyBoolean.YES;
}
private void warnOnConfusingSig(Shadow shadow) {
diff --git a/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java b/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java
index 02884b22c..59fe2522a 100644
--- a/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java
@@ -37,7 +37,7 @@ public class NotPointcut extends Pointcut {
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return body.fastMatch(type).not();
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
index 9e4eae4fb..1d1ce6298 100644
--- a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
@@ -35,7 +35,7 @@ public class OrPointcut extends Pointcut {
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return left.fastMatch(type).or(right.fastMatch(type));
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/PerCflow.java b/weaver/src/org/aspectj/weaver/patterns/PerCflow.java
index fe815e3ba..1c511bb08 100644
--- a/weaver/src/org/aspectj/weaver/patterns/PerCflow.java
+++ b/weaver/src/org/aspectj/weaver/patterns/PerCflow.java
@@ -47,7 +47,7 @@ public class PerCflow extends PerClause {
// -----
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java b/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java
index 4976d2f7f..dfd225377 100644
--- a/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java
+++ b/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java
@@ -31,7 +31,7 @@ public class PerFromSuper extends PerClause {
this.kind = kind;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
throw new RuntimeException("unimplemented");
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/PerObject.java b/weaver/src/org/aspectj/weaver/patterns/PerObject.java
index de70b35e2..bed5d4e81 100644
--- a/weaver/src/org/aspectj/weaver/patterns/PerObject.java
+++ b/weaver/src/org/aspectj/weaver/patterns/PerObject.java
@@ -40,7 +40,7 @@ public class PerObject extends PerClause {
}
// -----
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java b/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java
index 6399b6430..2ffeec761 100644
--- a/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java
+++ b/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java
@@ -30,7 +30,7 @@ public class PerSingleton extends PerClause {
public PerSingleton() {
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.YES;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java
index 126a43b84..6e3cf912f 100644
--- a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java
@@ -62,7 +62,7 @@ public abstract class Pointcut extends PatternNode {
/**
* Could I match any shadows in the code defined within this type?
*/
- public abstract FuzzyBoolean fastMatch(ResolvedTypeX type);
+ public abstract FuzzyBoolean fastMatch(FastMatchInfo info);
/**
* Do I really match this shadow?
@@ -202,7 +202,7 @@ public abstract class Pointcut extends PatternNode {
return Literal.FALSE; // can only get here if an earlier error occurred
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.NO;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java
index e73e24e82..b253b4d18 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java
@@ -57,7 +57,7 @@ public class ReferencePointcut extends Pointcut {
//??? do either of these match methods make any sense???
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
index 4fd791031..f17a5a15c 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
@@ -50,7 +50,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
this.type = type;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java
index 7881050fe..14267da07 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java
@@ -42,8 +42,8 @@ public class WithinPointcut extends Pointcut {
return FuzzyBoolean.NO;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
- return isWithinType(type);
+ public FuzzyBoolean fastMatch(FastMatchInfo info) {
+ return isWithinType(info.getType());
}
public FuzzyBoolean match(Shadow shadow) {
diff --git a/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java
index 71dba0d30..f30329bb2 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java
@@ -32,7 +32,7 @@ public class WithincodePointcut extends Pointcut {
this.signature = signature;
}
- public FuzzyBoolean fastMatch(ResolvedTypeX type) {
+ public FuzzyBoolean fastMatch(FastMatchInfo type) {
return FuzzyBoolean.MAYBE;
}