From 8d92b51c9c5a4038f57759c7024e9834896cf8c0 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 8 Jun 2006 09:28:56 +0000 Subject: [PATCH] synchronization joinpoints: code dump... --- weaver/src/org/aspectj/weaver/Member.java | 5 +++++ weaver/src/org/aspectj/weaver/World.java | 1 - weaver/src/org/aspectj/weaver/bcel/BcelField.java | 2 +- weaver/src/org/aspectj/weaver/bcel/BcelMethod.java | 4 ++-- .../src/org/aspectj/weaver/bcel/BcelObjectType.java | 6 +++--- weaver/src/org/aspectj/weaver/bcel/BcelWorld.java | 13 ++++++++++++- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/Member.java b/weaver/src/org/aspectj/weaver/Member.java index 723605816..f7505f088 100644 --- a/weaver/src/org/aspectj/weaver/Member.java +++ b/weaver/src/org/aspectj/weaver/Member.java @@ -35,6 +35,8 @@ public interface Member { case 5: return POINTCUT; case 6: return ADVICE; case 7: return HANDLER; + case 8: return MONITORENTER; + case 9: return MONITOREXIT; } throw new BCException("weird kind " + key); } @@ -48,6 +50,9 @@ public interface Member { public static final Kind POINTCUT = new Kind("POINTCUT", 5); public static final Kind ADVICE = new Kind("ADVICE", 6); public static final Kind HANDLER = new Kind("HANDLER", 7); + public static final Kind MONITORENTER = new Kind("MONITORENTER", 8); + public static final Kind MONITOREXIT = new Kind("MONITOREXIT", 9); + public ResolvedMember resolve(World world); diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index 8aacc20ee..5cb41d2b4 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -765,7 +765,6 @@ public abstract class World implements Dump.INode { public void setOptionalJoinpoints(String jps) { if (jps==null) return; if (jps.indexOf("arrayconstruction")!=-1) optionalJoinpoint_ArrayConstruction = true; - if (jps.indexOf("trivial")!=-1) optionalJoinpoint_Trivial = true; if (jps.indexOf("synchronization")!=-1) optionalJoinpoint_Synchronization = true; } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/org/aspectj/weaver/bcel/BcelField.java index eab34f54e..efb7d1f51 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelField.java @@ -64,7 +64,7 @@ final class BcelField extends ResolvedMemberImpl { private void unpackAttributes(World world) { Attribute[] attrs = field.getAttributes(); - List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),attrs, getSourceContext(world),world.getMessageHandler(),bcelObjectType.getWeaverVersionAttribute()); + List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),attrs, getSourceContext(world),world,bcelObjectType.getWeaverVersionAttribute()); as.addAll(AtAjAttributes.readAj5FieldAttributes(field, this, world.resolve(getDeclaringType()), getSourceContext(world), world.getMessageHandler())); for (Iterator iter = as.iterator(); iter.hasNext();) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java index ad960fbdb..d5c604863 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java @@ -129,7 +129,7 @@ final class BcelMethod extends ResolvedMemberImpl { private void unpackAjAttributes(World world) { associatedShadowMunger = null; - List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),method.getAttributes(), getSourceContext(world),world.getMessageHandler(),bcelObjectType.getWeaverVersionAttribute()); + List as = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),method.getAttributes(), getSourceContext(world),world,bcelObjectType.getWeaverVersionAttribute()); processAttributes(world, as); as = AtAjAttributes.readAj5MethodAttributes(method, this, world.resolve(getDeclaringType()), preResolvedPointcut,getSourceContext(world), world.getMessageHandler()); processAttributes(world,as); @@ -160,7 +160,7 @@ final class BcelMethod extends ResolvedMemberImpl { // for testing - if we have this attribute, return it - will return null if it doesnt know anything public AjAttribute[] getAttributes(String name) { List results = new ArrayList(); - List l = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),method.getAttributes(), getSourceContext(world),world.getMessageHandler(),bcelObjectType.getWeaverVersionAttribute()); + List l = BcelAttributes.readAjAttributes(getDeclaringType().getClassName(),method.getAttributes(), getSourceContext(world),world,bcelObjectType.getWeaverVersionAttribute()); for (Iterator iter = l.iterator(); iter.hasNext();) { AjAttribute element = (AjAttribute) iter.next(); if (element.getNameString().equals(name)) results.add(element); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index 3e791abe0..1257fe25a 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -299,7 +299,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { bitflag|=UNPACKED_AJATTRIBUTES; IMessageHandler msgHandler = getResolvedTypeX().getWorld().getMessageHandler(); // Pass in empty list that can store things for readAj5 to process - List l = BcelAttributes.readAjAttributes(className,javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),msgHandler,AjAttribute.WeaverVersionInfo.UNKNOWN); + List l = BcelAttributes.readAjAttributes(className,javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld(),AjAttribute.WeaverVersionInfo.UNKNOWN); List pointcuts = new ArrayList(); typeMungers = new ArrayList(); declares = new ArrayList(); @@ -817,7 +817,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { // for testing - if we have this attribute, return it - will return null if it doesnt know anything public AjAttribute[] getAttributes(String name) { List results = new ArrayList(); - List l = BcelAttributes.readAjAttributes(javaClass.getClassName(),javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld().getMessageHandler(),AjAttribute.WeaverVersionInfo.UNKNOWN); + List l = BcelAttributes.readAjAttributes(javaClass.getClassName(),javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),getResolvedTypeX().getWorld(),AjAttribute.WeaverVersionInfo.UNKNOWN); for (Iterator iter = l.iterator(); iter.hasNext();) { AjAttribute element = (AjAttribute) iter.next(); if (element.getNameString().equals(name)) results.add(element); @@ -854,4 +854,4 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } - + \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 23ad1bfa1..e75f79a27 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -39,6 +39,8 @@ import org.aspectj.apache.bcel.generic.INVOKESTATIC; import org.aspectj.apache.bcel.generic.Instruction; import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InvokeInstruction; +import org.aspectj.apache.bcel.generic.MONITORENTER; +import org.aspectj.apache.bcel.generic.MONITOREXIT; import org.aspectj.apache.bcel.generic.MULTIANEWARRAY; import org.aspectj.apache.bcel.generic.NEWARRAY; import org.aspectj.apache.bcel.generic.ObjectType; @@ -460,6 +462,15 @@ public class BcelWorld extends World implements Repository { } + public Member makeJoinPointSignatureForMonitorEnter(LazyClassGen cg,InstructionHandle h) { + MONITORENTER i = (MONITORENTER)h.getInstruction(); + return MemberImpl.monitorEnter(); + } + + public Member makeJoinPointSignatureForMonitorExit(LazyClassGen cg,InstructionHandle h) { + MONITOREXIT i = (MONITOREXIT)h.getInstruction(); + return MemberImpl.monitorExit(); + } public Member makeJoinPointSignatureForArrayConstruction(LazyClassGen cg, InstructionHandle handle) { Instruction i = handle.getInstruction(); @@ -709,4 +720,4 @@ public class BcelWorld extends World implements Repository { return true; } } -} +} \ No newline at end of file -- 2.39.5