Java 类org.objectweb.asm.tree.IntInsnNode 实例源码

项目:r8    文件:JarSourceCode.java   
private void updateState(IntInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH: {
      state.push(Type.INT_TYPE);
      break;
    }
    case Opcodes.NEWARRAY: {
      String desc = arrayTypeDesc(insn.operand);
      Type type = Type.getType(desc);
      state.pop();
      state.push(type);
      break;
    }
    default:
      throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
  }
}
项目:r8    文件:JarSourceCode.java   
private void build(IntInsnNode insn, IRBuilder builder) {
  switch (insn.getOpcode()) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH: {
      int dest = state.push(Type.INT_TYPE);
      builder.addIntConst(dest, insn.operand);
      break;
    }
    case Opcodes.NEWARRAY: {
      String desc = arrayTypeDesc(insn.operand);
      Type type = Type.getType(desc);
      DexType dexType = application.getTypeFromDescriptor(desc);
      int count = state.pop(Type.INT_TYPE).register;
      int array = state.push(type);
      builder.addNewArrayEmpty(array, count, dexType);
      break;
    }
    default:
      throw new Unreachable("Unexpected IntInsn opcode: " + insn.getOpcode());
  }
}
项目:elasticsearch_my    文件:ESLoggerUsageChecker.java   
@Override
public BasicValue newOperation(AbstractInsnNode insnNode) throws AnalyzerException {
    switch (insnNode.getOpcode()) {
        case ICONST_0: return new IntegerConstantBasicValue(Type.INT_TYPE, 0);
        case ICONST_1: return new IntegerConstantBasicValue(Type.INT_TYPE, 1);
        case ICONST_2: return new IntegerConstantBasicValue(Type.INT_TYPE, 2);
        case ICONST_3: return new IntegerConstantBasicValue(Type.INT_TYPE, 3);
        case ICONST_4: return new IntegerConstantBasicValue(Type.INT_TYPE, 4);
        case ICONST_5: return new IntegerConstantBasicValue(Type.INT_TYPE, 5);
        case BIPUSH:
        case SIPUSH: return new IntegerConstantBasicValue(Type.INT_TYPE, ((IntInsnNode)insnNode).operand);
        case Opcodes.LDC: {
            Object constant = ((LdcInsnNode)insnNode).cst;
            if (constant instanceof Integer) {
                return new IntegerConstantBasicValue(Type.INT_TYPE, (Integer)constant);
            } else {
                return super.newOperation(insnNode);
            }
        }
        default: return super.newOperation(insnNode);
    }
}
项目:anvil    文件:VeinCapTransformer.java   
@Override
public void transform(ClassNode clazz, MethodNode method, InsnMatcher matcher) {
    AbstractInsnNode[] match = Iterators.getOnlyElement(matcher.match("BIPUSH ISTORE", m -> {
        IntInsnNode push = (IntInsnNode) m[0];
        if (push.operand != 50) {
            return false;
        }

        VarInsnNode store = (VarInsnNode) m[1];
        LocalVariableNode node = AsmUtils.getLocalVariable(method, store.var, store);
        return node != null && node.name.equals("resource") && node.desc.equals("I");
    }));

    method.instructions.remove(match[0]);
    method.instructions.remove(match[1]);
}
项目:rembulan    文件:ASMUtils.java   
public static AbstractInsnNode loadInt(int i) {
    switch (i) {
        case -1: return new InsnNode(ICONST_M1);
        case 0:  return new InsnNode(ICONST_0);
        case 1:  return new InsnNode(ICONST_1);
        case 2:  return new InsnNode(ICONST_2);
        case 3:  return new InsnNode(ICONST_3);
        case 4:  return new InsnNode(ICONST_4);
        case 5:  return new InsnNode(ICONST_5);
        default: {
            if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) return new IntInsnNode(BIPUSH, i);
            else if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) return new IntInsnNode(SIPUSH, i);
            else return new LdcInsnNode(i);
        }
    }
}
项目:RorysMod    文件:InstructionComparator.java   
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) {
    if (node1.getType() != node2.getType()) {
        return false;
    } else if (node1.getOpcode() != node2.getOpcode()) {
        return false;
    }

    switch (node2.getType()) {
        case VAR_INSN:
            return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
        case TYPE_INSN:
            return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
        case FIELD_INSN:
            return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
        case METHOD_INSN:
            return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
        case LDC_INSN:
            return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
        case IINC_INSN:
            return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
        case INT_INSN:
            return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
        default:
            return true;
    }
}
项目:thesis-disassembler    文件:IntInsnNodeHandler.java   
@Override
public void handle(AbstractInsnNode node) throws IncorrectNodeException {
    super.handle(node);
    LOG.debug(logNode(node));
    checkType(node, IntInsnNode.class);

    ExpressionStack stack = mState.getActiveStack();
    int opCode = node.getOpcode();
    switch (opCode) {
        case Opcodes.BIPUSH:
            stack.push(new PrimaryExpression(opCode, ((IntInsnNode) node).operand, DataType.BYTE));
            break;
        case Opcodes.SIPUSH:
            stack.push(new PrimaryExpression(opCode, ((IntInsnNode) node).operand, DataType.SHORT));
            break;
        case Opcodes.NEWARRAY:
            stack.push(new ArrayCreationExpression(opCode, ((IntInsnNode) node).operand));
            break;
    }
}
项目:NOVA-Core    文件:InstructionComparator.java   
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) {
    if (node1.getOpcode() != node2.getOpcode()) {
        return false;
    }

    switch (node2.getType()) {
        case VAR_INSN:
            return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
        case TYPE_INSN:
            return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
        case FIELD_INSN:
            return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
        case METHOD_INSN:
            return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
        case LDC_INSN:
            return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
        case IINC_INSN:
            return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
        case INT_INSN:
            return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
        default:
            return true;
    }
}
项目:NOVA-Core    文件:InstructionComparator.java   
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) {
    if (node1.getOpcode() != node2.getOpcode()) {
        return false;
    }

    switch (node2.getType()) {
        case VAR_INSN:
            return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
        case TYPE_INSN:
            return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
        case FIELD_INSN:
            return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
        case METHOD_INSN:
            return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
        case LDC_INSN:
            return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
        case IINC_INSN:
            return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
        case INT_INSN:
            return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
        default:
            return true;
    }
}
项目:instrumentation    文件:TreeInstructions.java   
public static AbstractInsnNode getPushInstruction(int value) {

        if (value == -1) {
            return new InsnNode(Opcodes.ICONST_M1);
        } else if (value == 0) {
            return new InsnNode(Opcodes.ICONST_0);
        } else if (value == 1) {
            return new InsnNode(Opcodes.ICONST_1);
        } else if (value == 2) {
            return new InsnNode(Opcodes.ICONST_2);
        } else if (value == 3) {
            return new InsnNode(Opcodes.ICONST_3);
        } else if (value == 4) {
            return new InsnNode(Opcodes.ICONST_4);
        } else if (value == 5) {
            return new InsnNode(Opcodes.ICONST_5);
        } else if ((value >= -128) && (value <= 127)) {
            return new IntInsnNode(Opcodes.BIPUSH, value);
        } else if ((value >= -32768) && (value <= 32767)) {
            return new IntInsnNode(Opcodes.SIPUSH, value);
        } else {
            return new LdcInsnNode(value);
        }
    }
