Fixed: label copies should be added to all labels

This commit is contained in:
Svetlana Isakova
2014-09-05 15:45:37 +04:00
parent 976d5ab030
commit f5feb3bf33
6 changed files with 31 additions and 6 deletions
@@ -460,7 +460,7 @@ public class PseudocodeImpl implements Pseudocode {
Integer finishIndex = ((PseudocodeLabel) finishLabel).getTargetInstructionIndex();
assert finishIndex != null;
Map<Label, Label> originalToCopy = Maps.newHashMap();
Map<Label, Label> originalToCopy = Maps.newLinkedHashMap();
Multimap<Instruction, Label> originalLabelsForInstruction = HashMultimap.create();
for (PseudocodeLabel label : labels) {
Integer index = label.getTargetInstructionIndex();
@@ -472,6 +472,9 @@ public class PseudocodeImpl implements Pseudocode {
originalLabelsForInstruction.put(getJumpTarget(label), label);
}
}
for (Label label : originalToCopy.values()) {
labels.add((PseudocodeLabel) label);
}
for (int index = startIndex; index < finishIndex; index++) {
Instruction originalInstruction = mutableInstructionList.get(index);
repeatLabelsBindingForInstruction(originalInstruction, originalToCopy, originalLabelsForInstruction);