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

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2018 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.graph;
import java.util.List;
/**
* Basic Prev-Next walker which uses only nextParts+refs.
* @author JPEXS
*/
public class BasicPrevNextWalker implements PrevNextWalker {
@Override
public List<? extends GraphPart> getPrev(GraphPart node) {
return node.refs;
}
@Override
public List<? extends GraphPart> getNext(GraphPart node) {
return node.nextParts;
}
}