项目:TextFormatting    文件:BookValidTransformer.java   
private void transformMethod( MethodNode method )
{
    for ( int i = 0; i < method.instructions.size(); ++i )
    {
        AbstractInsnNode ins = method.instructions.get( i );
        if ( ins.getOpcode() == BIPUSH )
        {
            IntInsnNode node = ( IntInsnNode ) ins;
            // "Remove" 32 page title limit
            if ( node.operand == 16 )
            {
                TextFormattingLog.info( "Found value 32, assuming it to be the title limit." );

                node.setOpcode( SIPUSH );
                node.operand = Short.MAX_VALUE;
            }
        }
    }
}
项目:svm-fasttagging    文件:AsmHelper.java   
public static Integer getIntConstOperand (final AbstractInsnNode insn) {
    final int opcode = insn.getOpcode();
    if (Opcodes.ICONST_M1 <= opcode && opcode <= Opcodes.ICONST_5) {
        // The opcodes from ICONST_M1 to ICONST_5 are consecutive.
        return opcode - Opcodes.ICONST_0;

    } else if (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH) {
        return ((IntInsnNode) insn).operand;

    } else if (opcode == Opcodes.LDC) {
        final LdcInsnNode ldc = (LdcInsnNode) insn;
        if (ldc.cst instanceof Integer) {
            return (Integer) ldc.cst;
        }
    }

    // Not an integer literal load instruction.
    return null;
}
项目:Updater    文件:JarUtils.java   
public static int getRevision(ClassNode node){
    ListIterator<MethodNode> mnIt = node.methods.listIterator();
    while(mnIt.hasNext()){
        MethodNode mn = mnIt.next();
        if(mn.name.equals("init")){
            ListIterator<AbstractInsnNode> abIn = mn.instructions.iterator();
            while(abIn.hasNext()){
                AbstractInsnNode ain = abIn.next();
                if(ain instanceof IntInsnNode){
                    if(((IntInsnNode) ain).operand == 765){
                        ain = ain.getNext();
                        if(ain instanceof IntInsnNode)
                            if(((IntInsnNode) ain).operand == 503)
                                return ((IntInsnNode)ain.getNext()).operand;
                    }
                }
            }


        }
    }
  return -1;
}
项目:bytecodelib    文件:MethodUnresolver.java   
private AbstractInsnNode loadIntegerConstant(int c) {
    if (c == -1)
        return new InsnNode(Opcodes.ICONST_M1);
    if (c == 0)
        return new InsnNode(Opcodes.ICONST_0);
    if (c == 1)
        return new InsnNode(Opcodes.ICONST_1);
    if (c == 2)
        return new InsnNode(Opcodes.ICONST_2);
    if (c == 3)
        return new InsnNode(Opcodes.ICONST_3);
    if (c == 4)
        return new InsnNode(Opcodes.ICONST_4);
    if (c == 5)
        return new InsnNode(Opcodes.ICONST_5);
    if (Byte.MIN_VALUE <= c && c <= Byte.MAX_VALUE)
        return new IntInsnNode(Opcodes.BIPUSH, c);
    if (Short.MIN_VALUE <= c && c <= Short.MAX_VALUE)
        return new IntInsnNode(Opcodes.SIPUSH, c);
    return new LdcInsnNode(c);
}
项目:jooby    文件:BytecodeRouteParser.java   
private Integer statusCodeFor(MethodInsnNode node) {
  if (node.name.equals("noContent")) {
    return 204;
  }
  if (node.name.equals("with")) {
    AbstractInsnNode previous = node.getPrevious();
    if (previous instanceof IntInsnNode) {
      return ((IntInsnNode) previous).operand;
    }
    if (previous instanceof FieldInsnNode) {
      String owner = ((FieldInsnNode) previous).owner.replace("/", ".");
      if (owner.equals(Status.class.getName())) {
        String statusName = ((FieldInsnNode) previous).name;
        return Try.apply(() -> Status.class.getDeclaredField(statusName).get(null))
            .map(it -> ((Status) it).value())
            .orElse(null);
      }
    }
  }
  return null;
}
项目:javaslicer    文件:TracingMethodInstrumenter.java   
private AbstractInsnNode getIntConstInsn(final int value) {
    switch (value) {
    case -1:
        return new InsnNode(ICONST_M1);
    case 0:
        return new InsnNode(ICONST_0);
    case 1:
        return new InsnNode(ICONST_1);
    case 2:
        return new InsnNode(ICONST_2);
    case 3:
        return new InsnNode(ICONST_3);
    case 4:
        return new InsnNode(ICONST_4);
    case 5:
        return new InsnNode(ICONST_5);
    default:
        if ((byte)value == value)
            return new IntInsnNode(BIPUSH, value);
        else if ((short)value == value)
            return new IntInsnNode(SIPUSH, value);
        else
            return new LdcInsnNode(Integer.valueOf(value));
    }
}
项目:CCObfuscator    文件:InstructionComparator.java   
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2)
{
    if(node1.getOpcode() != node2.getOpcode())
        return false;

    switch(node2.getType())
    {
        case VAR_INSN:
            return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
        case TYPE_INSN:
            return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
        case FIELD_INSN:
            return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
        case METHOD_INSN:
            return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
        case LDC_INSN:
            return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
        case IINC_INSN:
            return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
        case INT_INSN:
            return intInsnEqual((IntInsnNode)node1, (IntInsnNode)node2);
        default:
            return true;
    }
}
项目:jBOP    文件:NodeHelper.java   
private static AbstractInsnNode getIntInsnNode(final Number newNumber) {
  switch (newNumber.intValue()) {
    case CONST_M1:
      return new InsnNode(Opcodes.ICONST_M1);
    case CONST_0:
      return new InsnNode(Opcodes.ICONST_0);
    case CONST_1:
      return new InsnNode(Opcodes.ICONST_1);
    case CONST_2:
      return new InsnNode(Opcodes.ICONST_2);
    case CONST_3:
      return new InsnNode(Opcodes.ICONST_3);
    case CONST_4:
      return new InsnNode(Opcodes.ICONST_4);
    case CONST_5:
      return new InsnNode(Opcodes.ICONST_5);
    default:
      if (newNumber.intValue() >= CONST_LOW_INT && newNumber.intValue() <= CONST_HIGH_INT) {
        return new IntInsnNode(getopcodePush(newNumber.intValue()), newNumber.intValue());
      }
      return new LdcInsnNode(newNumber);
  }
}
项目:jBOP    文件:ClassNodeBuilder.java   
/**
 * Adds the array to the last created method.
 * 
 * @param desc
 *          the desc
 * @param length
 *          the length
 * @return the class node builder
 */
