Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.MethodInsnNode


    FieldInsnNode ni = (FieldInsnNode) n;
    return oi.name.equals(ni.name) && oi.desc.equals(ni.desc) && oi.owner.equals(ni.owner);
  }

  private static boolean sameMethodInsnNode(AbstractInsnNode o, AbstractInsnNode n) {
    MethodInsnNode oi = (MethodInsnNode) o;
    if (!(n instanceof MethodInsnNode)) {
      return false;
    }
    MethodInsnNode ni = (MethodInsnNode) n;
    return oi.name.equals(ni.name) && oi.desc.equals(ni.desc) && oi.owner.equals(ni.owner);
  }
View Full Code Here


            VarInsnNode vi = null;
            TypeInsnNode ti = null;
            FieldInsnNode fi = null;
            String tidesc = null;
            MethodInsnNode mi = null;
            Type midesc = null;

            switch (anode.getType()) {
                case AbstractInsnNode.VAR_INSN:
                    vi = (VarInsnNode) anode;
View Full Code Here

        int accum=0;

        for (int i = 0; i < insnList.length; i++) {
            AbstractInsnNode ai = insnList[i];
            MethodInsnNode mi;
            int size = insnSize(ai);

            // some of these require special handling
            switch (ai.getOpcode()) {
                case Opcodes.RETURN:
View Full Code Here

                return;
            }
        }

        if (opc == Opcodes.INVOKESPECIAL) {
            MethodInsnNode mi = (MethodInsnNode)ai;
            Frame f1 = types[iix];
            Frame f2 = types[iix+1];
            String uninit = f1.stack[f2.sp];
            if (mi.name.equals("<init>") && spilledUTypes.contains(uninit)) {
                if (!f2.stack[f2.sp-1].equals(uninit)) throw new RuntimeException("general case of INVOKESPECIAL spill not implemented");
View Full Code Here

            instructions.add(new VarInsnNode(Opcodes.ILOAD, 1));
            instructions.add(intNode(firstJump.get(i)));
            instructions.add(new JumpInsnNode(Opcodes.IF_ICMPLT, not_my_problem));
            instructions.add(new VarInsnNode(Opcodes.ILOAD, 1));
            instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
            instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, tgtype, name + "$f" + i, "(I[Ljava/lang/Object;)I"));
            instructions.add(new VarInsnNode(Opcodes.ISTORE, 1));
            instructions.add(new JumpInsnNode(Opcodes.GOTO, loop));
            instructions.add(not_my_problem);
        }

        // time for return
        String rty = null, unboxName = null, unboxDesc = null;
        int retinst;
        Type rtyty = Type.getReturnType(desc);
        switch (rtyty.getSort()) {
            case Type.VOID:
                retinst = Opcodes.RETURN; break;
            case Type.BOOLEAN:
            case Type.CHAR:
            case Type.INT:
            case Type.SHORT:
            case Type.BYTE:
                retinst = Opcodes.IRETURN; rty = "java/lang/Integer"; unboxName = "intValue"; unboxDesc = "()I"; break;
            case Type.LONG:
                retinst = Opcodes.LRETURN; rty = "java/lang/Long"; unboxName = "longValue"; unboxDesc = "()J"; break;
            case Type.FLOAT:
                retinst = Opcodes.FRETURN; rty = "java/lang/Float"; unboxName = "floatValue"; unboxDesc = "()F"; break;
            case Type.DOUBLE:
                retinst = Opcodes.DRETURN; rty = "java/lang/Double"; unboxName = "doubleValue"; unboxDesc = "()D"; break;
            default:
                retinst = Opcodes.ARETURN; rty = rtyty.getInternalName(); break;
        }

        if (rty != null) {
            instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
            instructions.add(new InsnNode(Opcodes.ICONST_0));
            instructions.add(new InsnNode(Opcodes.AALOAD));
            instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, rty));
            if (unboxName != null)
                instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, rty, unboxName, unboxDesc));
        }
        instructions.add(new InsnNode(retinst));
    }
View Full Code Here

        if (ty != null) {
            il.add(new TypeInsnNode(Opcodes.NEW, ty));
            il.add(new InsnNode(Opcodes.DUP));
        }
        il.add(new VarInsnNode(opc, ltmp));
        if (ty != null) il.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, ty, "<init>", desc));
        il.add(new InsnNode(Opcodes.AASTORE));
        return at.getSize();
    }
View Full Code Here

      case 4:
        FieldInsnNode finsn = (FieldInsnNode) insn;
        visitFieldInsn(finsn.getOpcode(), finsn.owner, finsn.name, finsn.desc);
        break;
      case 5:
        MethodInsnNode minsn = (MethodInsnNode) insn;
        visitMethodInsn(minsn.getOpcode(), minsn.owner, minsn.name, minsn.desc);
        break;
      case 6:
        InvokeDynamicInsnNode idinsn = (InvokeDynamicInsnNode) insn;
        visitInvokeDynamicInsn(idinsn.name, idinsn.desc, idinsn.bsm, idinsn.bsmArgs);
        break;
View Full Code Here

  public AbstractInsnNode toInsn(int opcode)
  {
    if (isClass())
      return new TypeInsnNode(opcode, s_owner);
    else if (isMethod())
      return new MethodInsnNode(opcode, s_owner, s_name, s_desc);
    else
      return new FieldInsnNode(opcode, s_owner, s_name, s_desc);
  }
View Full Code Here

         case INVOKEINTERFACE:
         {
            // TODO: Check that methods have no side-effects
           
            assert(insn instanceof MethodInsnNode);
            MethodInsnNode methodInsn = (MethodInsnNode)insn;
            boolean isVirtualCall = (insn.getOpcode() != INVOKESTATIC);
            List<TypedValue> args = new Vector<TypedValue>();
            for (int n = (isVirtualCall? 1:0); n < values.size(); n++)
               args.add((TypedValue)values.get(n));
            MethodSignature sig = new MethodSignature(methodInsn.owner, methodInsn.name, methodInsn.desc);
View Full Code Here

    }

    private byte[] injectCallback(byte[] bytes) {
        ClassNode cnode = ASMHelper.createClassNode(bytes);
        MethodNode mnode = ASMHelper.findMethod(new ObfMapping(cnode.name, "<clinit>", "()V"), cnode);
        mnode.instructions.insert(new MethodInsnNode(INVOKESTATIC, "codechicken/core/asm/MCPDeobfuscationTransformer", "loadCallback", "()V"));
        return ASMHelper.createBytes(cnode, 0);
    }
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.MethodInsnNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.