Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.InsnNode


    VarInsnNode ni = (VarInsnNode) n;
    return oi.var == ni.var;
  }

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


                // Rather than JSRing, we will jump to the inline version and
                // push NULL for what was once the return value. This hack
                // allows us to avoid doing any sort of data flow analysis to
                // figure out which instructions manipulate the old return value
                // pointer which is now known to be unneeded.
                newInstructions.add(new InsnNode(ACONST_NULL));
                newInstructions.add(new JumpInsnNode(GOTO, startlbl));
                newInstructions.add(newinst.returnLabel);

                // Insert this new instantiation into the queue to be emitted
                // later.
View Full Code Here

            if (left != null) {
                if (DEBUG_FRAGMENT) System.out.printf("Breaking switch at %d\n", cutoff);

                LabelNode high = new LabelNode();
                instructions.insertBefore(ptr, new InsnNode(Opcodes.DUP));
                instructions.insertBefore(ptr, intNode(cutoff));
                instructions.insertBefore(ptr, new JumpInsnNode(Opcodes.IF_ICMPGE, high));
                instructions.insertBefore(ptr, left);
                instructions.insertBefore(ptr, high);
                instructions.insertBefore(ptr, right);
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

                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

        }
        instructions.add(new InsnNode(retinst));
    }

    private int saveArg(InsnList il, int ltmp, Type at) {
        il.add(new InsnNode(Opcodes.DUP));
        il.add(intNode(ltmp));
        int opc;
        String ty = null, desc = null;
        switch (at.getSort()) {
            case Type.BOOLEAN:
            case Type.CHAR:
            case Type.INT:
            case Type.SHORT:
            case Type.BYTE:
                opc = Opcodes.ILOAD; ty = "java/lang/Integer"; desc = "(I)V"; break;
            case Type.LONG:
                opc = Opcodes.LLOAD; ty = "java/lang/Long"; desc = "(J)V"; break;
            case Type.FLOAT:
                opc = Opcodes.FLOAD; ty = "java/lang/Float"; desc = "(F)V"; break;
            case Type.DOUBLE:
                opc = Opcodes.DLOAD; ty = "java/lang/Double"; desc = "(D)V"; break;
            default:
                opc = Opcodes.ALOAD; break;
        }

        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

                // Rather than JSRing, we will jump to the inline version and
                // push NULL for what was once the return value. This hack
                // allows us to avoid doing any sort of data flow analysis to
                // figure out which instructions manipulate the old return value
                // pointer which is now known to be unneeded.
                newInstructions.add(new InsnNode(ACONST_NULL));
                newInstructions.add(new JumpInsnNode(GOTO, startlbl));
                newInstructions.add(newinst.returnLabel);

                // Insert this new instantiation into the queue to be emitted
                // later.
View Full Code Here

        methodVisitor.visitCode();

        // visit instructions
        body.accept(methodVisitor);
        if (addReturn) {
            new InsnNode(RETURN).accept(methodVisitor);
        }

        // visit local variable declarations
        for (LocalVariableNode localVariableNode : localVariableNodes) {
            localVariableNode.accept(methodVisitor);
View Full Code Here

           
            VarInsnNode varInsn = (VarInsnNode)insn;
           
            Value topValue = getStack(getStackSize() - 1);
            if (!liveOut.get(varInsn.var) && topValue != IsNullInterpreter.NULL) {
                InsnNode pop = new InsnNode(Opcodes.POP);
                instructions.insert(insn, pop);
                instructions.remove(insn);
                def.clear();
            }
        }
View Full Code Here

            if (toNull.cardinality() > 0) {
                // Construct the nulling instructions.
                InsnList nullingInsns = new InsnList();
                for (int i = 0; i < toNull.length(); i++) {
                    if (toNull.get(i)) {
                        AbstractInsnNode pushNull = new InsnNode(Opcodes.ACONST_NULL);
                        AbstractInsnNode store = new VarInsnNode(Opcodes.ASTORE, i);
                        nullingInsns.add(pushNull);
                        nullingInsns.add(store);
                    }
                }
View Full Code Here

TOP

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

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.