From 1cec2c3739d2520009b2dea6fb22960125050e4c Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 11 Aug 2019 09:49:40 +0100 Subject: [PATCH] Remove ILOAD inlining This causes Fernflower to output invalid Java in some cases. Need to think about how exactly to replace it. --- .../deob/transform/DummyTransformer.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/transform/DummyTransformer.java b/deob/src/main/java/dev/openrs2/deob/transform/DummyTransformer.java index 970462bdbf..ef65753708 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/DummyTransformer.java +++ b/deob/src/main/java/dev/openrs2/deob/transform/DummyTransformer.java @@ -11,7 +11,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; -import dev.openrs2.asm.InsnNodeUtils; import dev.openrs2.asm.MemberRef; import dev.openrs2.asm.classpath.ClassPath; import dev.openrs2.asm.transform.Transformer; @@ -25,7 +24,6 @@ import org.objectweb.asm.tree.InsnNode; import org.objectweb.asm.tree.JumpInsnNode; import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; -import org.objectweb.asm.tree.VarInsnNode; import org.objectweb.asm.tree.analysis.Analyzer; import org.objectweb.asm.tree.analysis.AnalyzerException; import org.slf4j.Logger; @@ -164,12 +162,11 @@ public final class DummyTransformer extends Transformer { private final Multimap argValues = HashMultimap.create(); private final Map, ImmutableSet[]> constArgs = new HashMap<>(); private DisjointSet inheritedMethodSets; - private int loadsInlined, branchesSimplified; + private int branchesSimplified; @Override protected void preTransform(ClassPath classPath) { inheritedMethodSets = classPath.createInheritedMethodSets(); - loadsInlined = 0; branchesSimplified = 0; } @@ -223,18 +220,9 @@ public final class DummyTransformer extends Transformer { k += arg.getSize(); } break; - case Opcodes.ILOAD: - var iload = (VarInsnNode) insn; - var value = frame.getLocal(iload.var); - if (value.isSingleConstant()) { - method.instructions.set(insn, InsnNodeUtils.createIntConstant(value.getIntValue())); - loadsInlined++; - changed = true; - } - break; case Opcodes.IFEQ: case Opcodes.IFNE: - value = frame.getStack(stackSize - 1); + var value = frame.getStack(stackSize - 1); if (value.isUnknown()) { continue; } @@ -321,6 +309,6 @@ public final class DummyTransformer extends Transformer { @Override protected void postTransform(ClassPath classPath) { - logger.info("Inlined {} dummy loads and simplified {} dummy branches", loadsInlined, branchesSimplified); + logger.info("Simplified {} dummy branches", branchesSimplified); } }