Package jdk.internal.org.objectweb.asm

Examples of jdk.internal.org.objectweb.asm.Label


        if (!classOptimizer.class$) {
            MethodVisitor mv = classOptimizer.visitMethod(ACC_STATIC
                    | ACC_SYNTHETIC, "class$",
                    "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
            mv.visitCode();
            Label l0 = new Label();
            Label l1 = new Label();
            Label l2 = new Label();
            mv.visitTryCatchBlock(l0, l1, l2,
                    "java/lang/ClassNotFoundException");
            mv.visitLabel(l0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName",
                    "(Ljava/lang/String;)Ljava/lang/Class;");
            mv.visitLabel(l1);
            mv.visitInsn(ARETURN);
            mv.visitLabel(l2);
            mv.visitMethodInsn(INVOKEVIRTUAL,
                    "java/lang/ClassNotFoundException", "getMessage",
                    "()Ljava/lang/String;");
            mv.visitVarInsn(ASTORE, 1);
            mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
            mv.visitInsn(DUP);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError",
                    "<init>", "(Ljava/lang/String;)V");
            mv.visitInsn(ATHROW);
            mv.visitMaxs(3, 2);
            mv.visitEnd();

            classOptimizer.class$ = true;
        }

        String clsName = classOptimizer.clsName;
        mv.visitFieldInsn(GETSTATIC, clsName, fieldName, "Ljava/lang/Class;");
        Label elseLabel = new Label();
        mv.visitJumpInsn(IFNONNULL, elseLabel);
        mv.visitLdcInsn(ldcName.replace('/', '.'));
        mv.visitMethodInsn(INVOKESTATIC, clsName, "class$",
                "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, clsName, fieldName, "Ljava/lang/Class;");
        Label endLabel = new Label();
        mv.visitJumpInsn(GOTO, endLabel);
        mv.visitLabel(elseLabel);
        mv.visitFieldInsn(GETSTATIC, clsName, fieldName, "Ljava/lang/Class;");
        mv.visitLabel(endLabel);
    }
View Full Code Here


    @Override
    public void visitTypeInsn(final int opcode, final String type) {
        if (opcode == Opcodes.NEW) {
            if (labels == null) {
                Label l = new Label();
                labels = new ArrayList<Label>(3);
                labels.add(l);
                if (mv != null) {
                    mv.visitLabel(l);
                }
View Full Code Here

        return LABEL;
    }

    public Label getLabel() {
        if (label == null) {
            label = new Label();
        }
        return label;
    }
View Full Code Here

     * Record the current instruction.
     */
    private final void record(int opcode) {
        // insert anonymous label at head if the processing method has no label
        if (records[0] == 0 && opcode != LABEL) {
            visitLabel(new Label());
        }

        records[recordIndex++] = opcode;

        if (recordIndex == records.length) {
View Full Code Here

TOP

Related Classes of jdk.internal.org.objectweb.asm.Label

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.