Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.IincInsnNode


          il.add(new FieldInsnNode(((IInteger)((IConstructor)v).get(0)).intValue(),
                       ((IString)((IConstructor)v).get(1)).getValue(),
                       ((IString)((IConstructor)v).get(2)).getValue(),
                       ((IString)((IConstructor)v).get(3)).getValue()));
        } else if (((IConstructor)v).getName().equals("increment")) {
          il.add(new IincInsnNode(((IInteger)((IConstructor)v).get(0)).intValue(),
                      ((IInteger)((IConstructor)v).get(1)).intValue()));
        } else if (((IConstructor)v).getName().equals("instruction")) {
          il.add(new InsnNode(((IInteger)((IConstructor)v).get(0)).intValue()));
        } else if (((IConstructor)v).getName().equals("integer")) {
          il.add(new IntInsnNode(((IInteger)((IConstructor)v).get(0)).intValue(),
View Full Code Here


      if (first) { first = false; } else { writer.write(","); }
      if (ai instanceof FieldInsnNode) {
        FieldInsnNode n = ((FieldInsnNode)ai);
        writer.write("\n\t\t\t\tfieldRef(" + n.getOpcode() + ", \"" + escape(n.owner) + "\", \"" + escape(n.name) + "\", \"" + escape(n.desc) + "\")");
      } else if (ai instanceof IincInsnNode) {
        IincInsnNode n = ((IincInsnNode)ai);
        writer.write("\n\t\t\t\tincrement(" + n.var + ", " + n.incr + ")");
      } else if (ai instanceof InsnNode) {
        InsnNode n = ((InsnNode)ai);
        writer.write("\n\t\t\t\tinstruction(" + n.getOpcode() + ")");
      } else if (ai instanceof IntInsnNode) {
        IntInsnNode n = ((IntInsnNode)ai);
        writer.write("\n\t\t\t\tinteger(" + n.getOpcode() + ", " + n.operand + ")");
      } else if (ai instanceof JumpInsnNode) {
        JumpInsnNode n = ((JumpInsnNode)ai);
        writer.write("\n\t\t\t\tjump(" + n.getOpcode() + ", " + getLabelIndex(n.label) + ")");
      } else if (ai instanceof LabelNode) {
        LabelNode n = ((LabelNode)ai);
        writer.write("\n\t\t\t\tlabel(" + getLabelIndex(n) + ")");
      } else if (ai instanceof LineNumberNode) {
        LineNumberNode n = ((LineNumberNode)ai);
        writer.write("\n\t\t\t\tlineNumber(" + n.line + ", " + getLabelIndex(n.start) + ")");
      } else if (ai instanceof VarInsnNode) {
        VarInsnNode n = ((VarInsnNode)ai);
        writer.write("\n\t\t\t\tlocalVariable(" + n.getOpcode() + ", " + n.var + ")");
      } else if (ai instanceof LdcInsnNode) {
        LdcInsnNode n = ((LdcInsnNode)ai);
        if (n.cst instanceof String) {
          writer.write("\n\t\t\t\tloadConstantString(\"" + escape((String)n.cst) + "\")");
        } else if (n.cst instanceof Integer) {
          writer.write("\n\t\t\t\tloadConstantInteger(" + n.cst + ")");
        } else if (n.cst instanceof Long) {
          writer.write("\n\t\t\t\tloadConstantLong(" + n.cst + ")");
        } else if (n.cst instanceof Float) {
          writer.write("\n\t\t\t\tloadConstantFloat(" + n.cst + ")");
        } else if (n.cst instanceof Double) {
          writer.write("\n\t\t\t\tloadConstantDouble(" + n.cst + ")");
        }
      } else if (ai instanceof LookupSwitchInsnNode) {
        LookupSwitchInsnNode n = ((LookupSwitchInsnNode)ai);
        writer.write("\n\t\t\t\tlookupSwitch(" + getLabelIndex(n.dflt) + ", [");
        boolean firstKey = true;
        for (Integer k : (List<Integer>)n.keys) {
          if (firstKey) { firstKey = false; } else { writer.write(", "); }
          writer.write(k);
        }
        writer.write("], [");
        boolean firstCase = true;
        for (LabelNode l : (List<LabelNode>)n.labels) {
          if (firstCase) { firstCase = false; } else { writer.write(", "); }
          writer.write("" + getLabelIndex(l));
        }
        writer.write("])");
      } else if (ai instanceof MethodInsnNode) {
        MethodInsnNode n = ((MethodInsnNode)ai);
        writer.write("\n\t\t\t\tmethod(" + n.getOpcode() + ", \"" + escape(n.owner) + "\", \"" + escape(n.name) + "\", \"" + escape(n.desc) + "\")");
      } else if (ai instanceof MultiANewArrayInsnNode) {
        MultiANewArrayInsnNode n = ((MultiANewArrayInsnNode)ai);
        writer.write("\n\t\t\t\tmultiANewArray(\"" + escape(n.desc) + "\", " + n.dims + ")");
      } else if (ai instanceof TableSwitchInsnNode) {
        TableSwitchInsnNode n = ((TableSwitchInsnNode)ai);
        writer.write("\n\t\t\t\ttableSwitch(" + n.min + ", " + n.max + ", " + getLabelIndex(n.dflt) + ", [");
        boolean firstCase = true;
        for (LabelNode l : (List<LabelNode>)n.labels) {
          if (firstCase) { firstCase = false; } else { writer.write(", "); }
          writer.write("" + getLabelIndex(l));
        }
        writer.write("])");
      } else if (ai instanceof TypeInsnNode) {
        TypeInsnNode n = ((TypeInsnNode)ai);
        writer.write("\n\t\t\t\t\\type(" + n.getOpcode() + ", \"" + escape(n.desc) + "\")");
      } else {
        if (!(ai instanceof FrameNode)) {
          throw new RuntimeException("Error: Unsupported instruction encountered (" + ai.getClass() + ").");
        }
        first = true;
View Full Code Here

                if (vin.var >= purrSecretIndex) {
                    vin.var = vin.var + 1;
                }
            }
            if (current instanceof IincInsnNode) {
                IincInsnNode iin = (IincInsnNode) current;
                iin.var = iin.var + 1;
                log("Incremented iinc var to " + iin.var);
            }
        }
View Full Code Here

    testInstructionBetweenFrames(new LdcInsnNode("JaCoCo"));
  }

  @Test
  public void testIincInsn() {
    testInstructionBetweenFrames(new IincInsnNode(3, 42));
  }
View Full Code Here

        break;
       
      /** Increment local variable by constant.
        * Occurs a definition and a use of that variable */
      case INC: {
        final IincInsnNode iinc = (IincInsnNode) instruction.getInstruction();
        final Local local = new Local(opcode, iinc.var);
       
        /* new frame to indicate definition and
         * use of the incremented variable */
        frame = new DefUseFrame(local, local);
View Full Code Here

    return oi.line == ni.line;
    // TODO check oi.start?
  }

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

                return (opc == Opcodes.GOTO || opc == Opcodes.JSR) ? 5 : 8;
            case AbstractInsnNode.LDC_INSN:
                return 3;
            case AbstractInsnNode.IINC_INSN:
                {
                    IincInsnNode ii = (IincInsnNode) ai;
                    return (ii.var >= 256 || ii.incr > 127 || ii.incr < -128) ? 6 : 3;
                }
            case AbstractInsnNode.TABLESWITCH_INSN:
                {
                    TableSwitchInsnNode si = (TableSwitchInsnNode) ai;
View Full Code Here

      case 9:
        LdcInsnNode ldcinsn = (LdcInsnNode) insn;
        visitLdcInsn(ldcinsn.cst);
        break;
      case 10:
        IincInsnNode iiinsn = (IincInsnNode) insn;
        visitIincInsn(iiinsn.var, iiinsn.incr);
        break;
      case 11:
        TableSwitchInsnNode tsinsn = (TableSwitchInsnNode) insn;
        Label[] tslables = new Label[tsinsn.labels.size()];
View Full Code Here

    testInstructionBetweenFrames(new LdcInsnNode("JaCoCo"));
  }

  @Test
  public void testIincInsn() {
    testInstructionBetweenFrames(new IincInsnNode(3, 42));
  }
View Full Code Here

          case "SWITCH":
            return new TableSwitchInsnNode(toint(args[1]), toint(args[2]),
                getLabelNode(toint(args[3])), getLabelNode(toint(args[4]))); // FIXME arg4 is a
                                                                             // varargs
          case "IINC":
            return new IincInsnNode(toint(args[1]), toint(args[2]));
          case "FRAME":
            switch (args[1].toUpperCase()) {
              case "SAME":
                return new FrameNode(F_SAME, 0, null, 0, null);
View Full Code Here

TOP

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

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.