mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-17 16:11:54 +00:00
Fixed: #2270 AS3 decompilation - unnnecessary local registers assignments as part of expressions when using optimization like dup, setlocal N instead of setlocal N, getlocal N
This commit is contained in:
Binary file not shown.
@@ -34,5 +34,6 @@ program
|
||||
#include "tests/TestMutatingSwitch.script.asasm"
|
||||
#include "tests/TestSwitchMostCommon.script.asasm"
|
||||
#include "tests/TestXmlStar.script.asasm"
|
||||
#include "tests/TestLocalRegIf.script.asasm"
|
||||
; place to add next
|
||||
end ; program
|
||||
|
||||
80
libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestLocalRegIf.class.asasm
vendored
Normal file
80
libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestLocalRegIf.class.asasm
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
class
|
||||
refid "tests:TestLocalRegIf"
|
||||
instance QName(PackageNamespace("tests"), "TestLocalRegIf")
|
||||
extends QName(PackageNamespace(""), "Object")
|
||||
flag SEALED
|
||||
flag PROTECTEDNS
|
||||
protectedns ProtectedNamespace("tests:TestLocalRegIf")
|
||||
iinit
|
||||
refid "tests:TestLocalRegIf/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:TestLocalRegIf/instance/run"
|
||||
returns QName(PackageNamespace(""), "void")
|
||||
body
|
||||
maxstack 2
|
||||
localcount 7
|
||||
initscopedepth 4
|
||||
maxscopedepth 5
|
||||
code
|
||||
getlocal0
|
||||
pushscope
|
||||
pushbyte 8
|
||||
dup
|
||||
setlocal1
|
||||
pushbyte 5
|
||||
greaterthan
|
||||
dup
|
||||
iffalse ofs0020
|
||||
pop
|
||||
getlocal1
|
||||
pushbyte 10
|
||||
lessthan
|
||||
ofs0020:
|
||||
iffalse ofs0030
|
||||
getlex QName(PackageNamespace(""),"trace")
|
||||
getglobalscope
|
||||
pushstring "I"
|
||||
call 1
|
||||
pop
|
||||
ofs0030:
|
||||
returnvoid
|
||||
|
||||
returnvoid
|
||||
end ; code
|
||||
end ; body
|
||||
end ; method
|
||||
end ; trait
|
||||
end ; instance
|
||||
cinit
|
||||
refid "tests:TestLocalRegIf/class/init"
|
||||
body
|
||||
maxstack 1
|
||||
localcount 1
|
||||
initscopedepth 3
|
||||
maxscopedepth 4
|
||||
code
|
||||
getlocal0
|
||||
pushscope
|
||||
|
||||
returnvoid
|
||||
end ; code
|
||||
end ; body
|
||||
end ; method
|
||||
end ; class
|
||||
29
libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestLocalRegIf.script.asasm
vendored
Normal file
29
libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestLocalRegIf.script.asasm
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
script
|
||||
sinit
|
||||
refid "tests:TestLocalRegIf/init"
|
||||
body
|
||||
maxstack 2
|
||||
localcount 1
|
||||
initscopedepth 1
|
||||
maxscopedepth 3
|
||||
code
|
||||
getlocal0
|
||||
pushscope
|
||||
|
||||
findpropstrict Multiname("TestLocalRegIf", [PackageNamespace("tests")])
|
||||
getlex QName(PackageNamespace(""), "Object")
|
||||
pushscope
|
||||
|
||||
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestLocalRegIf"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
|
||||
newclass "tests:TestLocalRegIf"
|
||||
popscope
|
||||
initproperty QName(PackageNamespace("tests"), "TestLocalRegIf")
|
||||
|
||||
returnvoid
|
||||
end ; code
|
||||
end ; body
|
||||
end ; method
|
||||
trait class QName(PackageNamespace("tests"), "TestLocalRegIf")
|
||||
#include "TestLocalRegIf.class.asasm"
|
||||
end ; trait
|
||||
end ; script
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,4 +2,6 @@
|
||||
set COMPILERKIND=air
|
||||
set SWFNAME=as3_new
|
||||
call c:\air\bin\mxmlc.bat -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
|
||||
rem -warnings=false
|
||||
rem set COMPILERKIND=air.optimize
|
||||
rem call c:\air\bin\mxmlc.bat -compiler.optimize -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
|
||||
rem -warnings=false
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
set COMPILERKIND=flex
|
||||
set SWFNAME=as3_new
|
||||
call c:\flex\bin\mxmlc.bat -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
|
||||
rem set COMPILERKIND=flex.optimize
|
||||
rem call c:\flex\bin\mxmlc.bat -compiler.optimize -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
|
||||
rem -warnings=false
|
||||
|
||||
@@ -97,6 +97,7 @@ package
|
||||
TestNegate;
|
||||
TestNumberCall;
|
||||
TestOperations;
|
||||
TestOptimization;
|
||||
TestOptionalParameters;
|
||||
TestParamNames;
|
||||
TestParamsCount;
|
||||
|
||||
@@ -5,7 +5,7 @@ package tests
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
trace("hello");
|
||||
trace("hello");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
libsrc/ffdec_lib/testdata/as3_new/src/tests/TestOptimization.as
vendored
Normal file
25
libsrc/ffdec_lib/testdata/as3_new/src/tests/TestOptimization.as
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestOptimization
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
// Add more than 3 variables.
|
||||
// Optimization happens from register 4 on.
|
||||
// (setlocal X takes more bytes than dup)
|
||||
var a:int = 1;
|
||||
var b:int = 2;
|
||||
var c:int = 3;
|
||||
|
||||
var d:int = 4; //setlocal N
|
||||
var e:int = d + 5; //getlocal N is replaced with dup before setlocal N
|
||||
|
||||
//We must leave this case intact:
|
||||
var f:int;
|
||||
var g:int;
|
||||
var h:int;
|
||||
var i:int = h = g = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user