diff options
author | aclement <aclement> | 2011-08-05 16:05:54 +0000 |
---|---|---|
committer | aclement <aclement> | 2011-08-05 16:05:54 +0000 |
commit | 03a96ff817b81466690c048de08f604d73babd78 (patch) | |
tree | 2b789f2df808e7f04a0dbfa9b5177a97265430a4 /weaver | |
parent | a9d59bdaf387565f88b4a5926e273430ea6d5aeb (diff) | |
download | aspectj-03a96ff817b81466690c048de08f604d73babd78.tar.gz aspectj-03a96ff817b81466690c048de08f604d73babd78.zip |
353936
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 7fb6068b8..284f91ce9 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -1251,6 +1251,24 @@ public final class LazyMethodGen implements Traceable { // bcel before with duplicate local variables. Now that we're patching // bcel we should be able to do without it if we're paranoid enough // through the rest of the compiler. + InstructionHandle methodStart = gen.getInstructionList().getStart(); + InstructionHandle methodEnd = gen.getInstructionList().getEnd(); + + // Determine how many 'slots' are used by parameters to the method. + // Then below we can determine if a local variable is a parameter variable, if it is + // we force its range to from the method start (as it may have been shuffled down + // due to insertion of advice like cflow entry) + int paramSlots = gen.isStatic() ? 0 : 1; + Type[] argTypes = gen.getArgumentTypes(); + if (argTypes!=null) { + for (int i = 0; i < argTypes.length; i++) { + if (argTypes[i].getSize() == 2) { + paramSlots += 2; + } else { + paramSlots += 1; + } + } + } Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<InstructionHandle, Set<Integer>>(); for (LocalVariableTag tag : localVariables.keySet()) { @@ -1258,7 +1276,8 @@ public final class LazyMethodGen implements Traceable { // location? // if so, just continue. LVPosition lvpos = localVariables.get(tag); - InstructionHandle start = lvpos.start; + InstructionHandle start = (tag.getSlot() < paramSlots ? methodStart : lvpos.start); + InstructionHandle end = (tag.getSlot() < paramSlots ? methodEnd : lvpos.end); Set<Integer> slots = duplicatedLocalMap.get(start); if (slots == null) { slots = new HashSet<Integer>(); @@ -1272,7 +1291,7 @@ public final class LazyMethodGen implements Traceable { if (t == null) { t = BcelWorld.makeBcelType(UnresolvedType.forSignature(tag.getType())); } - gen.addLocalVariable(tag.getName(), t, tag.getSlot(), start, lvpos.end); + gen.addLocalVariable(tag.getName(), t, tag.getSlot(), start, end); } } |