summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-12-09 17:02:53 +0000
committeracolyer <acolyer>2004-12-09 17:02:53 +0000
commitd43e995f824ef8e02cebc4dcf7c5b9c05923db1e (patch)
tree384289bb5dabf45a50760d2ff769abc7ef17d8fd
parentcd22831a0d27d3f807e254db5fca950f6369417a (diff)
downloadaspectj-d43e995f824ef8e02cebc4dcf7c5b9c05923db1e.tar.gz
aspectj-d43e995f824ef8e02cebc4dcf7c5b9c05923db1e.zip
get test instructions ahead of jump test
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java b/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java
index 1c74a5229..bddcf7a50 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java
@@ -175,8 +175,6 @@ public class BcelRenderer implements ITestVisitor, IExprVisitor {
}
public void visit(HasAnnotation hasAnnotation) {
- instructions.insert(createJumpBasedOnBooleanOnStack());
- // now insert the instructions that leave a boolean on the stack
// in Java:
// foo.class.isAnnotationPresent(annotationClass);
// in bytecode:
@@ -184,14 +182,17 @@ public class BcelRenderer implements ITestVisitor, IExprVisitor {
// invokevirtual java/lang/Object.getClass:()Ljava/lang/Class
// ldc_w annotationClass
// invokevirtual java/lang/Class.isAnnotationPresent:(Ljava/lang/Class;)Z
+ InstructionList il = new InstructionList();
Member getClass = Member.method(TypeX.OBJECT, 0, "getClass", "()Ljava/lang/Class;");
- instructions.insert(Utility.createInvoke(fact, world, getClass));
+ il.append(Utility.createInvoke(fact, world, getClass));
// aload annotationClass
int annClassIndex = fact.getConstantPool().addClass(hasAnnotation.getAnnotationType().getSignature());
- instructions.insert(new LDC_W(annClassIndex));
+ il.append(new LDC_W(annClassIndex));
Member isAnnotationPresent = Member.method(TypeX.forName("Ljava/lang/Class"),0,
"isAnnotationPresent","(Ljava/lang/Class;)Z");
- instructions.insert(Utility.createInvoke(fact,world,isAnnotationPresent));
+ il.append(Utility.createInvoke(fact,world,isAnnotationPresent));
+ il.append(createJumpBasedOnBooleanOnStack());
+ instructions.insert(il);
hasAnnotation.getVar().accept(this);
}