removed some unused fields from AVM2Instruction

This commit is contained in:
honfika@gmail.com
2014-09-05 19:21:30 +02:00
parent 887c243bc2
commit e35c21ee8c
51 changed files with 186 additions and 144 deletions

View File

@@ -790,7 +790,6 @@ public class AVM2Code implements Serializable {
while (ais.available() > 0) {
DumpInfo di = ais.newDumpLevel("instruction", "instruction");
long startOffset = ais.getPosition();
ais.startBuffer();
int instructionCode = ais.read("instructionCode");
InstructionDefinition instr = instructionSetByCode[instructionCode];
if (di != null) {
@@ -827,7 +826,7 @@ public class AVM2Code implements Serializable {
}
}
code.add(new AVM2Instruction(startOffset, instr, actualOperands, ais.stopBuffer()));
code.add(new AVM2Instruction(startOffset, instr, actualOperands));
ais.endDumpLevel(instr.instructionCode);
} else {
ais.endDumpLevel();
@@ -1077,9 +1076,7 @@ public class AVM2Code implements Serializable {
writer.appendNoHilight(Helper.bytesToHexString(ins.getBytes()));
writer.newLine();
}
if (ins.labelname != null) {
writer.appendNoHilight(ins.labelname + ":");
} else if (Configuration.showAllAddresses.get() || offsets.contains(ofs)) {
if (Configuration.showAllAddresses.get() || offsets.contains(ofs)) {
writer.appendNoHilight("ofs" + Helper.formatAddress(ofs) + ":");
}
/*for (int e = 0; e < body.exceptions.length; e++) {

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.BaseLocalData;
@@ -44,18 +45,15 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
public InstructionDefinition definition;
public int[] operands;
public long offset;
public long offset;
public String comment;
public boolean ignored = false;
public boolean ignored = false;
public long mappedOffset = -1;
public int changeJumpTo = -1;
public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands) {
this.definition = definition;
this.operands = operands;
this.offset = offset;
this.offset = offset;
}
public byte[] getBytes() {

View File

@@ -117,7 +117,7 @@ public abstract class AVM2Item extends GraphTargetItem {
return toSource(localData, generator);
}
List<GraphSourceItem> ret = toSource(localData, generator);
ret.add(new AVM2Instruction(0, new PopIns(), new int[]{}, new byte[0]));
ret.add(new AVM2Instruction(0, new PopIns(), new int[]{}));
return ret;
}
@@ -133,7 +133,7 @@ public abstract class AVM2Item extends GraphTargetItem {
opArr[i] = ops.get(i);
}
return new AVM2Instruction(0, def, opArr, new byte[0]);
return new AVM2Instruction(0, def, opArr);
}
public static int getFreeRegister(SourceGeneratorLocalData localData, SourceGenerator generator) {

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -56,7 +57,7 @@ public class BooleanAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, value ? new PushTrueIns() : new PushFalseIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -60,7 +61,7 @@ public class CallPropertyAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, receiver, arguments,
return toSourceMerge(localData, generator, receiver, arguments,
new AVM2Instruction(0, new CallPropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName), arguments.size()})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -112,26 +113,26 @@ public class CoerceAVM2Item extends AVM2Item {
AVM2Instruction ins;
switch (typeObj.toString()) {
case "*":
case "*":
ins = new AVM2Instruction(0, new CoerceAIns(), new int[]{});
break;
case "String":
case "String":
ins = new AVM2Instruction(0, new CoerceSIns(), new int[]{});
break;
case "Boolean":
case "Boolean":
ins = new AVM2Instruction(0, new ConvertBIns(), new int[]{});
break;
case "int":
case "int":
ins = new AVM2Instruction(0, new ConvertIIns(), new int[]{});
break;
case "uint":
case "uint":
ins = new AVM2Instruction(0, new ConvertUIns(), new int[]{});
break;
case "Number":
case "Number":
ins = new AVM2Instruction(0, new ConvertDIns(), new int[]{});
break;
default:
int type_index = AVM2SourceGenerator.resolveType(localData, typeObj, ((AVM2SourceGenerator) generator).abc, (((AVM2SourceGenerator) generator).allABCs));
int type_index = AVM2SourceGenerator.resolveType(localData, typeObj, ((AVM2SourceGenerator) generator).abc, (((AVM2SourceGenerator) generator).allABCs));
ins = new AVM2Instruction(0, new CoerceIns(), new int[]{type_index});
break;
}
return toSourceMerge(localData, generator, value, ins);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -68,7 +69,7 @@ public class ConstructSuperAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, object, args,
return toSourceMerge(localData, generator, object, args,
new AVM2Instruction(0, new ConstructSuperIns(), new int[]{args.size()})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -56,7 +57,7 @@ public class FloatValueAVM2Item extends NumberValueAVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, new PushDoubleIns(), new int[]{((AVM2SourceGenerator) generator).abc.constants.getDoubleId(value, true)})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -47,7 +48,7 @@ public class GetPropertyAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, object,
return toSourceMerge(localData, generator, object,
new AVM2Instruction(0, new GetPropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName)})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -59,11 +60,11 @@ public class IntegerValueAVM2Item extends NumberValueAVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
AVM2Instruction ins = null;
if (value >= -128 && value <= 127) {
if (value >= -128 && value <= 127) {
ins = new AVM2Instruction(0, new PushByteIns(), new int[]{(int) (long) value});
} else if (value >= -32768 && value <= 32767) {
} else if (value >= -32768 && value <= 32767) {
ins = new AVM2Instruction(0, new PushShortIns(), new int[]{((int) (long) value) & 0xffff});
} else {
} else {
ins = new AVM2Instruction(0, new PushIntIns(), new int[]{((AVM2SourceGenerator) generator).abc.constants.getIntId(value, true)});
}
return toSourceMerge(localData, generator, ins);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -92,19 +93,19 @@ public class LocalRegAVM2Item extends AVM2Item {
AVM2Instruction ins;
switch (regIndex) {
case 0:
case 0:
ins = new AVM2Instruction(0, new GetLocal0Ins(), new int[]{});
break;
case 1:
case 1:
ins = new AVM2Instruction(0, new GetLocal1Ins(), new int[]{});
break;
case 2:
case 2:
ins = new AVM2Instruction(0, new GetLocal2Ins(), new int[]{});
break;
case 3:
case 3:
ins = new AVM2Instruction(0, new GetLocal3Ins(), new int[]{});
break;
default:
default:
ins = new AVM2Instruction(0, new GetLocalIns(), new int[]{regIndex});
break;
}
return toSourceMerge(localData, generator, ins);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class NanAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, new PushNanIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -61,7 +62,7 @@ public class NewArrayAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, values,
return toSourceMerge(localData, generator, values,
new AVM2Instruction(0, new NewArrayIns(), new int[]{values.size()})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -78,7 +79,7 @@ public class NewObjectAVM2Item extends AVM2Item {
args.add(p.value);
}
return toSourceMerge(localData, generator, args,
return toSourceMerge(localData, generator, args,
new AVM2Instruction(0, new NewObjectIns(), new int[]{pairs.size()})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -53,7 +54,7 @@ public class NullAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, new PushNullIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -70,23 +71,23 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig
AVM2Instruction ins;
switch (regIndex) {
case 0:
case 0:
ins = new AVM2Instruction(0, new SetLocal0Ins(), new int[]{});
break;
case 1:
case 1:
ins = new AVM2Instruction(0, new SetLocal1Ins(), new int[]{});
break;
case 2:
case 2:
ins = new AVM2Instruction(0, new SetLocal2Ins(), new int[]{});
break;
case 3:
case 3:
ins = new AVM2Instruction(0, new SetLocal3Ins(), new int[]{});
break;
default:
default:
ins = new AVM2Instruction(0, new SetLocalIns(), new int[]{regIndex});
break;
}
return toSourceMerge(localData, generator, value,
return toSourceMerge(localData, generator, value,
new AVM2Instruction(0, new DupIns(), new int[]{}), ins);
}
@Override
@@ -94,19 +95,19 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig
AVM2Instruction ins;
switch (regIndex) {
case 0:
case 0:
ins = new AVM2Instruction(0, new SetLocal0Ins(), new int[]{});
break;
case 1:
case 1:
ins = new AVM2Instruction(0, new SetLocal1Ins(), new int[]{});
break;
case 2:
case 2:
ins = new AVM2Instruction(0, new SetLocal2Ins(), new int[]{});
break;
case 3:
case 3:
ins = new AVM2Instruction(0, new SetLocal3Ins(), new int[]{});
break;
default:
default:
ins = new AVM2Instruction(0, new SetLocalIns(), new int[]{regIndex});
break;
}
return toSourceMerge(localData, generator, value, ins);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -73,7 +74,7 @@ public class SetPropertyAVM2Item extends AVM2Item implements SetTypeAVM2Item, As
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, object, value,
return toSourceMerge(localData, generator, object, value,
new AVM2Instruction(0, new SetPropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName)})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -57,7 +58,7 @@ public class StringAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, new PushStringIns(), new int[]{((AVM2SourceGenerator) generator).str(value)})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -49,7 +50,7 @@ public class ThisAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -63,7 +64,7 @@ public class UndefinedAVM2Item extends AVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, new PushUndefinedIns(), new int[]{})
);
}
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -74,12 +75,12 @@ public class AddAVM2Item extends BinaryOpItem {
IntegerValueAVM2Item iv = (IntegerValueAVM2Item) rightSide;
if (iv.value == 1) {
return toSourceMerge(localData, generator, leftSide,
return toSourceMerge(localData, generator, leftSide,
new AVM2Instruction(0, new IncrementIns(), new int[]{})
);
}
}
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new AddIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -34,7 +35,7 @@ public class AsTypeAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new AsTypeLateIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class BitAndAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new BitAndIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class BitNotAVM2Item extends UnaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, value,
return toSourceMerge(localData, generator, value,
new AVM2Instruction(0, new BitNotIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class BitOrAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new BitOrIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class BitXorAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new BitXorIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -68,7 +69,7 @@ public class DivideAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new DivideIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -60,7 +61,7 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new EqualsIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -67,7 +68,7 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new GreaterEqualsIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -60,7 +61,7 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new GreaterThanIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -35,7 +36,7 @@ public class InAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new InIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -35,7 +36,7 @@ public class InstanceOfAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new InstanceOfIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -35,7 +36,7 @@ public class IsTypeAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new IsTypeLateIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class LShiftAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new LShiftIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -67,7 +68,7 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new LessEqualsIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -60,7 +61,7 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new LessThanIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -68,7 +69,7 @@ public class ModuloAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new ModuloIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -65,7 +66,7 @@ public class MultiplyAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new MultiplyIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class NegAVM2Item extends UnaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, value,
return toSourceMerge(localData, generator, value,
new AVM2Instruction(0, new NegateIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -61,8 +62,8 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondit
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new EqualsIns(), new int[]{}, new byte[0]),
new AVM2Instruction(0, new EqualsIns(), new int[]{}),
new AVM2Instruction(0, new NotIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class RShiftAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new RShiftIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -63,7 +64,7 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfC
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new StrictEqualsIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -64,8 +65,8 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, If
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new StrictEqualsIns(), new int[]{}, new byte[0]),
new AVM2Instruction(0, new StrictEqualsIns(), new int[]{}),
new AVM2Instruction(0, new NotIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -71,12 +72,12 @@ public class SubtractAVM2Item extends BinaryOpItem {
IntegerValueAVM2Item iv = (IntegerValueAVM2Item) rightSide;
if (iv.value == 1) {
return toSourceMerge(localData, generator, leftSide,
return toSourceMerge(localData, generator, leftSide,
new AVM2Instruction(0, new DecrementIns(), new int[]{})
);
}
}
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new SubtractIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -70,7 +71,7 @@ public class TypeOfAVM2Item extends UnaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, value,
return toSourceMerge(localData, generator, value,
new AVM2Instruction(0, new TypeOfIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -41,7 +42,7 @@ public class URShiftAVM2Item extends BinaryOpItem {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSourceMerge(localData, generator, leftSide, rightSide,
return toSourceMerge(localData, generator, leftSide, rightSide,
new AVM2Instruction(0, new URShiftIns(), new int[]{})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.pcode;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
@@ -881,14 +882,14 @@ public class ASM3Parser {
for (int i = 0; i < operandsList.size(); i++) {
operands[i] = operandsList.get(i);
}
}
lastIns = new AVM2Instruction(offset, def, operands);
code.code.add(lastIns);
offset += lastIns.getBytes().length;
break;
}
}
if (symb.value.toString().toLowerCase().equals("ffdec_deobfuscatepop")) {
if (symb.value.toString().toLowerCase().equals("ffdec_deobfuscatepop")) {
lastIns = new AVM2Instruction(offset, new DeobfuscatePopIns(), new int[0]);
code.code.add(lastIns);
offset += lastIns.getBytes().length;
insFound = true;

View File

@@ -150,7 +150,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
public static final int MARK_E_FINALLYPART = 3;
private AVM2Instruction ins(InstructionDefinition def, int... operands) {
return new AVM2Instruction(0, def, operands, new byte[0]);
return new AVM2Instruction(0, def, operands);
}
public List<GraphSourceItem> generate(SourceGeneratorLocalData localData, GetDescendantsAVM2Item item) throws CompilationException {
@@ -635,7 +635,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
cases.addAll(0, preCases);
AVM2Instruction lookupOp = new AVM2Instruction(0, new LookupSwitchIns(), new int[item.caseValues.size() + 1 + 1 + 1], new byte[0]);
AVM2Instruction lookupOp = new AVM2Instruction(0, new LookupSwitchIns(), new int[item.caseValues.size() + 1 + 1 + 1]);
cases.addAll(toInsList(AssignableAVM2Item.killTemp(localData, this, Arrays.asList(switchedReg))));
List<AVM2Instruction> bodies = new ArrayList<>();
List<Integer> bodiesOffsets = new ArrayList<>();
@@ -897,7 +897,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
List<AVM2Instruction> finallySwitchCmds = new ArrayList<>();
finSwitch = new AVM2Instruction(0, new LookupSwitchIns(), new int[1 + 1 + 1], new byte[0]);
finSwitch = new AVM2Instruction(0, new LookupSwitchIns(), new int[1 + 1 + 1]);
finSwitch.operands[0] = finSwitch.getBytes().length;
finSwitch.operands[1] = 0; //switch cnt
@@ -1679,8 +1679,8 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
if (ac == -1) {
if (parentConstMinAC == 0) {
mbody.code.code.add(0, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}, new byte[0]));
mbody.code.code.add(1, new AVM2Instruction(0, new ConstructSuperIns(), new int[]{0}, new byte[0]));
mbody.code.code.add(0, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}));
mbody.code.code.add(1, new AVM2Instruction(0, new ConstructSuperIns(), new int[]{0}));
} else {
throw new CompilationException("Parent constructor must be called", line);
@@ -1688,8 +1688,8 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
}
if (className != null) {//It's method, not (inner) function
mbody.code.code.add(0, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}, new byte[0]));
mbody.code.code.add(1, new AVM2Instruction(0, new PushScopeIns(), new int[]{}, new byte[0]));
mbody.code.code.add(0, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}));
mbody.code.code.add(1, new AVM2Instruction(0, new PushScopeIns(), new int[]{}));
}
boolean addRet = false;
if (!mbody.code.code.isEmpty()) {
@@ -1702,10 +1702,10 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
if (addRet) {
if (retType.toString().equals("*") || retType.toString().equals("void") || constructor) {
mbody.code.code.add(new AVM2Instruction(0, new ReturnVoidIns(), new int[]{}, new byte[0]));
mbody.code.code.add(new AVM2Instruction(0, new ReturnVoidIns(), new int[]{}));
} else {
mbody.code.code.add(new AVM2Instruction(0, new PushUndefinedIns(), new int[]{}, new byte[0]));
mbody.code.code.add(new AVM2Instruction(0, new ReturnValueIns(), new int[]{}, new byte[0]));
mbody.code.code.add(new AVM2Instruction(0, new PushUndefinedIns(), new int[]{}));
mbody.code.code.add(new AVM2Instruction(0, new ReturnValueIns(), new int[]{}));
}
}
mbody.exceptions = localData.exceptions.toArray(new ABCException[localData.exceptions.size()]);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -131,7 +132,7 @@ public class CallAVM2Item extends AVM2Item {
if (propIndex != -1) {
if (obj == null) {
if (obj == null) {
obj = new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{propIndex});
}
return toSourceMerge(localData, generator, obj, arguments,
ins(needsReturn ? new CallPropertyIns() : new CallPropVoidIns(), propIndex, arguments.size())

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -70,8 +71,8 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item {
TypeItem prop = (TypeItem) resname;
int type_index = AVM2SourceGenerator.resolveType(localData, resname, ((AVM2SourceGenerator) generator).abc, ((AVM2SourceGenerator) generator).allABCs);
return toSourceMerge(localData, generator,
return toSourceMerge(localData, generator,
new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{type_index, arguments.size()}, new byte[0]), arguments,
new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{type_index, arguments.size()}), arguments,
new AVM2Instruction(0, new ConstructPropIns(), new int[]{type_index, arguments.size()})
);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -28,7 +29,7 @@ public class ExceptionMarkAVM2Instruction extends AVM2Instruction {
public int exceptionId;
public ExceptionMarkAVM2Instruction(int exceptionId, int markType) {
public ExceptionMarkAVM2Instruction(int exceptionId, int markType) {
super(0, null, new int[0]);
this.markType = markType;
this.exceptionId = exceptionId;
this.definition = new InstructionDefinition(0, "--mark", new int[0]);