Rename FieldRef to MemberRef

bzip2
Graham 5 years ago
parent c0568f1373
commit 7e4dee02d0
  1. 6
      asm/src/main/java/dev/openrs2/asm/MemberRef.java
  2. 8
      deob/src/main/java/dev/openrs2/deob/transform/OpaquePredicateTransformer.java

@ -2,10 +2,10 @@ package dev.openrs2.asm;
import java.util.Objects;
public final class FieldRef {
public final class MemberRef {
private final String owner, name, desc;
public FieldRef(String owner, String name, String desc) {
public MemberRef(String owner, String name, String desc) {
this.owner = owner;
this.name = name;
this.desc = desc;
@ -31,7 +31,7 @@ public final class FieldRef {
if (o == null || getClass() != o.getClass()) {
return false;
}
FieldRef fieldRef = (FieldRef) o;
MemberRef fieldRef = (MemberRef) o;
return owner.equals(fieldRef.owner) &&
name.equals(fieldRef.name) &&
desc.equals(fieldRef.desc);

@ -4,9 +4,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import dev.openrs2.asm.FieldRef;
import dev.openrs2.asm.InsnMatcher;
import dev.openrs2.asm.Library;
import dev.openrs2.asm.MemberRef;
import dev.openrs2.asm.Transformer;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
@ -25,7 +25,7 @@ public final class OpaquePredicateTransformer extends Transformer {
private static final InsnMatcher OPAQUE_PREDICATE_MATCHER = InsnMatcher.compile("(GETSTATIC | ILOAD) (IFEQ | IFNE)");
private static final InsnMatcher STORE_MATCHER = InsnMatcher.compile("GETSTATIC ISTORE");
private final Set<FieldRef> flowObstructors = new HashSet<>();
private final Set<MemberRef> flowObstructors = new HashSet<>();
private int opaquePredicates, stores;
@Override
@ -49,7 +49,7 @@ public final class OpaquePredicateTransformer extends Transformer {
FLOW_OBSTRUCTOR_INITIALIZER_MATCHER.match(method).forEach(match -> {
/* add flow obstructor to set */
var putstatic = (FieldInsnNode) match.get(match.size() - 1);
flowObstructors.add(new FieldRef(putstatic.owner, putstatic.name, putstatic.desc));
flowObstructors.add(new MemberRef(putstatic.owner, putstatic.name, putstatic.desc));
/* remove initializer */
match.forEach(method.instructions::remove);
@ -61,7 +61,7 @@ public final class OpaquePredicateTransformer extends Transformer {
}
private boolean isFlowObstructor(FieldInsnNode insn) {
return flowObstructors.contains(new FieldRef(insn.owner, insn.name, insn.desc));
return flowObstructors.contains(new MemberRef(insn.owner, insn.name, insn.desc));
}
private boolean isOpaquePredicate(MethodNode method, List<AbstractInsnNode> match) {

Loading…
Cancel
Save