public ClassNodeBuilder addArray(final String desc, final int... length) {
  if (isInterface) {
    return this;
  }
  final Type elementType = Type.getType(desc).getElementType();
  if (length.length == 1) {

    addInsn(NodeHelper.getInsnNodeFor(Integer.valueOf(length[0])));
    if (elementType.getDescriptor().startsWith("L")) {
      addInsn(new TypeInsnNode(Opcodes.ANEWARRAY, elementType.getInternalName()));
    } else {
      addInsn(new IntInsnNode(Opcodes.NEWARRAY, getSort(elementType)));
    }
  } else {
    for (final int currentLength : length) {
      addInsn(NodeHelper.getInsnNodeFor(Integer.valueOf(currentLength)));
    }
    addInsn(new MultiANewArrayInsnNode(desc, length.length));
  }
  addInsn(new VarInsnNode(Opcodes.ASTORE, methodVarIndex));
  lastMethodVarIndex = methodVarIndex;
  lastVarElementType = elementType;
  methodVarIndex++;
  return this;
}
项目:jBOP    文件:ClassNodeBuilder.java   
/**
 * Adds the given operation.
 * 
 * @param opcode
 *          the opcode
 * @param args
 *          the args
 * @return the class node builder
 */
public ClassNodeBuilder add(final int opcode, final Object... args) {
  if (opcode == IINC) {
    return addInsn(new IincInsnNode((Integer) args[0], (Integer) args[1]));
  }
  if (opcode >= NOP && opcode <= DCONST_1 || opcode >= POP && opcode <= DCMPG || opcode >= IALOAD && opcode <= SALOAD
      || opcode >= IASTORE && opcode <= SASTORE || opcode == ARRAYLENGTH || opcode == ATHROW) {
    return addInsn(new InsnNode(opcode));
  }
  if (opcode >= BIPUSH && opcode <= SIPUSH || opcode == NEWARRAY) {
    return addInsn(new IntInsnNode(opcode, (Integer) args[0]));
  }
  if (opcode == LDC) {
    return loadConstant(args[0]);
  }
  if (opcode >= ILOAD && opcode <= ALOAD) {
    return addInsn(new VarInsnNode(opcode, (Integer) args[0]));
  }
  if (opcode >= ISTORE && opcode <= ASTORE) {
    return addInsn(new VarInsnNode(opcode, (Integer) args[0]));
  }
  if (opcode >= IFEQ && opcode <= JSR) {
    return jump(opcode, (LabelNode) args[0]);
  }
  return this;
}
项目:Uranium    文件:UraniumClassTransformer.java   
public void extractFrom(ImagineASM asm, InsnList list) {
    //Pair<String, String> fieldChunkProvider = asm.field("net/minecraft/world/World", "chunkProvider");
    list.clear();
    list.add(new IntInsnNode(ALOAD, 1));
    list.add(new FieldInsnNode(GETFIELD, "ahb", "v", "Lapu;"));
    list.add(new InsnNode(ARETURN));
}
项目:luna    文件:ASMUtils.java   
public static AbstractInsnNode loadInt(int i) {
  switch (i) {
    case -1:
      return new InsnNode(ICONST_M1);
    case 0:
      return new InsnNode(ICONST_0);
    case 1:
      return new InsnNode(ICONST_1);
    case 2:
      return new InsnNode(ICONST_2);
    case 3:
      return new InsnNode(ICONST_3);
    case 4:
      return new InsnNode(ICONST_4);
    case 5:
      return new InsnNode(ICONST_5);
    default: {
      if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) {
        return new IntInsnNode(BIPUSH, i);
      } else if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) {
        return new IntInsnNode(SIPUSH, i);
      } else {
        return new LdcInsnNode(i);
      }
    }
  }
}
项目:dead-code-detector    文件:LocalVariablesAnalyzer.java   
private static boolean isSimpleConstant(Object previousInstructionObject) {
    // CHECKSTYLE:OFF
    final AbstractInsnNode previousInstruction = (AbstractInsnNode) previousInstructionObject;
    // CHECKSTYLE:ON
    final int opcode = previousInstruction.getOpcode();
    return (opcode >= Opcodes.ACONST_NULL && opcode <= Opcodes.DCONST_1
            || opcode == Opcodes.SIPUSH || opcode == Opcodes.BIPUSH)
            && (previousInstruction instanceof InsnNode
                    || previousInstruction instanceof IntInsnNode);
}
项目:VivecraftForgeExtensions    文件:ASMUtil.java   
public static boolean matchInstruction(AbstractInsnNode ain, AbstractInsnNode ain2) {
    if (ain.getOpcode() != ain2.getOpcode()) return false;
    if (ain instanceof InsnNode) {
        return true;
    } else if (ain instanceof VarInsnNode) {
        return ((VarInsnNode)ain).var == ((VarInsnNode)ain2).var;
    } else if (ain instanceof LdcInsnNode) {
        return ((LdcInsnNode)ain).cst.equals(((LdcInsnNode)ain2).cst);
    } else if (ain instanceof IntInsnNode) {
        return ((IntInsnNode)ain).operand == ((IntInsnNode)ain2).operand;
    } else if (ain instanceof TypeInsnNode) {
        return ((TypeInsnNode)ain).desc.equals(((TypeInsnNode)ain2).desc);
    } else if (ain instanceof FieldInsnNode) {
        FieldInsnNode fin = (FieldInsnNode)ain;
        FieldInsnNode fin2 = (FieldInsnNode)ain2;
        return fin.owner.equals(fin2.owner) && fin.name.equals(fin2.name) && fin.desc.equals(fin2.desc);
    } else if (ain instanceof MethodInsnNode) {
        MethodInsnNode min = (MethodInsnNode)ain;
        MethodInsnNode min2 = (MethodInsnNode)ain2;
        return min.owner.equals(min2.owner) && min.name.equals(min2.name) && min.desc.equals(min2.desc) && min.itf == min2.itf;
    } else if (ain instanceof JumpInsnNode) {
        return ((JumpInsnNode)ain).label == ((JumpInsnNode)ain2).label;
    } else if (ain instanceof IincInsnNode) {
        IincInsnNode iin = (IincInsnNode)ain;
        IincInsnNode iin2 = (IincInsnNode)ain2;
        return iin.var == iin2.var && iin.incr == iin2.incr;
    }
    return false;
}
项目:VivecraftForgeExtensions    文件:ASMUtil.java   
public static boolean matchInstruction(AbstractInsnNode ain, int opcode, Object... args) {
    if (ain.getOpcode() != opcode) return false;
    if (ain instanceof InsnNode) {
        return true;
    } else if (ain instanceof VarInsnNode) {
        return args[0] instanceof Integer && ((VarInsnNode)ain).var == (Integer)args[0];
    } else if (ain instanceof LdcInsnNode) {
        return args[0].equals(((LdcInsnNode)ain).cst);
    } else if (ain instanceof IntInsnNode) {
        return args[0] instanceof Integer && ((IntInsnNode)ain).operand == (Integer)args[0];
    } else if (ain instanceof TypeInsnNode) {
        return args[0] instanceof String && ((TypeInsnNode)ain).desc.equals(args[0]);
    } else if (ain instanceof FieldInsnNode) {
        if (args.length != 3 || !(args[0] instanceof String) || !(args[1] instanceof String) || !(args[2] instanceof String))
            return false;
        FieldInsnNode fin = (FieldInsnNode)ain;
        return fin.owner.equals(args[0]) && fin.name.equals(args[1]) && fin.desc.equals(args[2]);
    } else if (ain instanceof MethodInsnNode) {
        if (args.length != 4 || !(args[0] instanceof String) || !(args[1] instanceof String) || !(args[2] instanceof String) || !(args[3] instanceof Boolean))
            return false;
        MethodInsnNode min = (MethodInsnNode)ain;
        return min.owner.equals(args[0]) && min.name.equals(args[1]) && min.desc.equals(args[2]) && min.itf == (Boolean)args[3];
    } else if (ain instanceof JumpInsnNode) {
        return args[0] instanceof LabelNode && ((JumpInsnNode)ain).label == args[0];
    } else if (ain instanceof IincInsnNode) {
        if (args.length != 2 || !(args[0] instanceof Integer) || !(args[1] instanceof Integer))
            return false;
        IincInsnNode iin = (IincInsnNode)ain;
        return iin.var == (Integer)args[0] && iin.incr == (Integer)args[1];
    }
    return false;
}
项目:deobfuscator    文件:NewArrayStep.java   
@Override
public AbstractInsnNode tryMatch(InstructionMatcher matcher, AbstractInsnNode now) {
    if (now.getOpcode() == Opcodes.NEWARRAY && now instanceof IntInsnNode) {
        if (this.sorts.contains(((IntInsnNode) now).operand)) {
            return now.getNext();
        }
    }
    return null;
}
项目:ThermosRebased    文件:ImagineMethod.java   
public static InsnList methodCall(final ImagineMethod img, String owner, final String methodName, boolean staticForward, final boolean needReturn) {
    if (!staticForward || owner == null) {
        owner = img.mAsm.getActualName();
    }
    owner = ImagineASM.toDesc(owner);
    final ImagineDesc desc = ImagineDesc.parse(img.mMethod.desc);
    if (!needReturn) {
        desc.returnType(ImagineDesc.SubDesc.create(Type.VOID_TYPE, 0));
    }
    final InsnList instructions = new InsnList();
    if (!img.isStatic()) {
        staticForward = true;
        instructions.add((AbstractInsnNode)new IntInsnNode(25, 0));
    }
    int i = img.isStatic() ? 0 : 1;
    for (final ImagineDesc.SubDesc sub : desc.parameters()) {
        instructions.add((AbstractInsnNode)new IntInsnNode(sub.opcodeLoad(), i++));
    }
    if (staticForward && !img.isStatic()) {
        desc.first(Type.getType("L" + ImagineASM.toDesc(img.mAsm.getActualName()) + ";"), 0);
    }
    final MethodDesc method = img.mAsm.mapMethod(owner, methodName, desc.toString());
    instructions.add((AbstractInsnNode)new MethodInsnNode(staticForward ? 184 : 185, (String)((Pair<String, Y>)method).first(), (String)((Pair<X, String>)method).second(), (String)((Triple<X, Y, String>)method).third(), false));
    if (needReturn) {
        instructions.add((AbstractInsnNode)new InsnNode(desc.returnOpcode()));
    }
    return instructions;
}
项目:ThermosRebased    文件:ThermosClassTransformer.java   
public void extractFrom(ImagineASM asm, InsnList list) {
    //Pair<String, String> fieldChunkProvider = asm.field("net/minecraft/world/World", "chunkProvider");
    list.clear();
    list.add(new IntInsnNode(ALOAD, 1));
    list.add(new FieldInsnNode(GETFIELD, "ahb", "v", "Lapu;"));
    list.add(new InsnNode(ARETURN));
}
项目:Alchemy    文件:ASMHelper.java   
static AbstractInsnNode getIntNode(int value) {
    if (value <= 5 && -1 <= value)
        return new InsnNode(ICONST_M1 + value + 1);
    if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE)
        return new IntInsnNode(BIPUSH, value);
    if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE)
        return new IntInsnNode(SIPUSH, value);
    return new LdcInsnNode(value);
}
项目:jaop    文件:ASMHelper.java   
public static void intInsnNode(ListIterator<AbstractInsnNode> iterator, int i) {
        if (i >=0 && i < 6) {
//            int ICONST_0 = 3; // -
//            int ICONST_1 = 4; // -
//            int ICONST_2 = 5; // -
//            int ICONST_3 = 6; // -
//            int ICONST_4 = 7; // -
//            int ICONST_5 = 8; // -
            iterator.add(new InsnNode(Opcodes.ICONST_0 + i));
        } else {
            iterator.add(new IntInsnNode(Opcodes.BIPUSH, i));
        }
    }
