diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 98057d1dd..452371590 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -295,6 +295,7 @@ import com.jpexs.decompiler.graph.SimpleValue; import com.jpexs.decompiler.graph.TranslateStack; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import com.jpexs.decompiler.graph.model.DuplicateItem; import com.jpexs.decompiler.graph.model.ExitItem; import com.jpexs.decompiler.graph.model.IfItem; import com.jpexs.decompiler.graph.model.ScriptEndItem; @@ -1614,7 +1615,7 @@ public class AVM2Code implements Cloneable { AVM2Instruction insAfter = code.get(ip + 1); Set usages = setLocalPosToGetLocalPos.containsKey(ip) ? setLocalPosToGetLocalPos.get(ip) : new HashSet<>(); - if (!AVM2Item.mustStayIntact2(stack.peek()) && usages.size() == 1 && (usages.iterator().next().equals(ip + 1)) && (insAfter.definition instanceof GetLocalTypeIns) && (((GetLocalTypeIns) insAfter.definition).getRegisterId(insAfter) == ((SetLocalTypeIns) ins.definition).getRegisterId(ins))) { + if (!(stack.peek().getNotCoercedNoDup() instanceof DuplicateItem) && !AVM2Item.mustStayIntact2(stack.peek()) && usages.size() == 1 && (usages.iterator().next().equals(ip + 1)) && (insAfter.definition instanceof GetLocalTypeIns) && (((GetLocalTypeIns) insAfter.definition).getRegisterId(insAfter) == ((SetLocalTypeIns) ins.definition).getRegisterId(ins))) { ip += 2; continue iploop; } else { @@ -2097,14 +2098,14 @@ public class AVM2Code implements Cloneable { ins.operands[j] = updater.updateOperandOffset(target, ins.operands[j]); } }*/ //Faster, but not so universal - if (ins.definition instanceof IfTypeIns) { - long target = ins.getTargetAddress(); - try { - ins.operands[0] = updater.updateOperandOffset(ins.getAddress(), target, ins.operands[0]); - } catch (ConvertException cex) { - throw new ConvertException("Invalid offset (" + ins + ")", i); - } + if (ins.definition instanceof IfTypeIns) { + long target = ins.getTargetAddress(); + try { + ins.operands[0] = updater.updateOperandOffset(ins.getAddress(), target, ins.operands[0]); + } catch (ConvertException cex) { + throw new ConvertException("Invalid offset (" + ins + ")", i); } + } ins.setAddress(updater.updateInstructionOffset(ins.getAddress())); //Note: changing operands here does not change instruction byte length as offsets are always S24 (not variable length) } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java index b3bff26ae..0fcf056d7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java @@ -29,12 +29,20 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.IncLocalIIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.IncLocalIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.SetLocalTypeIns; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ExceptionAVM2Item; import com.jpexs.helpers.Reference; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.Multiname; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.abc.types.traits.TraitWithSlot; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -320,4 +328,50 @@ public abstract class InstructionDefinition implements Serializable { } return localData.code.adr2pos(src.getAddress()); } + + protected Multiname searchSlotName(int slotIndex, AVM2LocalData localData, GraphTargetItem obj) { + return searchSlotName(slotIndex, localData, obj, -1); + } + + private Multiname searchSlotName(int slotIndex, AVM2LocalData localData, GraphTargetItem obj, int multiNameIndex) { + if ((obj instanceof ExceptionAVM2Item) && (multiNameIndex == -1 || ((ExceptionAVM2Item) obj).exception.name_index == multiNameIndex)) { + return localData.getConstants().getMultiname(((ExceptionAVM2Item) obj).exception.name_index); + } else if ((obj instanceof ThisAVM2Item) || (obj instanceof ClassAVM2Item) || (obj instanceof ScriptAVM2Item)) { + List traits = localData.getScriptInfo().get(localData.scriptIndex).traits.traits; + for (int t = 0; t < traits.size(); t++) { + Trait trait = traits.get(t); + if (trait instanceof TraitWithSlot) { + if (multiNameIndex == -1 || trait.name_index == multiNameIndex) { + if (((TraitWithSlot) trait).getSlotIndex() == slotIndex) { + return trait.getName(localData.abc); + } + } + } + } + } else if (obj instanceof NewActivationAVM2Item) { + MethodBody body = localData.methodBody; + List traits = body.traits.traits; + for (int t = 0; t < traits.size(); t++) { + Trait trait = traits.get(t); + if (trait instanceof TraitWithSlot) { + if (multiNameIndex == -1 || trait.name_index == multiNameIndex) { + if (((TraitWithSlot) trait).getSlotIndex() == slotIndex) { + return trait.getName(localData.abc); + } + } + } + } + } else if (obj instanceof FindPropertyAVM2Item) { + FindPropertyAVM2Item findProp = (FindPropertyAVM2Item) obj; + + for (GraphTargetItem item : localData.scopeStack) { + Multiname ret = searchSlotName(slotIndex, localData, item, ((FullMultinameAVM2Item) findProp.propertyName).multinameIndex); + if (ret != null) { + return ret; + } + } + + } + return null; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/SetTypeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/SetTypeIns.java index b40b62bcc..555bc02cc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/SetTypeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/SetTypeIns.java @@ -48,26 +48,47 @@ public interface SetTypeIns { if (notCoercedValue instanceof DuplicateItem) { GraphTargetItem insideDup = notCoercedValue.value; - if (!AVM2Item.mustStayIntact1(insideDup.getNotCoerced())) { + if (!AVM2Item.mustStayIntact1(insideDup.getNotCoercedNoDup())) { if (!stack.isEmpty() && stack.peek() == insideDup) { stack.pop(); - if ((value instanceof CoerceAVM2Item) || (value instanceof ConvertAVM2Item)) { - value.value = insideDup; - } else { - value = insideDup; - } - result.value = value; - //GraphTargetItem result = new SetLocalAVM2Item(ins, localData.lineStartInstruction, regId, value); - - if (regId > -1 && AVM2Item.mustStayIntact2(insideDup.getNotCoerced())) { //hack + if ((insideDup instanceof DuplicateItem) && regId > -1) { + int numDups = 1; + while ((insideDup instanceof DuplicateItem) && !stack.isEmpty() && stack.peek() == insideDup.value) { + insideDup = insideDup.value; + stack.pop(); + numDups++; + } + if ((value instanceof CoerceAVM2Item) || (value instanceof ConvertAVM2Item)) { + value.value = insideDup; + } else { + value = insideDup; + } + result.value = value; output.add(result); - stack.push(new LocalRegAVM2Item(null, localData.lineStartInstruction, regId, value)); + for (int i = 0; i < numDups; i++) { + stack.push(new LocalRegAVM2Item(null, localData.lineStartInstruction, regId, value)); + } + return; + } else { + + if ((value instanceof CoerceAVM2Item) || (value instanceof ConvertAVM2Item)) { + value.value = insideDup; + } else { + value = insideDup; + } + + result.value = value; + + if (regId > -1 && AVM2Item.mustStayIntact2(insideDup.getNotCoerced())) { //hack + output.add(result); + stack.push(new LocalRegAVM2Item(null, localData.lineStartInstruction, regId, value)); + return; + } + + stack.push(result); return; } - - stack.push(result); - return; } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java index a29e0f264..21c540ab7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java @@ -50,32 +50,7 @@ public class GetSlotIns extends InstructionDefinition { int slotIndex = ins.operands[0]; GraphTargetItem objinreg = stack.pop(); //scope GraphTargetItem obj = objinreg.getThroughRegister(); - Multiname slotname = null; - if (obj instanceof ExceptionAVM2Item) { - slotname = localData.getConstants().getMultiname(((ExceptionAVM2Item) obj).exception.name_index); - } else if ((obj instanceof ThisAVM2Item) || (obj instanceof ClassAVM2Item) || (obj instanceof ScriptAVM2Item)) { - List traits = localData.getScriptInfo().get(localData.scriptIndex).traits.traits; - for (int t = 0; t < traits.size(); t++) { - Trait tr = traits.get(t); - if (tr instanceof TraitWithSlot) { - if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) { - slotname = tr.getName(localData.abc); - } - } - } - } else if (obj instanceof NewActivationAVM2Item) { - MethodBody body = localData.methodBody; - List traits = body.traits.traits; - for (int t = 0; t < traits.size(); t++) { - Trait trait = traits.get(t); - if (trait instanceof TraitWithSlot) { - if (((TraitWithSlot) trait).getSlotIndex() == slotIndex) { - slotname = trait.getName(localData.abc); - } - } - - } - } + Multiname slotname = searchSlotName(slotIndex, localData, obj); stack.push(new GetSlotAVM2Item(ins, localData.lineStartInstruction, obj, objinreg, slotIndex, slotname)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java index 633fc635c..f90e82681 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java @@ -161,6 +161,24 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns } } } + //assembled/TestIncrement3 + if ((value instanceof IncrementAVM2Item) || (value instanceof DecrementAVM2Item)) { + boolean isIncrement = (value instanceof IncrementAVM2Item); + if (value.value.getNotCoerced() instanceof GetPropertyAVM2Item) { + GetPropertyAVM2Item getProp = (GetPropertyAVM2Item) value.value.getNotCoerced(); + if (getProp.object instanceof DuplicateItem) { + if (getProp.object.value == obj) { + getProp.object = obj; + if (isIncrement) { + output.add(new PostIncrementAVM2Item(ins, localData.lineStartInstruction, getProp)); + } else { + output.add(new PostDecrementAVM2Item(ins, localData.lineStartInstruction, getProp)); + } + return; + } + } + } + } if (value instanceof LocalRegAVM2Item) { LocalRegAVM2Item valueLocalReg = (LocalRegAVM2Item) value; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java index 7ee425d7e..3fa95b917 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java @@ -25,6 +25,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ClassAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.DecrementAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.FindPropertyAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.GetSlotAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IncrementAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; @@ -66,36 +68,10 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns { GraphTargetItem obj = stack.pop(); //scopeId GraphTargetItem objnoreg = obj; obj = obj.getThroughRegister(); - Multiname slotname = null; if (obj instanceof NewActivationAVM2Item) { ((NewActivationAVM2Item) obj).slots.put(slotIndex, value); } - - if (obj instanceof ExceptionAVM2Item) { - slotname = localData.getConstants().getMultiname(((ExceptionAVM2Item) obj).exception.name_index); - } else if ((obj instanceof ThisAVM2Item) || (obj instanceof ClassAVM2Item) || (obj instanceof ScriptAVM2Item)) { - List traits = localData.getScriptInfo().get(localData.scriptIndex).traits.traits; - for (int t = 0; t < traits.size(); t++) { - Trait tr = traits.get(t); - if (tr instanceof TraitWithSlot) { - if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) { - slotname = tr.getName(localData.abc); - } - } - } - } else if (obj instanceof NewActivationAVM2Item) { - MethodBody body = localData.methodBody; - List traits = body.traits.traits; - for (int t = 0; t < traits.size(); t++) { - Trait trait = traits.get(t); - if (trait instanceof TraitWithSlot) { - if (((TraitWithSlot) trait).getSlotIndex() == slotIndex) { - slotname = trait.getName(localData.abc); - } - } - - } - } + Multiname slotname = searchSlotName(slotIndex, localData, obj); if (slotname != null) { if (value instanceof LocalRegAVM2Item) { diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java index d37b4a120..e2702a039 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java @@ -1573,6 +1573,19 @@ public class ActionScript3Test extends ActionScriptTestBase { false); } + @Test + public void testAssembledDoubleDup() { + decompileMethod("assembled", "testDoubleDup", "var _loc10_:Rectangle = myprop(_loc5_);\r\n" + + "_loc10_.mymethod(-_loc10_.width,-_loc10_.height);\r\n", + false); + } + + @Test + public void testAssembledDup() { + decompileMethod("assembled", "testDup", "return 1 - (var _loc1_:Number = 1 - _loc1_ / _loc4_) * _loc1_;\r\n", + false); + } + @Test public void testAssembledDupAssignment() { decompileMethod("assembled", "testDupAssignment", "var _loc1_:int = 0;\r\n" @@ -1625,6 +1638,12 @@ public class ActionScript3Test extends ActionScriptTestBase { false); } + @Test + public void testAssembledIncrement3() { + decompileMethod("assembled", "testIncrement3", "_loc1_.length--;\r\n", + false); + } + @Test public void testAssembledSetSlotDup() { decompileMethod("assembled", "testSetSlotDup", "var _loc5_:int = 5;\r\n" @@ -1633,6 +1652,12 @@ public class ActionScript3Test extends ActionScriptTestBase { false); } + @Test + public void testAssembledSetSlotFindProperty() { + decompileMethod("assembled", "testSetSlotFindProperty", "return var myprop:int = 50;\r\n", + false); + } + @Test public void testOptionalParameters() { String methodName = "testOptionalParameters"; diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java index 5b27b419f..8aa4d0ed3 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java @@ -38,6 +38,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -120,7 +121,7 @@ public class AS3Generator { useFile(s, new File("testdata/flashdevelop/bin/flashdevelop.swf"), "standard"); useFile(s, new File("testdata/custom/bin/custom.swf"), "assembled"); - try (PrintWriter pw = new PrintWriter("as3_teststub.java")) { + try (PrintWriter pw = new PrintWriter("as3_teststub.java", Charset.forName("UTF-8"))) { pw.println(s.toString()); } System.exit(0); diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.abc b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.abc index 1412e02c7..3ab0989ca 100644 Binary files a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.abc and b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.abc differ diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.asasm index 47f80cbdc..0d8d531be 100644 --- a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.asasm +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/custom-0.main.asasm @@ -10,5 +10,10 @@ program #include "tests/TestForEachCoerced.script.asasm" #include "tests/TestIncrement2.script.asasm" #include "tests/TestSetSlotDup.script.asasm" + #include "tests/TestSetSlotFindProperty.script.asasm" + #include "tests/TestDoubleDup.script.asasm" + #include "tests/TestIncrement3.script.asasm" + #include "tests/TestDup.script.asasm" + #include "tests/TestDup2.script.asasm" ; place to add next end ; program diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDoubleDup.class.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDoubleDup.class.asasm new file mode 100644 index 000000000..8b094898a --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDoubleDup.class.asasm @@ -0,0 +1,72 @@ +class + refid "tests:TestDoubleDup" + instance QName(PackageNamespace("tests"), "TestDoubleDup") + extends QName(PackageNamespace(""), "Object") + flag SEALED + flag PROTECTEDNS + protectedns ProtectedNamespace("tests:TestDoubleDup") + iinit + refid "tests:TestDoubleDup/instance/init" + body + maxstack 1 + localcount 1 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal0 + constructsuper 0 + + returnvoid + end ; code + end ; body + end ; method + trait method QName(PackageNamespace(""), "run") + method + refid "tests:TestDoubleDup/instance/run" + returns QName(PackageNamespace(""), "void") + body + maxstack 2 + localcount 4 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + findpropstrict QName(PackageNamespace(""),"myprop") + getlocal 5 + callproperty QName(PackageNamespace(""),"myprop"), 1 + coerce QName(PackageNamespace("flash.geom"),"Rectangle") + dup + dup + setlocal 10 + getproperty QName(PackageNamespace(""),"width") + negate + getlocal 10 + getproperty QName(PackageNamespace(""),"height") + negate + callpropvoid QName(PackageNamespace(""),"mymethod"), 2 + returnvoid + end ; code + end ; body + end ; method + end ; trait + end ; instance + cinit + refid "tests:TestDoubleDup/class/init" + body + maxstack 1 + localcount 1 + initscopedepth 3 + maxscopedepth 4 + code + getlocal0 + pushscope + + returnvoid + end ; code + end ; body + end ; method +end ; class diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDoubleDup.script.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDoubleDup.script.asasm new file mode 100644 index 000000000..9abfcd266 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDoubleDup.script.asasm @@ -0,0 +1,29 @@ +script + sinit + refid "tests:TestDoubleDup/init" + body + maxstack 2 + localcount 1 + initscopedepth 1 + maxscopedepth 3 + code + getlocal0 + pushscope + + findpropstrict Multiname("TestDoubleDup", [PackageNamespace("tests")]) + getlex QName(PackageNamespace(""), "Object") + pushscope + + getlex Multiname("Object", [PrivateNamespace(null, "tests:TestDoubleDup"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")]) + newclass "tests:TestDoubleDup" + popscope + initproperty QName(PackageNamespace("tests"), "TestDoubleDup") + + returnvoid + end ; code + end ; body + end ; method + trait class QName(PackageNamespace("tests"), "TestDoubleDup") + #include "TestDoubleDup.class.asasm" + end ; trait +end ; script diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup.class.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup.class.asasm new file mode 100644 index 000000000..3607ad97b --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup.class.asasm @@ -0,0 +1,71 @@ +class + refid "tests:TestDup" + instance QName(PackageNamespace("tests"), "TestDup") + extends QName(PackageNamespace(""), "Object") + flag SEALED + flag PROTECTEDNS + protectedns ProtectedNamespace("tests:TestDup") + iinit + refid "tests:TestDup/instance/init" + body + maxstack 1 + localcount 1 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal0 + constructsuper 0 + + returnvoid + end ; code + end ; body + end ; method + trait method QName(PackageNamespace(""), "run") + method + refid "tests:TestDup/instance/run" + returns QName(PackageNamespace(""), "void") + body + maxstack 2 + localcount 4 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + pushbyte 1 + pushbyte 1 + getlocal1 + getlocal 4 + divide + subtract + dup + convert_d + setlocal1 + getlocal1 + multiply + subtract + returnvalue + end ; code + end ; body + end ; method + end ; trait + end ; instance + cinit + refid "tests:TestDup/class/init" + body + maxstack 1 + localcount 1 + initscopedepth 3 + maxscopedepth 4 + code + getlocal0 + pushscope + + returnvoid + end ; code + end ; body + end ; method +end ; class diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup.script.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup.script.asasm new file mode 100644 index 000000000..3ab699a51 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup.script.asasm @@ -0,0 +1,29 @@ +script + sinit + refid "tests:TestDup/init" + body + maxstack 2 + localcount 1 + initscopedepth 1 + maxscopedepth 3 + code + getlocal0 + pushscope + + findpropstrict Multiname("TestDup", [PackageNamespace("tests")]) + getlex QName(PackageNamespace(""), "Object") + pushscope + + getlex Multiname("Object", [PrivateNamespace(null, "tests:TestDup"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")]) + newclass "tests:TestDup" + popscope + initproperty QName(PackageNamespace("tests"), "TestDup") + + returnvoid + end ; code + end ; body + end ; method + trait class QName(PackageNamespace("tests"), "TestDup") + #include "TestDup.class.asasm" + end ; trait +end ; script diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup2.class.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup2.class.asasm new file mode 100644 index 000000000..3d6a375c5 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup2.class.asasm @@ -0,0 +1,67 @@ +class + refid "tests:TestDup2" + instance QName(PackageNamespace("tests"), "TestDup2") + extends QName(PackageNamespace(""), "Object") + flag SEALED + flag PROTECTEDNS + protectedns ProtectedNamespace("tests:TestDup2") + iinit + refid "tests:TestDup2/instance/init" + body + maxstack 1 + localcount 1 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal0 + constructsuper 0 + + returnvoid + end ; code + end ; body + end ; method + trait method QName(PackageNamespace(""), "run") + method + refid "tests:TestDup2/instance/run" + returns QName(PackageNamespace(""), "void") + body + maxstack 2 + localcount 4 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + getlocal3 + getproperty QName(PackageNamespace(""),"myprop") + dup + getlocal1 + getproperty MultinameL([PrivateNamespace("somens")]) + swap + call 0 + pop + returnvoid + end ; code + end ; body + end ; method + end ; trait + end ; instance + cinit + refid "tests:TestDup2/class/init" + body + maxstack 1 + localcount 1 + initscopedepth 3 + maxscopedepth 4 + code + getlocal0 + pushscope + + returnvoid + end ; code + end ; body + end ; method +end ; class diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup2.script.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup2.script.asasm new file mode 100644 index 000000000..dc90d4b71 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestDup2.script.asasm @@ -0,0 +1,29 @@ +script + sinit + refid "tests:TestDup2/init" + body + maxstack 2 + localcount 1 + initscopedepth 1 + maxscopedepth 3 + code + getlocal0 + pushscope + + findpropstrict Multiname("TestDup2", [PackageNamespace("tests")]) + getlex QName(PackageNamespace(""), "Object") + pushscope + + getlex Multiname("Object", [PrivateNamespace(null, "tests:TestDup2"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")]) + newclass "tests:TestDup2" + popscope + initproperty QName(PackageNamespace("tests"), "TestDup2") + + returnvoid + end ; code + end ; body + end ; method + trait class QName(PackageNamespace("tests"), "TestDup2") + #include "TestDup2.class.asasm" + end ; trait +end ; script diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestIncrement3.class.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestIncrement3.class.asasm new file mode 100644 index 000000000..1726f172b --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestIncrement3.class.asasm @@ -0,0 +1,67 @@ +class + refid "tests:TestIncrement3" + instance QName(PackageNamespace("tests"), "TestIncrement3") + extends QName(PackageNamespace(""), "Object") + flag SEALED + flag PROTECTEDNS + protectedns ProtectedNamespace("tests:TestIncrement3") + iinit + refid "tests:TestIncrement3/instance/init" + body + maxstack 1 + localcount 1 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal0 + constructsuper 0 + + returnvoid + end ; code + end ; body + end ; method + trait method QName(PackageNamespace(""), "run") + method + refid "tests:TestIncrement3/instance/run" + returns QName(PackageNamespace(""), "void") + body + maxstack 2 + localcount 4 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal1 + dup + getproperty QName(PackageNamespace(""),"length") + convert_d + decrement + setproperty QName(PackageNamespace(""),"length") + + returnvoid + end ; code + end ; body + end ; method + end ; trait + end ; instance + cinit + refid "tests:TestIncrement3/class/init" + body + maxstack 1 + localcount 1 + initscopedepth 3 + maxscopedepth 4 + code + getlocal0 + pushscope + + returnvoid + end ; code + end ; body + end ; method +end ; class diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestIncrement3.script.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestIncrement3.script.asasm new file mode 100644 index 000000000..7cfae4b63 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestIncrement3.script.asasm @@ -0,0 +1,29 @@ +script + sinit + refid "tests:TestIncrement3/init" + body + maxstack 2 + localcount 1 + initscopedepth 1 + maxscopedepth 3 + code + getlocal0 + pushscope + + findpropstrict Multiname("TestIncrement3", [PackageNamespace("tests")]) + getlex QName(PackageNamespace(""), "Object") + pushscope + + getlex Multiname("Object", [PrivateNamespace(null, "tests:TestIncrement3"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")]) + newclass "tests:TestIncrement3" + popscope + initproperty QName(PackageNamespace("tests"), "TestIncrement3") + + returnvoid + end ; code + end ; body + end ; method + trait class QName(PackageNamespace("tests"), "TestIncrement3") + #include "TestIncrement3.class.asasm" + end ; trait +end ; script diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestSetSlotFindProperty.class.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestSetSlotFindProperty.class.asasm new file mode 100644 index 000000000..12f6c4ab4 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestSetSlotFindProperty.class.asasm @@ -0,0 +1,70 @@ +class + refid "tests:TestSetSlotFindProperty" + instance QName(PackageNamespace("tests"), "TestSetSlotFindProperty") + extends QName(PackageNamespace(""), "Object") + flag SEALED + flag PROTECTEDNS + protectedns ProtectedNamespace("tests:TestSetSlotFindProperty") + iinit + refid "tests:TestSetSlotFindProperty/instance/init" + body + maxstack 1 + localcount 1 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal0 + constructsuper 0 + + returnvoid + end ; code + end ; body + end ; method + trait method QName(PackageNamespace(""), "run") + method + refid "tests:TestSetSlotFindProperty/instance/run" + returns QName(PackageNamespace(""), "void") + body + maxstack 2 + localcount 4 + initscopedepth 4 + maxscopedepth 5 + code + newactivation + pushscope + pushbyte 50 + dup + findproperty QName(PackageInternalNs("myns"),"myprop") + swap + setslot 1 + returnvalue + end ; code + + trait const QName(PackageInternalNs("myns"),"myprop") + slotid 1 + type QName(PackageNamespace(""),"int") + end ; trait + + end ; body + end ; method + end ; trait + end ; instance + cinit + refid "tests:TestSetSlotFindProperty/class/init" + body + maxstack 1 + localcount 1 + initscopedepth 3 + maxscopedepth 4 + code + getlocal0 + pushscope + + returnvoid + end ; code + end ; body + end ; method +end ; class diff --git a/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestSetSlotFindProperty.script.asasm b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestSetSlotFindProperty.script.asasm new file mode 100644 index 000000000..f8fb98d46 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/custom/abc/custom-0/tests/TestSetSlotFindProperty.script.asasm @@ -0,0 +1,29 @@ +script + sinit + refid "tests:TestSetSlotFindProperty/init" + body + maxstack 2 + localcount 1 + initscopedepth 1 + maxscopedepth 3 + code + getlocal0 + pushscope + + findpropstrict Multiname("TestSetSlotFindProperty", [PackageNamespace("tests")]) + getlex QName(PackageNamespace(""), "Object") + pushscope + + getlex Multiname("Object", [PrivateNamespace(null, "tests:TestSetSlotFindProperty"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")]) + newclass "tests:TestSetSlotFindProperty" + popscope + initproperty QName(PackageNamespace("tests"), "TestSetSlotFindProperty") + + returnvoid + end ; code + end ; body + end ; method + trait class QName(PackageNamespace("tests"), "TestSetSlotFindProperty") + #include "TestSetSlotFindProperty.class.asasm" + end ; trait +end ; script diff --git a/libsrc/ffdec_lib/testdata/custom/bin/custom.swf b/libsrc/ffdec_lib/testdata/custom/bin/custom.swf index d56639ada..a5dc7b94e 100644 Binary files a/libsrc/ffdec_lib/testdata/custom/bin/custom.swf and b/libsrc/ffdec_lib/testdata/custom/bin/custom.swf differ