From eded3498239ac4510d0dfc8e317c6ba056a74b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 14 Jan 2018 14:18:23 +0100 Subject: [PATCH] removeNullPushes .. optimize call getImportantOffsets - only when instruction removed --- .../flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java | 4 +++- .../abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java index e5c96ad04..65b06ab3a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java @@ -153,9 +153,10 @@ public class AVM2DeobfuscatorSimple extends SWFDecompilerAdapter { protected boolean removeNullPushes(AVM2Code code, MethodBody body) throws InterruptedException { boolean result = false; + Set offsets = code.getImportantOffsets(body, true); + // Deliberately skip over instruction zero for (int i = 1; i < code.code.size(); i++) { - Set offsets = code.getImportantOffsets(body, true); AVM2Instruction ins1 = code.code.get(i - 1); AVM2Instruction ins2 = code.code.get(i); if (ins2.definition instanceof PopIns @@ -179,6 +180,7 @@ public class AVM2DeobfuscatorSimple extends SWFDecompilerAdapter { i--; code.removeInstruction(i, body); i--; + offsets = code.getImportantOffsets(body, true); //update offsets, they changed because of removing instruction result = true; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java index 23c135d87..3166d1ed2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java @@ -209,9 +209,10 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter { protected boolean removeNullPushes(AVM2Code code, MethodBody body) throws InterruptedException { boolean result = false; + Set offsets = code.getImportantOffsets(body, true); + // Deliberately skip over instruction zero for (int i = 1; i < code.code.size(); i++) { - Set offsets = code.getImportantOffsets(body, true); AVM2Instruction ins1 = code.code.get(i - 1); AVM2Instruction ins2 = code.code.get(i); if (ins2.definition instanceof PopIns @@ -235,6 +236,7 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter { i--; code.removeInstruction(i, body); i--; + offsets = code.getImportantOffsets(body, true); //update offsets, they changed because of removing instruction result = true; } }