Rename hasSideEffects() to isPure()

Its output has been inverted, as this wouldn't make sense otherwise.
bzip2
Graham 5 years ago
parent bfdfc2f211
commit fdcc5a217f
  1. 2
      asm/src/main/java/dev/openrs2/asm/InsnListUtils.java
  2. 28
      asm/src/main/java/dev/openrs2/asm/InsnNodeUtils.java
  3. 2
      deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.java

@ -32,7 +32,7 @@ public final class InsnListUtils {
}
insn = insn.getPrevious();
} while (insn != null && insn.getType() != AbstractInsnNode.LABEL && !InsnNodeUtils.hasSideEffects(insn));
} while (insn != null && insn.getType() != AbstractInsnNode.LABEL && InsnNodeUtils.isPure(insn));
return false;
}

@ -119,7 +119,7 @@ public final class InsnNodeUtils {
}
}
public static boolean hasSideEffects(AbstractInsnNode insn) {
public static boolean isPure(AbstractInsnNode insn) {
var opcode = insn.getOpcode();
switch (opcode) {
case -1:
@ -147,7 +147,7 @@ public final class InsnNodeUtils {
case Opcodes.FLOAD:
case Opcodes.DLOAD:
case Opcodes.ALOAD:
return false;
return true;
case Opcodes.IALOAD:
case Opcodes.LALOAD:
case Opcodes.FALOAD:
@ -170,7 +170,7 @@ public final class InsnNodeUtils {
case Opcodes.BASTORE:
case Opcodes.CASTORE:
case Opcodes.SASTORE:
return true;
return false;
case Opcodes.POP:
case Opcodes.POP2:
case Opcodes.DUP:
@ -226,9 +226,9 @@ public final class InsnNodeUtils {
case Opcodes.LOR:
case Opcodes.IXOR:
case Opcodes.LXOR:
return false;
case Opcodes.IINC:
return true;
case Opcodes.IINC:
return false;
case Opcodes.I2L:
case Opcodes.I2F:
case Opcodes.I2D:
@ -249,7 +249,7 @@ public final class InsnNodeUtils {
case Opcodes.FCMPG:
case Opcodes.DCMPL:
case Opcodes.DCMPG:
return false;
return true;
case Opcodes.IFEQ:
case Opcodes.IFNE:
case Opcodes.IFLT:
@ -275,22 +275,22 @@ public final class InsnNodeUtils {
case Opcodes.DRETURN:
case Opcodes.ARETURN:
case Opcodes.RETURN:
return true;
case Opcodes.GETSTATIC:
return false;
case Opcodes.GETSTATIC:
return true;
case Opcodes.PUTSTATIC:
case Opcodes.GETFIELD:
/* might throw NPE */
case Opcodes.PUTFIELD:
return true;
return false;
case Opcodes.INVOKEVIRTUAL:
case Opcodes.INVOKESPECIAL:
case Opcodes.INVOKESTATIC:
case Opcodes.INVOKEINTERFACE:
case Opcodes.INVOKEDYNAMIC:
return true;
case Opcodes.NEW:
return false;
case Opcodes.NEW:
return true;
case Opcodes.NEWARRAY:
case Opcodes.ANEWARRAY:
/* arrays might be created with negative size */
@ -298,15 +298,15 @@ public final class InsnNodeUtils {
/* might throw NPE */
case Opcodes.ATHROW:
case Opcodes.CHECKCAST:
return true;
case Opcodes.INSTANCEOF:
return false;
case Opcodes.INSTANCEOF:
return true;
case Opcodes.MONITORENTER:
case Opcodes.MONITOREXIT:
case Opcodes.MULTIANEWARRAY:
case Opcodes.IFNULL:
case Opcodes.IFNONNULL:
return true;
return false;
}
throw new IllegalArgumentException();

@ -387,7 +387,7 @@ public final class DummyArgTransformer extends Transformer {
}
break;
default:
if (InsnNodeUtils.hasSideEffects(insn) || InsnNodeUtils.isIntConstant(insn)) {
if (!InsnNodeUtils.isPure(insn) || InsnNodeUtils.isIntConstant(insn)) {
continue;
}

Loading…
Cancel
Save