项目:asm-framework-full    文件:ExprExtractor.java   
public static String extract(BasicExpr expr) {
    AbstractInsnNode insn = expr.insn();
    if (insn instanceof IntInsnNode) {
        int operand = ((IntInsnNode) insn).operand;
        return Integer.toString(operand);
    } else if (insn instanceof LdcInsnNode) {
        Object ldc = ((LdcInsnNode) insn).cst;
        return (ldc == null ? "null" : ldc.toString());
    }
    return EMPTY_STRING;
}
项目:asm-framework-full    文件:PushExpr.java   
/**
 * Retrieves this expression's instruction as an IntInsnNode.
 *
 * @return This expression's instruction as an IntInsnNode.
 */
public IntInsnNode asIntInsn() {
    if (!intInsn) {
        throw new IllegalStateException("Instruction is not an IntInsnNode");
    }
    return (IntInsnNode) insn;
}
项目:intellij-ce-playground    文件:ApiDetector.java   
@Override
protected void add(@NonNull AbstractInsnNode from, @NonNull AbstractInsnNode to) {
    if (from.getType() == AbstractInsnNode.JUMP_INSN &&
            from.getPrevious() != null &&
            from.getPrevious().getType() == AbstractInsnNode.INT_INSN) {
        IntInsnNode intNode = (IntInsnNode) from.getPrevious();
        if (intNode.getPrevious() != null && isSdkVersionLookup(intNode.getPrevious())) {
            JumpInsnNode jumpNode = (JumpInsnNode) from;
            int api = intNode.operand;
            boolean isJumpEdge = to == jumpNode.label;
            boolean includeEdge;
            switch (from.getOpcode()) {
                case Opcodes.IF_ICMPNE:
                    includeEdge = api < mRequiredApi || isJumpEdge;
                    break;
                case Opcodes.IF_ICMPLE:
                    includeEdge = api < mRequiredApi - 1 || isJumpEdge;
                    break;
                case Opcodes.IF_ICMPLT:
                    includeEdge = api < mRequiredApi || isJumpEdge;
                    break;

                case Opcodes.IF_ICMPGE:
                    includeEdge = api < mRequiredApi || !isJumpEdge;
                    break;
                case Opcodes.IF_ICMPGT:
                    includeEdge = api < mRequiredApi - 1 || !isJumpEdge;
                    break;
                default:
                    // unexpected comparison for int API level
                    includeEdge = true;
            }
            if (!includeEdge) {
                return;
            }
        }
    }

    super.add(from, to);
}
项目:Thermos    文件:ThermosClassTransformer.java   
public void extractFrom(ImagineASM asm, InsnList list) {
    //Pair<String, String> fieldChunkProvider = asm.field("net/minecraft/world/World", "chunkProvider");
    list.clear();
    list.add(new IntInsnNode(ALOAD, 1));
    list.add(new FieldInsnNode(GETFIELD, "ahb", "v", "Lapu;"));
    list.add(new InsnNode(ARETURN));
}
项目:TFC2    文件:InsnComparator.java   
/**
 * Respects {@link #INT_WILDCARD} and {@link #WILDCARD} instruction properties.
 * Always returns true if {@code a} and {@code b} are label, line number, or frame instructions.
 * 
 * @return Whether or not the given instructions are equivalent.
 */
