Tracking ASM 5.0.4 development: Fix for ASM issue 317545

Issue: SPR-12470
This commit is contained in:
Juergen Hoeller 2014-11-26 11:42:30 +01:00
parent a6e7044523
commit ab5856b6a8
2 changed files with 22 additions and 4 deletions

View File

@ -1173,7 +1173,14 @@ public class ClassReader {
if (labels[label] == null) {
readLabel(label, labels).status |= Label.DEBUG;
}
labels[label].line = readUnsignedShort(v + 12);
Label l = labels[label];
while (l.line > 0) {
if (l.next == null) {
l.next = new Label();
}
l = l.next;
}
l.line = readUnsignedShort(v + 12);
v += 4;
}
}
@ -1288,9 +1295,15 @@ public class ClassReader {
// visits the label and line number for this offset, if any
Label l = labels[offset];
if (l != null) {
Label next = l.next;
l.next = null;
mv.visitLabel(l);
if ((context.flags & SKIP_DEBUG) == 0 && l.line > 0) {
mv.visitLineNumber(l.line, l);
while (next != null) {
mv.visitLineNumber(next.line, l);
next = next.next;
}
}
}

View File

@ -131,7 +131,11 @@ public class Label {
int status;
/**
* The line number corresponding to this label, if known.
* The line number corresponding to this label, if known. If there are
* several lines, each line is stored in a separate label, all linked via
* their next field (these links are created in ClassReader and removed just
* before visitLabel is called, so that this does not impact the rest of the
* code).
*/
int line;
@ -154,7 +158,7 @@ public class Label {
* indicates if this reference uses 2 or 4 bytes, and its absolute value
* gives the position of the bytecode instruction. This array is also used
* as a bitset to store the subroutines to which a basic block belongs. This
* information is needed in {@linked MethodWriter#visitMaxs}, after all
* information is needed in {@link MethodWriter#visitMaxs}, after all
* forward references have been resolved. Hence the same array can be used
* for both purposes without problems.
*/
@ -239,7 +243,8 @@ public class Label {
* The next basic block in the basic block stack. This stack is used in the
* main loop of the fix point algorithm used in the second step of the
* control flow analysis algorithms. It is also used in
* {@link #visitSubroutine} to avoid using a recursive method.
* {@link #visitSubroutine} to avoid using a recursive method, and in
* ClassReader to temporarily store multiple source lines for a label.
*
* @see MethodWriter#visitMaxs
*/