mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-10 12:06:23 +00:00
try..catch vs loops
This commit is contained in:
@@ -89,6 +89,8 @@ public class AVM2LocalData extends BaseLocalData {
|
||||
*/
|
||||
public Map<Integer, GraphPart> finallyThrowParts = new HashMap<>();
|
||||
|
||||
public Map<Integer, GraphPart> finallyTargetParts = new HashMap<>();
|
||||
|
||||
//switchedPart -> index of nextpart
|
||||
public Map<GraphPart, Integer> defaultWays = new HashMap<>();
|
||||
|
||||
@@ -156,6 +158,7 @@ public class AVM2LocalData extends BaseLocalData {
|
||||
finallyThrowParts = localData.finallyThrowParts;
|
||||
inGetLoops = localData.inGetLoops;
|
||||
parsedExceptionIds = localData.parsedExceptionIds;
|
||||
finallyTargetParts = localData.finallyTargetParts;
|
||||
}
|
||||
|
||||
public AVM2ConstantPool getConstants() {
|
||||
|
||||
@@ -160,9 +160,27 @@ public class AVM2Graph extends Graph {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canBeBreakCandidate(BaseLocalData localData, GraphPart part) {
|
||||
AVM2LocalData aLocalData = (AVM2LocalData) localData;
|
||||
if (aLocalData.finallyTargetParts.containsValue(part)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void beforeGetLoops(BaseLocalData localData, String path, Set<GraphPart> allParts, List<ThrowState> throwStates) throws InterruptedException {
|
||||
AVM2LocalData avm2LocalData = ((AVM2LocalData) localData);
|
||||
|
||||
for (int e = 0; e < body.exceptions.length; e++) {
|
||||
ABCException ex = body.exceptions[e];
|
||||
if (ex.isFinally()) {
|
||||
avm2LocalData.finallyTargetParts.put(e, searchPart(code.adr2pos(ex.target), allParts));
|
||||
}
|
||||
}
|
||||
|
||||
avm2LocalData.codeStats = avm2LocalData.code.getStats(avm2LocalData.abc, avm2LocalData.methodBody, avm2LocalData.methodBody.init_scope_depth, false);
|
||||
getIgnoredSwitches((AVM2LocalData) localData, allParts);
|
||||
Set<Integer> integerSwitchesIps = new HashSet<>();
|
||||
|
||||
@@ -143,7 +143,7 @@ public class ActionGraph extends Graph {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canBeBreakCandidate(GraphPart part) {
|
||||
protected boolean canBeBreakCandidate(BaseLocalData localData, GraphPart part) {
|
||||
if (part.refs.size() <= 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user