AS3 instruction insert fix

This commit is contained in:
Jindra Petřík
2015-07-03 19:54:36 +02:00
parent 635b6d69d5
commit 3494556c52
2 changed files with 9 additions and 5 deletions

View File

@@ -1958,13 +1958,14 @@ public class AVM2Code implements Cloneable {
@Override
public int updateOperandOffset(long insAddr, long targetAddress, int offset) {
//System.err.println("instruction.offset=" + instruction.offset);
if ((targetAddress > instruction.offset) || (mapOffsetsAfterIns && (targetAddress == instruction.offset))) {
if (insAddr >= instruction.offset) {
return offset;
}
if (((targetAddress > instruction.offset) || (mapOffsetsAfterIns && (targetAddress == instruction.offset)))
&& (insAddr < instruction.offset)) {
return offset + byteCount;
}
if (((targetAddress < instruction.offset) || (mapOffsetsAfterIns && (targetAddress == instruction.offset)))
&& (insAddr > instruction.offset)) {
return offset - byteCount;
}
return offset;
}
}, body);

View File

@@ -1432,6 +1432,9 @@ public class Graph {
String labelName = "addr" + part.start;
List<GraphTargetItem> firstCode = partCodes.get(part);
int firstCodePos = partCodePos.get(part);
if (firstCodePos > firstCode.size()) {
firstCodePos = firstCode.size();
}
if (firstCode.size() > firstCodePos && (firstCode.get(firstCodePos) instanceof LabelItem)) {
labelName = ((LabelItem) firstCode.get(firstCodePos)).labelName;
} else {