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-01-26 21:12:34 +01:00
parent 90bf2057fe
commit 98c2b1eba9
53 changed files with 1245 additions and 376 deletions

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;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -56,7 +57,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
}
private int getBaseAddr() {
private int getBaseAddr() {
return 2; //getlocal0 + pushscope
}
private ABC getABC() {
@@ -81,7 +82,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
private MethodBody compilePCode(String str) throws IOException, AVM2ParseException, InterruptedException {
str = "code\r\n"
str = "code\r\n"
+ "getlocal0\r\n"
+ "pushscope\r\n"
+ str
+ "returnvoid\r\n";
@@ -101,7 +102,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
@Test
public void removeInstruction() throws Exception {
MethodBody b = compilePCode("pushbyte 1\r\n"
MethodBody b = compilePCode("pushbyte 1\r\n"
+ "setlocal1\r\n" //remove this
+ "jump label1\r\n"
+ "pushtrue\r\n"
+ "pop\r\n"
@@ -112,7 +113,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
@Test
public void removeInstruction2() throws Exception {
MethodBody b = compilePCode("pushbyte 1\r\n"
MethodBody b = compilePCode("pushbyte 1\r\n"
+ "setlocal1\r\n"
+ "jump label1\r\n"
+ "pushtrue\r\n"
+ "pop\r\n" //remove this
@@ -123,7 +124,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
@Test
public void replaceInstruction() throws Exception {
MethodBody b = compilePCode("pushbyte 1\r\n"
MethodBody b = compilePCode("pushbyte 1\r\n"
+ "setlocal1\r\n"
+ "jump label1\r\n" //remove this
+ "jump label1\r\n"
+ "pushtrue\r\n"
@@ -135,7 +136,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
@Test
public void replaceInstruction2() throws Exception {
MethodBody b = compilePCode("pushbyte 1\r\n"
MethodBody b = compilePCode("pushbyte 1\r\n"
+ "setlocal1\r\n"
+ "jump label1\r\n"
+ "pushtrue\r\n"
+ "jump label1\r\n" //remove this