fixed some NetBeanscode hints

This commit is contained in:
honfika
2014-07-20 00:42:57 +02:00
parent 203e816302
commit 1faee7eaa5
253 changed files with 19088 additions and 19091 deletions
File diff suppressed because it is too large Load Diff
@@ -39,7 +39,7 @@ public class SourceGeneratorLocalData implements Serializable {
//TODO: handle AVM2 separately //TODO: handle AVM2 separately
public List<ABCException> exceptions = new ArrayList<>(); public List<ABCException> exceptions = new ArrayList<>();
public List<Integer> finallyCatches = new ArrayList<Integer>(); public List<Integer> finallyCatches = new ArrayList<>();
public Map<Integer, Integer> finallyCounter = new HashMap<>(); public Map<Integer, Integer> finallyCounter = new HashMap<>();
public int finallyRegister = -1; public int finallyRegister = -1;
public String currentClass; public String currentClass;
@@ -47,7 +47,7 @@ public class SourceGeneratorLocalData implements Serializable {
public List<MethodBody> callStack = new ArrayList<>(); public List<MethodBody> callStack = new ArrayList<>();
public Map<MethodBody, List<Integer>> traitUsages = new HashMap<>(); public Map<MethodBody, List<Integer>> traitUsages = new HashMap<>();
public String pkg = ""; public String pkg = "";
public List<GraphTargetItem> scopeStack = new ArrayList<GraphTargetItem>(); public List<GraphTargetItem> scopeStack = new ArrayList<>();
public boolean documentClass; public boolean documentClass;
public ScriptInfo currentScript; public ScriptInfo currentScript;
@@ -1249,7 +1249,7 @@ public class AVM2Code implements Serializable {
return pos2adr(fixIPAfterDebugLine(adr2pos(addr))); return pos2adr(fixIPAfterDebugLine(adr2pos(addr)));
} }
public ConvertOutput toSourceOutput(String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ABC abc, ConstantPool constants, List<MethodInfo> method_info, MethodBody body, int start, int end, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, boolean[] visited, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) throws ConvertException, InterruptedException { public ConvertOutput toSourceOutput(String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ABC abc, ConstantPool constants, List<MethodInfo> method_info, MethodBody body, int start, int end, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, boolean[] visited, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) throws ConvertException, InterruptedException {
boolean debugMode = DEBUG_MODE; boolean debugMode = DEBUG_MODE;
if (debugMode) { if (debugMode) {
System.out.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); System.out.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString());
@@ -2699,7 +2699,7 @@ public class AVM2Code implements Serializable {
}*/ }*/
} }
if (((AVM2Instruction) ins).definition instanceof NewFunctionIns) { if (ins.definition instanceof NewFunctionIns) {
stack.push(new BooleanAVM2Item(null, true)); stack.push(new BooleanAVM2Item(null, true));
} else { } else {
localData.ip = ip; localData.ip = ip;
@@ -2724,8 +2724,8 @@ public class AVM2Code implements Serializable {
if (ins.isBranch() || ins.isJump()) { if (ins.isBranch() || ins.isJump()) {
List<Integer> branches = ins.getBranches(code); List<Integer> branches = ins.getBranches(code);
if (((AVM2Instruction) ins).definition instanceof IfTypeIns if (ins.definition instanceof IfTypeIns
&& (!(((AVM2Instruction) ins).definition instanceof JumpIns)) && (!(ins.definition instanceof JumpIns))
&& (!stack.isEmpty()) && (!stack.isEmpty())
&& (stack.peek().isCompileTime()) && (stack.peek().isCompileTime())
&& (!stack.peek().hasSideEffect())) { && (!stack.peek().hasSideEffect())) {
@@ -2858,11 +2858,10 @@ public class AVM2Code implements Serializable {
for (AVM2Instruction src : decisions.keySet()) { for (AVM2Instruction src : decisions.keySet()) {
Decision dec = decisions.get(src); Decision dec = decisions.get(src);
if (dec != null) { if (dec != null) {
if (((AVM2Instruction) src).definition instanceof LookupSwitchIns) { if (src.definition instanceof LookupSwitchIns) {
AVM2Instruction asrc = (AVM2Instruction) src;
if (dec.casesUsed.size() == 1) { if (dec.casesUsed.size() == 1) {
for (int c : dec.casesUsed) { for (int c : dec.casesUsed) {
asrc.setFixBranch(c); src.setFixBranch(c);
cnt++; cnt++;
} }
} }
@@ -1,25 +1,26 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions; package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.Stack; import java.util.HashMap;
import java.util.Stack;
public interface IfTypeIns {
public interface IfTypeIns {
public abstract void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins);
} public abstract void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins);
}
@@ -1,165 +1,165 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions; package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.DecLocalIIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.DecLocalIIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.DecLocalIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.DecLocalIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.IncLocalIIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.IncLocalIIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.IncLocalIns; 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.instructions.localregs.SetLocalTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; 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.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
public class InstructionDefinition implements Serializable { public class InstructionDefinition implements Serializable {
public static final long serialVersionUID = 1L; public static final long serialVersionUID = 1L;
public int[] operands; public int[] operands;
public String instructionName = ""; public String instructionName = "";
public int instructionCode = 0; public int instructionCode = 0;
public InstructionDefinition(int instructionCode, String instructionName, int[] operands) { public InstructionDefinition(int instructionCode, String instructionName, int[] operands) {
this.instructionCode = instructionCode; this.instructionCode = instructionCode;
this.instructionName = instructionName; this.instructionName = instructionName;
this.operands = operands; this.operands = operands;
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();
s.append(instructionName); s.append(instructionName);
for (int i = 0; i < operands.length; i++) { for (int i = 0; i < operands.length; i++) {
if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) { if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) {
s.append(" U30"); s.append(" U30");
} }
if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) { if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) {
s.append(" U8"); s.append(" U8");
} }
if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) { if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) {
s.append(" BYTE"); s.append(" BYTE");
} }
if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) { if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) {
s.append(" S24"); s.append(" S24");
} }
if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) { if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) {
s.append(" U30 S24,[S24]..."); s.append(" U30 S24,[S24]...");
} }
} }
return s.toString(); return s.toString();
} }
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented"); throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented");
} }
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
} }
protected FullMultinameAVM2Item resolveMultiname(Stack<GraphTargetItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { protected FullMultinameAVM2Item resolveMultiname(Stack<GraphTargetItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
GraphTargetItem ns = null; GraphTargetItem ns = null;
GraphTargetItem name = null; GraphTargetItem name = null;
if (constants.getMultiname(multinameIndex).needsName()) { if (constants.getMultiname(multinameIndex).needsName()) {
name = (GraphTargetItem) stack.pop(); name = stack.pop();
} }
if (constants.getMultiname(multinameIndex).needsNs()) { if (constants.getMultiname(multinameIndex).needsNs()) {
ns = (GraphTargetItem) stack.pop(); ns = stack.pop();
} }
return new FullMultinameAVM2Item(ins, multinameIndex, name, ns); return new FullMultinameAVM2Item(ins, multinameIndex, name, ns);
} }
protected int resolvedCount(ConstantPool constants, int multinameIndex) { protected int resolvedCount(ConstantPool constants, int multinameIndex) {
int pos = 0; int pos = 0;
if (constants.getMultiname(multinameIndex).needsNs()) { if (constants.getMultiname(multinameIndex).needsNs()) {
pos++; pos++;
} }
if (constants.getMultiname(multinameIndex).needsName()) { if (constants.getMultiname(multinameIndex).needsName()) {
pos++; pos++;
} }
return pos; return pos;
} }
protected String resolveMultinameNoPop(int pos, Stack<AVM2Item> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins, List<String> fullyQualifiedNames) { protected String resolveMultinameNoPop(int pos, Stack<AVM2Item> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins, List<String> fullyQualifiedNames) {
String ns = ""; String ns = "";
String name; String name;
if (constants.getMultiname(multinameIndex).needsNs()) { if (constants.getMultiname(multinameIndex).needsNs()) {
ns = "[" + stack.get(pos) + "]"; ns = "[" + stack.get(pos) + "]";
pos++; pos++;
} }
if (constants.getMultiname(multinameIndex).needsName()) { if (constants.getMultiname(multinameIndex).needsName()) {
name = stack.get(pos).toString(); name = stack.get(pos).toString();
} else { } else {
name = GraphTextWriter.hilighOffset(constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames), ins.offset); name = GraphTextWriter.hilighOffset(constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames), ins.offset);
} }
return name + ns; return name + ns;
} }
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 0; return 0;
} }
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) { public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 0; return 0;
} }
protected boolean isRegisterCompileTime(int regId, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { protected boolean isRegisterCompileTime(int regId, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
Set<Integer> previous = new HashSet<>(); Set<Integer> previous = new HashSet<>();
AVM2Code.getPreviousReachableIps(ip, refs, previous, new HashSet<Integer>()); AVM2Code.getPreviousReachableIps(ip, refs, previous, new HashSet<Integer>());
for (int p : previous) { for (int p : previous) {
if (p < 0) { if (p < 0) {
continue; continue;
} }
if (p >= code.code.size()) { if (p >= code.code.size()) {
continue; continue;
} }
AVM2Instruction sins = code.code.get(p); AVM2Instruction sins = code.code.get(p);
if (code.code.get(p).definition instanceof SetLocalTypeIns) { if (code.code.get(p).definition instanceof SetLocalTypeIns) {
SetLocalTypeIns sl = (SetLocalTypeIns) sins.definition; SetLocalTypeIns sl = (SetLocalTypeIns) sins.definition;
if (sl.getRegisterId(sins) == regId) { if (sl.getRegisterId(sins) == regId) {
if (!AVM2Code.isDirectAncestor(ip, p, refs)) { if (!AVM2Code.isDirectAncestor(ip, p, refs)) {
return false; return false;
} }
} }
} }
if ((code.code.get(p).definition instanceof IncLocalIns) if ((code.code.get(p).definition instanceof IncLocalIns)
|| (code.code.get(p).definition instanceof IncLocalIIns) || (code.code.get(p).definition instanceof IncLocalIIns)
|| (code.code.get(p).definition instanceof DecLocalIns) || (code.code.get(p).definition instanceof DecLocalIns)
|| (code.code.get(p).definition instanceof DecLocalIIns)) { || (code.code.get(p).definition instanceof DecLocalIIns)) {
if (sins.operands[0] == regId) { if (sins.operands[0] == regId) {
if (!AVM2Code.isDirectAncestor(ip, p, refs)) { if (!AVM2Code.isDirectAncestor(ip, p, refs)) {
return false; return false;
} }
} }
} }
} }
return true; return true;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class AddIIns extends AddIns { public class AddIIns extends AddIns {
public AddIIns() { public AddIIns() {
instructionName = "add_i"; instructionName = "add_i";
instructionCode = 0xc5; instructionCode = 0xc5;
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new AddAVM2Item(ins, v1, v2)); stack.push(new AddAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,72 +1,72 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class AddIns extends InstructionDefinition { public class AddIns extends InstructionDefinition {
public AddIns() { public AddIns() {
super(0xa0, "add", new int[]{}); super(0xa0, "add", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object o1 = lda.operandStack.pop(); Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) { if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = Long.valueOf(((Long) o1).longValue() + ((Long) o2).longValue()); Long ret = Long.valueOf(((Long) o1).longValue() + ((Long) o2).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) { } else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = Double.valueOf(((Double) o1).doubleValue() + ((Double) o2).doubleValue()); Double ret = Double.valueOf(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) { } else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue()); Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) { } else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue()); Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else { } else {
String s = o1.toString() + o2.toString(); String s = o1.toString() + o2.toString();
lda.operandStack.push(s); lda.operandStack.push(s);
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new AddAVM2Item(ins, v1, v2)); stack.push(new AddAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,66 +1,66 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DecrementIIns extends InstructionDefinition { public class DecrementIIns extends InstructionDefinition {
public DecrementIIns() { public DecrementIIns() {
super(0xc1, "decrement_i", new int[]{}); super(0xc1, "decrement_i", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object obj = lda.operandStack.pop(); Object obj = lda.operandStack.pop();
if (obj instanceof Long) { if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1; Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2); lda.operandStack.push(obj2);
} else if (obj instanceof Double) { } else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1; Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2); lda.operandStack.push(obj2);
} }
if (obj instanceof String) { if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1; Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2); lda.operandStack.push(obj2);
} else { } else {
throw new RuntimeException("Cannot decrement local register"); throw new RuntimeException("Cannot decrement local register");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.push(new DecrementAVM2Item(ins, (GraphTargetItem) stack.pop())); stack.push(new DecrementAVM2Item(ins, stack.pop()));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,66 +1,66 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DecrementIns extends InstructionDefinition { public class DecrementIns extends InstructionDefinition {
public DecrementIns() { public DecrementIns() {
super(0x93, "decrement", new int[]{}); super(0x93, "decrement", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object obj = lda.operandStack.pop(); Object obj = lda.operandStack.pop();
if (obj instanceof Long) { if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1; Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2); lda.operandStack.push(obj2);
} else if (obj instanceof Double) { } else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1; Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2); lda.operandStack.push(obj2);
} }
if (obj instanceof String) { if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1; Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2); lda.operandStack.push(obj2);
} else { } else {
throw new RuntimeException("Cannot decrement local register"); throw new RuntimeException("Cannot decrement local register");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.push(new DecrementAVM2Item(ins, (GraphTargetItem) stack.pop())); stack.push(new DecrementAVM2Item(ins, stack.pop()));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,71 +1,71 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.DivideAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.DivideAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DivideIns extends InstructionDefinition { public class DivideIns extends InstructionDefinition {
public DivideIns() { public DivideIns() {
super(0xa3, "divide", new int[]{}); super(0xa3, "divide", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object o2 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop();
Object o1 = lda.operandStack.pop(); Object o1 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) { if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = Long.valueOf(((Long) o1).longValue() / ((Long) o2).longValue()); Long ret = Long.valueOf(((Long) o1).longValue() / ((Long) o2).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) { } else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = Double.valueOf(((Double) o1).doubleValue() / ((Double) o2).doubleValue()); Double ret = Double.valueOf(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) { } else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue()); Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) { } else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue()); Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else { } else {
throw new RuntimeException("Cannot divide"); throw new RuntimeException("Cannot divide");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new DivideAVM2Item(ins, v1, v2)); stack.push(new DivideAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,47 +1,47 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IncrementIIns extends InstructionDefinition { public class IncrementIIns extends InstructionDefinition {
public IncrementIIns() { public IncrementIIns() {
super(0xc0, "increment_i", new int[]{}); super(0xc0, "increment_i", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.push(new IncrementAVM2Item(ins, (GraphTargetItem) stack.pop())); stack.push(new IncrementAVM2Item(ins, stack.pop()));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,47 +1,47 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IncrementIns extends InstructionDefinition { public class IncrementIns extends InstructionDefinition {
public IncrementIns() { public IncrementIns() {
super(0x91, "increment", new int[]{}); super(0x91, "increment", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.push(new IncrementAVM2Item(ins, (GraphTargetItem) stack.pop())); stack.push(new IncrementAVM2Item(ins, stack.pop()));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,63 +1,63 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.ModuloAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.ModuloAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ModuloIns extends InstructionDefinition { public class ModuloIns extends InstructionDefinition {
public ModuloIns() { public ModuloIns() {
super(0xa4, "modulo", new int[]{}); super(0xa4, "modulo", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object o1 = lda.operandStack.pop(); Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) { if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = Long.valueOf(((Long) o2).longValue() % ((Long) o1).longValue()); Long ret = Long.valueOf(((Long) o2).longValue() % ((Long) o1).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else { } else {
throw new RuntimeException("Cannot modulo"); throw new RuntimeException("Cannot modulo");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new ModuloAVM2Item(ins, v1, v2)); stack.push(new ModuloAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.MultiplyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.MultiplyAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class MultiplyIIns extends InstructionDefinition { public class MultiplyIIns extends InstructionDefinition {
public MultiplyIIns() { public MultiplyIIns() {
super(0xc7, "multiply_i", new int[]{}); super(0xc7, "multiply_i", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new MultiplyAVM2Item(ins, v1, v2)); stack.push(new MultiplyAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,71 +1,71 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.MultiplyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.MultiplyAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class MultiplyIns extends InstructionDefinition { public class MultiplyIns extends InstructionDefinition {
public MultiplyIns() { public MultiplyIns() {
super(0xa2, "multiply", new int[]{}); super(0xa2, "multiply", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object o1 = lda.operandStack.pop(); Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop(); Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) { if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = Long.valueOf(((Long) o1).longValue() * ((Long) o2).longValue()); Long ret = Long.valueOf(((Long) o1).longValue() * ((Long) o2).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) { } else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = Double.valueOf(((Double) o1).doubleValue() * ((Double) o2).doubleValue()); Double ret = Double.valueOf(((Double) o1).doubleValue() * ((Double) o2).doubleValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) { } else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() * ((Double) o2).doubleValue()); Double ret = new Double(((Long) o1).longValue() * ((Double) o2).doubleValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) { } else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() * ((Long) o2).longValue()); Double ret = new Double(((Double) o1).doubleValue() * ((Long) o2).longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} else { } else {
throw new RuntimeException("Cannot multiply"); throw new RuntimeException("Cannot multiply");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new MultiplyAVM2Item(ins, v1, v2)); stack.push(new MultiplyAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,48 +1,48 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.NegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.NegAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NegateIIns extends InstructionDefinition { public class NegateIIns extends InstructionDefinition {
public NegateIIns() { public NegateIIns() {
super(0xc4, "negate_i", new int[]{}); super(0xc4, "negate_i", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v = (GraphTargetItem) stack.pop(); GraphTargetItem v = stack.pop();
stack.push(new NegAVM2Item(ins, v)); stack.push(new NegAVM2Item(ins, v));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,48 +1,48 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.NegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.NegAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NegateIns extends InstructionDefinition { public class NegateIns extends InstructionDefinition {
public NegateIns() { public NegateIns() {
super(0x90, "negate", new int[]{}); super(0x90, "negate", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v = (GraphTargetItem) stack.pop(); GraphTargetItem v = stack.pop();
stack.push(new NegAVM2Item(ins, v)); stack.push(new NegAVM2Item(ins, v));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,48 +1,48 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.NotItem; import com.jpexs.decompiler.graph.model.NotItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NotIns extends InstructionDefinition { public class NotIns extends InstructionDefinition {
public NotIns() { public NotIns() {
super(0x96, "not", new int[]{}); super(0x96, "not", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v = (GraphTargetItem) stack.pop(); GraphTargetItem v = stack.pop();
stack.push(new NotItem(ins, v)); stack.push(new NotItem(ins, v));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class SubtractIIns extends InstructionDefinition { public class SubtractIIns extends InstructionDefinition {
public SubtractIIns() { public SubtractIIns() {
super(0xc6, "subtract_i", new int[]{}); super(0xc6, "subtract_i", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new SubtractAVM2Item(ins, v1, v2)); stack.push(new SubtractAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic; package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class SubtractIns extends InstructionDefinition { public class SubtractIns extends InstructionDefinition {
public SubtractIns() { public SubtractIns() {
super(0xa1, "subtract", new int[]{}); super(0xa1, "subtract", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new SubtractAVM2Item(ins, v1, v2)); stack.push(new SubtractAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitAndAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitAndAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class BitAndIns extends InstructionDefinition { public class BitAndIns extends InstructionDefinition {
public BitAndIns() { public BitAndIns() {
super(0xa8, "bitand", new int[]{}); super(0xa8, "bitand", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Long value2 = (Long) lda.operandStack.pop(); Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop(); Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 & value2; Long value3 = value1 & value2;
lda.operandStack.push(value3); lda.operandStack.push(value3);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new BitAndAVM2Item(ins, v1, v2)); stack.push(new BitAndAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,56 +1,56 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitNotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitNotAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class BitNotIns extends InstructionDefinition { public class BitNotIns extends InstructionDefinition {
public BitNotIns() { public BitNotIns() {
super(0x97, "bitnot", new int[]{}); super(0x97, "bitnot", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Long value = (Long) lda.operandStack.pop(); Long value = (Long) lda.operandStack.pop();
Long ret = Long.valueOf(-value.longValue()); Long ret = Long.valueOf(-value.longValue());
lda.operandStack.push(ret); lda.operandStack.push(ret);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v = (GraphTargetItem) stack.pop(); GraphTargetItem v = stack.pop();
stack.push(new BitNotAVM2Item(ins, v)); stack.push(new BitNotAVM2Item(ins, v));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitOrAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitOrAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class BitOrIns extends InstructionDefinition { public class BitOrIns extends InstructionDefinition {
public BitOrIns() { public BitOrIns() {
super(0xa9, "bitor", new int[]{}); super(0xa9, "bitor", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Long value2 = (Long) lda.operandStack.pop(); Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop(); Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 | value2; Long value3 = value1 | value2;
lda.operandStack.push(value3); lda.operandStack.push(value3);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new BitOrAVM2Item(ins, v1, v2)); stack.push(new BitOrAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitXorAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitXorAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class BitXorIns extends InstructionDefinition { public class BitXorIns extends InstructionDefinition {
public BitXorIns() { public BitXorIns() {
super(0xaa, "bitxor", new int[]{}); super(0xaa, "bitxor", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Long value2 = (Long) lda.operandStack.pop(); Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop(); Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 ^ value2; Long value3 = value1 ^ value2;
lda.operandStack.push(value3); lda.operandStack.push(value3);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new BitXorAVM2Item(ins, v1, v2)); stack.push(new BitXorAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LShiftAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LShiftAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class LShiftIns extends InstructionDefinition { public class LShiftIns extends InstructionDefinition {
public LShiftIns() { public LShiftIns() {
super(0xa5, "lshift", new int[]{}); super(0xa5, "lshift", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LShiftAVM2Item(ins, v1, v2)); stack.push(new LShiftAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.RShiftAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.RShiftAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class RShiftIns extends InstructionDefinition { public class RShiftIns extends InstructionDefinition {
public RShiftIns() { public RShiftIns() {
super(0xa6, "rshift", new int[]{}); super(0xa6, "rshift", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new RShiftAVM2Item(ins, v1, v2)); stack.push(new RShiftAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise; package com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.URShiftAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.URShiftAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class URShiftIns extends InstructionDefinition { public class URShiftIns extends InstructionDefinition {
public URShiftIns() { public URShiftIns() {
super(0xa7, "urshift", new int[]{}); super(0xa7, "urshift", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new URShiftAVM2Item(ins, v1, v2)); stack.push(new URShiftAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class EqualsIns extends InstructionDefinition { public class EqualsIns extends InstructionDefinition {
public EqualsIns() { public EqualsIns() {
super(0xab, "equals", new int[]{}); super(0xab, "equals", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object obj1 = lda.operandStack.pop(); Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop(); Object obj2 = lda.operandStack.pop();
Boolean res = obj1.equals(obj2); Boolean res = obj1.equals(obj2);
lda.operandStack.push(res); lda.operandStack.push(res);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new EqAVM2Item(ins, v1, v2)); stack.push(new EqAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GreaterEqualsIns extends InstructionDefinition { public class GreaterEqualsIns extends InstructionDefinition {
public GreaterEqualsIns() { public GreaterEqualsIns() {
super(0xb0, "greaterequals", new int[]{}); super(0xb0, "greaterequals", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2)); stack.push(new GeAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GreaterThanIns extends InstructionDefinition { public class GreaterThanIns extends InstructionDefinition {
public GreaterThanIns() { public GreaterThanIns() {
super(0xaf, "greaterthan", new int[]{}); super(0xaf, "greaterthan", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2)); stack.push(new GtAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class LessEqualsIns extends InstructionDefinition { public class LessEqualsIns extends InstructionDefinition {
public LessEqualsIns() { public LessEqualsIns() {
super(0xae, "lessequals", new int[]{}); super(0xae, "lessequals", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2)); stack.push(new LeAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class LessThanIns extends InstructionDefinition { public class LessThanIns extends InstructionDefinition {
public LessThanIns() { public LessThanIns() {
super(0xad, "lessthan", new int[]{}); super(0xad, "lessthan", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2)); stack.push(new LtAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison; package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class StrictEqualsIns extends InstructionDefinition { public class StrictEqualsIns extends InstructionDefinition {
public StrictEqualsIns() { public StrictEqualsIns() {
super(0xac, "strictequals", new int[]{}); super(0xac, "strictequals", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new StrictEqAVM2Item(ins, v1, v2)); stack.push(new StrictEqAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,119 +1,119 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ConstructAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ConstructAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXAttrAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXAttrAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXElemAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXElemAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetLexAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetLexAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.StringAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.StringAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.XMLAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.XMLAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ConstructIns extends InstructionDefinition { public class ConstructIns extends InstructionDefinition {
public ConstructIns() { public ConstructIns() {
super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT}); super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue(); /*int argCount = (int) ((Long) arguments.get(0)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
Object obj = lda.operandStack.pop();*/ Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call constructor"); throw new RuntimeException("Cannot call constructor");
//call construct property of obj //call construct property of obj
//push new instance //push new instance
} }
public static boolean walkXML(GraphTargetItem item, List<GraphTargetItem> list) { public static boolean walkXML(GraphTargetItem item, List<GraphTargetItem> list) {
boolean ret = true; boolean ret = true;
if (item instanceof StringAVM2Item) { if (item instanceof StringAVM2Item) {
list.add(item); list.add(item);
} else if (item instanceof AddAVM2Item) { } else if (item instanceof AddAVM2Item) {
ret = ret && walkXML(((AddAVM2Item) item).leftSide, list); ret = ret && walkXML(((AddAVM2Item) item).leftSide, list);
ret = ret && walkXML(((AddAVM2Item) item).rightSide, list); ret = ret && walkXML(((AddAVM2Item) item).rightSide, list);
} else if ((item instanceof EscapeXElemAVM2Item) || (item instanceof EscapeXAttrAVM2Item)) { } else if ((item instanceof EscapeXElemAVM2Item) || (item instanceof EscapeXAttrAVM2Item)) {
list.add(item); list.add(item);
} else { } else {
return false; return false;
} }
return ret; return ret;
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
int argCount = ins.operands[0]; int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
FullMultinameAVM2Item xmlMult = null; FullMultinameAVM2Item xmlMult = null;
boolean isXML = false; boolean isXML = false;
if (obj instanceof GetPropertyAVM2Item) { if (obj instanceof GetPropertyAVM2Item) {
GetPropertyAVM2Item gpt = (GetPropertyAVM2Item) obj; GetPropertyAVM2Item gpt = (GetPropertyAVM2Item) obj;
if (gpt.object instanceof FindPropertyAVM2Item) { if (gpt.object instanceof FindPropertyAVM2Item) {
FindPropertyAVM2Item fpt = (FindPropertyAVM2Item) gpt.object; FindPropertyAVM2Item fpt = (FindPropertyAVM2Item) gpt.object;
xmlMult = (FullMultinameAVM2Item) fpt.propertyName; xmlMult = (FullMultinameAVM2Item) fpt.propertyName;
isXML = xmlMult.isXML(constants, localRegNames, fullyQualifiedNames) && xmlMult.isXML(constants, localRegNames, fullyQualifiedNames); isXML = xmlMult.isXML(constants, localRegNames, fullyQualifiedNames) && xmlMult.isXML(constants, localRegNames, fullyQualifiedNames);
} }
} }
if (obj instanceof GetLexAVM2Item) { if (obj instanceof GetLexAVM2Item) {
GetLexAVM2Item glt = (GetLexAVM2Item) obj; GetLexAVM2Item glt = (GetLexAVM2Item) obj;
isXML = glt.propertyName.getName(constants, fullyQualifiedNames).equals("XML"); isXML = glt.propertyName.getName(constants, fullyQualifiedNames).equals("XML");
} }
if (isXML) { if (isXML) {
if (args.size() == 1) { if (args.size() == 1) {
GraphTargetItem arg = args.get(0); GraphTargetItem arg = args.get(0);
List<GraphTargetItem> xmlLines = new ArrayList<>(); List<GraphTargetItem> xmlLines = new ArrayList<>();
if (walkXML(arg, xmlLines)) { if (walkXML(arg, xmlLines)) {
stack.push(new XMLAVM2Item(ins, xmlLines)); stack.push(new XMLAVM2Item(ins, xmlLines));
return; return;
} }
} }
} }
stack.push(new ConstructAVM2Item(ins, obj, args)); stack.push(new ConstructAVM2Item(ins, obj, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] - 1 + 1; return -ins.operands[0] - 1 + 1;
} }
} }
@@ -1,94 +1,94 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ConstructPropAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ConstructPropAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.XMLAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.XMLAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ConstructPropIns extends InstructionDefinition { public class ConstructPropIns extends InstructionDefinition {
public ConstructPropIns() { public ConstructPropIns() {
super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
}*/ }*/
//if multiname[multinameIndex] is runtime //if multiname[multinameIndex] is runtime
//pop(name) pop(ns) //pop(name) pop(ns)
throw new RuntimeException("Cannot construct property"); throw new RuntimeException("Cannot construct property");
//create property //create property
//push new instance //push new instance
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
if (multiname.isXML(constants, localRegNames, fullyQualifiedNames)) { if (multiname.isXML(constants, localRegNames, fullyQualifiedNames)) {
if (args.size() == 1) { if (args.size() == 1) {
GraphTargetItem arg = args.get(0); GraphTargetItem arg = args.get(0);
List<GraphTargetItem> xmlLines = new ArrayList<>(); List<GraphTargetItem> xmlLines = new ArrayList<>();
if (ConstructIns.walkXML(arg, xmlLines)) { if (ConstructIns.walkXML(arg, xmlLines)) {
stack.push(new XMLAVM2Item(ins, xmlLines)); stack.push(new XMLAVM2Item(ins, xmlLines));
return; return;
} }
} }
} }
stack.push(new ConstructPropAVM2Item(ins, obj, multiname, args)); stack.push(new ConstructPropAVM2Item(ins, obj, multiname, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1; int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,68 +1,68 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ConstructSuperAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ConstructSuperAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ConstructSuperIns extends InstructionDefinition { public class ConstructSuperIns extends InstructionDefinition {
public ConstructSuperIns() { public ConstructSuperIns() {
super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT}); super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue(); /*int argCount = (int) ((Long) arguments.get(0)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
Object obj = lda.operandStack.pop();*/ Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call super constructor"); throw new RuntimeException("Cannot call super constructor");
//call construct property of obj //call construct property of obj
//do not push anything //do not push anything
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int argCount = ins.operands[0]; int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
output.add(new ConstructSuperAVM2Item(ins, obj, args)); output.add(new ConstructSuperAVM2Item(ins, obj, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] - 1; return -ins.operands[0] - 1;
} }
} }
@@ -1,47 +1,47 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NewActivationIns extends InstructionDefinition { public class NewActivationIns extends InstructionDefinition {
public NewActivationIns() { public NewActivationIns() {
super(0x57, "newactivation", new int[]{}); super(0x57, "newactivation", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.push(new NewActivationAVM2Item(ins)); stack.push(new NewActivationAVM2Item(ins));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,53 +1,53 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NewArrayAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewArrayAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NewArrayIns extends InstructionDefinition { public class NewArrayIns extends InstructionDefinition {
public NewArrayIns() { public NewArrayIns() {
super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT}); super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int argCount = ins.operands[0]; int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
stack.push(new NewArrayAVM2Item(ins, args)); stack.push(new NewArrayAVM2Item(ins, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] + 1; return -ins.operands[0] + 1;
} }
} }
@@ -1,48 +1,48 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NewCatchIns extends InstructionDefinition { public class NewCatchIns extends InstructionDefinition {
public NewCatchIns() { public NewCatchIns() {
super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX}); super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int exInfo = ins.operands[0]; int exInfo = ins.operands[0];
stack.push(new ExceptionAVM2Item(body.exceptions[exInfo])); stack.push(new ExceptionAVM2Item(body.exceptions[exInfo]));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,54 +1,54 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.UnparsedAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.UnparsedAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.LocalData;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NewClassIns extends InstructionDefinition { public class NewClassIns extends InstructionDefinition {
public NewClassIns() { public NewClassIns() {
super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX}); super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
int clsIndex = ins.operands[0]; int clsIndex = ins.operands[0];
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
stack.pop().toString(writer, LocalData.create(constants, localRegNames, fullyQualifiedNames)); stack.pop().toString(writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
String baseType = writer.toString(); String baseType = writer.toString();
stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(constants, fullyQualifiedNames) + ".class extends " + baseType)); stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(constants, fullyQualifiedNames) + ".class extends " + baseType));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NewFunctionAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewFunctionAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NewFunctionIns extends InstructionDefinition { public class NewFunctionIns extends InstructionDefinition {
public NewFunctionIns() { public NewFunctionIns() {
super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX}); super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int methodIndex = ins.operands[0]; int methodIndex = ins.operands[0];
NewFunctionAVM2Item function = new NewFunctionAVM2Item(ins, "", path, isStatic, scriptIndex, classIndex, abc, fullyQualifiedNames, constants, method_info, methodIndex); NewFunctionAVM2Item function = new NewFunctionAVM2Item(ins, "", path, isStatic, scriptIndex, classIndex, abc, fullyQualifiedNames, constants, method_info, methodIndex);
stack.push(function); stack.push(function);
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,56 +1,56 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction; package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NameValuePair; import com.jpexs.decompiler.flash.abc.avm2.model.NameValuePair;
import com.jpexs.decompiler.flash.abc.avm2.model.NewObjectAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewObjectAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NewObjectIns extends InstructionDefinition { public class NewObjectIns extends InstructionDefinition {
public NewObjectIns() { public NewObjectIns() {
super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT}); super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int argCount = ins.operands[0]; int argCount = ins.operands[0];
List<NameValuePair> args = new ArrayList<>(); List<NameValuePair> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
GraphTargetItem value = (GraphTargetItem) stack.pop(); GraphTargetItem value = stack.pop();
GraphTargetItem name = (GraphTargetItem) stack.pop(); GraphTargetItem name = stack.pop();
args.add(0, new NameValuePair(name, value)); args.add(0, new NameValuePair(name, value));
} }
stack.push(new NewObjectAVM2Item(ins, args)); stack.push(new NewObjectAVM2Item(ins, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -ins.operands[0] * 2 + 1; return -ins.operands[0] * 2 + 1;
} }
} }
@@ -1,69 +1,69 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallIns extends InstructionDefinition { public class CallIns extends InstructionDefinition {
public CallIns() { public CallIns() {
super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT}); super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int argCount = (int) ((Long) arguments.get(0)).longValue(); /*int argCount = (int) ((Long) arguments.get(0)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
Object receiver = lda.operandStack.pop(); Object receiver = lda.operandStack.pop();
Object function = lda.operandStack.pop();*/ Object function = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown function"); throw new RuntimeException("Call to unknown function");
//push(result) //push(result)
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int argCount = ins.operands[0]; int argCount = ins.operands[0];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
GraphTargetItem function = (GraphTargetItem) stack.pop(); GraphTargetItem function = stack.pop();
stack.push(new CallAVM2Item(ins, receiver, function, args)); stack.push(new CallAVM2Item(ins, receiver, function, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1 - ins.operands[0]; return -2 + 1 - ins.operands[0];
} }
} }
@@ -1,70 +1,70 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallMethodAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallMethodAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallMethodIns extends InstructionDefinition { public class CallMethodIns extends InstructionDefinition {
public CallMethodIns() { public CallMethodIns() {
super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method /*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
Object receiver = lda.operandStack.pop();*/ Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown method"); throw new RuntimeException("Call to unknown method");
//push(result) //push(result)
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int methodIndex = ins.operands[0]; int methodIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
String methodName = method_info.get(methodIndex).getName(constants); String methodName = method_info.get(methodIndex).getName(constants);
stack.push(new CallMethodAVM2Item(ins, receiver, methodName, args)); stack.push(new CallMethodAVM2Item(ins, receiver, methodName, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1 - ins.operands[1]; return -1 + 1 - ins.operands[1];
} }
} }
@@ -1,66 +1,66 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.model.CallPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallPropLexIns extends CallPropertyIns { public class CallPropLexIns extends CallPropertyIns {
public CallPropLexIns() { public CallPropLexIns() {
instructionName = "callproplex"; instructionName = "callproplex";
instructionCode = 0x4c; instructionCode = 0x4c;
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
stack.push(new CallPropertyAVM2Item(ins, false, receiver, multiname, args)); stack.push(new CallPropertyAVM2Item(ins, false, receiver, multiname, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1; int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,85 +1,85 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallPropVoidIns extends InstructionDefinition { public class CallPropVoidIns extends InstructionDefinition {
public CallPropVoidIns() { public CallPropVoidIns() {
super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
//same as callproperty //same as callproperty
/* /*
int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
//if multiname[multinameIndex] is runtime //if multiname[multinameIndex] is runtime
//pop(name) pop(ns) //pop(name) pop(ns)
Object obj = lda.operandStack.pop();*/ Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property"); throw new RuntimeException("Call to unknown property");
//do not push anything //do not push anything
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
output.add(new CallPropertyAVM2Item(ins, true, receiver, multiname, args)); output.add(new CallPropertyAVM2Item(ins, true, receiver, multiname, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1; int ret = -ins.operands[1] - 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,83 +1,83 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallPropertyIns extends InstructionDefinition { public class CallPropertyIns extends InstructionDefinition {
public CallPropertyIns() { public CallPropertyIns() {
super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
//if multiname[multinameIndex] is runtime //if multiname[multinameIndex] is runtime
//pop(name) pop(ns) //pop(name) pop(ns)
Object obj = lda.operandStack.pop();*/ Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property"); throw new RuntimeException("Call to unknown property");
//push(result) //push(result)
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
stack.push(new CallPropertyAVM2Item(ins, false, receiver, multiname, args)); stack.push(new CallPropertyAVM2Item(ins, false, receiver, multiname, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1; int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,70 +1,70 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallStaticAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallStaticAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallStaticIns extends InstructionDefinition { public class CallStaticIns extends InstructionDefinition {
public CallStaticIns() { public CallStaticIns() {
super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info /*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
Object receiver = lda.operandStack.pop();*/ Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown static method"); throw new RuntimeException("Call to unknown static method");
//push(result) //push(result)
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int methodIndex = ins.operands[0]; int methodIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
String methodName = method_info.get(methodIndex).getName(constants); String methodName = method_info.get(methodIndex).getName(constants);
stack.push(new CallStaticAVM2Item(ins, receiver, methodName, args)); stack.push(new CallStaticAVM2Item(ins, receiver, methodName, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1 - ins.operands[1]; return -1 + 1 - ins.operands[1];
} }
} }
@@ -1,82 +1,82 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallSuperAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallSuperAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallSuperIns extends InstructionDefinition { public class CallSuperIns extends InstructionDefinition {
public CallSuperIns() { public CallSuperIns() {
super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
//if multiname[multinameIndex] is runtime //if multiname[multinameIndex] is runtime
//pop(name) pop(ns) //pop(name) pop(ns)
Object receiver = lda.operandStack.pop();*/ Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method"); throw new RuntimeException("Call to unknown super method");
//push(result) //push(result)
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
stack.push(new CallSuperAVM2Item(ins, false, receiver, multiname, args)); stack.push(new CallSuperAVM2Item(ins, false, receiver, multiname, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1 + 1; int ret = -ins.operands[1] - 1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,83 +1,83 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.executing; package com.jpexs.decompiler.flash.abc.avm2.instructions.executing;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.CallSuperAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CallSuperAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class CallSuperVoidIns extends InstructionDefinition { public class CallSuperVoidIns extends InstructionDefinition {
public CallSuperVoidIns() { public CallSuperVoidIns() {
super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); /*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue(); int argCount = (int) ((Long) arguments.get(1)).longValue();
List<Object> passArguments = new ArrayList<Object>(); List<Object> passArguments = new ArrayList<Object>();
for (int i = argCount - 1; i >= 0; i--) { for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop()); passArguments.set(i, lda.operandStack.pop());
} }
//if multiname[multinameIndex] is runtime //if multiname[multinameIndex] is runtime
//pop(name) pop(ns) //pop(name) pop(ns)
Object receiver = lda.operandStack.pop();*/ Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method"); throw new RuntimeException("Call to unknown super method");
//do not push anything //do not push anything
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
int argCount = ins.operands[1]; int argCount = ins.operands[1];
List<GraphTargetItem> args = new ArrayList<>(); List<GraphTargetItem> args = new ArrayList<>();
for (int a = 0; a < argCount; a++) { for (int a = 0; a < argCount; a++) {
args.add(0, (GraphTargetItem) stack.pop()); args.add(0, stack.pop());
} }
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem receiver = (GraphTargetItem) stack.pop(); GraphTargetItem receiver = stack.pop();
output.add(new CallSuperAVM2Item(ins, true, receiver, multiname, args)); output.add(new CallSuperAVM2Item(ins, true, receiver, multiname, args));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -ins.operands[1] - 1; int ret = -ins.operands[1] - 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.NeqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.NeqAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfEqIns extends InstructionDefinition implements IfTypeIns { public class IfEqIns extends InstructionDefinition implements IfTypeIns {
public IfEqIns() { public IfEqIns() {
super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET}); super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new EqAVM2Item(ins, v1, v2)); stack.push(new EqAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new NeqAVM2Item(ins, v1, v2)); stack.push(new NeqAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,55 +1,55 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.NotItem; import com.jpexs.decompiler.graph.model.NotItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfFalseIns extends InstructionDefinition implements IfTypeIns { public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
public IfFalseIns() { public IfFalseIns() {
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET}); super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new NotItem(ins, v1)); stack.push(new NotItem(ins, v1));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
//String v1 = stack.pop().toString(); //String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")"); //stack.push("(" + v1 + ")");
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfGeIns extends InstructionDefinition implements IfTypeIns { public class IfGeIns extends InstructionDefinition implements IfTypeIns {
public IfGeIns() { public IfGeIns() {
super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET}); super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2)); stack.push(new GeAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2)); stack.push(new LtAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfGtIns extends InstructionDefinition implements IfTypeIns { public class IfGtIns extends InstructionDefinition implements IfTypeIns {
public IfGtIns() { public IfGtIns() {
super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET}); super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2)); stack.push(new GtAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2)); stack.push(new LeAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfLeIns extends InstructionDefinition implements IfTypeIns { public class IfLeIns extends InstructionDefinition implements IfTypeIns {
public IfLeIns() { public IfLeIns() {
super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET}); super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2)); stack.push(new LeAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2)); stack.push(new GtAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfLtIns extends InstructionDefinition implements IfTypeIns { public class IfLtIns extends InstructionDefinition implements IfTypeIns {
public IfLtIns() { public IfLtIns() {
super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET}); super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2)); stack.push(new LtAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2)); stack.push(new GeAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfNGeIns extends InstructionDefinition implements IfTypeIns { public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
public IfNGeIns() { public IfNGeIns() {
super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET}); super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2)); stack.push(new LtAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2)); stack.push(new GeAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfNGtIns extends InstructionDefinition implements IfTypeIns { public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
public IfNGtIns() { public IfNGtIns() {
super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET}); super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2)); stack.push(new LeAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2)); stack.push(new GtAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfNLeIns extends InstructionDefinition implements IfTypeIns { public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
public IfNLeIns() { public IfNLeIns() {
super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET}); super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GtAVM2Item(ins, v1, v2)); stack.push(new GtAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LeAVM2Item(ins, v1, v2)); stack.push(new LeAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfNLtIns extends InstructionDefinition implements IfTypeIns { public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
public IfNLtIns() { public IfNLtIns() {
super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET}); super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new GeAVM2Item(ins, v1, v2)); stack.push(new GeAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new LtAVM2Item(ins, v1, v2)); stack.push(new LtAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.NeqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.NeqAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfNeIns extends InstructionDefinition implements IfTypeIns { public class IfNeIns extends InstructionDefinition implements IfTypeIns {
public IfNeIns() { public IfNeIns() {
super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET}); super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new NeqAVM2Item(ins, v1, v2)); stack.push(new NeqAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new EqAVM2Item(ins, v1, v2)); stack.push(new EqAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictNeqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictNeqAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns { public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
public IfStrictEqIns() { public IfStrictEqIns() {
super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET}); super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new StrictEqAVM2Item(ins, v1, v2)); stack.push(new StrictEqAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new StrictNeqAVM2Item(ins, v1, v2)); stack.push(new StrictNeqAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,58 +1,58 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictNeqAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictNeqAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns { public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
public IfStrictNeIns() { public IfStrictNeIns() {
super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET}); super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new StrictNeqAVM2Item(ins, v1, v2)); stack.push(new StrictNeqAVM2Item(ins, v1, v2));
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v2 = (GraphTargetItem) stack.pop(); GraphTargetItem v2 = stack.pop();
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new StrictEqAVM2Item(ins, v1, v2)); stack.push(new StrictEqAVM2Item(ins, v1, v2));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,55 +1,55 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.NotItem; import com.jpexs.decompiler.graph.model.NotItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IfTrueIns extends InstructionDefinition implements IfTypeIns { public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
public IfTrueIns() { public IfTrueIns() {
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET}); super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
//String v1 = stack.pop().toString(); //String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")"); //stack.push("(" + v1 + ")");
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
GraphTargetItem v1 = (GraphTargetItem) stack.pop(); GraphTargetItem v1 = stack.pop();
stack.push(new NotItem(ins, v1)); stack.push(new NotItem(ins, v1));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
} }
@@ -1,46 +1,46 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class JumpIns extends InstructionDefinition implements IfTypeIns { public class JumpIns extends InstructionDefinition implements IfTypeIns {
public JumpIns() { public JumpIns() {
super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET}); super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
//stack.push(new BooleanAVM2Item(ins, Boolean.TRUE));// + ins.operands[0]); //stack.push(new BooleanAVM2Item(ins, Boolean.TRUE));// + ins.operands[0]);
} }
@Override @Override
public void translateInverted(java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) { public void translateInverted(HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, AVM2Instruction ins) {
} }
} }
@@ -1,48 +1,48 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps; package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class LookupSwitchIns extends InstructionDefinition { public class LookupSwitchIns extends InstructionDefinition {
public LookupSwitchIns() { public LookupSwitchIns() {
super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS}); super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
//int defaultOffset = ins.operands[0]; //int defaultOffset = ins.operands[0];
//int caseCount = ins.operands[1]; //int caseCount = ins.operands[1];
//stack.push("switch(...)"); //stack.push("switch(...)");
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
} }
@@ -1,75 +1,75 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.DecLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecLocalAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DecLocalIIns extends InstructionDefinition { public class DecLocalIIns extends InstructionDefinition {
public DecLocalIIns() { public DecLocalIIns() {
super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex); Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) { if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1; Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.put(locRegIndex, obj2); lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) { } else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1; Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.put(locRegIndex, obj2); lda.localRegisters.put(locRegIndex, obj2);
} }
if (obj instanceof String) { if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1; Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2); lda.localRegisters.put(locRegIndex, obj2);
} else { } else {
throw new RuntimeException("Cannot decrement local register"); throw new RuntimeException("Cannot decrement local register");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int regId = ins.operands[0]; int regId = ins.operands[0];
output.add(new DecLocalAVM2Item(ins, regId)); output.add(new DecLocalAVM2Item(ins, regId));
if (localRegs.containsKey(regId)) { if (localRegs.containsKey(regId)) {
localRegs.put(regId, new SubtractAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1)))); localRegs.put(regId, new SubtractAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1))));
} else { } 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, new IntegerValueAVM2Item(ins, new Long(0)), new IntegerValueAVM2Item(ins, new Long(1))));
} }
if (!regAssignCount.containsKey(regId)) { if (!regAssignCount.containsKey(regId)) {
regAssignCount.put(regId, 0); regAssignCount.put(regId, 0);
} }
regAssignCount.put(regId, regAssignCount.get(regId) + 1); regAssignCount.put(regId, regAssignCount.get(regId) + 1);
} }
} }
@@ -1,74 +1,74 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.DecLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecLocalAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DecLocalIns extends InstructionDefinition { public class DecLocalIns extends InstructionDefinition {
public DecLocalIns() { public DecLocalIns() {
super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex); Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) { if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1; Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.put(locRegIndex, obj2); lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) { } else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1; Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.put(locRegIndex, obj2); lda.localRegisters.put(locRegIndex, obj2);
} }
if (obj instanceof String) { if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1; Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2); lda.localRegisters.put(locRegIndex, obj2);
} else { } else {
throw new RuntimeException("Cannot decrement local register"); throw new RuntimeException("Cannot decrement local register");
} }
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int regId = ins.operands[0]; int regId = ins.operands[0];
output.add(new DecLocalAVM2Item(ins, regId)); output.add(new DecLocalAVM2Item(ins, regId));
if (localRegs.containsKey(regId)) { if (localRegs.containsKey(regId)) {
localRegs.put(regId, new SubtractAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1)))); localRegs.put(regId, new SubtractAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1))));
} else { } 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, new IntegerValueAVM2Item(ins, new Long(0)), new IntegerValueAVM2Item(ins, new Long(1))));
} }
if (!regAssignCount.containsKey(regId)) { if (!regAssignCount.containsKey(regId)) {
regAssignCount.put(regId, 0); regAssignCount.put(regId, 0);
} }
regAssignCount.put(regId, regAssignCount.get(regId) + 1); regAssignCount.put(regId, regAssignCount.get(regId) + 1);
} }
} }
@@ -1,62 +1,62 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetLocal0Ins extends GetLocalTypeIns { public class GetLocal0Ins extends GetLocalTypeIns {
public GetLocal0Ins() { public GetLocal0Ins() {
super(0xd0, "getlocal_0", new int[]{}); super(0xd0, "getlocal_0", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
lda.operandStack.push(lda.localRegisters.get(0)); lda.operandStack.push(lda.localRegisters.get(0));
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
if ((classIndex >= abc.instance_info.size()) || classIndex < 0) { if ((classIndex >= abc.instance_info.size()) || classIndex < 0) {
stack.push(new ScriptAVM2Item(scriptIndex)); stack.push(new ScriptAVM2Item(scriptIndex));
return; return;
} }
if (isStatic) { if (isStatic) {
stack.push(new ClassAVM2Item(abc.instance_info.get(classIndex).getName(constants))); stack.push(new ClassAVM2Item(abc.instance_info.get(classIndex).getName(constants)));
} else { } else {
stack.push(new ThisAVM2Item(abc.instance_info.get(classIndex).getName(constants))); stack.push(new ThisAVM2Item(abc.instance_info.get(classIndex).getName(constants)));
} }
} }
@Override @Override
public int getRegisterId(AVM2Instruction par0) { public int getRegisterId(AVM2Instruction par0) {
return 0; return 0;
} }
} }
@@ -1,67 +1,67 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.NotCompileTimeItem; import com.jpexs.decompiler.graph.NotCompileTimeItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public abstract class GetLocalTypeIns extends InstructionDefinition { public abstract class GetLocalTypeIns extends InstructionDefinition {
public GetLocalTypeIns(int instructionCode, String instructionName, int[] operands) { public GetLocalTypeIns(int instructionCode, String instructionName, int[] operands) {
super(instructionCode, instructionName, operands); super(instructionCode, instructionName, operands);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int regId = getRegisterId(ins); int regId = getRegisterId(ins);
GraphTargetItem computedValue = localRegs.get(regId); GraphTargetItem computedValue = localRegs.get(regId);
int assignCount = 0; int assignCount = 0;
if (regAssignCount.containsKey(regId)) { if (regAssignCount.containsKey(regId)) {
assignCount = regAssignCount.get(regId); assignCount = regAssignCount.get(regId);
} }
if (assignCount > 5) { //Do not allow change register more than 5 - for deobfuscation if (assignCount > 5) { //Do not allow change register more than 5 - for deobfuscation
computedValue = new NotCompileTimeItem(ins, computedValue); computedValue = new NotCompileTimeItem(ins, computedValue);
} }
/*if (!isRegisterCompileTime(regId, ip, refs, code)) { /*if (!isRegisterCompileTime(regId, ip, refs, code)) {
computedValue = new NotCompileTimeAVM2Item(ins, computedValue); computedValue = new NotCompileTimeAVM2Item(ins, computedValue);
} }
if (computedValue == null) { if (computedValue == null) {
if (!localRegNames.containsKey(regId)) { if (!localRegNames.containsKey(regId)) {
computedValue = new UndefinedAVM2Item(null); //In some obfuscated code there seems to be reading of undefined registers 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, regId, computedValue));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
public abstract int getRegisterId(AVM2Instruction ins); public abstract int getRegisterId(AVM2Instruction ins);
} }
@@ -1,54 +1,54 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.IncLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncLocalAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IncLocalIIns extends InstructionDefinition { public class IncLocalIIns extends InstructionDefinition {
public IncLocalIIns() { public IncLocalIIns() {
super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int regId = ins.operands[0]; int regId = ins.operands[0];
output.add(new IncLocalAVM2Item(ins, regId)); output.add(new IncLocalAVM2Item(ins, regId));
if (localRegs.containsKey(regId)) { if (localRegs.containsKey(regId)) {
localRegs.put(regId, new AddAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1)))); localRegs.put(regId, new AddAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1))));
} else { } else {
//localRegs.put(regIndex, new AddAVM2Item(ins, null, new IntegerValueAVM2Item(ins, new Long(1)))); //localRegs.put(regIndex, new AddAVM2Item(ins, null, new IntegerValueAVM2Item(ins, new Long(1))));
} }
if (!regAssignCount.containsKey(regId)) { if (!regAssignCount.containsKey(regId)) {
regAssignCount.put(regId, 0); regAssignCount.put(regId, 0);
} }
regAssignCount.put(regId, regAssignCount.get(regId) + 1); regAssignCount.put(regId, regAssignCount.get(regId) + 1);
} }
} }
@@ -1,54 +1,54 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.IncLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncLocalAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class IncLocalIns extends InstructionDefinition { public class IncLocalIns extends InstructionDefinition {
public IncLocalIns() { public IncLocalIns() {
super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int regId = ins.operands[0]; int regId = ins.operands[0];
output.add(new IncLocalAVM2Item(ins, regId)); output.add(new IncLocalAVM2Item(ins, regId));
if (localRegs.containsKey(regId)) { if (localRegs.containsKey(regId)) {
localRegs.put(regId, new AddAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1)))); localRegs.put(regId, new AddAVM2Item(ins, localRegs.get(regId), new IntegerValueAVM2Item(ins, Long.valueOf(1))));
} else { } else {
//localRegs.put(regIndex, new AddAVM2Item(ins, null, new IntegerValueAVM2Item(ins, new Long(1)))); //localRegs.put(regIndex, new AddAVM2Item(ins, null, new IntegerValueAVM2Item(ins, new Long(1))));
} }
if (!regAssignCount.containsKey(regId)) { if (!regAssignCount.containsKey(regId)) {
regAssignCount.put(regId, 0); regAssignCount.put(regId, 0);
} }
regAssignCount.put(regId, regAssignCount.get(regId) + 1); regAssignCount.put(regId, regAssignCount.get(regId) + 1);
} }
} }
@@ -1,41 +1,41 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class KillIns extends InstructionDefinition { public class KillIns extends InstructionDefinition {
public KillIns() { public KillIns() {
super(0x08, "kill", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); super(0x08, "kill", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
//kill local register //kill local register
} }
} }
@@ -1,132 +1,132 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs; package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.PostIncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.PostIncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreDecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreDecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreIncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreIncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public abstract class SetLocalTypeIns extends InstructionDefinition implements SetTypeIns { public abstract class SetLocalTypeIns extends InstructionDefinition implements SetTypeIns {
public SetLocalTypeIns(int instructionCode, String instructionName, int[] operands) { public SetLocalTypeIns(int instructionCode, String instructionName, int[] operands) {
super(instructionCode, instructionName, operands); super(instructionCode, instructionName, operands);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> regAssignCount, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int regId = getRegisterId(ins); int regId = getRegisterId(ins);
GraphTargetItem value = (GraphTargetItem) stack.pop(); GraphTargetItem value = stack.pop();
/*if (localRegs.containsKey(regId)) { /*if (localRegs.containsKey(regId)) {
localRegs.put(regId, new NotCompileTimeAVM2Item(ins, value)); localRegs.put(regId, new NotCompileTimeAVM2Item(ins, value));
} else { } else {
localRegs.put(regId, value); localRegs.put(regId, value);
}*/ }*/
localRegs.put(regId, value); localRegs.put(regId, value);
if (!regAssignCount.containsKey(regId)) { if (!regAssignCount.containsKey(regId)) {
regAssignCount.put(regId, 0); regAssignCount.put(regId, 0);
} }
regAssignCount.put(regId, regAssignCount.get(regId) + 1); regAssignCount.put(regId, regAssignCount.get(regId) + 1);
//localRegsAssignmentIps.put(regId, ip); //localRegsAssignmentIps.put(regId, ip);
if (value instanceof NewActivationAVM2Item) { if (value instanceof NewActivationAVM2Item) {
return; return;
} }
if (value instanceof FindPropertyAVM2Item) { if (value instanceof FindPropertyAVM2Item) {
return; return;
} }
if (value.getNotCoerced() instanceof IncrementAVM2Item) { if (value.getNotCoerced() instanceof IncrementAVM2Item) {
GraphTargetItem inside = ((IncrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate(); GraphTargetItem inside = ((IncrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate();
if (inside instanceof LocalRegAVM2Item) { if (inside instanceof LocalRegAVM2Item) {
if (((LocalRegAVM2Item) inside).regIndex == regId) { if (((LocalRegAVM2Item) inside).regIndex == regId) {
if (stack.size() > 0) { if (stack.size() > 0) {
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate(); GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
if (top == inside) { if (top == inside) {
stack.pop(); stack.pop();
stack.push(new PostIncrementAVM2Item(ins, inside)); stack.push(new PostIncrementAVM2Item(ins, inside));
} else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) { } else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) {
stack.pop(); stack.pop();
stack.push(new PreIncrementAVM2Item(ins, inside)); stack.push(new PreIncrementAVM2Item(ins, inside));
} else { } else {
output.add(new PostIncrementAVM2Item(ins, inside)); output.add(new PostIncrementAVM2Item(ins, inside));
} }
} else { } else {
output.add(new PostIncrementAVM2Item(ins, inside)); output.add(new PostIncrementAVM2Item(ins, inside));
} }
return; return;
} }
} }
} }
if (value.getNotCoerced() instanceof DecrementAVM2Item) { if (value.getNotCoerced() instanceof DecrementAVM2Item) {
GraphTargetItem inside = ((DecrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate(); GraphTargetItem inside = ((DecrementAVM2Item) value.getNotCoerced()).value.getNotCoerced().getThroughDuplicate();
if (inside instanceof LocalRegAVM2Item) { if (inside instanceof LocalRegAVM2Item) {
if (((LocalRegAVM2Item) inside).regIndex == regId) { if (((LocalRegAVM2Item) inside).regIndex == regId) {
if (stack.size() > 0) { if (stack.size() > 0) {
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate(); GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
if (top == inside) { if (top == inside) {
stack.pop(); stack.pop();
stack.push(new PostDecrementAVM2Item(ins, inside)); stack.push(new PostDecrementAVM2Item(ins, inside));
} else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) { } else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) {
stack.pop(); stack.pop();
stack.push(new PreDecrementAVM2Item(ins, inside)); stack.push(new PreDecrementAVM2Item(ins, inside));
} else { } else {
output.add(new PostDecrementAVM2Item(ins, inside)); output.add(new PostDecrementAVM2Item(ins, inside));
} }
} else { } else {
output.add(new PostDecrementAVM2Item(ins, inside)); output.add(new PostDecrementAVM2Item(ins, inside));
} }
return; return;
} }
} }
} }
//if(val.startsWith("catchscope ")) return; //if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return; //if(val.startsWith("newactivation()")) return;
output.add(new SetLocalAVM2Item(ins, regId, value)); output.add(new SetLocalAVM2Item(ins, regId, value));
} }
@Override @Override
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) { public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return AVM2Item.localRegName(localRegNames, getRegisterId(ins)); return AVM2Item.localRegName(localRegNames, getRegisterId(ins));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
public abstract int getRegisterId(AVM2Instruction ins); public abstract int getRegisterId(AVM2Instruction ins);
} }
@@ -1,73 +1,73 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.DeletePropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.DeletePropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DeletePropertyIns extends InstructionDefinition { public class DeletePropertyIns extends InstructionDefinition {
public DeletePropertyIns() { public DeletePropertyIns() {
super(0x6a, "deleteproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x6a, "deleteproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int multiIndex = (int) ((Long) arguments.get(0)).longValue(); /*int multiIndex = (int) ((Long) arguments.get(0)).longValue();
//if multiname[multinameIndex] is runtime //if multiname[multinameIndex] is runtime
//pop(name) pop(ns) //pop(name) pop(ns)
Object obj = lda.operandStack.pop(); Object obj = lda.operandStack.pop();
//push true if removed*/ //push true if removed*/
throw new RuntimeException("Cannot remove property"); throw new RuntimeException("Cannot remove property");
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
stack.add(new BooleanAVM2Item(ins, Boolean.TRUE));//property successfully deleted stack.add(new BooleanAVM2Item(ins, Boolean.TRUE));//property successfully deleted
output.add(new DeletePropertyAVM2Item(ins, obj, multiname)); output.add(new DeletePropertyAVM2Item(ins, obj, multiname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -1 + 1; int ret = -1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,50 +1,50 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FindDefAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FindDefAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class FindDefIns extends InstructionDefinition { public class FindDefIns extends InstructionDefinition {
public FindDefIns() { public FindDefIns() {
super(0x5f, "finddef", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x5f, "finddef", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
Multiname multiname = constants.getMultiname(multinameIndex); Multiname multiname = constants.getMultiname(multinameIndex);
stack.push(new FindDefAVM2Item(ins, multiname)); stack.push(new FindDefAVM2Item(ins, multiname));
} }
@Override @Override
public int getScopeStackDelta(AVM2Instruction ins, ABC abc) { public int getScopeStackDelta(AVM2Instruction ins, ABC abc) {
return 1; //multiname may not be runtime return 1; //multiname may not be runtime
} }
} }
@@ -1,68 +1,68 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class FindPropertyIns extends InstructionDefinition { public class FindPropertyIns extends InstructionDefinition {
public FindPropertyIns() { public FindPropertyIns() {
super(0x5e, "findproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x5e, "findproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
//int multiIndex = (int) ((Long) arguments.get(0)).longValue(); //int multiIndex = (int) ((Long) arguments.get(0)).longValue();
//if is runtime //if is runtime
//pop(name), pop(ns) //pop(name), pop(ns)
throw new RuntimeException("Cannot find property"); throw new RuntimeException("Cannot find property");
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
stack.push(new FindPropertyAVM2Item(ins, multiname)); //resolve right object stack.push(new FindPropertyAVM2Item(ins, multiname)); //resolve right object
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = 1; int ret = 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,67 +1,67 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class FindPropertyStrictIns extends InstructionDefinition { public class FindPropertyStrictIns extends InstructionDefinition {
public FindPropertyStrictIns() { public FindPropertyStrictIns() {
super(0x5d, "findpropstrict", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x5d, "findpropstrict", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
//int multiIndex = (int) ((Long) arguments.get(0)).longValue(); //int multiIndex = (int) ((Long) arguments.get(0)).longValue();
//if is runtime //if is runtime
//pop(name), pop(ns) //pop(name), pop(ns)
throw new RuntimeException("Cannot find property"); throw new RuntimeException("Cannot find property");
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
stack.push(new FindPropertyAVM2Item(ins, multiname)); stack.push(new FindPropertyAVM2Item(ins, multiname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = 1; int ret = 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,69 +1,69 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetDescendantsAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetDescendantsAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetDescendantsIns extends InstructionDefinition { public class GetDescendantsIns extends InstructionDefinition {
public GetDescendantsIns() { public GetDescendantsIns() {
super(0x59, "getdescentants", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x59, "getdescentants", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
/*int multiIndex = (int) ((Long) arguments.get(0)).longValue(); /*int multiIndex = (int) ((Long) arguments.get(0)).longValue();
//if is runtime //if is runtime
//pop(name), pop(ns) //pop(name), pop(ns)
Object obj = lda.operandStack.pop();*/ Object obj = lda.operandStack.pop();*/
throw new RuntimeException("getdescentants not working"); throw new RuntimeException("getdescentants not working");
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
stack.push(new GetDescendantsAVM2Item(ins, obj, multiname)); stack.push(new GetDescendantsAVM2Item(ins, obj, multiname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -1 + 1; int ret = -1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,62 +1,62 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetGlobalScopeIns extends InstructionDefinition { public class GetGlobalScopeIns extends InstructionDefinition {
public GetGlobalScopeIns() { public GetGlobalScopeIns() {
super(0x64, "getglobalscope", new int[]{}); super(0x64, "getglobalscope", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
throw new RuntimeException("getglobalscope not working"); throw new RuntimeException("getglobalscope not working");
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
if (scopeStack.isEmpty()) { if (scopeStack.isEmpty()) {
if (classIndex == -1) { if (classIndex == -1) {
stack.push(new ScriptAVM2Item(scriptIndex)); stack.push(new ScriptAVM2Item(scriptIndex));
} else { } else {
stack.push(new ClassAVM2Item(abc.instance_info.get(classIndex).getName(constants))); stack.push(new ClassAVM2Item(abc.instance_info.get(classIndex).getName(constants)));
} }
return; return;
} }
stack.push(scopeStack.get(0)); stack.push(scopeStack.get(0));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,66 +1,66 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetGlobalSlotIns extends InstructionDefinition { public class GetGlobalSlotIns extends InstructionDefinition {
public GetGlobalSlotIns() { public GetGlobalSlotIns() {
super(0x6e, "getglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); super(0x6e, "getglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int slotIndex = ins.operands[0]; int slotIndex = ins.operands[0];
GraphTargetItem obj = (GraphTargetItem) scopeStack.get(0); //scope GraphTargetItem obj = scopeStack.get(0); //scope
Multiname slotname = null; Multiname slotname = null;
if (obj instanceof ExceptionAVM2Item) { if (obj instanceof ExceptionAVM2Item) {
slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index); slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index);
} else { } else {
for (int t = 0; t < body.traits.traits.size(); t++) { for (int t = 0; t < body.traits.traits.size(); t++) {
if (body.traits.traits.get(t) instanceof TraitSlotConst) { if (body.traits.traits.get(t) instanceof TraitSlotConst) {
if (((TraitSlotConst) body.traits.traits.get(t)).slot_id == slotIndex) { if (((TraitSlotConst) body.traits.traits.get(t)).slot_id == slotIndex) {
slotname = body.traits.traits.get(t).getName(abc); slotname = body.traits.traits.get(t).getName(abc);
} }
} }
} }
} }
stack.push(new GetSlotAVM2Item(ins, obj, slotname)); stack.push(new GetSlotAVM2Item(ins, obj, slotname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,51 +1,51 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.GetLexAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetLexAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetLexIns extends InstructionDefinition { public class GetLexIns extends InstructionDefinition {
public GetLexIns() { public GetLexIns() {
super(0x60, "getlex", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x60, "getlex", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
Multiname multiname = constants.getMultiname(multinameIndex); Multiname multiname = constants.getMultiname(multinameIndex);
stack.push(new GetLexAVM2Item(ins, multiname)); stack.push(new GetLexAVM2Item(ins, multiname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,64 +1,64 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetPropertyIns extends InstructionDefinition { public class GetPropertyIns extends InstructionDefinition {
public GetPropertyIns() { public GetPropertyIns() {
super(0x66, "getproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x66, "getproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
stack.push(new GetPropertyAVM2Item(ins, obj, multiname)); stack.push(new GetPropertyAVM2Item(ins, obj, multiname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -1 + 1; int ret = -1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
//Note: In official compiler, the stack can be wrong(greater) for some MULTINAMEL/A, e.g. increments //Note: In official compiler, the stack can be wrong(greater) for some MULTINAMEL/A, e.g. increments
/* /*
var arr=[1,2,3]; var arr=[1,2,3];
return arr[2]++; return arr[2]++;
*/ */
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,47 +1,47 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetScopeObjectIns extends InstructionDefinition { public class GetScopeObjectIns extends InstructionDefinition {
public GetScopeObjectIns() { public GetScopeObjectIns() {
super(0x65, "getscopeobject", new int[]{AVM2Code.DAT_SLOT_SCOPE_INDEX}); super(0x65, "getscopeobject", new int[]{AVM2Code.DAT_SLOT_SCOPE_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int index = ins.operands[0]; int index = ins.operands[0];
stack.push(scopeStack.get(index)); stack.push(scopeStack.get(index));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,85 +1,85 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.TraitWithSlot; import com.jpexs.decompiler.flash.abc.types.traits.TraitWithSlot;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetSlotIns extends InstructionDefinition { public class GetSlotIns extends InstructionDefinition {
public GetSlotIns() { public GetSlotIns() {
super(0x6c, "getslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); super(0x6c, "getslot", new int[]{AVM2Code.DAT_SLOT_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int slotIndex = ins.operands[0]; int slotIndex = ins.operands[0];
GraphTargetItem obj = (GraphTargetItem) stack.pop(); //scope GraphTargetItem obj = stack.pop(); //scope
obj = obj.getThroughRegister(); obj = obj.getThroughRegister();
Multiname slotname = null; Multiname slotname = null;
if (obj instanceof ExceptionAVM2Item) { if (obj instanceof ExceptionAVM2Item) {
slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index); slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index);
} else if (obj instanceof ClassAVM2Item) { } else if (obj instanceof ClassAVM2Item) {
slotname = ((ClassAVM2Item) obj).className; slotname = ((ClassAVM2Item) obj).className;
} else if (obj instanceof ThisAVM2Item) { } else if (obj instanceof ThisAVM2Item) {
slotname = ((ThisAVM2Item) obj).className; slotname = ((ThisAVM2Item) obj).className;
} else if (obj instanceof ScriptAVM2Item) { } else if (obj instanceof ScriptAVM2Item) {
for (int t = 0; t < abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.size(); t++) { for (int t = 0; t < abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.size(); t++) {
Trait tr = abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.get(t); Trait tr = abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.get(t);
if (tr instanceof TraitWithSlot) { if (tr instanceof TraitWithSlot) {
if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) { if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) {
slotname = tr.getName(abc); slotname = tr.getName(abc);
} }
} }
} }
} else if (obj instanceof NewActivationAVM2Item) { } else if (obj instanceof NewActivationAVM2Item) {
for (int t = 0; t < body.traits.traits.size(); t++) { for (int t = 0; t < body.traits.traits.size(); t++) {
if (body.traits.traits.get(t) instanceof TraitWithSlot) { if (body.traits.traits.get(t) instanceof TraitWithSlot) {
if (((TraitWithSlot) body.traits.traits.get(t)).getSlotIndex() == slotIndex) { if (((TraitWithSlot) body.traits.traits.get(t)).getSlotIndex() == slotIndex) {
slotname = body.traits.traits.get(t).getName(abc); slotname = body.traits.traits.get(t).getName(abc);
} }
} }
} }
} }
stack.push(new GetSlotAVM2Item(ins, obj, slotname)); stack.push(new GetSlotAVM2Item(ins, obj, slotname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 1; return -1 + 1;
} }
} }
@@ -1,59 +1,59 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetSuperAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetSuperAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class GetSuperIns extends InstructionDefinition { public class GetSuperIns extends InstructionDefinition {
public GetSuperIns() { public GetSuperIns() {
super(0x04, "getsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x04, "getsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
stack.push(new GetSuperAVM2Item(ins, obj, multiname)); stack.push(new GetSuperAVM2Item(ins, obj, multiname));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -1 + 1; int ret = -1 + 1;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,52 +1,52 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class HasNext2Ins extends InstructionDefinition { public class HasNext2Ins extends InstructionDefinition {
public HasNext2Ins() { public HasNext2Ins() {
super(0x32, "hasnext2", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX, AVM2Code.DAT_LOCAL_REG_INDEX}); super(0x32, "hasnext2", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX, AVM2Code.DAT_LOCAL_REG_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int objectReg = ins.operands[0]; int objectReg = ins.operands[0];
int indexReg = ins.operands[1]; int indexReg = ins.operands[1];
//stack.push("_loc_" + objectReg + ".hasNext(cnt=_loc_" + indexReg + ")"); //stack.push("_loc_" + objectReg + ".hasNext(cnt=_loc_" + indexReg + ")");
stack.push(new HasNextAVM2Item(ins, new LocalRegAVM2Item(ins, indexReg, localRegs.get(indexReg)), localRegs.get(objectReg))); stack.push(new HasNextAVM2Item(ins, new LocalRegAVM2Item(ins, indexReg, localRegs.get(indexReg)), localRegs.get(objectReg)));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; return 1;
} }
} }
@@ -1,50 +1,50 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class HasNextIns extends InstructionDefinition { public class HasNextIns extends InstructionDefinition {
public HasNextIns() { public HasNextIns() {
super(0x1f, "hasnext", new int[]{}); super(0x1f, "hasnext", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem curIndex = (GraphTargetItem) stack.pop(); GraphTargetItem curIndex = stack.pop();
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
stack.push(new HasNextAVM2Item(ins, curIndex, obj)); stack.push(new HasNextAVM2Item(ins, curIndex, obj));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.InAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.InAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class InIns extends InstructionDefinition { public class InIns extends InstructionDefinition {
public InIns() { public InIns() {
super(0xb4, "in", new int[]{}); super(0xb4, "in", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
GraphTargetItem name = (GraphTargetItem) stack.pop(); GraphTargetItem name = stack.pop();
stack.push(new InAVM2Item(ins, name, obj)); stack.push(new InAVM2Item(ins, name, obj));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,61 +1,61 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.InitPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.InitPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class InitPropertyIns extends InstructionDefinition { public class InitPropertyIns extends InstructionDefinition {
public InitPropertyIns() { public InitPropertyIns() {
super(0x68, "initproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x68, "initproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
GraphTargetItem val = (GraphTargetItem) stack.pop(); GraphTargetItem val = stack.pop();
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
output.add(new InitPropertyAVM2Item(ins, obj, multiname, val)); output.add(new InitPropertyAVM2Item(ins, obj, multiname, val));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -2; int ret = -2;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NextNameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NextNameAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NextNameIns extends InstructionDefinition { public class NextNameIns extends InstructionDefinition {
public NextNameIns() { public NextNameIns() {
super(0x1e, "nextname", new int[]{}); super(0x1e, "nextname", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem index = stack.pop(); GraphTargetItem index = stack.pop();
GraphTargetItem obj = stack.pop(); GraphTargetItem obj = stack.pop();
stack.push(new NextNameAVM2Item(ins, index, obj)); stack.push(new NextNameAVM2Item(ins, index, obj));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,49 +1,49 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NextValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NextValueAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class NextValueIns extends InstructionDefinition { public class NextValueIns extends InstructionDefinition {
public NextValueIns() { public NextValueIns() {
super(0x23, "nextvalue", new int[]{}); super(0x23, "nextvalue", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem index = stack.pop(); GraphTargetItem index = stack.pop();
GraphTargetItem obj = stack.pop(); GraphTargetItem obj = stack.pop();
stack.push(new NextValueAVM2Item(ins, index, obj)); stack.push(new NextValueAVM2Item(ins, index, obj));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; return -2 + 1;
} }
} }
@@ -1,47 +1,47 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ReturnValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ReturnValueAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ReturnValueIns extends InstructionDefinition { public class ReturnValueIns extends InstructionDefinition {
public ReturnValueIns() { public ReturnValueIns() {
super(0x48, "returnvalue", new int[]{}); super(0x48, "returnvalue", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
output.add(new ReturnValueAVM2Item(ins, (GraphTargetItem) stack.pop())); output.add(new ReturnValueAVM2Item(ins, stack.pop()));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
} }
@@ -1,42 +1,42 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ReturnVoidAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ReturnVoidAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ReturnVoidIns extends InstructionDefinition { public class ReturnVoidIns extends InstructionDefinition {
public ReturnVoidIns() { public ReturnVoidIns() {
super(0x47, "returnvoid", new int[]{}); super(0x47, "returnvoid", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
output.add(new ReturnVoidAVM2Item(ins)); output.add(new ReturnVoidAVM2Item(ins));
} }
} }
@@ -1,54 +1,54 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.SetGlobalSlotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetGlobalSlotAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class SetGlobalSlotIns extends InstructionDefinition implements SetTypeIns { public class SetGlobalSlotIns extends InstructionDefinition implements SetTypeIns {
public SetGlobalSlotIns() { public SetGlobalSlotIns() {
super(0x6f, "setglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); super(0x6f, "setglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
output.add(new SetGlobalSlotAVM2Item(ins, ins.operands[0], (GraphTargetItem) stack.pop())); output.add(new SetGlobalSlotAVM2Item(ins, ins.operands[0], stack.pop()));
} }
@Override @Override
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) { public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return "globalslot" + ins.operands[0]; return "globalslot" + ins.operands[0];
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
} }
@@ -51,11 +51,11 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
GraphTargetItem value = (GraphTargetItem) stack.pop(); GraphTargetItem value = stack.pop();
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
if (value.getThroughDuplicate().getThroughRegister().getThroughDuplicate() instanceof IncrementAVM2Item) { if (value.getThroughDuplicate().getThroughRegister().getThroughDuplicate() instanceof IncrementAVM2Item) {
GraphTargetItem inside = ((IncrementAVM2Item) value.getThroughDuplicate().getThroughRegister().getThroughDuplicate()).value.getThroughRegister().getNotCoerced().getThroughDuplicate(); GraphTargetItem inside = ((IncrementAVM2Item) value.getThroughDuplicate().getThroughRegister().getThroughDuplicate()).value.getThroughRegister().getNotCoerced().getThroughDuplicate();
if (inside instanceof GetPropertyAVM2Item) { if (inside instanceof GetPropertyAVM2Item) {
@@ -1,181 +1,181 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.PostIncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.PostIncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.SetSlotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetSlotAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreDecrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreDecrementAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreIncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.PreIncrementAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.flash.abc.types.traits.TraitWithSlot; import com.jpexs.decompiler.flash.abc.types.traits.TraitWithSlot;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class SetSlotIns extends InstructionDefinition implements SetTypeIns { public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
public SetSlotIns() { public SetSlotIns() {
super(0x6d, "setslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); super(0x6d, "setslot", new int[]{AVM2Code.DAT_SLOT_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int slotIndex = ins.operands[0]; int slotIndex = ins.operands[0];
GraphTargetItem value = (GraphTargetItem) stack.pop(); GraphTargetItem value = stack.pop();
GraphTargetItem obj = (GraphTargetItem) stack.pop(); //scopeId GraphTargetItem obj = stack.pop(); //scopeId
GraphTargetItem objnoreg = obj; GraphTargetItem objnoreg = obj;
obj = obj.getThroughRegister(); obj = obj.getThroughRegister();
Multiname slotname = null; Multiname slotname = null;
if (obj instanceof NewActivationAVM2Item) { if (obj instanceof NewActivationAVM2Item) {
((NewActivationAVM2Item) obj).slots.put(slotIndex, value); ((NewActivationAVM2Item) obj).slots.put(slotIndex, value);
} }
if (obj instanceof ExceptionAVM2Item) { if (obj instanceof ExceptionAVM2Item) {
slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index); slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index);
} else if (obj instanceof ClassAVM2Item) { } else if (obj instanceof ClassAVM2Item) {
slotname = ((ClassAVM2Item) obj).className; slotname = ((ClassAVM2Item) obj).className;
} else if (obj instanceof ThisAVM2Item) { } else if (obj instanceof ThisAVM2Item) {
slotname = ((ThisAVM2Item) obj).className; slotname = ((ThisAVM2Item) obj).className;
} else if (obj instanceof ScriptAVM2Item) { } else if (obj instanceof ScriptAVM2Item) {
for (int t = 0; t < abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.size(); t++) { for (int t = 0; t < abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.size(); t++) {
Trait tr = abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.get(t); Trait tr = abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.get(t);
if (tr instanceof TraitWithSlot) { if (tr instanceof TraitWithSlot) {
if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) { if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) {
slotname = tr.getName(abc); slotname = tr.getName(abc);
} }
} }
} }
} else if (obj instanceof NewActivationAVM2Item) { } else if (obj instanceof NewActivationAVM2Item) {
for (int t = 0; t < body.traits.traits.size(); t++) { for (int t = 0; t < body.traits.traits.size(); t++) {
if (body.traits.traits.get(t) instanceof TraitWithSlot) { if (body.traits.traits.get(t) instanceof TraitWithSlot) {
if (((TraitWithSlot) body.traits.traits.get(t)).getSlotIndex() == slotIndex) { if (((TraitWithSlot) body.traits.traits.get(t)).getSlotIndex() == slotIndex) {
slotname = body.traits.traits.get(t).getName(abc); slotname = body.traits.traits.get(t).getName(abc);
} }
} }
} }
} }
if (slotname != null) { if (slotname != null) {
if (value instanceof LocalRegAVM2Item) { if (value instanceof LocalRegAVM2Item) {
LocalRegAVM2Item lr = (LocalRegAVM2Item) value; LocalRegAVM2Item lr = (LocalRegAVM2Item) value;
String slotNameStr = slotname.getName(constants, fullyQualifiedNames); String slotNameStr = slotname.getName(constants, fullyQualifiedNames);
if (localRegNames.containsKey(lr.regIndex)) { if (localRegNames.containsKey(lr.regIndex)) {
if (localRegNames.get(lr.regIndex).equals(slotNameStr)) { if (localRegNames.get(lr.regIndex).equals(slotNameStr)) {
return; //Register with same name to slot return; //Register with same name to slot
} }
} }
} }
} }
if (value.getNotCoerced().getThroughDuplicate() instanceof IncrementAVM2Item) { if (value.getNotCoerced().getThroughDuplicate() instanceof IncrementAVM2Item) {
GraphTargetItem inside = ((IncrementAVM2Item) value.getNotCoerced()).value.getThroughRegister().getNotCoerced().getThroughDuplicate(); GraphTargetItem inside = ((IncrementAVM2Item) value.getNotCoerced()).value.getThroughRegister().getNotCoerced().getThroughDuplicate();
if (inside instanceof GetSlotAVM2Item) { if (inside instanceof GetSlotAVM2Item) {
GetSlotAVM2Item slotItem = (GetSlotAVM2Item) inside; GetSlotAVM2Item slotItem = (GetSlotAVM2Item) inside;
if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister()) if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister())
&& (slotItem.slotName == slotname)) { && (slotItem.slotName == slotname)) {
if (stack.size() > 0) { if (stack.size() > 0) {
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate(); GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
if (top == inside) { if (top == inside) {
stack.pop(); stack.pop();
stack.push(new PostIncrementAVM2Item(ins, inside)); stack.push(new PostIncrementAVM2Item(ins, inside));
} else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) { } else if ((top instanceof IncrementAVM2Item) && (((IncrementAVM2Item) top).value == inside)) {
stack.pop(); stack.pop();
stack.push(new PreIncrementAVM2Item(ins, inside)); stack.push(new PreIncrementAVM2Item(ins, inside));
} else { } else {
output.add(new PostIncrementAVM2Item(ins, inside)); output.add(new PostIncrementAVM2Item(ins, inside));
} }
} else { } else {
output.add(new PostIncrementAVM2Item(ins, inside)); output.add(new PostIncrementAVM2Item(ins, inside));
} }
return; return;
} }
} }
} }
if (value.getNotCoerced().getThroughDuplicate() instanceof DecrementAVM2Item) { if (value.getNotCoerced().getThroughDuplicate() instanceof DecrementAVM2Item) {
GraphTargetItem inside = ((DecrementAVM2Item) value.getNotCoerced()).value.getThroughRegister().getNotCoerced().getThroughDuplicate(); GraphTargetItem inside = ((DecrementAVM2Item) value.getNotCoerced()).value.getThroughRegister().getNotCoerced().getThroughDuplicate();
if (inside instanceof GetSlotAVM2Item) { if (inside instanceof GetSlotAVM2Item) {
GetSlotAVM2Item slotItem = (GetSlotAVM2Item) inside; GetSlotAVM2Item slotItem = (GetSlotAVM2Item) inside;
if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister()) if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister())
&& (slotItem.slotName == slotname)) { && (slotItem.slotName == slotname)) {
if (stack.size() > 0) { if (stack.size() > 0) {
GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate(); GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
if (top == inside) { if (top == inside) {
stack.pop(); stack.pop();
stack.push(new PostDecrementAVM2Item(ins, inside)); stack.push(new PostDecrementAVM2Item(ins, inside));
} else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) { } else if ((top instanceof DecrementAVM2Item) && (((DecrementAVM2Item) top).value == inside)) {
stack.pop(); stack.pop();
stack.push(new PreDecrementAVM2Item(ins, inside)); stack.push(new PreDecrementAVM2Item(ins, inside));
} else { } else {
output.add(new PostDecrementAVM2Item(ins, inside)); output.add(new PostDecrementAVM2Item(ins, inside));
} }
} else { } else {
output.add(new PostDecrementAVM2Item(ins, inside)); output.add(new PostDecrementAVM2Item(ins, inside));
} }
return; return;
} }
} }
} }
output.add(new SetSlotAVM2Item(ins, obj, slotname, value)); output.add(new SetSlotAVM2Item(ins, obj, slotname, value));
} }
@Override @Override
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) { public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
int slotIndex = ins.operands[0]; int slotIndex = ins.operands[0];
////String obj = stack.get(1); ////String obj = stack.get(1);
String slotname = ""; String slotname = "";
for (int t = 0; t < body.traits.traits.size(); t++) { for (int t = 0; t < body.traits.traits.size(); t++) {
if (body.traits.traits.get(t) instanceof TraitSlotConst) { if (body.traits.traits.get(t) instanceof TraitSlotConst) {
if (((TraitSlotConst) body.traits.traits.get(t)).slot_id == slotIndex) { if (((TraitSlotConst) body.traits.traits.get(t)).slot_id == slotIndex) {
slotname = body.traits.traits.get(t).getName(abc).getName(abc.constants, fullyQualifiedNames); slotname = body.traits.traits.get(t).getName(abc).getName(abc.constants, fullyQualifiedNames);
} }
} }
} }
return slotname; return slotname;
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2; return -2;
} }
} }
@@ -1,76 +1,76 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; 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.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.SetSuperAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetSuperAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.LocalData;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class SetSuperIns extends InstructionDefinition implements SetTypeIns { public class SetSuperIns extends InstructionDefinition implements SetTypeIns {
public SetSuperIns() { public SetSuperIns() {
super(0x05, "setsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); super(0x05, "setsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
GraphTargetItem value = (GraphTargetItem) stack.pop(); GraphTargetItem value = stack.pop();
FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins); FullMultinameAVM2Item multiname = resolveMultiname(stack, constants, multinameIndex, ins);
GraphTargetItem obj = (GraphTargetItem) stack.pop(); GraphTargetItem obj = stack.pop();
output.add(new SetSuperAVM2Item(ins, value, obj, multiname)); output.add(new SetSuperAVM2Item(ins, value, obj, multiname));
} }
@Override @Override
public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) throws InterruptedException { public String getObject(Stack<AVM2Item> stack, ABC abc, AVM2Instruction ins, List<AVM2Item> output, MethodBody body, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) throws InterruptedException {
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
String multiname = resolveMultinameNoPop(1, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames); String multiname = resolveMultinameNoPop(1, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames);
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
stack.get(1 + resolvedCount(abc.constants, multinameIndex)).toString(writer, LocalData.create(abc.constants, localRegNames, fullyQualifiedNames)); stack.get(1 + resolvedCount(abc.constants, multinameIndex)).toString(writer, LocalData.create(abc.constants, localRegNames, fullyQualifiedNames));
String obj = writer.toString(); String obj = writer.toString();
return obj + ".super." + multiname; return obj + ".super." + multiname;
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
int ret = -2; int ret = -2;
int multinameIndex = ins.operands[0]; int multinameIndex = ins.operands[0];
if (abc.constants.getMultiname(multinameIndex).needsName()) { if (abc.constants.getMultiname(multinameIndex).needsName()) {
ret--; ret--;
} }
if (abc.constants.getMultiname(multinameIndex).needsNs()) { if (abc.constants.getMultiname(multinameIndex).needsNs()) {
ret--; ret--;
} }
return ret; return ret;
} }
} }
@@ -1,47 +1,47 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other; package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ThrowAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ThrowAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class ThrowIns extends InstructionDefinition { public class ThrowIns extends InstructionDefinition {
public ThrowIns() { public ThrowIns() {
super(0x03, "throw", new int[]{}); super(0x03, "throw", new int[]{});
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
output.add(new ThrowAVM2Item(ins, (GraphTargetItem) stack.pop())); output.add(new ThrowAVM2Item(ins, stack.pop()));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1; return -1;
} }
} }
@@ -1,59 +1,59 @@
/* /*
* Copyright (C) 2010-2014 JPEXS * Copyright (C) 2010-2014 JPEXS
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.stack; package com.jpexs.decompiler.flash.abc.avm2.instructions.stack;
import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.model.DuplicateItem; import com.jpexs.decompiler.graph.model.DuplicateItem;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
public class DupIns extends InstructionDefinition { public class DupIns extends InstructionDefinition {
public DupIns() { public DupIns() {
super(0x2a, "dup", new int[]{}); super(0x2a, "dup", new int[]{});
} }
@Override @Override
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) { public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
Object obj = lda.operandStack.pop(); Object obj = lda.operandStack.pop();
lda.operandStack.push(obj); lda.operandStack.push(obj);
lda.operandStack.push(obj); lda.operandStack.push(obj);
} }
@Override @Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) { public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
GraphTargetItem v = stack.pop(); GraphTargetItem v = stack.pop();
stack.push(v); stack.push(v);
stack.push(new DuplicateItem(ins, v)); stack.push(new DuplicateItem(ins, v));
//v.moreSrc.add(new GraphSourceItemPos(ins, 0)); //v.moreSrc.add(new GraphSourceItemPos(ins, 0));
} }
@Override @Override
public int getStackDelta(AVM2Instruction ins, ABC abc) { public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -1 + 2; return -1 + 2;
} }
} }

Some files were not shown because too many files have changed in this diff Show More