Package org.objectweb.asm

Examples of org.objectweb.asm.MethodVisitor.visitVarInsn()


    private static void genConstructor(ClassWriter cw, final String superClass) {
        MethodVisitor mv;
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitCode();
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, superClass, "<init>", "()V");
        mv.visitInsn(Opcodes.RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
View Full Code Here


        // make call
        if (Modifier.isStatic(method.getModifiers())) {
            genLoadParameters(2, mv, method);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, type, method.getName(), descriptor);
        } else {
            mv.visitVarInsn(Opcodes.ALOAD, 1);
            BytecodeHelper.doCast(mv, callClass);
            genLoadParameters(2, mv, method);
            mv.visitMethodInsn((useInterface) ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL, type, method.getName(), descriptor);
        }
View Full Code Here

            // make call
             if (Modifier.isStatic(method.getModifiers())) {
                MethodHandleFactory.genLoadParametersDirect(2, mv,  method);
                mv.visitMethodInsn(Opcodes.INVOKESTATIC, type, method.getName(), descriptor);
            } else {
                mv.visitVarInsn(Opcodes.ALOAD, 1);
                BytecodeHelper.doCast(mv, callClass);
                MethodHandleFactory.genLoadParametersDirect(2, mv, method);
                mv.visitMethodInsn((useInterface) ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL, type, method.getName(), descriptor);
            }
View Full Code Here

            // make call
             if (Modifier.isStatic(method.getModifiers())) {
                MethodHandleFactory.genLoadParametersPrimitiveDirect(2, mv, method);
                mv.visitMethodInsn(Opcodes.INVOKESTATIC, type, method.getName(), descriptor);
            } else {
                mv.visitVarInsn(Opcodes.ALOAD, 1);
                BytecodeHelper.doCast(mv, callClass);
                MethodHandleFactory.genLoadParametersPrimitiveDirect(2, mv, method);
                mv.visitMethodInsn((useInterface) ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL, type, method.getName(), descriptor);
            }
View Full Code Here

        Label continueLabel = compileStack.getContinueLabel();
        Label breakLabel = compileStack.getBreakLabel();

        mv.visitLabel(continueLabel);
        mv.visitVarInsn(ALOAD, iteratorIdx);
        writeIteratorHasNext(mv);
        // note: ifeq tests for ==0, a boolean is 0 if it is false
        mv.visitJumpInsn(IFEQ, breakLabel);

        mv.visitVarInsn(ALOAD, iteratorIdx);
View Full Code Here

        mv.visitVarInsn(ALOAD, iteratorIdx);
        writeIteratorHasNext(mv);
        // note: ifeq tests for ==0, a boolean is 0 if it is false
        mv.visitJumpInsn(IFEQ, breakLabel);

        mv.visitVarInsn(ALOAD, iteratorIdx);
        writeIteratorNext(mv);
        operandStack.push(ClassHelper.OBJECT_TYPE);
        operandStack.storeVar(variable);

        // Generate the loop body
View Full Code Here

        int anyExceptionIndex = compileStack.defineTemporaryVariable("exception", true);

        finallyStatement.visit(controller.getAcg());

        // load the exception and rethrow it
        mv.visitVarInsn(ALOAD, anyExceptionIndex);
        mv.visitInsn(ATHROW);

        mv.visitLabel(skipCatchAll);
    }
   
View Full Code Here

    {
        controller.getAcg().onLineNumber(statement, "visitCaseStatement");
        MethodVisitor mv = controller.getMethodVisitor();
        OperandStack operandStack = controller.getOperandStack();

        mv.visitVarInsn(ALOAD, switchVariableIndex);
       
        statement.getExpression().visit(controller.getAcg());
        operandStack.box();
        controller.getBinaryExpHelper().getIsCaseMethod().call(mv);
        operandStack.replace(ClassHelper.boolean_TYPE);
View Full Code Here

        final Label synchronizedStart = new Label();
        final Label synchronizedEnd = new Label();
        final Label catchAll = new Label();

        mv.visitVarInsn(ALOAD, index);
        mv.visitInsn(MONITORENTER);
        mv.visitLabel(synchronizedStart);
        // place holder for "empty" synchronized blocks, for example
        // if there is only a break/continue.
        mv.visitInsn(NOP);
View Full Code Here

        // if there is only a break/continue.
        mv.visitInsn(NOP);

        Runnable finallyPart = new Runnable() {
            public void run() {
                mv.visitVarInsn(ALOAD, index);
                mv.visitInsn(MONITOREXIT);
            }
        };
        BlockRecorder fb = new BlockRecorder(finallyPart);
        fb.startRange(synchronizedStart);
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.