AS3 p-code more RAbcDasm like

- get/setlocal_x renamed to get/setlocalx
- QName casing changed from Qname

Better increment/decrement detection, chained assignments.
This commit is contained in:
Jindra Petřík
2021-02-08 20:15:19 +01:00
parent 90bf2057fe
commit 98c2b1eba9
53 changed files with 1245 additions and 376 deletions
@@ -0,0 +1,77 @@
class
refid "tests:TestDupAssignment"
instance QName(PackageNamespace("tests"), "TestDupAssignment")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestDupAssignment")
iinit
refid "tests:TestDupAssignment/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:TestDupAssignment/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
pushbyte 0
setlocal1
pushbyte 10
setlocal2
getlocal2
dup
convert_i
setlocal1
iffalse L15
findpropstrict Multiname("trace", [PrivateNamespace(null, "tests:TestDupAssignment/instance/run"), PrivateNamespace(null, "tests:TestDupAssignment"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin"), ProtectedNamespace("tests:TestDupAssignment"), StaticProtectedNs("tests:TestDupAssignment")])
getlocal2
callpropvoid Multiname("trace", [PrivateNamespace(null, "tests:TestDupAssignment/instance/run"), PrivateNamespace(null, "tests:TestDupAssignment"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin"), ProtectedNamespace("tests:TestDupAssignment"), StaticProtectedNs("tests:TestDupAssignment")]), 1
L15:
returnvoid
end ; code
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestDupAssignment/class/init"
body
maxstack 1
localcount 1
initscopedepth 3
maxscopedepth 4
code
getlocal0
pushscope
returnvoid
end ; code
end ; body
end ; method
end ; class
@@ -0,0 +1,29 @@
script
sinit
refid "tests:TestDupAssignment/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestDupAssignment", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestDupAssignment"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestDupAssignment"
popscope
initproperty QName(PackageNamespace("tests"), "TestDupAssignment")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestDupAssignment")
#include "TestDupAssignment.class.asasm"
end ; trait
end ; script
@@ -0,0 +1,71 @@
class
refid "tests:TestIncrement"
instance QName(PackageNamespace("tests"), "TestIncrement")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestIncrement")
iinit
refid "tests:TestIncrement/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:TestIncrement/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
getlocal0
constructsuper 0
getlex QName(PrivateNamespace("myns"),"a")
convert_d
dup
increment
findpropstrict QName(PrivateNamespace("myns"),"a")
swap
setproperty QName(PrivateNamespace("myns"),"a")
findproperty QName(PackageNamespace(""),"b")
swap
setproperty QName(PackageNamespace(""),"b")
returnvoid
end ; code
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestIncrement/class/init"
body
maxstack 1
localcount 1
initscopedepth 3
maxscopedepth 4
code
getlocal0
pushscope
returnvoid
end ; code
end ; body
end ; method
end ; class
@@ -0,0 +1,29 @@
script
sinit
refid "tests:TestIncrement/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestIncrement", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestIncrement"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestIncrement"
popscope
initproperty QName(PackageNamespace("tests"), "TestIncrement")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestIncrement")
#include "TestIncrement.class.asasm"
end ; trait
end ; script