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