public boolean areInsnsEqual(AbstractInsnNode a, AbstractInsnNode b)
{
    if (a == b)
        return true;

    if (a == null || b == null)
        return false;

    if (a.equals(b))
        return true;

    if (a.getOpcode() != b.getOpcode())
        return false;

    switch (a.getType())
    {
        case AbstractInsnNode.VAR_INSN:
            return areVarInsnsEqual((VarInsnNode) a, (VarInsnNode) b);
        case AbstractInsnNode.TYPE_INSN:
            return areTypeInsnsEqual((TypeInsnNode) a, (TypeInsnNode) b);
        case AbstractInsnNode.FIELD_INSN:
            return areFieldInsnsEqual((FieldInsnNode) a, (FieldInsnNode) b);
        case AbstractInsnNode.METHOD_INSN:
            return areMethodInsnsEqual((MethodInsnNode) a, (MethodInsnNode) b);
        case AbstractInsnNode.LDC_INSN:
            return areLdcInsnsEqual((LdcInsnNode) a, (LdcInsnNode) b);
        case AbstractInsnNode.IINC_INSN:
            return areIincInsnsEqual((IincInsnNode) a, (IincInsnNode) b);
        case AbstractInsnNode.INT_INSN:
            return areIntInsnsEqual((IntInsnNode) a, (IntInsnNode) b);
        default:
            return true;
    }
}
项目:KCauldron    文件:KCauldronClassTransformer.java   
public void extractFrom(ImagineASM asm, InsnList list) {
    //Pair<String, String> fieldChunkProvider = asm.field("net/minecraft/world/World", "chunkProvider");
    list.clear();
    list.add(new IntInsnNode(ALOAD, 1));
    list.add(new FieldInsnNode(GETFIELD, "ahb", "v", "Lapu;"));
    list.add(new InsnNode(ARETURN));
}
项目:jephyr    文件:ContinuationMethodAdapter.java   
private static AbstractInsnNode newPushNode(int operand) {
    if (operand <= 5) {
        return new InsnNode(ICONST_0 + operand);
    } else if (operand <= Byte.MAX_VALUE) {
        return new IntInsnNode(BIPUSH, operand);
    } else if (operand <= Short.MAX_VALUE) {
        return new IntInsnNode(SIPUSH, operand);
    } else {
        return new LdcInsnNode(operand);
    }
}
项目:FFoKC    文件:KCauldronClassTransformer.java   
public void extractFrom(ImagineASM asm, InsnList list) {
    //Pair<String, String> fieldChunkProvider = asm.field("net/minecraft/world/World", "chunkProvider");
    list.clear();
    list.add(new IntInsnNode(ALOAD, 1));
    list.add(new FieldInsnNode(GETFIELD, "ahb", "v", "Lapu;"));
    list.add(new InsnNode(ARETURN));
}
项目:evosuite    文件:BooleanArrayTransformer.java   
@Override
protected AbstractInsnNode transformIntInsnNode(MethodNode mn,
        IntInsnNode intInsnNode) {
    if (intInsnNode.operand == Opcodes.T_BOOLEAN) {
        intInsnNode.operand = Opcodes.T_INT;
    }
    return intInsnNode;
}
项目:evosuite    文件:ReplaceConstant.java   
private Object getValue(AbstractInsnNode constant) {
    switch (constant.getOpcode()) {
    case Opcodes.LDC:
        return ((LdcInsnNode) constant).cst;
    case Opcodes.ICONST_0:
        return 0;
    case Opcodes.ICONST_1:
        return 1;
    case Opcodes.ICONST_2:
        return 2;
    case Opcodes.ICONST_3:
        return 3;
    case Opcodes.ICONST_4:
        return 4;
    case Opcodes.ICONST_5:
        return 5;
    case Opcodes.ICONST_M1:
        return -1;
    case Opcodes.LCONST_0:
        return 0L;
    case Opcodes.LCONST_1:
        return 1L;
    case Opcodes.DCONST_0:
        return 0.0;
    case Opcodes.DCONST_1:
        return 1.0;
    case Opcodes.FCONST_0:
        return 0.0F;
    case Opcodes.FCONST_1:
        return 1.0F;
    case Opcodes.FCONST_2:
        return 2.0F;
    case Opcodes.SIPUSH:
        return ((IntInsnNode) constant).operand;
    case Opcodes.BIPUSH:
        return ((IntInsnNode) constant).operand;
    default:
        throw new RuntimeException("Unknown constant: " + constant.getOpcode());
    }
}