aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-10-05 09:36:51 +0000
committeracolyer <acolyer>2005-10-05 09:36:51 +0000
commit760ceb8deed44cdb6f0cb8624bfc5764f4a8037e (patch)
tree27990f41b1823cb1773cf577bd4820e26bbb8c3b /weaver
parent2b0e6755030eb378e612a00fcb80d7bdca2c55ee (diff)
downloadaspectj-760ceb8deed44cdb6f0cb8624bfc5764f4a8037e.tar.gz
aspectj-760ceb8deed44cdb6f0cb8624bfc5764f4a8037e.zip
final part of fix for 100195 - local var debug info for inlined around advicepreDefaultReweavable
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LocalVariableTag.java10
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/ShadowRange.java19
-rw-r--r--weaver/testdata/AroundAllAndOthersFancyHelloWorld.txt8
-rw-r--r--weaver/testdata/AroundAllFancyHelloWorld.txt8
4 files changed, 36 insertions, 9 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/LocalVariableTag.java b/weaver/src/org/aspectj/weaver/bcel/LocalVariableTag.java
index 109211329..14bb30acf 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LocalVariableTag.java
+++ b/weaver/src/org/aspectj/weaver/bcel/LocalVariableTag.java
@@ -18,8 +18,9 @@ import org.aspectj.weaver.UnresolvedType;
public final class LocalVariableTag extends Tag {
private final UnresolvedType type;
private final String name;
- private final int slot;
+ private int slot;
private final int startPos;
+ boolean remapped = false;
// AMC - pr101047, two local vars with the same name can share the same slot, but must in that case
// have different start positions.
@@ -40,6 +41,13 @@ public final class LocalVariableTag extends Tag {
return type;
}
+ public void updateSlot(int newSlot) {
+ this.slot = newSlot;
+ this.remapped = true;
+ }
+
+ public boolean isRemapped() { return this.remapped; }
+
// ---- from Object
public String toString() {
diff --git a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java b/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
index b6381f9a7..7632c3e16 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
+++ b/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
@@ -175,6 +175,25 @@ final class ShadowRange extends Range {
// System.err.println("JUST COPIED: " + oldIh.getInstruction().toString(freshMethod.getEnclosingClass().getConstantPoolGen().getConstantPool())
// + " INTO " + freshIh.getInstruction().toString(freshMethod.getEnclosingClass().getConstantPoolGen().getConstantPool()));
}
+
+ // now go through again and update variable slots that have been altered as a result
+ // of remapping...
+ for (InstructionHandle newIh = freshBody.getStart(); newIh != freshBody.getEnd(); newIh = newIh.getNext()) {
+ InstructionTargeter[] sources = newIh.getTargeters();
+ if (sources != null) {
+ for (int i = sources.length - 1; i >= 0; i--) {
+ if (sources[i] instanceof LocalVariableTag) {
+ LocalVariableTag lvt = (LocalVariableTag) sources[i];
+ if (!lvt.isRemapped() && remap.hasKey(lvt.getSlot())) {
+ lvt.updateSlot(remap.get(lvt.getSlot()));
+ }
+ }
+ }
+ }
+ }
+
+
+
// we've now copied out all the instructions.
// now delete the instructions... we've already taken care of the damn
diff --git a/weaver/testdata/AroundAllAndOthersFancyHelloWorld.txt b/weaver/testdata/AroundAllAndOthersFancyHelloWorld.txt
index 709ff60a7..789b9d37e 100644
--- a/weaver/testdata/AroundAllAndOthersFancyHelloWorld.txt
+++ b/weaver/testdata/AroundAllAndOthersFancyHelloWorld.txt
@@ -203,7 +203,7 @@ public abstract class FancyHelloWorld extends java.lang.Object:
ASTORE_3 (line 9)
finally -> E1
| catch java.lang.Exception -> E0
- | | ALOAD_3 (line 11)
+ | | ALOAD_3 // java.io.PrintStream out (line 11)
| | LDC "bye"
| | ASTORE 5
| | ASTORE 7
@@ -230,8 +230,8 @@ public abstract class FancyHelloWorld extends java.lang.Object:
| | GOTO L0
| catch java.lang.Exception -> E0
| E0: ASTORE 11 (line 12)
- | ALOAD_3 (line 13)
- | ALOAD 11
+ | ALOAD_3 // java.io.PrintStream out (line 13)
+ | ALOAD 11 // java.lang.Exception e
| ASTORE 13
| ASTORE 15
| method-call(void java.io.PrintStream.println(java.lang.Object))
@@ -263,7 +263,7 @@ public abstract class FancyHelloWorld extends java.lang.Object:
L0: JSR L1
GOTO L2
L1: ASTORE 21
- ALOAD_3 (line 15)
+ ALOAD_3 // java.io.PrintStream out (line 15)
LDC "finally"
ASTORE 23
ASTORE 25
diff --git a/weaver/testdata/AroundAllFancyHelloWorld.txt b/weaver/testdata/AroundAllFancyHelloWorld.txt
index de2e58197..b7a8d8623 100644
--- a/weaver/testdata/AroundAllFancyHelloWorld.txt
+++ b/weaver/testdata/AroundAllFancyHelloWorld.txt
@@ -101,7 +101,7 @@ public abstract class FancyHelloWorld extends java.lang.Object:
ASTORE_3 (line 9)
finally -> E1
| catch java.lang.Exception -> E0
- | | ALOAD_3 (line 11)
+ | | ALOAD_3 // java.io.PrintStream out (line 11)
| | LDC "bye"
| | ASTORE 5
| | ASTORE 7
@@ -127,8 +127,8 @@ public abstract class FancyHelloWorld extends java.lang.Object:
| | GOTO L0
| catch java.lang.Exception -> E0
| E0: ASTORE 11 (line 12)
- | ALOAD_3 (line 13)
- | ALOAD 11
+ | ALOAD_3 // java.io.PrintStream out (line 13)
+ | ALOAD 11 // java.lang.Exception e
| ASTORE 13
| ASTORE 15
| method-call(void java.io.PrintStream.println(java.lang.Object))
@@ -159,7 +159,7 @@ public abstract class FancyHelloWorld extends java.lang.Object:
L0: JSR L1
GOTO L2
L1: ASTORE 21
- ALOAD_3 (line 15)
+ ALOAD_3 // java.io.PrintStream out (line 15)
LDC "finally"
ASTORE 23
ASTORE 25