Examples of LdcInsnNode


Examples of org.objectweb.asm.tree.LdcInsnNode

                        getLabel(((IInteger)((IConstructor)v).get(1)).intValue())));
        } else if (((IConstructor)v).getName().equals("localVariable")) {
          il.add(new VarInsnNode(((IInteger)((IConstructor)v).get(0)).intValue(),
                       ((IInteger)((IConstructor)v).get(1)).intValue()));
        } else if (((IConstructor)v).getName().equals("loadConstantString")) {
          il.add(new LdcInsnNode(((IString)((IConstructor)v).get(0)).getValue()));
        } else if (((IConstructor)v).getName().equals("loadConstantInteger")) {
          il.add(new LdcInsnNode(((IInteger)((IConstructor)v).get(0)).intValue()));
        } else if (((IConstructor)v).getName().equals("loadConstantLong")) {
          il.add(new LdcInsnNode(((IInteger)((IConstructor)v).get(0)).longValue()));
        } else if (((IConstructor)v).getName().equals("loadConstantFloat")) {
          il.add(new LdcInsnNode(((IReal)((IConstructor)v).get(0)).floatValue()));
        } else if (((IConstructor)v).getName().equals("loadConstantDouble")) {
          il.add(new LdcInsnNode(((IReal)((IConstructor)v).get(0)).doubleValue()));
        } else if (((IConstructor)v).getName().equals("lookupSwitch")) {
          IList kl = (IList)((IConstructor)v).get(1);
          int ka[] = new int[kl.length()];
          for (int i = 0; i < kl.length(); i++) {
            ka[i] = ((IInteger)kl.get(i)).intValue();
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

        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

Examples of org.objectweb.asm.tree.LdcInsnNode

        }

        InsnList pre = new InsnList();
        // pre.add(vStart);
        if (isStatic) {
            pre.add(new LdcInsnNode(cn.name));
        } else {
            pre.add(new VarInsnNode(ALOAD, 0)); // "this" is index 0 locvar.
        }

        pre.add(new MethodInsnNode(INVOKESTATIC, classDesc, BEFORE,
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

       

    InsnList preExitInsns(ClassNode cn, MethodNode mn, int varIndex ) {
        InsnList post = new InsnList();
        if ( (mn.access & ACC_STATIC) != 0 ) {
            post.add( new LdcInsnNode( cn.name ));
        }
        else {
            post.add( new VarInsnNode( ALOAD, 0 ));
        }
        post.add( new VarInsnNode( ALOAD, varIndex ));
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

        new LabelNode()));
  }

  @Test
  public void testLdcInsn() {
    testInstructionBetweenFrames(new LdcInsnNode("JaCoCo"));
  }
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

        stack.push(new Constant(opcode));
        break;
       
      /** pushes some constant value to the stack */
      case LDC: {
        final LdcInsnNode ldc = (LdcInsnNode) instruction.getInstruction();
        stack.push(new Constant(ldc.cst));
        break;
      }
       
      /** pushes some local variable to the stack */
 
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

    // TODO tricky to compare destinations when captured as labels with no exposed identifier/position
    return true;
  }

  private static boolean sameLdcInsnNode(AbstractInsnNode o, AbstractInsnNode n) {
    LdcInsnNode oi = (LdcInsnNode) o;
    if (!(n instanceof LdcInsnNode)) {
      return false;
    }
    LdcInsnNode ni = (LdcInsnNode) n;
    Object ocst = oi.cst;
    if (ocst instanceof Integer) {
      if (!(ni.cst instanceof Integer)) {
        return false;
      }
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

    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

Examples of org.objectweb.asm.tree.LdcInsnNode

      case 8:
        LabelNode linsn = (LabelNode) insn;
        visitLabel(linsn.getLabel());
        break;
      case 9:
        LdcInsnNode ldcinsn = (LdcInsnNode) insn;
        visitLdcInsn(ldcinsn.cst);
        break;
      case 10:
        IincInsnNode iiinsn = (IincInsnNode) insn;
        visitIincInsn(iiinsn.var, iiinsn.incr);
View Full Code Here

Examples of org.objectweb.asm.tree.LdcInsnNode

         case ACONST_NULL:
            return new ConstantValue.NullConstant();
         case LDC:
         {
            assert(insn instanceof LdcInsnNode);
            LdcInsnNode ldcInsn = (LdcInsnNode)insn;
            Object val = ldcInsn.cst;
            if (val instanceof String)
               return new ConstantValue.StringConstant((String)val);
            else if (val instanceof Integer)
               return new ConstantValue.IntegerConstant(((Integer)val).intValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.