Package webit.script.asm.lib

Examples of webit.script.asm.lib.MethodWriter.visitInsn()


    static void visitConstructor(ClassWriter classWriter) {
        MethodWriter m = classWriter.visitMethod(Constants.ACC_PUBLIC, "<init>", "()V", null);
        m.visitVarInsn(Constants.ALOAD, 0);
        m.visitMethodInsn(Constants.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
        m.visitInsn(Constants.RETURN);
        m.visitMaxs();
    }

    private static final class AsmClassLoader extends ClassLoader {
View Full Code Here


            visitXetMethod(true, classWriter, beanClass, all, hashs, indexer);
            visitXetMethod(false, classWriter, beanClass, all, hashs, indexer);

            //getMatchClass
            final MethodWriter m = classWriter.visitMethod(Constants.ACC_PUBLIC, "getMatchClass", "()Ljava/lang/Class;", null);
            m.visitInsn(Constants.ACONST_NULL);
            m.visitInsn(Constants.ARETURN);
            m.visitMaxs();

            return ASMUtil.loadClass(className, classWriter);
        } else {
View Full Code Here

            visitXetMethod(false, classWriter, beanClass, all, hashs, indexer);

            //getMatchClass
            final MethodWriter m = classWriter.visitMethod(Constants.ACC_PUBLIC, "getMatchClass", "()Ljava/lang/Class;", null);
            m.visitInsn(Constants.ACONST_NULL);
            m.visitInsn(Constants.ARETURN);
            m.visitMaxs();

            return ASMUtil.loadClass(className, classWriter);
        } else {
            throw new Exception(StringUtil.format("Class [{}] is not public", beanClass));
View Full Code Here

            }
            m.visitLabel(finalEndLabel);
        }
        //Exception
        m.visitTypeInsn(Constants.NEW, "webit/script/exceptions/ScriptRuntimeException");
        m.visitInsn(Constants.DUP);
        m.visitLdcInsn(StringUtil.concat("Invalid property ", beanClass.getName(), "#"));
        m.visitVarInsn(Constants.ALOAD, 2);
        m.invokeStatic("java/lang/String", "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;");
        m.invokeVirtual("java/lang/String", "concat", "(Ljava/lang/String;)Ljava/lang/String;");
        m.visitMethodInsn(Constants.INVOKESPECIAL, "webit/script/exceptions/ScriptRuntimeException", "<init>", "(Ljava/lang/String;)V");
View Full Code Here

        m.visitLdcInsn(StringUtil.concat("Invalid property ", beanClass.getName(), "#"));
        m.visitVarInsn(Constants.ALOAD, 2);
        m.invokeStatic("java/lang/String", "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;");
        m.invokeVirtual("java/lang/String", "concat", "(Ljava/lang/String;)Ljava/lang/String;");
        m.visitMethodInsn(Constants.INVOKESPECIAL, "webit/script/exceptions/ScriptRuntimeException", "<init>", "(Ljava/lang/String;)V");
        m.visitInsn(Constants.ATHROW);
        m.visitMaxs();
    }

    private static void visitXetFields(final boolean isGetter, final MethodWriter m, final FieldInfo[] fieldInfos, final int start, final int end, final String beanName, final Label failedMatchLabel) {
        final Label[] gotoTable = new Label[end - start];
View Full Code Here

        if (paramTypesLen == 0) {
            if (isStatic) {
                m.invokeStatic(ownerClass, destName, destDesc);
                ASMUtil.visitBoxIfNeed(m, returnType);
                m.visitInsn(Constants.ARETURN);
            } else if (isConstructor) {
                m.visitTypeInsn(Constants.NEW, ownerClass);
                m.visitInsn(Constants.DUP);
                m.visitMethodInsn(Constants.INVOKESPECIAL, ownerClass, "<init>", "()V");
                m.visitInsn(Constants.ARETURN);
View Full Code Here

                m.invokeStatic(ownerClass, destName, destDesc);
                ASMUtil.visitBoxIfNeed(m, returnType);
                m.visitInsn(Constants.ARETURN);
            } else if (isConstructor) {
                m.visitTypeInsn(Constants.NEW, ownerClass);
                m.visitInsn(Constants.DUP);
                m.visitMethodInsn(Constants.INVOKESPECIAL, ownerClass, "<init>", "()V");
                m.visitInsn(Constants.ARETURN);
            } else {
                Label toExcaption = new Label();
                m.visitVarInsn(Constants.ALOAD, 2);
View Full Code Here

                m.visitInsn(Constants.ARETURN);
            } else if (isConstructor) {
                m.visitTypeInsn(Constants.NEW, ownerClass);
                m.visitInsn(Constants.DUP);
                m.visitMethodInsn(Constants.INVOKESPECIAL, ownerClass, "<init>", "()V");
                m.visitInsn(Constants.ARETURN);
            } else {
                Label toExcaption = new Label();
                m.visitVarInsn(Constants.ALOAD, 2);
                m.visitJumpInsn(Constants.IFNULL, toExcaption);
                m.visitVarInsn(Constants.ALOAD, 2);
View Full Code Here

            } else {
                Label toExcaption = new Label();
                m.visitVarInsn(Constants.ALOAD, 2);
                m.visitJumpInsn(Constants.IFNULL, toExcaption);
                m.visitVarInsn(Constants.ALOAD, 2);
                m.visitInsn(Constants.ARRAYLENGTH);
                m.visitJumpInsn(Constants.IFEQ, toExcaption);
                m.visitVarInsn(Constants.ALOAD, 2);
                m.visitInsn(Constants.ICONST_0);
                m.visitInsn(Constants.AALOAD);
                m.visitJumpInsn(Constants.IFNULL, toExcaption);
View Full Code Here

        Label toExcaption = new Label();
        m.visitVarInsn(Constants.ALOAD, 1);
        m.visitJumpInsn(Constants.IFNULL, toExcaption);
        m.visitVarInsn(Constants.ALOAD, 1);
        m.visitInsn(Constants.ARRAYLENGTH);
        m.visitJumpInsn(Constants.IFEQ, toExcaption);
        m.visitVarInsn(Constants.ALOAD, 1);
        m.visitInsn(Constants.ICONST_0); //m.visitIntInsn(Constants.SIPUSH, 17);
       
        m.visitInsn(Constants.AALOAD);
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.