mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 17:40:43 +00:00
collect decompilation performance statistic data
This commit is contained in:
@@ -290,6 +290,7 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.ExitItem;
|
||||
import com.jpexs.decompiler.graph.model.ScriptEndItem;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.stat.Statistics;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -2259,9 +2260,15 @@ public class AVM2Code implements Cloneable {
|
||||
if (Configuration.deobfuscationOldMode.get()) {
|
||||
return removeTrapsOld(constants, trait, info, body, abc, scriptIndex, classIndex, isStatic, path);
|
||||
} else {
|
||||
new AVM2DeobfuscatorSimple().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
new AVM2DeobfuscatorRegisters().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
new AVM2DeobfuscatorJumps().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
try (Statistics s = new Statistics("AVM2DeobfuscatorSimple")) {
|
||||
new AVM2DeobfuscatorSimple().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
}
|
||||
try (Statistics s = new Statistics("AVM2DeobfuscatorRegisters")) {
|
||||
new AVM2DeobfuscatorRegisters().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
}
|
||||
try (Statistics s = new Statistics("AVM2DeobfuscatorJumps")) {
|
||||
new AVM2DeobfuscatorJumps().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.MemoryInputStream;
|
||||
import com.jpexs.helpers.stat.Statistics;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -292,11 +293,18 @@ public final class MethodBody implements Cloneable {
|
||||
Callable<Void> callable = new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws InterruptedException {
|
||||
MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits);
|
||||
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
|
||||
List<GraphTargetItem> convertedItems1 = converted.getCode().toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<>(), converted.getCode().visitCode(converted));
|
||||
Graph.graphToString(convertedItems1, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
convertedItems = convertedItems1;
|
||||
try (Statistics s1 = new Statistics("MethodBody.convert")) {
|
||||
MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits);
|
||||
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
|
||||
List<GraphTargetItem> convertedItems1;
|
||||
try (Statistics s = new Statistics("AVM2Code.toGraphTargetItems")) {
|
||||
convertedItems1 = converted.getCode().toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<>(), converted.getCode().visitCode(converted));
|
||||
}
|
||||
try (Statistics s = new Statistics("Graph.graphToString")) {
|
||||
Graph.graphToString(convertedItems1, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
}
|
||||
convertedItems = convertedItems1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -334,22 +342,24 @@ public final class MethodBody implements Cloneable {
|
||||
}
|
||||
int timeout = Configuration.decompilationTimeoutSingleMethod.get();
|
||||
|
||||
if (convertException == null) {
|
||||
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
|
||||
//writer.startMethod(this.method_info);
|
||||
if (Configuration.showMethodBodyId.get()) {
|
||||
writer.appendNoHilight("// method body id: ");
|
||||
writer.appendNoHilight(abc.findBodyIndex(this.method_info));
|
||||
writer.newLine();
|
||||
try (Statistics s = new Statistics("MethodBody.toString")) {
|
||||
if (convertException == null) {
|
||||
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
|
||||
//writer.startMethod(this.method_info);
|
||||
if (Configuration.showMethodBodyId.get()) {
|
||||
writer.appendNoHilight("// method body id: ");
|
||||
writer.appendNoHilight(abc.findBodyIndex(this.method_info));
|
||||
writer.newLine();
|
||||
}
|
||||
Graph.graphToString(convertedItems, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
//writer.endMethod();
|
||||
} else if (convertException instanceof TimeoutException) {
|
||||
// exception was logged in convert method
|
||||
Helper.appendTimeoutCommentAs3(writer, timeout, getCode().code.size());
|
||||
} else {
|
||||
// exception was logged in convert method
|
||||
Helper.appendErrorComment(writer, convertException);
|
||||
}
|
||||
Graph.graphToString(convertedItems, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
//writer.endMethod();
|
||||
} else if (convertException instanceof TimeoutException) {
|
||||
// exception was logged in convert method
|
||||
Helper.appendTimeoutCommentAs3(writer, timeout, getCode().code.size());
|
||||
} else {
|
||||
// exception was logged in convert method
|
||||
Helper.appendErrorComment(writer, convertException);
|
||||
}
|
||||
}
|
||||
return writer;
|
||||
|
||||
@@ -49,6 +49,7 @@ import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.stat.Statistics;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -179,8 +180,12 @@ public class ActionListReader {
|
||||
}
|
||||
} else if (deobfuscationMode == 1) {
|
||||
try {
|
||||
new ActionDeobfuscatorSimple().actionListParsed(actions, sis.getSwf());
|
||||
new ActionDeobfuscator().actionListParsed(actions, sis.getSwf());
|
||||
try (Statistics s = new Statistics("ActionDeobfuscatorSimple")) {
|
||||
new ActionDeobfuscatorSimple().actionListParsed(actions, sis.getSwf());
|
||||
}
|
||||
try (Statistics s = new Statistics("ActionDeobfuscator")) {
|
||||
new ActionDeobfuscator().actionListParsed(actions, sis.getSwf());
|
||||
}
|
||||
} catch (ThreadDeath | InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
|
||||
+9
-2
@@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.helpers.FileTextWriter;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Path;
|
||||
import com.jpexs.helpers.stat.Statistics;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -103,9 +104,15 @@ public class ExportScriptTask implements Callable<File> {
|
||||
asm.getASMSource(exportMode, writer2, null);
|
||||
asm.getActionSourceSuffix(writer2);
|
||||
} else {
|
||||
List<Action> as = asm.getActions();
|
||||
List<Action> as;
|
||||
try (Statistics s = new Statistics("ASMSource.getActions")) {
|
||||
as = asm.getActions();
|
||||
}
|
||||
Action.setActionsAddresses(as, 0);
|
||||
Action.actionsToSource(asm, as, asm.toString()/*FIXME?*/, writer2);
|
||||
|
||||
try (Statistics s = new Statistics("Action.actionsToSource")) {
|
||||
Action.actionsToSource(asm, as, asm.toString()/*FIXME?*/, writer2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user