From 914a2bb70134d3f37bc7c6a51c49324d81cd6426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 7 Feb 2021 17:18:45 +0100 Subject: [PATCH] minor try improvement --- .../jpexs/decompiler/flash/abc/AVM2LocalData.java | 3 +++ .../decompiler/flash/abc/avm2/graph/AVM2Graph.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java index 7bc9b5506..1c1327074 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java @@ -83,6 +83,8 @@ public class AVM2LocalData extends BaseLocalData { public Map defaultParts = new HashMap<>(); public Map switchedRegs = new HashMap<>(); + + public Map pushDefaultPart = new HashMap<>(); /** * exception index -> switch throw part @@ -159,6 +161,7 @@ public class AVM2LocalData extends BaseLocalData { inGetLoops = localData.inGetLoops; parsedExceptionIds = localData.parsedExceptionIds; finallyTargetParts = localData.finallyTargetParts; + pushDefaultPart = localData.pushDefaultPart; } public AVM2ConstantPool getConstants() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index c2a21f0e2..b4a9f9f70 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -316,8 +316,12 @@ public class AVM2Graph extends Graph { } else if (ins.definition instanceof PushByteIns) { defaultPushByte = ins.operands[0]; + localData.pushDefaultPart.put(e, prevFinallyEndPart); } else if (ins.definition instanceof JumpIns) { } else { + if(localData.pushDefaultPart.containsKey(e)){ + localData.pushDefaultPart.remove(e); + } defaultPushByte = null; break; } @@ -333,6 +337,7 @@ public class AVM2Graph extends Graph { } else if (ins.definition instanceof PushByteIns) { defaultPushByte = ins.operands[0]; + localData.pushDefaultPart.put(e, prevFinallyEndPart); break; } else { break; @@ -1049,7 +1054,7 @@ public class AVM2Graph extends Graph { if (afterPart == null) { afterPart = searchFirstPartOutSideTryCatch(localData, finallyException, loops, allParts); } - + if (afterPart != null) { tryStopPart.add(afterPart); } @@ -1061,6 +1066,11 @@ public class AVM2Graph extends Graph { afterPart = null; } } + + if (afterPart == null && localData.pushDefaultPart.containsKey(finallyIndex)){ + exAfterPart = localData.pushDefaultPart.get(finallyIndex); + tryStopPart.add(exAfterPart); + } tryCommands = printGraph(foundGotos, partCodes, partCodePos, visited, localData, stack, allParts, null, part, tryStopPart, loops, throwStates, staticOperation, path); makeAllCommands(tryCommands, stack);