mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 18:51:14 +00:00
properly interrupt on timeout
This commit is contained in:
@@ -204,7 +204,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
appendTo(writer, traits, exportMode, parallel);
|
||||
}
|
||||
|
||||
public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException {
|
||||
public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException, InterruptedException {
|
||||
File file = null;
|
||||
|
||||
if (!exportSettings.singleFile) {
|
||||
@@ -212,12 +212,8 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
|
||||
try (FileTextWriter writer = exportSettings.singleFile ? null : new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) {
|
||||
try {
|
||||
FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer;
|
||||
toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel);
|
||||
} catch (InterruptedException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer;
|
||||
toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel);
|
||||
} catch (FileNotFoundException ex) {
|
||||
logger.log(Level.SEVERE, "The file path is probably too long", ex);
|
||||
}
|
||||
|
||||
@@ -1355,25 +1355,21 @@ public class AVM2Code implements Cloneable {
|
||||
|
||||
private Map<Integer, Set<Integer>> killedRegs = new HashMap<>();
|
||||
|
||||
public void calcKilledStats(MethodBody body) {
|
||||
public void calcKilledStats(MethodBody body) throws InterruptedException {
|
||||
killedRegs.clear();
|
||||
try {
|
||||
HashMap<Integer, List<Integer>> vis = visitCode(body);
|
||||
for (int k = 0; k < code.size(); k++) {
|
||||
if (vis.get(k).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (code.get(k).definition instanceof KillIns) {
|
||||
int regid = code.get(k).operands[0];
|
||||
if (!killedRegs.containsKey(regid)) {
|
||||
killedRegs.put(regid, new HashSet<>());
|
||||
}
|
||||
killedRegs.get(regid).add(k);
|
||||
}
|
||||
}
|
||||
HashMap<Integer, List<Integer>> vis = visitCode(body);
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
// ignored
|
||||
for (int k = 0; k < code.size(); k++) {
|
||||
if (vis.get(k).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (code.get(k).definition instanceof KillIns) {
|
||||
int regid = code.get(k).operands[0];
|
||||
if (!killedRegs.containsKey(regid)) {
|
||||
killedRegs.put(regid, new HashSet<>());
|
||||
}
|
||||
killedRegs.get(regid).add(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -153,7 +153,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
}
|
||||
}
|
||||
|
||||
private int getFirstRegisterSetter(Reference<AVM2Instruction> assignment, int classIndex, boolean isStatic, int scriptIndex, ABC abc, AVM2ConstantPool cpool, Trait trait, MethodInfo minfo, MethodBody body, Set<Integer> ignoredRegisters, Set<Integer> ignoredGets) {
|
||||
private int getFirstRegisterSetter(Reference<AVM2Instruction> assignment, int classIndex, boolean isStatic, int scriptIndex, ABC abc, AVM2ConstantPool cpool, Trait trait, MethodInfo minfo, MethodBody body, Set<Integer> ignoredRegisters, Set<Integer> ignoredGets) throws InterruptedException {
|
||||
AVM2Code code = body.getCode();
|
||||
Map<Integer, GraphTargetItem> ret = new HashMap<>();
|
||||
|
||||
@@ -165,7 +165,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
return visitCode(assignment, new HashSet<>(), new TranslateStack("deo"), classIndex, isStatic, body, scriptIndex, abc, code, 0, code.code.size() - 1, res, ignoredRegisters, ignoredGets);
|
||||
}
|
||||
|
||||
private int visitCode(Reference<AVM2Instruction> assignment, Set<Integer> visited, TranslateStack stack, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, Set<Integer> ignored, Set<Integer> ignoredGets) {
|
||||
private int visitCode(Reference<AVM2Instruction> assignment, Set<Integer> visited, TranslateStack stack, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, Set<Integer> ignored, Set<Integer> ignoredGets) throws InterruptedException {
|
||||
List<GraphTargetItem> output = new ArrayList<>();
|
||||
AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex);
|
||||
localData.localRegs.put(0, new NullAVM2Item(null));//this
|
||||
@@ -193,7 +193,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
|
||||
action.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
|
||||
|
||||
//if (!(def instanceof KillIns))
|
||||
//if (!(def instanceof KillIns))
|
||||
if (def instanceof SetLocalTypeIns) {
|
||||
int regId = ((SetLocalTypeIns) def).getRegisterId(action);
|
||||
if (!ignored.contains(regId)) {
|
||||
@@ -295,6 +295,8 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
+3
-1
@@ -224,7 +224,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
|
||||
return localData;
|
||||
}
|
||||
|
||||
private void executeActions(Map<Integer, GraphTargetItem> staticRegs, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, List<AVM2Instruction> inlineIns) {
|
||||
private void executeActions(Map<Integer, GraphTargetItem> staticRegs, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, List<AVM2Instruction> inlineIns) throws InterruptedException {
|
||||
List<GraphTargetItem> output = new ArrayList<>();
|
||||
AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex);
|
||||
|
||||
@@ -393,6 +393,8 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user