some AS3 instruction executions implemented

This commit is contained in:
2015-11-04 07:49:49 +01:00
parent 45c1cae754
commit 3508a67fc1
126 changed files with 1546 additions and 256 deletions
@@ -32,6 +32,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
import com.jpexs.decompiler.flash.abc.avm2.instructions.DeobfuscatePopIns;
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.UnknownInstruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Lf32Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Lf64Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy.Li16Ins;
@@ -275,6 +276,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
@@ -372,7 +374,7 @@ public class AVM2Code implements Cloneable {
public static final int DAT_DECIMAL_PARAMS = OPT_U30 + 0x13;
public static InstructionDefinition[] instructionSet = new InstructionDefinition[]{
public static final InstructionDefinition[] instructionSet = new InstructionDefinition[]{
/*0x00*/null,
/*0x01*/ new BkptIns(),
/*0x02*/ new NopIns(),
@@ -633,6 +635,14 @@ public class AVM2Code implements Cloneable {
/*0xFF*/ new DecodeIns(),};
// endoflist
static {
for (int i = 0; i < instructionSet.length; i++) {
if (instructionSet[i] == null) {
instructionSet[i] = new UnknownInstruction(i);
}
}
}
public boolean hideTemporaryRegisters = true;
public static final String IDENTOPEN = "/*IDENTOPEN*/";
@@ -642,32 +652,40 @@ public class AVM2Code implements Cloneable {
public AVM2Code() {
}
public Object execute(HashMap<Integer, Object> arguments, AVM2ConstantPool constants) {
public Object execute(HashMap<Integer, Object> arguments, AVM2ConstantPool constants) throws AVM2ExecutionException {
return execute(arguments, constants, AVM2Runtime.UNKNOWN, 0);
}
public Object execute(HashMap<Integer, Object> arguments, AVM2ConstantPool constants, AVM2Runtime runtime, int runtimeVersoin) throws AVM2ExecutionException {
int pos = 0;
LocalDataArea lda = new LocalDataArea();
lda.methodName = "methodName"; // todo: needed for VerifyError exception message
lda.localRegisters = arguments;
try {
while (pos < code.size()) {
AVM2Instruction ins = code.get(pos);
ins.definition.execute(lda, constants, ins);
lda.runtime = runtime;
lda.runtimeVersion = runtimeVersoin;
while (pos < code.size()) {
AVM2Instruction ins = code.get(pos);
if (!ins.definition.execute(lda, constants, ins)) {
return null;
}
if (lda.jump != null) {
if (lda.jump != null) {
try {
pos = adr2pos(lda.jump);
lda.jump = null;
} else {
pos++;
} catch (ConvertException ex) {
throw new AVM2VerifyErrorException(AVM2VerifyErrorException.BRANCH_TARGET_INVALID_INSTRUCTION);
}
if (lda.returnValue != null) {
return lda.returnValue;
}
lda.jump = null;
} else {
pos++;
}
} catch (ConvertException e) {
if (lda.returnValue != null) {
return lda.returnValue;
}
}
return null;
return Undefined.INSTANCE;
}
public void calculateDebugFileLine(ABC abc) {
@@ -12,19 +12,16 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
* License along with this library. */
package com.jpexs.decompiler.flash.abc.avm2;
/**
*
* @author JPEXS
*/
public class TagInstruction extends InstructionDefinition {
public class AVM2ExecutionException extends Exception {
public static final long serialVersionUID = 1L;
public TagInstruction(String tagName) {
super(-1, tagName, new int[0], false /*?*/);
public AVM2ExecutionException(String message) {
super(message);
}
}
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
package com.jpexs.decompiler.flash.abc.avm2;
/**
*
* @author JPEXS
*/
public enum AVM2Runtime {
UNKNOWN, ADOBE_FLASH
}
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
package com.jpexs.decompiler.flash.abc.avm2;
/**
*
* @author JPEXS
*/
public class AVM2TypeErrorException extends AVM2ExecutionException {
public AVM2TypeErrorException(int code) {
super(codeToMessage(code, null));
}
public AVM2TypeErrorException(int code, Object[] params) {
super(codeToMessage(code, params));
}
private static String codeToMessage(int code, Object[] params) {
String msg = null;
switch (code) {
}
String result = "TypeError: Error #" + code;
/*if (msg != null) {
result += ": " + msg;
}*/
return result;
}
}
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
package com.jpexs.decompiler.flash.abc.avm2;
/**
*
* @author JPEXS
*/
public class AVM2VerifyErrorException extends AVM2ExecutionException {
public static final int ILLEGAL_OPCODE = 1011;
public static final int BRANCH_TARGET_INVALID_INSTRUCTION = 1021;
public AVM2VerifyErrorException(int code) {
super(codeToMessage(code, null));
}
public AVM2VerifyErrorException(int code, Object[] params) {
super(codeToMessage(code, params));
}
private static String codeToMessage(int code, Object[] params) {
String msg = null;
switch (code) {
case ILLEGAL_OPCODE:
msg = "Method " + params[0] + " contained illegal opcode " + params[1] + " at offset " + params[2] + ".";
break;
case 1014:
msg = "class could not be found";
break;
case 1021:
msg = "At least one branch target was not on a valid instruction in the method.";
break;
case 1030:
msg = "Stack depth is unbalanced";
break;
}
String result = "VerifyError: Error #" + code;
/*if (msg != null) {
result += ": " + msg;
}*/
return result;
}
}
@@ -21,6 +21,8 @@ import java.util.Stack;
public class LocalDataArea {
public String methodName;
public Stack<Object> operandStack = new Stack<>();
public Stack<Object> scopeStack = new Stack<>();
@@ -33,6 +35,23 @@ public class LocalDataArea {
public String executionException;
public AVM2Runtime runtime;
public int runtimeVersion;
private byte[] domainMemory;
public LocalDataArea() {
}
public byte[] getDomainMemory() {
if (domainMemory == null) {
domainMemory = new byte[1024 * 1024];
}
return domainMemory;
}
public void clear() {
operandStack.clear();
scopeStack.clear();
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2VerifyErrorException;
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.DecLocalIns;
@@ -87,11 +89,15 @@ public abstract class InstructionDefinition implements Serializable {
return s.toString();
}
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
//throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented");
return false;
}
protected void illegalOpCode(LocalDataArea lda, AVM2Instruction ins) throws AVM2VerifyErrorException {
throw new AVM2VerifyErrorException(AVM2VerifyErrorException.ILLEGAL_OPCODE, new Object[]{lda.methodName, instructionCode, ins.getOffset()});
}
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) throws InterruptedException {
}
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
/**
*
* @author JPEXS
*/
public class UnknownInstruction extends InstructionDefinition {
public UnknownInstruction(int instructionCode) {
super(instructionCode, "instruction_" + Integer.toString(instructionCode), new int[0], false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
illegalOpCode(lda, ins);
return false;
}
}
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Lf32Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x38, "lf32", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: get 32 bits float
lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr]));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Lf64Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x39, "lf64", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: get 64 bits float
lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr]));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Li16Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x36, "li16", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: get 16 bits
lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr]));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Li32Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x37, "li32", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: get 32 bits
lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr]));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyLoadAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,13 @@ public class Li8Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x35, "li8", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
lda.operandStack.push((Double) (double) (lda.getDomainMemory()[addr]));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyStoreAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,15 @@ public class Sf32Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x3D, "sf32", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) EcmaScript.toNumber(lda.operandStack.pop());
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: set domainMemory
//lda.getDomainMemory()[addr] = ...
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyStoreAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,15 @@ public class Sf64Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x3E, "sf64", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) EcmaScript.toNumber(lda.operandStack.pop());
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: set domainMemory
//lda.getDomainMemory()[addr] = ...
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyStoreAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,15 @@ public class Si16Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x3B, "si16", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) EcmaScript.toNumber(lda.operandStack.pop());
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: set domainMemory
//lda.getDomainMemory()[addr] = ...
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyStoreAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,15 @@ public class Si32Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x3C, "si32", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) EcmaScript.toNumber(lda.operandStack.pop());
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: set domainMemory
//lda.getDomainMemory()[addr] = ...
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemyStoreAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,15 @@ public class Si8Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x3A, "si8", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) EcmaScript.toNumber(lda.operandStack.pop());
int addr = (int) (double) EcmaScript.toNumber(lda.operandStack.pop());
// todo: set domainMemory
//lda.getDomainMemory()[addr] = ...
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem ofs = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemySignExtendAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Sxi16Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x52, "sxi16", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) (((int) (double) EcmaScript.toNumber(lda.operandStack.pop())) & 0xffff);
// todo: extend value to 32 bits
lda.operandStack.push(value);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem value = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemySignExtendAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Sxi1Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x50, "sxi1", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) (((int) (double) EcmaScript.toNumber(lda.operandStack.pop())) & 1);
// todo: extend value to 32 bits
lda.operandStack.push(value);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem value = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.alchemy;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.AlchemySignExtendAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,6 +38,14 @@ public class Sxi8Ins extends InstructionDefinition implements AlchemyTypeIns {
super(0x51, "sxi8", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double value = (double) (((int) (double) EcmaScript.toNumber(lda.operandStack.pop())) & 0xff);
// todo: extend value to 32 bits
lda.operandStack.push(value);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem value = stack.pop();
@@ -23,6 +23,8 @@ 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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.ecma.EcmaType;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,24 +37,16 @@ public class AddIns extends InstructionDefinition {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = ((Long) o1) + ((Long) o2);
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = ((Double) o1) + ((Double) o2);
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = ((Long) o1) + ((Double) o2);
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = ((Double) o1) + ((Long) o2);
Object right = lda.operandStack.pop();
Object left = lda.operandStack.pop();
if (EcmaScript.type(left) == EcmaType.STRING || EcmaScript.type(right) == EcmaType.STRING) {
String ret = EcmaScript.toString(left) + EcmaScript.toString(right);
lda.operandStack.push(ret);
} else {
String s = o1.toString() + o2.toString();
lda.operandStack.push(s);
Double ret = EcmaScript.toNumber(left) + EcmaScript.toNumber(right);
lda.operandStack.push(ret);
}
return true;
}
@@ -23,6 +23,7 @@ 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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -36,20 +37,7 @@ public class DecrementIIns extends InstructionDefinition {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj) - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj) - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
lda.executionException = "Cannot decrement local register";
return false;
}
lda.operandStack.push(EcmaScript.toNumber(obj) - 1);
return true;
}
@@ -23,6 +23,7 @@ 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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -36,20 +37,7 @@ public class DecrementIns extends InstructionDefinition {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj) - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj) - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
lda.executionException = "Cannot decrement local register";
return false;
}
lda.operandStack.push(EcmaScript.toInt32(obj) - 1);
return true;
}
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,13 @@ public class IncrementIIns extends InstructionDefinition {
super(0xc0, "increment_i", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object obj = lda.operandStack.pop();
lda.operandStack.push(EcmaScript.toInt32(obj) + 1);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
stack.push(new IncrementAVM2Item(ins, stack.pop()));
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,13 @@ public class IncrementIns extends InstructionDefinition {
super(0x91, "increment", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object obj = lda.operandStack.pop();
lda.operandStack.push(EcmaScript.toNumber(obj) + 1);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
stack.push(new IncrementAVM2Item(ins, stack.pop()));
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.NegAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,13 @@ public class NegateIIns extends InstructionDefinition {
super(0xc4, "negate_i", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
lda.operandStack.push(-EcmaScript.toInt32(value));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.NegAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,13 @@ public class NegateIns extends InstructionDefinition {
super(0x90, "negate", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
lda.operandStack.push(-EcmaScript.toNumber(value));
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v = stack.pop();
@@ -18,8 +18,11 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -30,6 +33,13 @@ public class NotIns extends InstructionDefinition {
super(0x96, "not", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
boolean value = EcmaScript.toBoolean(lda.operandStack.pop());
lda.operandStack.push(!value);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,16 @@ public class SubtractIns extends InstructionDefinition {
super(0xa1, "subtract", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object right = lda.operandStack.pop();
Object left = lda.operandStack.pop();
Double ret = EcmaScript.toNumber(left) - EcmaScript.toNumber(right);
lda.operandStack.push(ret);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -23,6 +23,7 @@ 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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.BitNotAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -35,9 +36,8 @@ public class BitNotIns extends InstructionDefinition {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Long value = (Long) lda.operandStack.pop();
Long ret = -value;
lda.operandStack.push(ret);
int value = EcmaScript.toInt32(lda.operandStack.pop());
lda.operandStack.push(~value);
return true;
}
@@ -23,6 +23,7 @@ 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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.EqAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -37,7 +38,7 @@ public class EqualsIns extends InstructionDefinition {
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop();
Boolean res = obj1.equals(obj2);
boolean res = EcmaScript.equals(obj1, obj2);
lda.operandStack.push(res);
return true;
}
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GeAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,14 @@ public class GreaterEqualsIns extends InstructionDefinition {
super(0xb0, "greaterequals", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
lda.operandStack.push(left >= right);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.GtAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,14 @@ public class GreaterThanIns extends InstructionDefinition {
super(0xaf, "greaterthan", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
lda.operandStack.push(left > right);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LeAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,14 @@ public class LessEqualsIns extends InstructionDefinition {
super(0xae, "lessequals", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
lda.operandStack.push(left <= right);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.LtAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,14 @@ public class LessThanIns extends InstructionDefinition {
super(0xad, "lessthan", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
lda.operandStack.push(left < right);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.StrictEqAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +34,15 @@ public class StrictEqualsIns extends InstructionDefinition {
super(0xac, "strictequals", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop();
boolean res = EcmaScript.strictEquals(obj1, obj2);
lda.operandStack.push(res);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.NeqAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfEqIns extends InstructionDefinition implements IfTypeIns {
super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (left == right) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -24,6 +24,7 @@ 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.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -37,7 +38,7 @@ public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Boolean b = (Boolean) lda.operandStack.pop();
boolean b = EcmaScript.toBoolean(lda.operandStack.pop());
if (b == false) {
lda.jump = ins.getParamAsLong(constants, 0);
}
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LtAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfGeIns extends InstructionDefinition implements IfTypeIns {
super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (left >= right) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LeAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfGtIns extends InstructionDefinition implements IfTypeIns {
super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (left > right) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LeAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfLeIns extends InstructionDefinition implements IfTypeIns {
super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (left <= right) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LtAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfLtIns extends InstructionDefinition implements IfTypeIns {
super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (left < right) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LtAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (!(left >= right)) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LeAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (!(left > right)) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LeAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (!(left <= right)) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.LtAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (!(left < right)) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.NeqAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfNeIns extends InstructionDefinition implements IfTypeIns {
super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Double right = EcmaScript.toNumber(lda.operandStack.pop());
Double left = EcmaScript.toNumber(lda.operandStack.pop());
if (left != right) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.StrictNeqAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object rightObj = lda.operandStack.pop();
Object leftObj = lda.operandStack.pop();
if (EcmaScript.strictEquals(leftObj, rightObj)) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -19,11 +19,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.jumps;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.IfTypeIns;
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.StrictNeqAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -35,6 +38,18 @@ public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object rightObj = lda.operandStack.pop();
Object leftObj = lda.operandStack.pop();
if (!EcmaScript.strictEquals(leftObj, rightObj)) {
lda.jump = ins.getParamAsLong(constants, 0);
}
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
GraphTargetItem v2 = stack.pop();
@@ -24,6 +24,7 @@ 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.IfTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
@@ -37,7 +38,7 @@ public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Boolean b = (Boolean) lda.operandStack.pop();
boolean b = EcmaScript.toBoolean(lda.operandStack.pop());
if (b == true) {
lda.jump = ins.getParamAsLong(constants, 0);
}
@@ -25,6 +25,7 @@ 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.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -39,20 +40,7 @@ public class DecLocalIIns extends InstructionDefinition {
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int locRegIndex = ins.getParamAsLong(constants, 0).intValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else {
lda.executionException = "Cannot decrement local register";
return false;
}
lda.localRegisters.put(locRegIndex, EcmaScript.toInt32(obj) - 1);
return true;
}
@@ -25,6 +25,7 @@ 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.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -39,20 +40,7 @@ public class DecLocalIns extends InstructionDefinition {
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int locRegIndex = ins.getParamAsLong(constants, 0).intValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.put(locRegIndex, obj2);
} else {
lda.executionException = "Cannot decrement local register";
return false;
}
lda.localRegisters.put(locRegIndex, EcmaScript.toNumber(obj) - 1);
return true;
}
@@ -16,8 +16,6 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
public class GetLocal0Ins extends GetLocalTypeIns {
@@ -26,12 +24,6 @@ public class GetLocal0Ins extends GetLocalTypeIns {
super(0xd0, "getlocal_0", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.operandStack.push(lda.localRegisters.get(0));
return true;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 0;
@@ -16,8 +16,6 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
public class GetLocal1Ins extends GetLocalTypeIns {
@@ -26,12 +24,6 @@ public class GetLocal1Ins extends GetLocalTypeIns {
super(0xd1, "getlocal_1", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.operandStack.push(lda.localRegisters.get(1));
return true;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 1;
@@ -16,8 +16,6 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
public class GetLocal2Ins extends GetLocalTypeIns {
@@ -26,12 +24,6 @@ public class GetLocal2Ins extends GetLocalTypeIns {
super(0xd2, "getlocal_2", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.operandStack.push(lda.localRegisters.get(2));
return true;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 2;
@@ -16,8 +16,6 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
public class GetLocal3Ins extends GetLocalTypeIns {
@@ -26,12 +24,6 @@ public class GetLocal3Ins extends GetLocalTypeIns {
super(0xd3, "getlocal_3", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.operandStack.push(lda.localRegisters.get(3));
return true;
}
@Override
public int getRegisterId(AVM2Instruction par0) {
return 3;
@@ -17,8 +17,6 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
public class GetLocalIns extends GetLocalTypeIns {
@@ -27,12 +25,6 @@ public class GetLocalIns extends GetLocalTypeIns {
super(0x62, "getlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.operandStack.push(lda.localRegisters.get(ins.getParamAsLong(constants, 0).intValue()));
return true;
}
@Override
public int getRegisterId(AVM2Instruction ins) {
return ins.operands[0];
@@ -18,12 +18,15 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.NotCompileTimeItem;
import com.jpexs.decompiler.graph.TranslateStack;
@@ -35,6 +38,13 @@ public abstract class GetLocalTypeIns extends InstructionDefinition {
super(instructionCode, instructionName, operands, canThrow);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.localRegisters.get(getRegisterId(ins));
lda.operandStack.push(value == null ? Undefined.INSTANCE : value);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
@@ -18,11 +18,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
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.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -33,6 +36,14 @@ public class IncLocalIIns extends InstructionDefinition {
super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int locRegIndex = ins.getParamAsLong(constants, 0).intValue();
Object obj = lda.localRegisters.get(locRegIndex);
lda.localRegisters.put(locRegIndex, EcmaScript.toInt32(obj) + 1);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
int regId = ins.operands[0];
@@ -18,11 +18,14 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
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.operations.AddAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -33,6 +36,14 @@ public class IncLocalIns extends InstructionDefinition {
super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
int locRegIndex = ins.getParamAsLong(constants, 0).intValue();
Object obj = lda.localRegisters.get(locRegIndex);
lda.localRegisters.put(locRegIndex, EcmaScript.toNumber(obj) - 1);
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
int regId = ins.operands[0];
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.localregs;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.SetTypeIns;
@@ -47,6 +48,12 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S
super(instructionCode, instructionName, operands, canThrow);
}
@Override
public boolean execute(com.jpexs.decompiler.flash.abc.avm2.LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.localRegisters.put(getRegisterId(ins), lda.operandStack.pop());
return true;
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
int regId = getRegisterId(ins);
@@ -41,7 +41,6 @@ public class GetDescendantsIns extends InstructionDefinition {
//if is runtime
//pop(name), pop(ns)
Object obj = lda.operandStack.pop();*/
lda.executionException = "getdescendants not working";
return false;
}
@@ -36,7 +36,6 @@ public class GetGlobalScopeIns extends InstructionDefinition {
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
lda.executionException = "getglobalscope not working";
return false;
}
@@ -18,9 +18,13 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.ThrowAVM2Item;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -31,6 +35,12 @@ public class ThrowIns extends InstructionDefinition {
super(0x03, "throw", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
String msg = EcmaScript.toString(lda.operandStack.pop());
throw new AVM2ExecutionException(msg);
}
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
output.add(new ThrowAVM2Item(ins, stack.pop()));
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class AbsJumpIns extends InstructionDefinition {
super(0xEE, "abs_jump", new int[]{}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class AddDIns extends InstructionDefinition {
super(0x9B, "add_d", new int[]{}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 2; // ?
@@ -17,6 +17,11 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class AddPIns extends InstructionDefinition {
@@ -24,4 +29,13 @@ public class AddPIns extends InstructionDefinition {
public AddPIns() {
super(0xB5, "add_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class AllocIns extends InstructionDefinition {
super(0xF6, "alloc", new int[]{}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -16,6 +16,10 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
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.InstructionDefinition;
public class BkptIns extends InstructionDefinition {
@@ -23,4 +27,10 @@ public class BkptIns extends InstructionDefinition {
public BkptIns() {
super(0x01, "bkpt", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
// do nothing
return true;
}
}
@@ -17,6 +17,11 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class CallInterfaceIns extends InstructionDefinition {
@@ -24,4 +29,13 @@ public class CallInterfaceIns extends InstructionDefinition {
public CallInterfaceIns() {
super(0x4D, "callinterface", new int[]{AVM2Code.OPT_U30}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -16,6 +16,11 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class CallSuperIdIns extends InstructionDefinition {
@@ -23,4 +28,13 @@ public class CallSuperIdIns extends InstructionDefinition {
public CallSuperIdIns() {
super(0x4B, "callsuperid", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class CodeGenOpIns extends InstructionDefinition {
super(0xFD, "codegenop", new int[]{}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -18,9 +18,11 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceOrConvertTypeIns;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
@@ -31,6 +33,13 @@ public class CoerceBIns extends InstructionDefinition implements CoerceOrConvert
super(0x81, "coerce_b", new int[]{}, true); // stack: -1+1
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
lda.operandStack.push(EcmaScript.toBoolean(value));
return true;
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -18,9 +18,11 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceOrConvertTypeIns;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
@@ -31,6 +33,13 @@ public class CoerceDIns extends InstructionDefinition implements CoerceOrConvert
super(0x84, "coerce_d", new int[]{}, true); // stack: -1+1
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
lda.operandStack.push(EcmaScript.toNumber(value));
return true;
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -18,9 +18,11 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceOrConvertTypeIns;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
@@ -31,6 +33,13 @@ public class CoerceIIns extends InstructionDefinition implements CoerceOrConvert
super(0x83, "coerce_i", new int[]{}, true); // stack: -1+1
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
lda.operandStack.push(EcmaScript.toInt32(value));
return true;
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceOrConvertTypeIns;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
@@ -31,6 +34,18 @@ public class CoerceOIns extends InstructionDefinition implements CoerceOrConvert
super(0x89, "coerce_o", new int[]{}, true); // stack: -1+1
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
// The only action appears to be to convert undefined to null.
if (value instanceof Undefined) {
value = Null.INSTANCE;
}
lda.operandStack.push(value);
return true;
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -18,9 +18,11 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
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.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceOrConvertTypeIns;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
@@ -31,6 +33,13 @@ public class CoerceUIns extends InstructionDefinition implements CoerceOrConvert
super(0x88, "coerce_u", new int[]{}, true); // stack: -1+1
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
Object value = lda.operandStack.pop();
lda.operandStack.push(EcmaScript.toUint32(value));
return true;
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class ConcatIns extends InstructionDefinition {
super(0x9A, "concat", new int[]{}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 2; // ?
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class ConvertF4Ins extends InstructionDefinition {
super(0x7B, "convert_f4", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class ConvertMIns extends InstructionDefinition {
super(0x79, "convert_m", new int[]{}, true); // -1 +1
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 1;
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class ConvertMPIns extends InstructionDefinition {
super(0x7A, "convert_m_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -17,6 +17,11 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class DecLocalPIns extends InstructionDefinition {
@@ -24,4 +29,13 @@ public class DecLocalPIns extends InstructionDefinition {
public DecLocalPIns() {
super(0x9F, "declocal_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS, AVM2Code.DAT_REGISTER_INDEX}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class DecodeIns extends InstructionDefinition {
super(0xFF, "decode", new int[]{}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -17,6 +17,11 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class DecrementPIns extends InstructionDefinition {
@@ -24,4 +29,13 @@ public class DecrementPIns extends InstructionDefinition {
public DecrementPIns() {
super(0x9E, "decrement_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class DelDescendantsIns extends InstructionDefinition {
super(0x5B, "deldescendants", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class DeletePropertyLateIns extends InstructionDefinition {
super(0x6B, "deletepropertylate", new int[]{}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class DividePIns extends InstructionDefinition {
super(0xB8, "divide_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 2; // ?
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class DoubleToAtomIns extends InstructionDefinition {
super(0xFB, "doubletoatom", new int[]{}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class FindPropGlobalIns extends InstructionDefinition {
super(0x5C, "findpropglobal", new int[]{AVM2Code.DAT_MULTINAME_INDEX}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -17,6 +17,11 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class IncLocalPIns extends InstructionDefinition {
@@ -24,4 +29,13 @@ public class IncLocalPIns extends InstructionDefinition {
public IncLocalPIns() {
super(0x9D, "inclocal_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS, AVM2Code.DAT_REGISTER_INDEX}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -17,6 +17,11 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class IncrementPIns extends InstructionDefinition {
@@ -24,4 +29,13 @@ public class IncrementPIns extends InstructionDefinition {
public IncrementPIns() {
super(0x9C, "increment_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -16,6 +16,11 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class InvalidIns extends InstructionDefinition {
@@ -23,4 +28,13 @@ public class InvalidIns extends InstructionDefinition {
public InvalidIns() {
super(0xED, "invalid", new int[]{}, false);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -16,6 +16,11 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
public class Lf32x4Ins extends InstructionDefinition {
@@ -23,4 +28,13 @@ public class Lf32x4Ins extends InstructionDefinition {
public Lf32x4Ins() {
super(0x0A, "lf32x4", new int[]{}, true);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
}
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class MarkIns extends InstructionDefinition {
super(0xF7, "mark", new int[]{}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class ModuloPIns extends InstructionDefinition {
super(0xB9, "modulo_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 2; // ?
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class MultiplyPIns extends InstructionDefinition {
super(0xB7, "multiply_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
return 2; // ?
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class NegatePIns extends InstructionDefinition {
super(0x8F, "negate_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}, true /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -17,6 +17,10 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -26,6 +30,15 @@ public class PrologueIns extends InstructionDefinition {
super(0xF9, "prologue", new int[]{}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPopCount(AVM2Instruction ins, ABC abc) {
throw new UnsupportedOperationException();
@@ -18,6 +18,10 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ExecutionException;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
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.InstructionDefinition;
@@ -27,6 +31,15 @@ public class PushConstantIns extends InstructionDefinition {
super(0x22, "pushconstant", new int[]{AVM2Code.DAT_STRING_INDEX}, false /*?*/);
}
@Override
public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2ExecutionException {
if (lda.runtime == AVM2Runtime.ADOBE_FLASH) {
illegalOpCode(lda, ins);
}
return super.execute(lda, constants, ins);
}
@Override
public int getStackPushCount(AVM2Instruction ins, ABC abc) {
return 1; // ?

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