mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-24 17:24:54 +00:00
Better line start detection
Fixed debug info injection
This commit is contained in:
Binary file not shown.
@@ -16,9 +16,13 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class BaseLocalData {
|
||||
|
||||
public GraphSourceItem lineStartInstruction;
|
||||
}
|
||||
|
||||
@@ -1773,7 +1773,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
r.add(new ArrayList<>());
|
||||
r.add(new ArrayList<>());
|
||||
r.add(new ArrayList<>());
|
||||
((GraphSourceItemContainer) ins).translateContainer(r, stack, output, new HashMap<>(), new HashMap<>(), new HashMap<>());
|
||||
((GraphSourceItemContainer) ins).translateContainer(r, ins, stack, output, new HashMap<>(), new HashMap<>(), new HashMap<>());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1799,7 +1799,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
// for..in return
|
||||
if (((ins instanceof ActionEquals) || (ins instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) {
|
||||
stack.push(new DirectValueActionItem(null, 0, Null.INSTANCE, new ArrayList<>()));
|
||||
stack.push(new DirectValueActionItem(null, null, 0, Null.INSTANCE, new ArrayList<>()));
|
||||
}
|
||||
|
||||
if (ins instanceof ActionConstantPool) {
|
||||
@@ -2383,7 +2383,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
boolean parallel = Configuration.parallelSpeedUp.get();
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
pack.toSource(writer, script.traits.traits, new ConvertData(), ScriptExportMode.AS, parallel);
|
||||
pack.toSource(writer, script == null ? null : script.traits.traits, new ConvertData(), ScriptExportMode.AS, parallel);
|
||||
HighlightedText hilightedCode = new HighlightedText(writer);
|
||||
CachedDecompilation res = new CachedDecompilation(hilightedCode);
|
||||
swf.as3Cache.put(pack, res);
|
||||
@@ -2896,7 +2896,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
if (needed.contains(dep)) {
|
||||
timeline.tags.remove(i);
|
||||
i--;
|
||||
continue;
|
||||
//continue;
|
||||
}
|
||||
}
|
||||
if (t == toRemove) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc;
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.types.ABCException;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConvertException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugFileIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugLineIns;
|
||||
@@ -318,15 +319,22 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
*/
|
||||
public void injectDebugInfo(File directoryPath) {
|
||||
Map<Integer, Map<Integer, Integer>> bodyToPosToLine = new HashMap<>();
|
||||
Map<Integer, Map<Integer, Integer>> bodyLineToPos = new HashMap<>();
|
||||
Map<Integer, Map<Integer, String>> bodyToRegToName = new HashMap<>();
|
||||
Map<Integer, Map<Integer, Integer>> bodyToRegToLine = new HashMap<>();
|
||||
|
||||
Set<Integer> lonelyBody = new HashSet<>();
|
||||
try {
|
||||
CachedDecompilation decompiled = SWF.getCached(this);
|
||||
int line = 1;
|
||||
String txt = decompiled.text;
|
||||
txt = txt.replace("\r", "");
|
||||
|
||||
for (int i = 0; i < txt.length(); i++) {
|
||||
blk:
|
||||
{
|
||||
Highlighting sh = Highlighting.searchPos(decompiled.specialHilights, i);
|
||||
|
||||
Highlighting cls = Highlighting.searchPos(decompiled.classHilights, i);
|
||||
/*if (cls == null) {
|
||||
continue;
|
||||
@@ -339,7 +347,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
if (method == null) {
|
||||
break blk;
|
||||
}
|
||||
Highlighting instr = Highlighting.searchPos(decompiled.instructionHilights, i);
|
||||
Highlighting instr = Highlighting.searchPos(decompiled.instructionHilights, i); //h
|
||||
/*if (instr == null) {
|
||||
continue;
|
||||
}*/
|
||||
@@ -350,8 +358,19 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
break blk;
|
||||
}
|
||||
int pos = -1;
|
||||
int regIndex = -1;
|
||||
String regName = null;
|
||||
if (sh != null && sh.getProperties().declaration && sh.getProperties().regIndex > -1) {
|
||||
regIndex = sh.getProperties().regIndex;
|
||||
regName = sh.getProperties().localName;
|
||||
}
|
||||
if (instr != null) {
|
||||
long instrOffset = instr.getProperties().offset;
|
||||
if (instr.getProperties().declaration && instr.getProperties().regIndex > -1) {
|
||||
regIndex = instr.getProperties().regIndex;
|
||||
regName = instr.getProperties().localName;
|
||||
}
|
||||
|
||||
long instrOffset = instr.getProperties().firstLineOffset;
|
||||
if (trt != null && cls != null) {
|
||||
int traitIndex = (int) trt.getProperties().index;
|
||||
|
||||
@@ -362,6 +381,9 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
}
|
||||
|
||||
if (instrOffset == -1) {
|
||||
break blk;
|
||||
}
|
||||
try {
|
||||
pos = abc.bodies.get(bodyIndex).getCode().adr2pos(instrOffset);
|
||||
} catch (ConvertException cex) {
|
||||
@@ -372,11 +394,25 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
if (!bodyToPosToLine.containsKey(bodyIndex)) {
|
||||
bodyToPosToLine.put(bodyIndex, new HashMap<>());
|
||||
bodyLineToPos.put(bodyIndex, new HashMap<>());
|
||||
}
|
||||
//int origPos = bodyLineToPos.get(bodyIndex).containsKey(line) ? bodyLineToPos.get(bodyIndex).get(line) : -1;
|
||||
|
||||
bodyToPosToLine.get(bodyIndex).put(pos, line);
|
||||
bodyLineToPos.get(bodyIndex).put(line, pos);
|
||||
} else {
|
||||
lonelyBody.add(bodyIndex);
|
||||
}
|
||||
if (regIndex > -1 && regName != null) {
|
||||
if (!bodyToRegToName.containsKey(bodyIndex)) {
|
||||
bodyToRegToName.put(bodyIndex, new HashMap<>());
|
||||
bodyToRegToLine.put(bodyIndex, new HashMap<>());
|
||||
}
|
||||
if (!bodyToRegToName.get(bodyIndex).containsKey(regIndex)) {
|
||||
bodyToRegToName.get(bodyIndex).put(regIndex, regName);
|
||||
bodyToRegToLine.get(bodyIndex).put(regIndex, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (txt.charAt(i) == '\n') {
|
||||
line++;
|
||||
@@ -431,11 +467,20 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
delIns.add(ins);
|
||||
}
|
||||
}
|
||||
int dpos = 0;
|
||||
b.insertInstruction(0, new AVM2Instruction(0, AVM2Instructions.DebugFile, new int[]{abc.constants.getStringId(filename, true)}), true);
|
||||
dpos++;
|
||||
Set<Integer> regs = bodyToRegToName.containsKey(bodyIndex) ? bodyToRegToName.get(bodyIndex).keySet() : new TreeSet<>();
|
||||
for (int r : regs) {
|
||||
String name = bodyToRegToName.get(bodyIndex).get(r);
|
||||
int line = bodyToRegToLine.get(bodyIndex).get(r);
|
||||
b.insertInstruction(dpos++, new AVM2Instruction(0, AVM2Instructions.Debug, new int[]{1, abc.constants.getStringId(name, true), r - 1, line}));
|
||||
}
|
||||
List<Integer> pos = new ArrayList<>(bodyToPosToLine.get(bodyIndex).keySet());
|
||||
Collections.sort(pos);
|
||||
Collections.reverse(pos);
|
||||
Set<Integer> addedLines = new HashSet<>();
|
||||
loopi:
|
||||
for (int i : pos) {
|
||||
int line = bodyToPosToLine.get(bodyIndex).get(i);
|
||||
if (addedLines.contains(line)) {
|
||||
@@ -443,7 +488,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
addedLines.add(line);
|
||||
Logger.getLogger(ScriptPack.class.getName()).log(Level.FINE, "Script " + path + ": Insert debugline(" + line + ") at pos " + i + " to body " + bodyIndex);
|
||||
b.insertInstruction(i, new AVM2Instruction(0, AVM2Instructions.DebugLine, new int[]{line}));
|
||||
b.insertInstruction(i + dpos, new AVM2Instruction(0, AVM2Instructions.DebugLine, new int[]{line}));
|
||||
}
|
||||
//remove old debug instructions
|
||||
for (int i = 0; i < code.size(); i++) {
|
||||
|
||||
@@ -263,6 +263,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ForInAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.PropertyAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference;
|
||||
import com.jpexs.decompiler.flash.abc.types.ABCException;
|
||||
import com.jpexs.decompiler.flash.abc.types.AssignedValue;
|
||||
import com.jpexs.decompiler.flash.abc.types.ConvertData;
|
||||
@@ -965,7 +966,7 @@ public class AVM2Code implements Cloneable {
|
||||
continue loopaddr;
|
||||
}
|
||||
}
|
||||
if (instr instanceof LookupSwitchIns) {
|
||||
if ((instr instanceof LookupSwitchIns) && actualOperands != null) {
|
||||
if (handleJumps) {
|
||||
addresses.add(startOffset + actualOperands[0]);
|
||||
|
||||
@@ -1486,7 +1487,7 @@ public class AVM2Code implements Cloneable {
|
||||
return pos2adr(fixIPAfterDebugLine(adr2pos(addr, true)));
|
||||
}
|
||||
|
||||
public ConvertOutput toSourceOutput(String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, ABC abc, MethodBody body, int start, int end, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, boolean[] visited, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) throws ConvertException, InterruptedException {
|
||||
public ConvertOutput toSourceOutput(Reference<GraphSourceItem> lineStartItem, String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, ABC abc, MethodBody body, int start, int end, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, boolean[] visited, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) throws ConvertException, InterruptedException {
|
||||
calcKilledStats(body);
|
||||
boolean debugMode = DEBUG_MODE;
|
||||
if (debugMode) {
|
||||
@@ -1511,11 +1512,12 @@ public class AVM2Code implements Cloneable {
|
||||
ip++;
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean processTry = processJumps;
|
||||
//addr = pos2adr(ip);
|
||||
int ipfix = fixIPAfterDebugLine(ip);
|
||||
//int ipfix = fixIPAfterDebugLine(ip);
|
||||
//int addrfix = pos2adr(ipfix);
|
||||
int maxend = -1;
|
||||
//int maxend = -1;
|
||||
|
||||
if (ip > end) {
|
||||
break;
|
||||
@@ -1529,8 +1531,13 @@ public class AVM2Code implements Cloneable {
|
||||
//logger.warning(path + ": Code already visited, ofs:" + Helper.formatAddress(pos2adr(ip)) + ", ip:" + ip);
|
||||
break;
|
||||
}
|
||||
|
||||
visited[ip] = true;
|
||||
AVM2Instruction ins = code.get(ip);
|
||||
if (stack.isEmpty()) {
|
||||
lineStartItem.setVal(ins);
|
||||
}
|
||||
|
||||
if (debugMode) {
|
||||
System.err.println("translating ip " + ip + " ins " + ins.toString() + " stack:" + stack.toString() + " scopeStack:" + scopeStack.toString());
|
||||
}
|
||||
@@ -1591,12 +1598,12 @@ public class AVM2Code implements Cloneable {
|
||||
AVM2Instruction insAfter = code.get(ip + 1);
|
||||
if ((insAfter.definition instanceof GetLocalTypeIns) && (((GetLocalTypeIns) insAfter.definition).getRegisterId(insAfter) == ((SetLocalTypeIns) ins.definition).getRegisterId(ins))) {
|
||||
GraphTargetItem before = stack.peek();
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
stack.push(before);
|
||||
ip += 2;
|
||||
continue iploop;
|
||||
} else {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ip++;
|
||||
continue iploop;
|
||||
}
|
||||
@@ -1605,7 +1612,7 @@ public class AVM2Code implements Cloneable {
|
||||
do {
|
||||
AVM2Instruction insAfter = ip + 1 < code.size() ? code.get(ip + 1) : null;
|
||||
if (insAfter == null) {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ip++;
|
||||
break;
|
||||
}
|
||||
@@ -1639,7 +1646,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (((GetLocalTypeIns) code.get(t).definition).getRegisterId(code.get(t)) == reg) {
|
||||
if (code.get(t + 1).definition instanceof KillIns) {
|
||||
if (code.get(t + 1).operands[0] == reg) {
|
||||
ConvertOutput assignment = toSourceOutput(path, part, processJumps, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, abc, body, ip + 2, t - 1, localRegNames, fullyQualifiedNames, visited, localRegAssigmentIps, refs);
|
||||
ConvertOutput assignment = toSourceOutput(lineStartItem, path, part, processJumps, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, abc, body, ip + 2, t - 1, localRegNames, fullyQualifiedNames, visited, localRegAssigmentIps, refs);
|
||||
if (!assignment.output.isEmpty()) {
|
||||
GraphTargetItem tar = assignment.output.remove(assignment.output.size() - 1);
|
||||
tar.firstPart = part;
|
||||
@@ -1669,25 +1676,25 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < dupCnt; i++) {
|
||||
stack.push(new LocalRegAVM2Item(ins, reg, vx));
|
||||
stack.push(new LocalRegAVM2Item(ins, (AVM2Instruction) lineStartItem.getVal(), reg, vx));
|
||||
}
|
||||
stack.push(vx);
|
||||
} else {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
}
|
||||
ip++;
|
||||
break;
|
||||
//}
|
||||
|
||||
} else {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ip++;
|
||||
break;
|
||||
//throw new ConvertException("Unknown pattern after DUP:" + insComparsion.toString());
|
||||
}
|
||||
} while (ins.definition instanceof DupIns);
|
||||
} else if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
//ip = end + 1;
|
||||
break;
|
||||
} else if (ins.definition instanceof NewFunctionIns) {
|
||||
@@ -1723,13 +1730,13 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
}
|
||||
// What to do when hasDup is false?
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
NewFunctionAVM2Item nft = (NewFunctionAVM2Item) stack.peek();
|
||||
nft.functionName = functionName;
|
||||
ip++;
|
||||
} else {
|
||||
try {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
ins.definition.translate(lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, ins, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
|
||||
} catch (RuntimeException re) {
|
||||
/*String last="";
|
||||
int len=5;
|
||||
@@ -1907,7 +1914,7 @@ public class AVM2Code implements Cloneable {
|
||||
|
||||
int regCount = getRegisterCount();
|
||||
for (int i = 0; i < regCount; i++) {
|
||||
localRegs.put(0, new UndefinedAVM2Item(null));
|
||||
localRegs.put(0, new UndefinedAVM2Item(null, null));
|
||||
}
|
||||
|
||||
//try {
|
||||
@@ -2717,7 +2724,7 @@ public class AVM2Code implements Cloneable {
|
||||
public void restoreControlFlow(int ip, HashMap<Integer, List<Integer>> refs, int[] visited2, HashMap<Integer, List<Object>> appended) throws ConvertException {
|
||||
List<Object> buf = new ArrayList<>();
|
||||
boolean cont = false;
|
||||
int continueip = 0;
|
||||
int continueip;
|
||||
for (; ip < code.size(); ip++) {
|
||||
AVM2Instruction ins = code.get(ip);
|
||||
|
||||
@@ -2736,7 +2743,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (cont) {
|
||||
buf.add(new ControlFlowTag("appendjump", ip));
|
||||
}
|
||||
cont = false;
|
||||
//cont = false;
|
||||
restoreControlFlow(adr2pos(pos2adr(ip) + ins.operands[0]), refs, visited2, appended);
|
||||
for (int i = 2; i < ins.operands.length; i++) {
|
||||
restoreControlFlow(adr2pos(pos2adr(ip) + ins.operands[i]), refs, visited2, appended);
|
||||
@@ -3224,7 +3231,7 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
|
||||
if (ins.definition instanceof NewFunctionIns) {
|
||||
stack.push(new BooleanAVM2Item(null, true));
|
||||
stack.push(new BooleanAVM2Item(null, null, true));
|
||||
} else {
|
||||
localData.ip = ip;
|
||||
ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, path);
|
||||
@@ -3237,7 +3244,7 @@ public class AVM2Code implements Cloneable {
|
||||
HashMap<Integer, GraphTargetItem> registers = localData.localRegs;
|
||||
GraphTargetItem regVal = registers.get(regId);
|
||||
if (regVal.isCompileTime()) {
|
||||
registers.put(regId, new NotCompileTimeItem(null, regVal));
|
||||
registers.put(regId, new NotCompileTimeItem(null, null, regVal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class AVM2DeobfuscatorGetSet implements SWFDecompilerListener {
|
||||
|
||||
private static final UndefinedAVM2Item UNDEFINED_ITEM = new UndefinedAVM2Item(null);
|
||||
private static final UndefinedAVM2Item UNDEFINED_ITEM = new UndefinedAVM2Item(null, null);
|
||||
|
||||
private static final NotCompileTimeItem NOT_COMPILE_TIME_UNDEFINED_ITEM = new NotCompileTimeItem(null, UNDEFINED_ITEM);
|
||||
private static final NotCompileTimeItem NOT_COMPILE_TIME_UNDEFINED_ITEM = new NotCompileTimeItem(null, null, UNDEFINED_ITEM);
|
||||
|
||||
private final int executionLimit = 30000;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class AVM2DeobfuscatorGetSet implements SWFDecompilerListener {
|
||||
Map<Integer, GraphTargetItem> staticRegs = new HashMap<>();
|
||||
for (AVM2Instruction ins : inlineIns) {
|
||||
if (ins.definition instanceof GetLocalTypeIns) {
|
||||
staticRegs.put(((GetLocalTypeIns) ins.definition).getRegisterId(ins), new UndefinedAVM2Item(ins));
|
||||
staticRegs.put(((GetLocalTypeIns) ins.definition).getRegisterId(ins), new UndefinedAVM2Item(ins, null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
List<GraphTargetItem> output = new ArrayList<>();
|
||||
AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex);
|
||||
initLocalRegs(localData, body.getLocalReservedCount(), body.max_regs);
|
||||
localData.localRegs.put(0, new NullAVM2Item(null)); // this
|
||||
localData.localRegs.put(0, new NullAVM2Item(null, null)); // this
|
||||
|
||||
List<Integer> toVisit = new ArrayList<>();
|
||||
toVisit.add(idx);
|
||||
|
||||
@@ -102,9 +102,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
|
||||
|
||||
private static final UndefinedAVM2Item UNDEFINED_ITEM = new UndefinedAVM2Item(null);
|
||||
private static final UndefinedAVM2Item UNDEFINED_ITEM = new UndefinedAVM2Item(null, null);
|
||||
|
||||
private static final NotCompileTimeItem NOT_COMPILE_TIME_UNDEFINED_ITEM = new NotCompileTimeItem(null, UNDEFINED_ITEM);
|
||||
private static final NotCompileTimeItem NOT_COMPILE_TIME_UNDEFINED_ITEM = new NotCompileTimeItem(null, null, UNDEFINED_ITEM);
|
||||
|
||||
private final int executionLimit = 30000;
|
||||
|
||||
@@ -178,7 +178,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
|
||||
Map<Integer, GraphTargetItem> staticRegs = new HashMap<>();
|
||||
for (AVM2Instruction ins : inlineIns) {
|
||||
if (ins.definition instanceof GetLocalTypeIns) {
|
||||
staticRegs.put(((GetLocalTypeIns) ins.definition).getRegisterId(ins), new UndefinedAVM2Item(ins));
|
||||
staticRegs.put(((GetLocalTypeIns) ins.definition).getRegisterId(ins), new UndefinedAVM2Item(ins, null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
for (GraphPart p : allBlocks) {
|
||||
if (avm2code.pos2adr(p.start) >= ex.start && avm2code.pos2adr(p.end) <= ex.end) {
|
||||
if (avm2code.pos2adr(p.start) >= ex.start && avm2code.pos2adr(p.end) <= ex.end && target != null) {
|
||||
p.throwParts.add(target);
|
||||
target.refs.add(p);
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public class AVM2Graph extends Graph {
|
||||
List<GraphTargetItem> finallyCommands = new ArrayList<>();
|
||||
boolean hasFinally = false;
|
||||
int returnPos = afterCatchPos;
|
||||
int finStart = -1;
|
||||
int finStart;
|
||||
for (int e = 0; e < body.exceptions.length; e++) {
|
||||
if (body.exceptions[e].isFinally()) {
|
||||
if (addr == avm2code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
|
||||
@@ -281,7 +281,7 @@ public class AVM2Graph extends Graph {
|
||||
Map<Integer, List<Integer>> oldFinallyJumps = new HashMap<>(finallyJumps);
|
||||
finallyJumps.clear();
|
||||
ignoredSwitches.put(e, swPos);
|
||||
st.push(new PopItem(null));
|
||||
st.push(new PopItem(null, aLocalData.lineStartInstruction));
|
||||
finallyCommands = printGraph(partCodes, partCodePos, localData, st, allParts, parent, fpart, null, loops, staticOperation, path);
|
||||
//ignoredSwitches.remove(igs_size-1);
|
||||
finallyJumps.putAll(oldFinallyJumps);
|
||||
@@ -434,7 +434,8 @@ public class AVM2Graph extends Graph {
|
||||
ret = new ArrayList<>();
|
||||
ret.addAll(output);
|
||||
ret.remove(ret.size() - 1);
|
||||
ret.add(new ReturnValueAVM2Item(avm2code.code.get(part.end), ((SetLocalAVM2Item) output.get(output.size() - 2)).value));
|
||||
GraphTargetItem v = ((SetLocalAVM2Item) output.get(output.size() - 2)).value;
|
||||
ret.add(new ReturnValueAVM2Item(avm2code.code.get(part.end), (AVM2Instruction) v.getLineStartItem(), v));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -448,208 +449,6 @@ public class AVM2Graph extends Graph {
|
||||
ret.addAll(output);
|
||||
return ret;
|
||||
}
|
||||
if (false && (((part.nextParts.size() == 2)
|
||||
&& (!stack.isEmpty())
|
||||
&& (stack.peek() instanceof StrictEqAVM2Item)
|
||||
&& (part.nextParts.get(0).getHeight() >= 2)
|
||||
&& (avm2code.code.get(avm2code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)
|
||||
&& (!part.nextParts.get(0).nextParts.isEmpty())
|
||||
&& (avm2code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns))
|
||||
|| ((part.nextParts.size() == 2)
|
||||
&& (!stack.isEmpty())
|
||||
&& (stack.peek() instanceof StrictNeqAVM2Item)
|
||||
&& (part.nextParts.get(1).getHeight() >= 2)
|
||||
&& (avm2code.code.get(avm2code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)
|
||||
&& (!part.nextParts.get(1).nextParts.isEmpty())
|
||||
&& (avm2code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns)))) {
|
||||
|
||||
if (stack.peek() instanceof StrictEqAVM2Item) {
|
||||
ignoredSwitches2.add(part.nextParts.get(0).nextParts.get(0).end);
|
||||
} else {
|
||||
ignoredSwitches2.add(part.nextParts.get(1).nextParts.get(0).end);
|
||||
}
|
||||
ret = new ArrayList<>();
|
||||
ret.addAll(output);
|
||||
boolean reversed = false;
|
||||
if (stack.peek() instanceof StrictEqAVM2Item) {
|
||||
reversed = true;
|
||||
}
|
||||
GraphTargetItem switchedObject = null;
|
||||
if (!output.isEmpty()) {
|
||||
if (output.get(output.size() - 1) instanceof SetLocalAVM2Item) {
|
||||
switchedObject = ((SetLocalAVM2Item) output.get(output.size() - 1)).value;
|
||||
}
|
||||
}
|
||||
if (switchedObject == null) {
|
||||
switchedObject = new NullAVM2Item(null);
|
||||
}
|
||||
HashMap<Integer, GraphTargetItem> caseValuesMap = new HashMap<>();
|
||||
|
||||
GraphTargetItem tar = stack.pop();
|
||||
if (tar instanceof StrictEqAVM2Item) {
|
||||
tar = ((StrictEqAVM2Item) tar).leftSide;
|
||||
}
|
||||
if (tar instanceof StrictNeqAVM2Item) {
|
||||
tar = ((StrictNeqAVM2Item) tar).leftSide;
|
||||
}
|
||||
caseValuesMap.put(avm2code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], tar);
|
||||
|
||||
GraphPart switchLoc = part.nextParts.get(reversed ? 0 : 1).nextParts.get(0);
|
||||
|
||||
while ((avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns)
|
||||
|| (avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) {
|
||||
part = part.nextParts.get(reversed ? 1 : 0);
|
||||
translatePart(localData, part, stack, staticOperation, null);
|
||||
tar = stack.pop();
|
||||
if (tar instanceof StrictEqAVM2Item) {
|
||||
tar = ((StrictEqAVM2Item) tar).leftSide;
|
||||
}
|
||||
if (tar instanceof StrictNeqAVM2Item) {
|
||||
tar = ((StrictNeqAVM2Item) tar).leftSide;
|
||||
}
|
||||
if (avm2code.code.get(part.end).definition instanceof IfStrictNeIns) {
|
||||
reversed = false;
|
||||
} else {
|
||||
reversed = true;
|
||||
}
|
||||
GraphPart numPart = part.nextParts.get(reversed ? 0 : 1);
|
||||
AVM2Instruction ins = null;
|
||||
TranslateStack sstack = new TranslateStack(path);
|
||||
do {
|
||||
for (int n = 0; n < numPart.getHeight(); n++) {
|
||||
ins = avm2code.code.get(numPart.getPosAt(n));
|
||||
if (ins.definition instanceof LookupSwitchIns) {
|
||||
break;
|
||||
}
|
||||
ins.translate(localData, sstack, new ArrayList<>(), staticOperation, path);
|
||||
}
|
||||
if (numPart.nextParts.size() > 1) {
|
||||
break;
|
||||
} else {
|
||||
numPart = numPart.nextParts.get(0);
|
||||
}
|
||||
} while (!(avm2code.code.get(numPart.end).definition instanceof LookupSwitchIns));
|
||||
GraphTargetItem nt = sstack.peek();
|
||||
|
||||
if (!(nt instanceof IntegerValueAVM2Item)) {
|
||||
throw new RuntimeException("Invalid integer value in Switch:" + nt);
|
||||
}
|
||||
IntegerValueAVM2Item iv = (IntegerValueAVM2Item) nt;
|
||||
caseValuesMap.put((int) (long) iv.value, tar);
|
||||
while (avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).start).definition instanceof JumpIns) {
|
||||
reversed = false;
|
||||
part = part.nextParts.get(reversed ? 1 : 0);
|
||||
if (part instanceof GraphPartMulti) {
|
||||
part = ((GraphPartMulti) part).parts.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean hasDefault = false;
|
||||
GraphPart dp = part.nextParts.get(reversed ? 1 : 0);
|
||||
while (avm2code.code.get(dp.start).definition instanceof JumpIns) {
|
||||
if (dp instanceof GraphPartMulti) {
|
||||
dp = ((GraphPartMulti) dp).parts.get(0);
|
||||
}
|
||||
dp = dp.nextParts.get(0);
|
||||
}
|
||||
|
||||
GraphPart numPart = dp;
|
||||
AVM2Instruction ins = null;
|
||||
TranslateStack sstack = new TranslateStack(path);
|
||||
do {
|
||||
for (int n = 0; n < numPart.getHeight(); n++) {
|
||||
ins = avm2code.code.get(numPart.getPosAt(n));
|
||||
if (ins.definition instanceof LookupSwitchIns) {
|
||||
break;
|
||||
}
|
||||
ins.translate(localData, sstack, new ArrayList<>(), staticOperation, path);
|
||||
}
|
||||
if (numPart.nextParts.size() > 1) {
|
||||
break;
|
||||
} else {
|
||||
numPart = numPart.nextParts.get(0);
|
||||
}
|
||||
} while (!(avm2code.code.get(numPart.end).definition instanceof LookupSwitchIns));
|
||||
GraphTargetItem nt = sstack.peek();
|
||||
if (nt instanceof IntegerValueAVM2Item) {
|
||||
hasDefault = true;
|
||||
}
|
||||
List<GraphTargetItem> caseValues = new ArrayList<>();
|
||||
for (int i = 0; i < switchLoc.nextParts.size() - 1; i++) {
|
||||
if (caseValuesMap.containsKey(i)) {
|
||||
caseValues.add(caseValuesMap.get(i));
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
List<List<GraphTargetItem>> caseCommands = new ArrayList<>();
|
||||
GraphPart next = null;
|
||||
|
||||
next = getMostCommonPart(localData, switchLoc.nextParts, loops);//getNextPartPath(loopContinues);
|
||||
currentLoop = new Loop(loops.size(), null, next);
|
||||
currentLoop.phase = 1;
|
||||
loops.add(currentLoop);
|
||||
//switchLoc.getNextPartPath(new ArrayList<GraphPart>());
|
||||
List<Integer> valuesMapping = new ArrayList<>();
|
||||
List<GraphPart> caseBodies = new ArrayList<>();
|
||||
for (int i = 0; i < caseValues.size(); i++) {
|
||||
GraphPart cur = switchLoc.nextParts.get(1 + i);
|
||||
if (!caseBodies.contains(cur)) {
|
||||
caseBodies.add(cur);
|
||||
}
|
||||
valuesMapping.add(caseBodies.indexOf(cur));
|
||||
}
|
||||
|
||||
List<GraphTargetItem> defaultCommands = new ArrayList<>();
|
||||
GraphPart defaultPart = null;
|
||||
if (hasDefault) {
|
||||
defaultPart = switchLoc.nextParts.get(switchLoc.nextParts.size() - 1);
|
||||
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
|
||||
stopPart2.add(next);
|
||||
defaultCommands = printGraph(partCodes, partCodePos, localData, stack, allParts, switchLoc, defaultPart, stopPart2, loops, staticOperation, path);
|
||||
if (!defaultCommands.isEmpty()) {
|
||||
if (defaultCommands.get(defaultCommands.size() - 1) instanceof BreakItem) {
|
||||
if (((BreakItem) defaultCommands.get(defaultCommands.size() - 1)).loopId == currentLoop.id) {
|
||||
defaultCommands.remove(defaultCommands.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<GraphPart> ignored = new ArrayList<>();
|
||||
for (Loop l : loops) {
|
||||
ignored.add(l.loopContinue);
|
||||
}
|
||||
|
||||
for (int i = 0; i < caseBodies.size(); i++) {
|
||||
List<GraphTargetItem> cc = new ArrayList<>();
|
||||
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
|
||||
for (int j = 0; j < caseBodies.size(); j++) {
|
||||
if (caseBodies.get(j) != caseBodies.get(i)) {
|
||||
stopPart2.add(caseBodies.get(j));
|
||||
}
|
||||
}
|
||||
if (hasDefault) {
|
||||
stopPart2.add(defaultPart);
|
||||
}
|
||||
|
||||
cc.addAll(0, printGraph(partCodes, partCodePos, localData, stack, allParts, switchLoc, caseBodies.get(i), stopPart2, loops, staticOperation, path));
|
||||
caseCommands.add(cc);
|
||||
}
|
||||
|
||||
SwitchItem sti = new SwitchItem(null, currentLoop, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping);
|
||||
ret.add(sti);
|
||||
//loops.remove(currentLoop);
|
||||
if (next != null) {
|
||||
/*if (ti != null) {
|
||||
ret.add(ti);
|
||||
} else {*/
|
||||
currentLoop.phase = 2;
|
||||
ret.addAll(printGraph(partCodes, partCodePos, localData, stack, allParts, null, next, stopPart, loops, staticOperation, path));
|
||||
//}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -754,7 +553,7 @@ public class AVM2Graph extends Graph {
|
||||
int regIndex = ((LocalRegAVM2Item) spt.object).regIndex;
|
||||
HasNextAVM2Item iti = (HasNextAVM2Item) w.expression.get(w.expression.size() - 1);
|
||||
HashMap<Integer, GraphTargetItem> localRegs = aLocalData.localRegs;
|
||||
localRegs.put(regIndex, new FilterAVM2Item(null, iti.collection.getThroughRegister(), ift.expression));
|
||||
localRegs.put(regIndex, new FilterAVM2Item(null, null, iti.collection.getThroughRegister(), ift.expression));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -767,9 +566,9 @@ public class AVM2Graph extends Graph {
|
||||
SetTypeAVM2Item sti = (SetTypeAVM2Item) w.commands.remove(0);
|
||||
GraphTargetItem gti = sti.getValue().getNotCoerced();
|
||||
if (gti instanceof NextValueAVM2Item) {
|
||||
return new ForEachInAVM2Item(w.getSrc(), w.loop, new InAVM2Item(hn.getInstruction(), sti.getObject(), ((HasNextAVM2Item) w.expression.get(w.expression.size() - 1)).collection), w.commands);
|
||||
return new ForEachInAVM2Item(w.getSrc(), w.getLineStartItem(), w.loop, new InAVM2Item(hn.getInstruction(), hn.getLineStartIns(), sti.getObject(), ((HasNextAVM2Item) w.expression.get(w.expression.size() - 1)).collection), w.commands);
|
||||
} else if (gti instanceof NextNameAVM2Item) {
|
||||
return new ForInAVM2Item(w.getSrc(), w.loop, new InAVM2Item(hn.getInstruction(), sti.getObject(), ((HasNextAVM2Item) w.expression.get(w.expression.size() - 1)).collection), w.commands);
|
||||
return new ForInAVM2Item(w.getSrc(), w.getLineStartItem(), w.loop, new InAVM2Item(hn.getInstruction(), hn.getLineStartIns(), sti.getObject(), ((HasNextAVM2Item) w.expression.get(w.expression.size() - 1)).collection), w.commands);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -845,7 +644,7 @@ public class AVM2Graph extends Graph {
|
||||
ThrowAVM2Item t = (ThrowAVM2Item) list.get(i + 2);
|
||||
t.value = ri.value;
|
||||
list.remove(i + 1);
|
||||
continue;
|
||||
//continue;
|
||||
}
|
||||
} else if (i + 1 < list.size()) {
|
||||
if (list.get(i + 1) instanceof IntegerValueAVM2Item) {
|
||||
@@ -874,9 +673,9 @@ public class AVM2Graph extends Graph {
|
||||
if (((ifi.expression instanceof HasNextAVM2Item)
|
||||
|| ((ifi.expression instanceof NotItem)
|
||||
&& (((NotItem) ifi.expression).getOriginal() instanceof HasNextAVM2Item)))) {
|
||||
HasNextAVM2Item hnt = null;
|
||||
HasNextAVM2Item hnt;
|
||||
List<GraphTargetItem> body = new ArrayList<>();
|
||||
List<GraphTargetItem> nextbody = new ArrayList<>();
|
||||
List<GraphTargetItem> nextbody;//= new ArrayList<>();
|
||||
if (ifi.expression instanceof NotItem) {
|
||||
hnt = (HasNextAVM2Item) ((NotItem) ifi.expression).getOriginal();
|
||||
body.addAll(ifi.onFalse);
|
||||
@@ -896,9 +695,9 @@ public class AVM2Graph extends Graph {
|
||||
GraphTargetItem repl = null;
|
||||
|
||||
if (gti instanceof NextValueAVM2Item) {
|
||||
repl = new ForEachInAVM2Item(ifi.getSrc(), new Loop(0, null, null), new InAVM2Item(null, sti.getObject(), hnt.collection), body);
|
||||
repl = new ForEachInAVM2Item(ifi.getSrc(), ifi.getLineStartItem(), new Loop(0, null, null), new InAVM2Item(null, null, sti.getObject(), hnt.collection), body);
|
||||
} else if (gti instanceof NextNameAVM2Item) {
|
||||
repl = new ForInAVM2Item(ifi.getSrc(), new Loop(0, null, null), new InAVM2Item(null, sti.getObject(), hnt.collection), body);
|
||||
repl = new ForInAVM2Item(ifi.getSrc(), ifi.getLineStartItem(), new Loop(0, null, null), new InAVM2Item(null, null, sti.getObject(), hnt.collection), body);
|
||||
}
|
||||
if (repl != null) {
|
||||
list.remove(i);
|
||||
|
||||
@@ -22,10 +22,12 @@ import com.jpexs.decompiler.flash.abc.AVM2LocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConvertOutput;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphPart;
|
||||
import com.jpexs.decompiler.graph.GraphSource;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -102,7 +104,9 @@ public class AVM2GraphSource extends GraphSource {
|
||||
public List<GraphTargetItem> translatePart(GraphPart part, BaseLocalData localData, TranslateStack stack, int start, int end, int staticOperation, String path) throws InterruptedException {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
ScopeStack newstack = ((AVM2LocalData) localData).scopeStack;
|
||||
ConvertOutput co = code.toSourceOutput(path, part, false, isStatic, scriptIndex, classIndex, localRegs, stack, newstack, abc, body, start, end, localRegNames, fullyQualifiedNames, new boolean[size()], localRegAssigmentIps, refs);
|
||||
Reference<GraphSourceItem> lineStartItem = new Reference<>(localData.lineStartInstruction);
|
||||
ConvertOutput co = code.toSourceOutput(lineStartItem, path, part, false, isStatic, scriptIndex, classIndex, localRegs, stack, newstack, abc, body, start, end, localRegNames, fullyQualifiedNames, new boolean[size()], localRegAssigmentIps, refs);
|
||||
localData.lineStartInstruction = lineStartItem.getVal();
|
||||
ret.addAll(co.output);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.HashMap;
|
||||
|
||||
public interface IfTypeIns {
|
||||
|
||||
public abstract void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins);
|
||||
public abstract void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,11 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.IncLocalIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.SetLocalTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
@@ -134,11 +136,12 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) throws InterruptedException {
|
||||
}
|
||||
|
||||
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2Instruction ins, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
|
||||
public void translate(Reference<GraphSourceItem> lineStartItem, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2Instruction ins, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
|
||||
AVM2LocalData localData = new AVM2LocalData();
|
||||
localData.isStatic = isStatic;
|
||||
localData.scriptIndex = scriptIndex;
|
||||
localData.classIndex = classIndex;
|
||||
localData.lineStartInstruction = lineStartItem.getVal();
|
||||
localData.localRegs = localRegs;
|
||||
localData.scopeStack = scopeStack;
|
||||
localData.methodBody = body;
|
||||
@@ -150,6 +153,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
localData.refs = refs;
|
||||
localData.code = code;
|
||||
translate(localData, stack, ins, output, path);
|
||||
lineStartItem.setVal(localData.lineStartInstruction);
|
||||
}
|
||||
|
||||
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
|
||||
@@ -160,7 +164,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected FullMultinameAVM2Item resolveMultiname(boolean property, TranslateStack stack, AVM2ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
|
||||
protected FullMultinameAVM2Item resolveMultiname(AVM2LocalData localData, boolean property, TranslateStack stack, AVM2ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
|
||||
GraphTargetItem ns = null;
|
||||
GraphTargetItem name = null;
|
||||
if (multinameIndex > 0 && multinameIndex < constants.getMultinameCount()) {
|
||||
@@ -172,7 +176,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
}
|
||||
|
||||
}
|
||||
return new FullMultinameAVM2Item(property, ins, multinameIndex, name, ns);
|
||||
return new FullMultinameAVM2Item(property, ins, localData.lineStartInstruction, multinameIndex, name, ns);
|
||||
}
|
||||
|
||||
protected int getMultinameRequiredStackSize(AVM2ConstantPool constants, int multinameIndex) {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Lf32Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, ofs, 'f', 32));
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, localData.lineStartInstruction, ofs, 'f', 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Lf64Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, ofs, 'f', 64));
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, localData.lineStartInstruction, ofs, 'f', 64));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Li16Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, ofs, 'i', 16));
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, localData.lineStartInstruction, ofs, 'i', 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Li32Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, ofs, 'i', 32));
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, localData.lineStartInstruction, ofs, 'i', 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Li8Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, ofs, 'i', 8));
|
||||
stack.push(new AlchemyLoadAVM2Item(ins, localData.lineStartInstruction, ofs, 'i', 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Sf32Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
GraphTargetItem value = stack.pop();
|
||||
output.add(new AlchemyStoreAVM2Item(ins, value, ofs, 'f', 32));
|
||||
output.add(new AlchemyStoreAVM2Item(ins, localData.lineStartInstruction, value, ofs, 'f', 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Sf64Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
GraphTargetItem value = stack.pop();
|
||||
output.add(new AlchemyStoreAVM2Item(ins, value, ofs, 'f', 64));
|
||||
output.add(new AlchemyStoreAVM2Item(ins, localData.lineStartInstruction, value, ofs, 'f', 64));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Si16Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
GraphTargetItem value = stack.pop();
|
||||
output.add(new AlchemyStoreAVM2Item(ins, value, ofs, 'i', 16));
|
||||
output.add(new AlchemyStoreAVM2Item(ins, localData.lineStartInstruction, value, ofs, 'i', 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Si32Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
GraphTargetItem value = stack.pop();
|
||||
output.add(new AlchemyStoreAVM2Item(ins, value, ofs, 'i', 32));
|
||||
output.add(new AlchemyStoreAVM2Item(ins, localData.lineStartInstruction, value, ofs, 'i', 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Si8Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem ofs = stack.pop();
|
||||
GraphTargetItem value = stack.pop();
|
||||
output.add(new AlchemyStoreAVM2Item(ins, value, ofs, 'i', 8));
|
||||
output.add(new AlchemyStoreAVM2Item(ins, localData.lineStartInstruction, value, ofs, 'i', 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Sxi16Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem value = stack.pop();
|
||||
stack.push(new AlchemySignExtendAVM2Item(ins, value, 16));
|
||||
stack.push(new AlchemySignExtendAVM2Item(ins, localData.lineStartInstruction, value, 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Sxi1Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem value = stack.pop();
|
||||
stack.push(new AlchemySignExtendAVM2Item(ins, value, 1));
|
||||
stack.push(new AlchemySignExtendAVM2Item(ins, localData.lineStartInstruction, value, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Sxi8Ins extends InstructionDefinition implements AlchemyTypeIns {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem value = stack.pop();
|
||||
stack.push(new AlchemySignExtendAVM2Item(ins, value, 8));
|
||||
stack.push(new AlchemySignExtendAVM2Item(ins, localData.lineStartInstruction, value, 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AddIIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new AddAVM2Item(ins, v1, v2));
|
||||
stack.push(new AddAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public class AddIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new AddAVM2Item(ins, v1, v2));
|
||||
stack.push(new AddAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DecrementIIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new DecrementAVM2Item(ins, stack.pop()));
|
||||
stack.push(new DecrementAVM2Item(ins, localData.lineStartInstruction, stack.pop()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DecrementIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new DecrementAVM2Item(ins, stack.pop()));
|
||||
stack.push(new DecrementAVM2Item(ins, localData.lineStartInstruction, stack.pop()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DivideIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new DivideAVM2Item(ins, v1, v2));
|
||||
stack.push(new DivideAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class IncrementIIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new IncrementAVM2Item(ins, stack.pop()));
|
||||
stack.push(new IncrementAVM2Item(ins, localData.lineStartInstruction, stack.pop()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class IncrementIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new IncrementAVM2Item(ins, stack.pop()));
|
||||
stack.push(new IncrementAVM2Item(ins, localData.lineStartInstruction, stack.pop()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ModuloIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new ModuloAVM2Item(ins, v1, v2));
|
||||
stack.push(new ModuloAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MultiplyIIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new MultiplyAVM2Item(ins, v1, v2));
|
||||
stack.push(new MultiplyAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MultiplyIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new MultiplyAVM2Item(ins, v1, v2));
|
||||
stack.push(new MultiplyAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class NegateIIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v = stack.pop();
|
||||
stack.push(new NegAVM2Item(ins, v));
|
||||
stack.push(new NegAVM2Item(ins, localData.lineStartInstruction, v));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class NegateIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v = stack.pop();
|
||||
stack.push(new NegAVM2Item(ins, v));
|
||||
stack.push(new NegAVM2Item(ins, localData.lineStartInstruction, v));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SubtractIIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new SubtractAVM2Item(ins, v1, v2));
|
||||
stack.push(new SubtractAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SubtractIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new SubtractAVM2Item(ins, v1, v2));
|
||||
stack.push(new SubtractAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BitAndIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new BitAndAVM2Item(ins, v1, v2));
|
||||
stack.push(new BitAndAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BitNotIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v = stack.pop();
|
||||
stack.push(new BitNotAVM2Item(ins, v));
|
||||
stack.push(new BitNotAVM2Item(ins, localData.lineStartInstruction, v));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BitOrIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new BitOrAVM2Item(ins, v1, v2));
|
||||
stack.push(new BitOrAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BitXorIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new BitXorAVM2Item(ins, v1, v2));
|
||||
stack.push(new BitXorAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class LShiftIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LShiftAVM2Item(ins, v1, v2));
|
||||
stack.push(new LShiftAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RShiftIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new RShiftAVM2Item(ins, v1, v2));
|
||||
stack.push(new RShiftAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class URShiftIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new URShiftAVM2Item(ins, v1, v2));
|
||||
stack.push(new URShiftAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class EqualsIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new EqAVM2Item(ins, v1, v2));
|
||||
stack.push(new EqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GreaterEqualsIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GeAVM2Item(ins, v1, v2));
|
||||
stack.push(new GeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GreaterThanIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GtAVM2Item(ins, v1, v2));
|
||||
stack.push(new GtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LessEqualsIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LeAVM2Item(ins, v1, v2));
|
||||
stack.push(new LeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LessThanIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LtAVM2Item(ins, v1, v2));
|
||||
stack.push(new LtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class StrictEqualsIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new StrictEqAVM2Item(ins, v1, v2));
|
||||
stack.push(new StrictEqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -104,13 +104,13 @@ public class ConstructIns extends InstructionDefinition {
|
||||
GraphTargetItem arg = args.get(0);
|
||||
List<GraphTargetItem> xmlLines = new ArrayList<>();
|
||||
if (walkXML(arg, xmlLines)) {
|
||||
stack.push(new XMLAVM2Item(ins, xmlLines));
|
||||
stack.push(new XMLAVM2Item(ins, localData.lineStartInstruction, xmlLines));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack.push(new ConstructAVM2Item(ins, obj, args));
|
||||
stack.push(new ConstructAVM2Item(ins, localData.lineStartInstruction, obj, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ConstructPropIns extends InstructionDefinition {
|
||||
for (int a = 0; a < argCount; a++) {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem obj = stack.pop();
|
||||
if (obj instanceof FindPropertyAVM2Item) {
|
||||
multiname.property = false; //can be type
|
||||
@@ -73,13 +73,13 @@ public class ConstructPropIns extends InstructionDefinition {
|
||||
GraphTargetItem arg = args.get(0);
|
||||
List<GraphTargetItem> xmlLines = new ArrayList<>();
|
||||
if (ConstructIns.walkXML(arg, xmlLines)) {
|
||||
stack.push(new XMLAVM2Item(ins, xmlLines));
|
||||
stack.push(new XMLAVM2Item(ins, localData.lineStartInstruction, xmlLines));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack.push(new ConstructPropAVM2Item(ins, obj, multiname, args));
|
||||
stack.push(new ConstructPropAVM2Item(ins, localData.lineStartInstruction, obj, multiname, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ConstructSuperIns extends InstructionDefinition {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
GraphTargetItem obj = stack.pop();
|
||||
output.add(new ConstructSuperAVM2Item(ins, obj, args));
|
||||
output.add(new ConstructSuperAVM2Item(ins, localData.lineStartInstruction, obj, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,7 +33,7 @@ public class NewActivationIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new NewActivationAVM2Item(ins));
|
||||
stack.push(new NewActivationAVM2Item(ins, localData.lineStartInstruction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,12 +43,12 @@ public class NewArrayIns extends InstructionDefinition {
|
||||
GraphTargetItem item = stack.pop();
|
||||
//No PopItems in this loop, since some obfuscators put there large numbers
|
||||
if (item instanceof PopItem) {
|
||||
stack.push(new NullAVM2Item(ins));
|
||||
stack.push(new NullAVM2Item(ins, localData.lineStartInstruction));
|
||||
return;
|
||||
}
|
||||
args.add(0, item);
|
||||
}
|
||||
stack.push(new NewArrayAVM2Item(ins, args));
|
||||
stack.push(new NewArrayAVM2Item(ins, localData.lineStartInstruction, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class NewClassIns extends InstructionDefinition {
|
||||
stack.pop().toString(writer, LocalData.create(localData.getConstants(), localData.localRegNames, localData.fullyQualifiedNames));
|
||||
String baseType = writer.toString();
|
||||
ABC abc = localData.abc;
|
||||
stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(localData.getConstants(), localData.fullyQualifiedNames, false) + ".class extends " + baseType));
|
||||
stack.push(new UnparsedAVM2Item(ins, localData.lineStartInstruction, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(localData.getConstants(), localData.fullyQualifiedNames, false) + ".class extends " + baseType));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class NewFunctionIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int methodIndex = ins.operands[0];
|
||||
NewFunctionAVM2Item function = new NewFunctionAVM2Item(ins, "", path, localData.isStatic, localData.scriptIndex, localData.classIndex, localData.abc, localData.fullyQualifiedNames, methodIndex);
|
||||
NewFunctionAVM2Item function = new NewFunctionAVM2Item(ins, localData.lineStartInstruction, "", path, localData.isStatic, localData.scriptIndex, localData.classIndex, localData.abc, localData.fullyQualifiedNames, methodIndex);
|
||||
stack.push(function);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,17 +44,17 @@ public class NewObjectIns extends InstructionDefinition {
|
||||
//No PopItems in this loop, since some obfuscators put there large numbers
|
||||
GraphTargetItem value = stack.pop();
|
||||
if (value instanceof PopItem) {
|
||||
stack.push(new NullAVM2Item(ins));
|
||||
stack.push(new NullAVM2Item(ins, localData.lineStartInstruction));
|
||||
return;
|
||||
}
|
||||
GraphTargetItem name = stack.pop();
|
||||
if (value instanceof PopItem) {
|
||||
stack.push(new NullAVM2Item(ins));
|
||||
stack.push(new NullAVM2Item(ins, localData.lineStartInstruction));
|
||||
return;
|
||||
}
|
||||
args.add(0, new NameValuePair(name, value));
|
||||
}
|
||||
stack.push(new NewObjectAVM2Item(ins, args));
|
||||
stack.push(new NewObjectAVM2Item(ins, localData.lineStartInstruction, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,7 +58,7 @@ public class CallIns extends InstructionDefinition {
|
||||
}
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
GraphTargetItem function = stack.pop();
|
||||
stack.push(new CallAVM2Item(ins, receiver, function, args));
|
||||
stack.push(new CallAVM2Item(ins, localData.lineStartInstruction, receiver, function, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CallMethodIns extends InstructionDefinition {
|
||||
}
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
String methodName = localData.getMethodInfo().get(methodIndex).getName(localData.getConstants());
|
||||
stack.push(new CallMethodAVM2Item(ins, receiver, methodName, args));
|
||||
stack.push(new CallMethodAVM2Item(ins, localData.lineStartInstruction, receiver, methodName, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,10 +42,10 @@ public class CallPropLexIns extends CallPropertyIns {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
|
||||
stack.push(new CallPropertyAVM2Item(ins, false, receiver, multiname, args));
|
||||
stack.push(new CallPropertyAVM2Item(ins, localData.lineStartInstruction, false, receiver, multiname, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,11 +62,11 @@ public class CallPropVoidIns extends InstructionDefinition {
|
||||
for (int a = 0; a < argCount; a++) {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
|
||||
output.add(new CallPropertyAVM2Item(ins, true, receiver, multiname, args));
|
||||
output.add(new CallPropertyAVM2Item(ins, localData.lineStartInstruction, true, receiver, multiname, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,10 +61,10 @@ public class CallPropertyIns extends InstructionDefinition {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
|
||||
stack.push(new CallPropertyAVM2Item(ins, false, receiver, multiname, args));
|
||||
stack.push(new CallPropertyAVM2Item(ins, localData.lineStartInstruction, false, receiver, multiname, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CallStaticIns extends InstructionDefinition {
|
||||
}
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
String methodName = localData.getMethodInfo().get(methodIndex).getName(localData.getConstants());
|
||||
stack.push(new CallStaticAVM2Item(ins, receiver, methodName, args));
|
||||
stack.push(new CallStaticAVM2Item(ins, localData.lineStartInstruction, receiver, methodName, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,10 +60,10 @@ public class CallSuperIns extends InstructionDefinition {
|
||||
for (int a = 0; a < argCount; a++) {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
|
||||
stack.push(new CallSuperAVM2Item(ins, false, receiver, multiname, args));
|
||||
stack.push(new CallSuperAVM2Item(ins, localData.lineStartInstruction, false, receiver, multiname, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,10 +60,10 @@ public class CallSuperVoidIns extends InstructionDefinition {
|
||||
for (int a = 0; a < argCount; a++) {
|
||||
args.add(0, stack.pop());
|
||||
}
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem receiver = stack.pop();
|
||||
|
||||
output.add(new CallSuperAVM2Item(ins, true, receiver, multiname, args));
|
||||
output.add(new CallSuperAVM2Item(ins, localData.lineStartInstruction, true, receiver, multiname, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,14 +54,14 @@ public class IfEqIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new EqAVM2Item(ins, v1, v2));
|
||||
stack.push(new EqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new NeqAVM2Item(ins, v1, v2));
|
||||
stack.push(new NeqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
//String v1 = stack.pop().toString();
|
||||
//stack.push("(" + v1 + ")");
|
||||
}
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfGeIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GeAVM2Item(ins, v1, v2));
|
||||
stack.push(new GeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LtAVM2Item(ins, v1, v2));
|
||||
stack.push(new LtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfGtIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GtAVM2Item(ins, v1, v2));
|
||||
stack.push(new GtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LeAVM2Item(ins, v1, v2));
|
||||
stack.push(new LeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfLeIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LeAVM2Item(ins, v1, v2));
|
||||
stack.push(new LeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GtAVM2Item(ins, v1, v2));
|
||||
stack.push(new GtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfLtIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LtAVM2Item(ins, v1, v2));
|
||||
stack.push(new LtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GeAVM2Item(ins, v1, v2));
|
||||
stack.push(new GeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LtAVM2Item(ins, v1, v2));
|
||||
stack.push(new LtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GeAVM2Item(ins, v1, v2));
|
||||
stack.push(new GeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LeAVM2Item(ins, v1, v2));
|
||||
stack.push(new LeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GtAVM2Item(ins, v1, v2));
|
||||
stack.push(new GtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GtAVM2Item(ins, v1, v2));
|
||||
stack.push(new GtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LeAVM2Item(ins, v1, v2));
|
||||
stack.push(new LeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,14 +56,14 @@ public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new GeAVM2Item(ins, v1, v2));
|
||||
stack.push(new GeAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new LtAVM2Item(ins, v1, v2));
|
||||
stack.push(new LtAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,14 +54,14 @@ public class IfNeIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new NeqAVM2Item(ins, v1, v2));
|
||||
stack.push(new NeqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new EqAVM2Item(ins, v1, v2));
|
||||
stack.push(new EqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,14 +54,14 @@ public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new StrictEqAVM2Item(ins, v1, v2));
|
||||
stack.push(new StrictEqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new StrictNeqAVM2Item(ins, v1, v2));
|
||||
stack.push(new StrictNeqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,14 +54,14 @@ public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new StrictNeqAVM2Item(ins, v1, v2));
|
||||
stack.push(new StrictNeqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v2 = stack.pop();
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(new StrictEqAVM2Item(ins, v1, v2));
|
||||
stack.push(new StrictEqAVM2Item(ins, localData.lineStartInstruction, v1, v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
GraphTargetItem v1 = stack.pop();
|
||||
stack.push(v1.invert(null));
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ public class JumpIns extends InstructionDefinition implements IfTypeIns {
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
//stack.push(new BooleanAVM2Item(ins, Boolean.TRUE));// + ins.operands[0]);
|
||||
//stack.push(new BooleanAVM2Item(ins, localData.lineStartInstruction, Boolean.TRUE));// + ins.operands[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
public void translateInverted(AVM2LocalData localData, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, AVM2Instruction ins) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ public class DecLocalIIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int regId = ins.operands[0];
|
||||
output.add(new DecLocalAVM2Item(ins, regId));
|
||||
output.add(new DecLocalAVM2Item(ins, localData.lineStartInstruction, regId));
|
||||
if (localData.localRegs.containsKey(regId)) {
|
||||
localData.localRegs.put(regId, new SubtractAVM2Item(ins, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, 1L)));
|
||||
localData.localRegs.put(regId, new SubtractAVM2Item(ins, localData.lineStartInstruction, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, localData.lineStartInstruction, 1L)));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new SubtractAVM2Item(ins, new IntegerValueAVM2Item(ins, new Long(0)), new IntegerValueAVM2Item(ins, new Long(1))));
|
||||
//localRegs.put(regIndex, new SubtractAVM2Item(ins, localData.lineStartInstruction, new IntegerValueAVM2Item(ins, localData.lineStartInstruction, new Long(0)), new IntegerValueAVM2Item(ins, localData.lineStartInstruction, new Long(1))));
|
||||
}
|
||||
if (!localData.localRegAssignmentIps.containsKey(regId)) {
|
||||
localData.localRegAssignmentIps.put(regId, 0);
|
||||
|
||||
@@ -47,11 +47,11 @@ public class DecLocalIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int regId = ins.operands[0];
|
||||
output.add(new DecLocalAVM2Item(ins, regId));
|
||||
output.add(new DecLocalAVM2Item(ins, localData.lineStartInstruction, regId));
|
||||
if (localData.localRegs.containsKey(regId)) {
|
||||
localData.localRegs.put(regId, new SubtractAVM2Item(ins, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, 1L)));
|
||||
localData.localRegs.put(regId, new SubtractAVM2Item(ins, localData.lineStartInstruction, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, localData.lineStartInstruction, 1L)));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new SubtractAVM2Item(ins, new IntegerValueAVM2Item(ins, new Long(0)), new IntegerValueAVM2Item(ins, new Long(1))));
|
||||
//localRegs.put(regIndex, new SubtractAVM2Item(ins, localData.lineStartInstruction, new IntegerValueAVM2Item(ins, localData.lineStartInstruction, new Long(0)), new IntegerValueAVM2Item(ins, localData.lineStartInstruction, new Long(1))));
|
||||
}
|
||||
if (!localData.localRegAssignmentIps.containsKey(regId)) {
|
||||
localData.localRegAssignmentIps.put(regId, 0);
|
||||
|
||||
@@ -58,7 +58,7 @@ public abstract class GetLocalTypeIns extends InstructionDefinition {
|
||||
if (localData.isStatic) {
|
||||
stack.push(new ClassAVM2Item(localData.getInstanceInfo().get(localData.classIndex).getName(localData.getConstants())));
|
||||
} else {
|
||||
stack.push(new ThisAVM2Item(ins, localData.getInstanceInfo().get(localData.classIndex).getName(localData.getConstants())));
|
||||
stack.push(new ThisAVM2Item(ins, localData.lineStartInstruction, localData.getInstanceInfo().get(localData.classIndex).getName(localData.getConstants())));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -69,17 +69,17 @@ public abstract class GetLocalTypeIns extends InstructionDefinition {
|
||||
assignCount = localData.localRegAssignmentIps.get(regId);
|
||||
}
|
||||
if (assignCount > 5) { //Do not allow change register more than 5 - for deobfuscation
|
||||
computedValue = new NotCompileTimeItem(ins, computedValue);
|
||||
computedValue = new NotCompileTimeItem(ins, localData.lineStartInstruction, computedValue);
|
||||
}
|
||||
/*if (!isRegisterCompileTime(regId, ip, refs, code)) {
|
||||
computedValue = new NotCompileTimeAVM2Item(ins, computedValue);
|
||||
computedValue = new NotCompileTimeAVM2Item(ins, localData.lineStartInstruction, computedValue);
|
||||
}
|
||||
if (computedValue == null) {
|
||||
if (!localRegNames.containsKey(regId)) {
|
||||
computedValue = new UndefinedAVM2Item(null); //In some obfuscated code there seems to be reading of undefined registers
|
||||
}
|
||||
}*/
|
||||
stack.push(new LocalRegAVM2Item(ins, regId, computedValue));
|
||||
stack.push(new LocalRegAVM2Item(ins, localData.lineStartInstruction, regId, computedValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,11 +47,11 @@ public class IncLocalIIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int regId = ins.operands[0];
|
||||
output.add(new IncLocalAVM2Item(ins, regId));
|
||||
output.add(new IncLocalAVM2Item(ins, localData.lineStartInstruction, regId));
|
||||
if (localData.localRegs.containsKey(regId)) {
|
||||
localData.localRegs.put(regId, new AddAVM2Item(ins, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, 1L)));
|
||||
localData.localRegs.put(regId, new AddAVM2Item(ins, localData.lineStartInstruction, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, localData.lineStartInstruction, 1L)));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new AddAVM2Item(ins, null, new IntegerValueAVM2Item(ins, new Long(1))));
|
||||
//localRegs.put(regIndex, new AddAVM2Item(ins, localData.lineStartInstruction, null, new IntegerValueAVM2Item(ins, localData.lineStartInstruction, new Long(1))));
|
||||
}
|
||||
if (!localData.localRegAssignmentIps.containsKey(regId)) {
|
||||
localData.localRegAssignmentIps.put(regId, 0);
|
||||
|
||||
@@ -47,11 +47,11 @@ public class IncLocalIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int regId = ins.operands[0];
|
||||
output.add(new IncLocalAVM2Item(ins, regId));
|
||||
output.add(new IncLocalAVM2Item(ins, localData.lineStartInstruction, regId));
|
||||
if (localData.localRegs.containsKey(regId)) {
|
||||
localData.localRegs.put(regId, new AddAVM2Item(ins, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, 1L)));
|
||||
localData.localRegs.put(regId, new AddAVM2Item(ins, localData.lineStartInstruction, localData.localRegs.get(regId), new IntegerValueAVM2Item(ins, localData.lineStartInstruction, 1L)));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new AddAVM2Item(ins, null, new IntegerValueAVM2Item(ins, new Long(1))));
|
||||
//localRegs.put(regIndex, new AddAVM2Item(ins, localData.lineStartInstruction, null, new IntegerValueAVM2Item(ins, localData.lineStartInstruction, new Long(1))));
|
||||
}
|
||||
if (!localData.localRegAssignmentIps.containsKey(regId)) {
|
||||
localData.localRegAssignmentIps.put(regId, 0);
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S
|
||||
int regId = getRegisterId(ins);
|
||||
GraphTargetItem value = stack.pop();
|
||||
/*if (localRegs.containsKey(regId)) {
|
||||
localRegs.put(regId, new NotCompileTimeAVM2Item(ins, value));
|
||||
localRegs.put(regId, new NotCompileTimeAVM2Item(ins, localData.lineStartInstruction, value));
|
||||
} else {
|
||||
localRegs.put(regId, value);
|
||||
}*/
|
||||
@@ -85,15 +85,15 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S
|
||||
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
|
||||
if (top == inside) {
|
||||
stack.pop();
|
||||
stack.push(new PostIncrementAVM2Item(ins, inside));
|
||||
stack.push(new PostIncrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
} else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) {
|
||||
stack.pop();
|
||||
stack.push(new PreIncrementAVM2Item(ins, inside));
|
||||
stack.push(new PreIncrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
} else {
|
||||
output.add(new PostIncrementAVM2Item(ins, inside));
|
||||
output.add(new PostIncrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
}
|
||||
} else {
|
||||
output.add(new PostIncrementAVM2Item(ins, inside));
|
||||
output.add(new PostIncrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -108,15 +108,15 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S
|
||||
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
|
||||
if (top == inside) {
|
||||
stack.pop();
|
||||
stack.push(new PostDecrementAVM2Item(ins, inside));
|
||||
stack.push(new PostDecrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
} else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) {
|
||||
stack.pop();
|
||||
stack.push(new PreDecrementAVM2Item(ins, inside));
|
||||
stack.push(new PreDecrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
} else {
|
||||
output.add(new PostDecrementAVM2Item(ins, inside));
|
||||
output.add(new PostDecrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
}
|
||||
} else {
|
||||
output.add(new PostDecrementAVM2Item(ins, inside));
|
||||
output.add(new PostDecrementAVM2Item(ins, localData.lineStartInstruction, inside));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S
|
||||
|
||||
//if(val.startsWith("catchscope ")) return;
|
||||
//if(val.startsWith("newactivation()")) return;
|
||||
output.add(new SetLocalAVM2Item(ins, regId, value));
|
||||
output.add(new SetLocalAVM2Item(ins, localData.lineStartInstruction, regId, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,10 +49,10 @@ public class DeletePropertyIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem obj = stack.pop();
|
||||
//stack.add(new BooleanAVM2Item(ins, Boolean.TRUE));//property successfully deleted
|
||||
stack.add(new DeletePropertyAVM2Item(ins, obj, multiname));
|
||||
//stack.add(new BooleanAVM2Item(ins, localData.lineStartInstruction, Boolean.TRUE));//property successfully deleted
|
||||
stack.add(new DeletePropertyAVM2Item(ins, localData.lineStartInstruction, obj, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FindDefIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
Multiname multiname = localData.getConstants().getMultiname(multinameIndex);
|
||||
stack.push(new FindDefAVM2Item(ins, multiname));
|
||||
stack.push(new FindDefAVM2Item(ins, localData.lineStartInstruction, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,8 +47,8 @@ public class FindPropertyIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
stack.push(new FindPropertyAVM2Item(ins, multiname)); //resolve right object
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
stack.push(new FindPropertyAVM2Item(ins, localData.lineStartInstruction, multiname)); //resolve right object
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,8 +47,8 @@ public class FindPropertyStrictIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
stack.push(new FindPropertyAVM2Item(ins, multiname));
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
stack.push(new FindPropertyAVM2Item(ins, localData.lineStartInstruction, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,9 +47,9 @@ public class GetDescendantsIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem obj = stack.pop();
|
||||
stack.push(new GetDescendantsAVM2Item(ins, obj, multiname));
|
||||
stack.push(new GetDescendantsAVM2Item(ins, localData.lineStartInstruction, obj, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GetGlobalSlotIns extends InstructionDefinition {
|
||||
|
||||
}
|
||||
}
|
||||
stack.push(new GetSlotAVM2Item(ins, obj, slotname));
|
||||
stack.push(new GetSlotAVM2Item(ins, localData.lineStartInstruction, obj, slotname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GetLexIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
Multiname multiname = localData.getConstants().getMultiname(multinameIndex);
|
||||
stack.push(new GetLexAVM2Item(ins, multiname));
|
||||
stack.push(new GetLexAVM2Item(ins, localData.lineStartInstruction, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,9 +36,9 @@ public class GetPropertyIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem obj = stack.pop();
|
||||
stack.push(new GetPropertyAVM2Item(ins, obj, multiname));
|
||||
stack.push(new GetPropertyAVM2Item(ins, localData.lineStartInstruction, obj, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class GetSlotIns extends InstructionDefinition {
|
||||
|
||||
}
|
||||
}
|
||||
stack.push(new GetSlotAVM2Item(ins, obj, slotname));
|
||||
stack.push(new GetSlotAVM2Item(ins, localData.lineStartInstruction, obj, slotname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,9 +36,9 @@ public class GetSuperIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
FullMultinameAVM2Item multiname = resolveMultiname(localData, true, stack, localData.getConstants(), multinameIndex, ins);
|
||||
GraphTargetItem obj = stack.pop();
|
||||
stack.push(new GetSuperAVM2Item(ins, obj, multiname));
|
||||
stack.push(new GetSuperAVM2Item(ins, localData.lineStartInstruction, obj, multiname));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user