mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 12:20:53 +00:00
Added: AS2 - Information about need of decompiling all scripts to detect uninitialized class fields
Fixed: #2338 AS decompiling threads got stuck after cancelling / timeout CancellableWorker refactoring
This commit is contained in:
@@ -466,7 +466,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
writer.suspendMeasure();
|
||||
int timeout = Configuration.decompilationTimeoutFile.get();
|
||||
try {
|
||||
CancellableWorker.call(new Callable<Void>() {
|
||||
CancellableWorker.call("script.scriptPack.toSource", new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
convert(abcIndex, new NulWriter(), traits, convertData, exportMode, parallel);
|
||||
|
||||
@@ -305,6 +305,7 @@ import com.jpexs.decompiler.graph.SimpleValue;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.ScriptEndItem;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.LinkedIdentityHashSet;
|
||||
import com.jpexs.helpers.Reference;
|
||||
@@ -3458,7 +3459,7 @@ public class AVM2Code implements Cloneable {
|
||||
toVisit.add(ip);
|
||||
toVisitLast.add(lastIp);
|
||||
while (!toVisit.isEmpty()) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
ip = toVisit.remove();
|
||||
|
||||
+2
-1
@@ -40,6 +40,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.NotCompileTimeItem;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -107,7 +108,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter {
|
||||
AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex);
|
||||
int localReservedCount = body.getLocalReservedCount();
|
||||
for (int i = 0; i < code.code.size(); i++) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -44,6 +44,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -134,7 +135,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
Reference<AVM2Instruction> assignmentRef = new Reference<>(null);
|
||||
|
||||
while (setReg > -1) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
@@ -200,7 +201,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
AVM2Code code = body.getCode();
|
||||
|
||||
for (int i = 0; i < code.code.size(); i++) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
@@ -271,7 +272,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
|
||||
toVisitStacks.add(stack);
|
||||
outer:
|
||||
while (!toVisit.isEmpty()) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -42,6 +42,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -131,7 +132,7 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld {
|
||||
Reference<AVM2Instruction> assignmentRef = new Reference<>(null);
|
||||
|
||||
while (setReg > -1) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
@@ -290,7 +291,7 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld {
|
||||
toVisitStacks.add(stack);
|
||||
outer:
|
||||
while (!toVisit.isEmpty()) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -78,6 +78,7 @@ import com.jpexs.decompiler.flash.ecma.NotCompileTime;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.collections.FixItemCounterStack;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -135,7 +136,7 @@ public class AVM2DeobfuscatorSimple extends AVM2DeobfuscatorZeroJumpsNullPushes
|
||||
|
||||
int localReservedCount = body.getLocalReservedCount();
|
||||
for (int i = 0; i < code.code.size(); i++) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -99,6 +99,7 @@ import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.decompiler.graph.model.FalseItem;
|
||||
import com.jpexs.decompiler.graph.model.TrueItem;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -209,7 +210,7 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush
|
||||
int localReservedCount = body.getLocalReservedCount();
|
||||
Set<Long> importantOffsets = code.getImportantOffsets(body, isStatic);
|
||||
for (int i = 0; i < code.code.size(); i++) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushUndefinedIns;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.helpers.SWFDecompilerAdapter;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter {
|
||||
AVM2Instruction ins = code.code.get(i);
|
||||
if (ins.definition instanceof JumpIns) {
|
||||
if (ins.operands[0] == 0) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter {
|
||||
if (ins2.definition instanceof PopIns
|
||||
&& !offsets.contains(ins2.getAddress())
|
||||
&& isSimplePush(ins1.definition)) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
@@ -159,7 +160,7 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter {
|
||||
&& !offsets.contains(ins2.getAddress())
|
||||
&& !offsets.contains(ins1.getAddress())
|
||||
&& isSimplePush(ins0.definition)) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
code.removeInstruction(i - 2, body);
|
||||
|
||||
+2
-1
@@ -42,6 +42,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
@@ -1605,7 +1606,7 @@ public class ASM3Parser {
|
||||
}
|
||||
|
||||
for (OffsetItem oi : offsetItems) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
if (!labelToOffset.containsKey(oi.label)) {
|
||||
|
||||
+2
-1
@@ -119,6 +119,7 @@ import com.jpexs.decompiler.graph.model.SwitchItem;
|
||||
import com.jpexs.decompiler.graph.model.TernarOpItem;
|
||||
import com.jpexs.decompiler.graph.model.TrueItem;
|
||||
import com.jpexs.decompiler.graph.model.WhileItem;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
@@ -473,7 +474,7 @@ public class ActionScript3Parser {
|
||||
}
|
||||
|
||||
private ParsedSymbol lex() throws IOException, AVM2ParseException, InterruptedException {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (CancellableWorker.isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
ParsedSymbol ret = lexer.lex();
|
||||
|
||||
@@ -482,7 +482,7 @@ public final class MethodBody implements Cloneable {
|
||||
}
|
||||
};
|
||||
if (firstLevel) {
|
||||
CancellableWorker.call(callable, timeout, TimeUnit.SECONDS);
|
||||
CancellableWorker.call("script.methodbody.convert", callable, timeout, TimeUnit.SECONDS);
|
||||
} else {
|
||||
callable.call();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user