Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.IntInsnNode


          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(),
                       ((IInteger)((IConstructor)v).get(1)).intValue()));
        } else if (((IConstructor)v).getName().equals("jump")) {
          il.add(new JumpInsnNode(((IInteger)((IConstructor)v).get(0)).intValue(),
                      getLabel(((IInteger)((IConstructor)v).get(1)).intValue())));
        } else if (((IConstructor)v).getName().equals("label")) {
View Full Code Here


        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

    int offset = offset(name);
   
    if (offset <= 5)
      return new InsnNode(ICONST_0 + offset);
    else if (offset <= 0xff)
      return new IntInsnNode(BIPUSH, offset);
    else
      return new IntInsnNode(SIPUSH, offset);
  }
View Full Code Here

    testInstructionBetweenFrames(new InsnNode(Opcodes.NOP));
  }

  @Test
  public void testIntInsn() {
    testInstructionBetweenFrames(new IntInsnNode(Opcodes.BIPUSH, 123));
  }
View Full Code Here

        case GETFIELD: {
            final FieldInsnNode f = (FieldInsnNode) insn;
            return new ObjectField(f.owner, f.name, f.desc, value);
        }
        case NEWARRAY: {
            final IntInsnNode iinsn = (IntInsnNode) insn;
            switch (iinsn.operand) {
            case T_BOOLEAN:
                return new ArrayRef(Type.getType("[Z"), value);
            case T_CHAR:
                return new ArrayRef(Type.getType("[C"), value);
View Full Code Here

    // must be Type
    return ((Type) ocst).equals(ni.cst);
  }

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

        }
    }

    private AbstractInsnNode intNode(int value) {
        return (value >= -1   && value <= 5) ? new InsnNode(Opcodes.ICONST_0 + value) :
               (value >= -128 && value <= 127) ? new IntInsnNode(Opcodes.BIPUSH, value) :
               (value >= -32768 && value <= 32767) ? new IntInsnNode(Opcodes.SIPUSH, value) :
               new LdcInsnNode(value);
    }
View Full Code Here

    {
      case 0:
        visitInsn(insn.getOpcode());
        break;
      case 1:
        IntInsnNode iinsn = (IntInsnNode) insn;
        visitIntInsn(iinsn.getOpcode(), iinsn.operand);
        break;
      case 2:
        VarInsnNode vinsn = (VarInsnNode) insn;
        visitVarInsn(vinsn.getOpcode(), vinsn.var);
        break;
View Full Code Here

         }
         case BIPUSH:
         case SIPUSH:
         {
            assert(insn instanceof IntInsnNode);
            IntInsnNode intInsn = (IntInsnNode)insn;
            return new ConstantValue.IntegerConstant(intInsn.operand);
         }
         case JSR:
         case GETSTATIC:
         default:
View Full Code Here

    testInstructionBetweenFrames(new InsnNode(Opcodes.NOP));
  }

  @Test
  public void testIntInsn() {
    testInstructionBetweenFrames(new IntInsnNode(Opcodes.BIPUSH, 123));
  }
View Full Code Here

TOP

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

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.