Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.VarInsnNode


    }

    public void process(@NotNull ParserClassNode classNode, @NotNull RuleMethod method) throws Exception {
        // replace all method code with a simple call to the super method
        method.instructions.clear();
        method.instructions.add(new VarInsnNode(ALOAD, 0));
        method.instructions.add(createArgumentLoaders(method.desc));
        method.instructions.add(new MethodInsnNode(INVOKESPECIAL,
                classNode.getParentType().getInternalName(), method.name, method.desc));
        method.instructions.add(new InsnNode(ARETURN));
    }
View Full Code Here


    // create FieldNodes for all xLoad instructions
    private void extractFields(InstructionGroup group) {
        List<FieldNode> fields = group.getFields();
        for (InstructionGraphNode node : group.getNodes()) {
            if (node.isXLoad()) {
                VarInsnNode insn = (VarInsnNode) node.getInstruction();

                // check whether we already have a field for the var with this index
                int index;
                for (index = 0; index < fields.size(); index++) {
                    if (fields.get(index).access == insn.var) break;
View Full Code Here

    // create FieldNodes for all xLoad instructions
    private void extractFields(InstructionGroup group) {
        List<FieldNode> fields = group.getFields();
        for (InstructionGraphNode node : group.getNodes()) {
            if (node.isXLoad()) {
                VarInsnNode insn = (VarInsnNode) node.getInstruction();

                // check whether we already have a field for the var with this index
                int index;
                for (index = 0; index < fields.size(); index++) {
                    if (fields.get(index).access == insn.var) break;
View Full Code Here

    }

    public void process(@NotNull ParserClassNode classNode, @NotNull RuleMethod method) throws Exception {
        // replace all method code with a simple call to the super method
        method.instructions.clear();
        method.instructions.add(new VarInsnNode(ALOAD, 0));
        method.instructions.add(createArgumentLoaders(method.desc));
        method.instructions.add(new MethodInsnNode(INVOKESPECIAL,
                classNode.getParentType().getInternalName(), method.name, method.desc));
        method.instructions.add(new InsnNode(ARETURN));
    }
View Full Code Here

    public static InsnList createArgumentLoaders(@NotNull String methodDescriptor) {
        InsnList instructions = new InsnList();
        Type[] types = Type.getArgumentTypes(methodDescriptor);
        for (int i = 0; i < types.length; i++) {
            instructions.add(new VarInsnNode(getLoadingOpcode(types[i]), i + 1));
        }
        return instructions;
    }
View Full Code Here

    testInstructionBetweenFrames(new IntInsnNode(Opcodes.BIPUSH, 123));
  }

  @Test
  public void testVarInsn() {
    testInstructionBetweenFrames(new VarInsnNode(Opcodes.ILOAD, 0));
  }
View Full Code Here

        case ILOAD:
        case LLOAD:
        case FLOAD:
        case DLOAD:
        case ALOAD: {
            final VarInsnNode v = (VarInsnNode) insn;
            return new Local(value.type, v.var);
        }
        case ISTORE:
        case LSTORE:
        case FSTORE:
View Full Code Here

        break;
      }
       
      /** pushes some local variable to the stack */
      case LOAD: {
        final VarInsnNode v = (VarInsnNode) instruction.getInstruction();
        stack.push(new Local(opcode, v.var));
        break;
      }
     
      /** pops two operands (..., array reference, index) and
        * pushes the value in the component of the array at index position */
      case LOAD_ARRAY: {
        final ValueRef index = stack.pop();
        final ValueRef arref = stack.pop();
        stack.push(new ArrayValue(opcode, arref, index))
        break;
      }
     
      /** pops one operand (..., value) and store to a local variable.
        * this is a definition of that variable */
      case STORE: {
        final VarInsnNode v = (VarInsnNode) instruction.getInstruction();
        final ValueRef value = stack.pop();
       
        /* new frame to indicate definition of local variable
         * and use of the value in top of the stack */
        final Local definition = new Local(opcode, v.var);
View Full Code Here

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

  private static boolean sameVarInsn(AbstractInsnNode o, AbstractInsnNode n) {
    VarInsnNode oi = (VarInsnNode) o;
    if (!(n instanceof VarInsnNode)) {
      return false;
    }
    VarInsnNode ni = (VarInsnNode) n;
    return oi.var == ni.var;
  }
View Full Code Here

                for (String s : simp.push)
                    stack[sp++] = s;
                return;
            }

            VarInsnNode vi = null;
            TypeInsnNode ti = null;
            FieldInsnNode fi = null;
            String tidesc = null;
            MethodInsnNode mi = null;
            Type midesc = null;
View Full Code Here

TOP

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

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.