diff --git a/deobfuscator-api/pom.xml b/deobfuscator-api/pom.xml
index 63ddbe3..862800a 100644
--- a/deobfuscator-api/pom.xml
+++ b/deobfuscator-api/pom.xml
@@ -16,7 +16,12 @@
17
UTF-8
- 9.7.1
+
+ 9.8-SNAPSHOT
2.23.1
2.0.13
@@ -30,6 +35,11 @@
jitpack.io
https://jitpack.io
+
+
+ ow2-repo
+ https://repository.ow2.org/nexus/content/repositories/snapshots
+
diff --git a/deobfuscator-transformers/src/main/java/uwu/narumi/deobfuscator/core/other/impl/clean/peephole/UselessPopCleanTransformer.java b/deobfuscator-transformers/src/main/java/uwu/narumi/deobfuscator/core/other/impl/clean/peephole/UselessPopCleanTransformer.java
index 37418c3..0504a83 100644
--- a/deobfuscator-transformers/src/main/java/uwu/narumi/deobfuscator/core/other/impl/clean/peephole/UselessPopCleanTransformer.java
+++ b/deobfuscator-transformers/src/main/java/uwu/narumi/deobfuscator/core/other/impl/clean/peephole/UselessPopCleanTransformer.java
@@ -7,16 +7,16 @@
import uwu.narumi.deobfuscator.api.helper.FramedInstructionsStream;
import uwu.narumi.deobfuscator.api.transformer.Transformer;
-import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
public class UselessPopCleanTransformer extends Transformer {
public UselessPopCleanTransformer() {
this.rerunOnChange = true;
}
- private final Set poppedDups = new HashSet<>();
+ private final Set poppedInsns = ConcurrentHashMap.newKeySet();
@Override
protected void transform() throws Exception {
@@ -87,10 +87,15 @@ private boolean canPop(OriginalSourceValue sourceValue) {
// Check if all producers of the source value are constants
for (AbstractInsnNode producer : sourceValue.insns) {
+ // Prevent popping instructions twice (especially DUPs)
+ if (poppedInsns.contains(producer)) return false;
+
// Can be popped if the value is constant
if (producer.isConstant()) continue;
- // Can be popped if the value is DUP, and it wasn't popped yet
- if (producer.getOpcode() == DUP && !poppedDups.contains(producer)) continue;
+ // Can be popped if the value is DUP or DUP2
+ if (producer.getOpcode() == DUP || producer.getOpcode() == DUP2) continue;
+ // Can be popped if value is a local variable
+ if (producer.isVarLoad()) continue;
return false;
}
@@ -99,10 +104,9 @@ private boolean canPop(OriginalSourceValue sourceValue) {
private void popSourceValue(OriginalSourceValue value, MethodNode methodNode) {
for (AbstractInsnNode producer : value.insns) {
- if (producer.getOpcode() == DUP) {
- // Prevent popping DUP twice
- poppedDups.add(producer);
- }
+ // Prevent popping instructions twice (especially DUPs)
+ poppedInsns.add(producer);
+
methodNode.instructions.remove(producer);
}
}
diff --git a/testData/results/custom-classes/zkm/sample1/io/github/repooper/packetevents/PacketEvents.dec b/testData/results/custom-classes/zkm/sample1/io/github/repooper/packetevents/PacketEvents.dec
index 9acc7ae..239bac7 100644
--- a/testData/results/custom-classes/zkm/sample1/io/github/repooper/packetevents/PacketEvents.dec
+++ b/testData/results/custom-classes/zkm/sample1/io/github/repooper/packetevents/PacketEvents.dec
@@ -136,7 +136,6 @@ public final class PacketEvents implements Listener, EventManager {
int var17;
PacketEvents var24;
label89: {
- long var1 = 37314761108082L;
var3 = 100924278520616L;
var5 = 26099128416120L;
var7 = 127830791373044L;
@@ -318,7 +317,6 @@ public final class PacketEvents implements Listener, EventManager {
Runnable var6;
label37: {
var6 = () -> {
- long var1x = 66876338785522L;
long var3 = 119084676127620L;
long var5x = 123797029215992L;
Bukkit.getPluginManager().registerEvents(this.bukkitEventProcessorInternal, plugin);
@@ -373,7 +371,6 @@ public final class PacketEvents implements Listener, EventManager {
}
public void Vulcan_o() {
- long var1 = 47666491843353L;
long var3 = 94080624911225L;
long var5 = 53297714112873L;
int var7 = Vulcan_Q();
@@ -498,7 +495,6 @@ public final class PacketEvents implements Listener, EventManager {
}
Thread var4 = new Thread(() -> {
- long var1 = 73114304934084L;
long var3x = 71820540609001L;
int var10000x = Vulcan_a();
this.Vulcan_a().getLogger().info("[packetevents] Checking for an update, please wait...");
diff --git a/testData/results/custom-classes/zkm/sample2/a/a/a/a/a_.dec b/testData/results/custom-classes/zkm/sample2/a/a/a/a/a_.dec
index 1de114d..900bc76 100644
--- a/testData/results/custom-classes/zkm/sample2/a/a/a/a/a_.dec
+++ b/testData/results/custom-classes/zkm/sample2/a/a/a/a/a_.dec
@@ -34,17 +34,17 @@ public class a_ implements Serializable {
@Deprecated
public static a_ a(Comparable var0, Comparable var1, long var2) {
var2 = 104039320445854L ^ var2;
- long var10001 = var2 ^ 126902786326681L;
+ long var10000 = var2 ^ 126902786326681L;
int var5 = (int)((var2 ^ 126902786326681L) >>> 48);
int var6 = (int)((var2 ^ 126902786326681L) << 16 >>> 32);
- int var7 = (int)(var10001 << 48 >>> 48);
- char var10000 = (char)var5;
+ int var7 = (int)(var10000 << 48 >>> 48);
+ char var9 = (char)var5;
Object[] var10007 = new Object[]{null, null, null, null, null, var7};
var10007[4] = var6;
var10007[3] = null;
var10007[2] = var1;
var10007[1] = var0;
- var10007[0] = Integer.valueOf(var10000);
+ var10007[0] = Integer.valueOf(var9);
return f(var10007);
}
@@ -58,49 +58,49 @@ public class a_ implements Serializable {
public static a_ c(long var0, Comparable var2) {
var0 = 104039320445854L ^ var0;
- long var10001 = var0 ^ 18483036967427L;
+ long var10000 = var0 ^ 18483036967427L;
int var4 = (int)((var0 ^ 18483036967427L) >>> 48);
int var5 = (int)((var0 ^ 18483036967427L) << 16 >>> 32);
- int var6 = (int)(var10001 << 48 >>> 48);
- char var10000 = (char)var4;
+ int var6 = (int)(var10000 << 48 >>> 48);
+ char var8 = (char)var4;
Object[] var10007 = new Object[]{null, null, null, null, null, var6};
var10007[4] = var5;
var10007[3] = null;
var10007[2] = var2;
var10007[1] = var2;
- var10007[0] = Integer.valueOf(var10000);
+ var10007[0] = Integer.valueOf(var8);
return f(var10007);
}
public static a_ d(Object var0, long var1, Comparator var3) {
var1 = 104039320445854L ^ var1;
- long var10001 = var1 ^ 21537914483950L;
+ long var10000 = var1 ^ 21537914483950L;
int var5 = (int)((var1 ^ 21537914483950L) >>> 48);
int var6 = (int)((var1 ^ 21537914483950L) << 16 >>> 32);
- int var7 = (int)(var10001 << 48 >>> 48);
- char var10000 = (char)var5;
+ int var7 = (int)(var10000 << 48 >>> 48);
+ char var9 = (char)var5;
Object[] var10007 = new Object[]{null, null, null, null, null, var7};
var10007[4] = var6;
var10007[3] = var3;
var10007[2] = var0;
var10007[1] = var0;
- var10007[0] = Integer.valueOf(var10000);
+ var10007[0] = Integer.valueOf(var9);
return f(var10007);
}
public static a_ e(long var0, Comparable var2, Comparable var3) {
var0 = 104039320445854L ^ var0;
- long var10001 = var0 ^ 30036545302711L;
+ long var10000 = var0 ^ 30036545302711L;
int var5 = (int)((var0 ^ 30036545302711L) >>> 48);
int var6 = (int)((var0 ^ 30036545302711L) << 16 >>> 32);
- int var7 = (int)(var10001 << 48 >>> 48);
- char var10000 = (char)var5;
+ int var7 = (int)(var10000 << 48 >>> 48);
+ char var9 = (char)var5;
Object[] var10007 = new Object[]{null, null, null, null, null, var7};
var10007[4] = var6;
var10007[3] = null;
var10007[2] = var3;
var10007[1] = var2;
- var10007[0] = Integer.valueOf(var10000);
+ var10007[0] = Integer.valueOf(var9);
return f(var10007);
}
@@ -190,7 +190,6 @@ public class a_ implements Serializable {
}
public int hashCode() {
- long var1 = 98334368194806L;
int var3 = this.b;
if (this.b == 0) {
int var4 = b<"m">(26604, 8453020672365342500L);
@@ -343,7 +342,6 @@ public class a_ implements Serializable {
}
public String toString() {
- long var1 = 15341762901975L;
if (this.e == null) {
this.e = "[" + this.d + a<"c">(18317, 6648620723262088254L) + this.c + "]";
}
diff --git a/testData/results/custom-jars/SnakeGame-obf-zkm/Main.dec b/testData/results/custom-jars/SnakeGame-obf-zkm/Main.dec
index 5b7a3db..bddca8d 100644
--- a/testData/results/custom-jars/SnakeGame-obf-zkm/Main.dec
+++ b/testData/results/custom-jars/SnakeGame-obf-zkm/Main.dec
@@ -4,7 +4,6 @@ public class Main {
private static final Integer[] c;
public static void main(String[] var0) {
- long var1 = 53836601486112L;
e var3 = new e();
var3.setTitle(a);
var3.setSize(a(23704, 8408508685984484905L), a(21193, 5113680640368394361L));
diff --git a/testData/results/custom-jars/SnakeGame-obf-zkm/d.dec b/testData/results/custom-jars/SnakeGame-obf-zkm/d.dec
index 2ee7c8a..0b92aaa 100644
--- a/testData/results/custom-jars/SnakeGame-obf-zkm/d.dec
+++ b/testData/results/custom-jars/SnakeGame-obf-zkm/d.dec
@@ -46,7 +46,6 @@ public class d extends Thread {
}
public void run() {
- long var1 = 89995196843699L;
long var3 = 12972172530972L;
long var5 = 121593940001805L;
long var7 = 41896598891982L;
diff --git a/testData/results/custom-jars/SnakeGame-obf-zkm/e.dec b/testData/results/custom-jars/SnakeGame-obf-zkm/e.dec
index f6cce4e..5c6c0d8 100644
--- a/testData/results/custom-jars/SnakeGame-obf-zkm/e.dec
+++ b/testData/results/custom-jars/SnakeGame-obf-zkm/e.dec
@@ -11,7 +11,6 @@ class e extends JFrame {
private static final Integer[] e;
public e() {
- long var1 = 71224974300475L;
long var3 = 61070374780970L;
byte var10000 = d.h;
super();