feat!: redesigned loop detector (#2542)

Instead of walking code structures to get loops,
the loops are populated by new faster algorithm.
Also, we do not join adjacent GraphParts anymore
in non-obfuscated code.
For proper switch handling, the code is decompiled
in two passes everytime (Previously, the second pass
was used only sometimes).
In first pass we do not process ifs as it may break
switch detection. Second pass is executed after we know
the switches position.

Fixes #2542
This commit is contained in:
Jindra Petřík
2026-03-14 17:29:08 +01:00
parent a52126472a
commit 7d18834c81
19 changed files with 1378 additions and 192 deletions

View File

@@ -3953,7 +3953,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
* @throws InterruptedException On interrupt
*/
private static void getVariables(SWF swf, boolean insideDoInitAction, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes, ActionGraphSource code, long addr, String path) throws InterruptedException {
ActionLocalData localData = new ActionLocalData(null, insideDoInitAction, new HashMap<>() /*??*/, new LinkedHashSet<>());
ActionLocalData localData = new ActionLocalData(null, insideDoInitAction, new HashMap<>() /*??*/, new LinkedHashSet<>(), new ArrayList<>(), new ArrayList<>());
getVariables(swf, null, localData, new TranslateStack(path), new ArrayList<>(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList<>(), usageTypes, path);
}