summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-08-13 18:19:11 +0000
committeraclement <aclement>2008-08-13 18:19:11 +0000
commit6e045d6f04519fc7cc541157f10e5ce0cdc079b7 (patch)
treed2fbe533ce56a780c72115a07c6095b7924d11ad
parent3d378958148e0fbcb527d05eea67ea0bc743fe88 (diff)
downloadaspectj-6e045d6f04519fc7cc541157f10e5ce0cdc079b7.tar.gz
aspectj-6e045d6f04519fc7cc541157f10e5ce0cdc079b7.zip
243192: optimizing handling of constant instructions (eg. ALOAD_0)
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java13
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/ShadowRange.java8
2 files changed, 18 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
index 01b575faa..ca3d095de 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
@@ -38,6 +38,7 @@ import org.aspectj.apache.bcel.generic.InstructionCP;
import org.aspectj.apache.bcel.generic.InstructionConstants;
import org.aspectj.apache.bcel.generic.InstructionFactory;
import org.aspectj.apache.bcel.generic.InstructionHandle;
+import org.aspectj.apache.bcel.generic.InstructionLV;
import org.aspectj.apache.bcel.generic.InstructionList;
import org.aspectj.apache.bcel.generic.InstructionSelect;
import org.aspectj.apache.bcel.generic.InstructionTargeter;
@@ -1946,7 +1947,11 @@ class BcelClassWeaver implements IClassWeaver {
} else {
freshIndex = frameEnv.get(oldIndex);
}
- fresh.setIndex(freshIndex);
+ if (fresh instanceof RET) {
+ fresh.setIndex(freshIndex);
+ } else {
+ fresh = ((InstructionLV)fresh).setIndexAndCopyIfNecessary(freshIndex);
+ }
dest = ret.append(fresh);
} else {
dest = ret.append(fresh);
@@ -2079,7 +2084,11 @@ class BcelClassWeaver implements IClassWeaver {
// } else {
freshIndex = oldIndex;//frameEnv.get(oldIndex);
// }
- fresh.setIndex(freshIndex);
+ if (fresh instanceof RET) {
+ fresh.setIndex(freshIndex);
+ } else {
+ fresh = ((InstructionLV)fresh).setIndexAndCopyIfNecessary(freshIndex);
+ }
dest = newList.append(fresh);
} else {
dest = newList.append(fresh);
diff --git a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java b/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
index 93f0dba4f..e43a6992e 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
+++ b/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
@@ -17,6 +17,7 @@ import org.aspectj.apache.bcel.generic.Instruction;
import org.aspectj.apache.bcel.generic.InstructionBranch;
import org.aspectj.apache.bcel.generic.InstructionFactory;
import org.aspectj.apache.bcel.generic.InstructionHandle;
+import org.aspectj.apache.bcel.generic.InstructionLV;
import org.aspectj.apache.bcel.generic.InstructionList;
import org.aspectj.apache.bcel.generic.InstructionSelect;
import org.aspectj.apache.bcel.generic.InstructionTargeter;
@@ -169,7 +170,12 @@ final class ShadowRange extends Range {
} else {
freshIndex = remap.get(oldIndex);
}
- freshI.setIndex(freshIndex);
+ if (freshI instanceof RET) {
+ freshI.setIndex(freshIndex);
+ } else {
+ freshI = ((InstructionLV)freshI).setIndexAndCopyIfNecessary(freshIndex);
+ freshIh.setInstruction(freshI);
+ }
}
// System.err.println("JUST COPIED: " + oldIh.getInstruction().toString(freshMethod.getEnclosingClass().getConstantPoolGen().getConstantPool())
// + " INTO " + freshIh.getInstruction().toString(freshMethod.getEnclosingClass().getConstantPoolGen().getConstantPool()));