Package org.objectweb.asm

Examples of org.objectweb.asm.ClassVisitor.visitMethod()


        byte[] b = (byte[]) classes.get(j);
        ClassWriter cw = new ClassWriter(0);
        ClassVisitor cv = new ClassAdapter(cw) {
          public MethodVisitor visitMethod(int access, String name,
              String desc, String signature, String[] exceptions) {
            return new RemoveGetFieldPutFieldAdapter(cv.visitMethod(
                access, name, desc, signature, exceptions));
          }
        };
        new ClassReader(b).accept(cv, 0);
        cw.toByteArray();
View Full Code Here


        ClassReader cr = new ClassReader(b);
        ClassWriter cw = new ClassWriter(cr, 0);
        ClassVisitor cv = new ClassAdapter(cw) {
          public MethodVisitor visitMethod(int access, String name,
              String desc, String signature, String[] exceptions) {
            return new RemoveGetFieldPutFieldAdapter(cv.visitMethod(
                access, name, desc, signature, exceptions));
          }
        };
        cr.accept(cv, 0);
        cw.toByteArray();
View Full Code Here

//            break;
        default:
            signature = sig(Object.class, Object.class, Object[].class);
            break;
        }
        m = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC | ACC_FINAL | ACC_SYNTHETIC, "invoke", signature, null, null));
       
        m.start();
       
        // load receiver
        if (!Modifier.isStatic(method.getModifiers())) {
View Full Code Here

        }
        m.areturn();
        m.end();
       
        // constructor
        m = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC, "<init>", sig(void.class), null, null));
        m.start();
        m.aload(0);
        m.invokespecial(p(Handle.class), "<init>", sig(void.class));
        m.voidreturn();
        m.end();
View Full Code Here

    }

    private void beginInit() {
        ClassVisitor cv = getClassVisitor();

        initMethod = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC, "<init>", sig(Void.TYPE), null, null));
        initMethod.start();
        initMethod.aload(THIS);
        initMethod.invokespecial(p(AbstractScript.class), "<init>", sig(Void.TYPE));
       
        cv.visitField(ACC_PRIVATE | ACC_FINAL, "$class", ci(Class.class), null, null);
View Full Code Here

    }

    private void beginClassInit() {
        ClassVisitor cv = getClassVisitor();

        clinitMethod = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC | ACC_STATIC, "<clinit>", sig(Void.TYPE), null, null));
        clinitMethod.start();

        if (invDynSupportInstaller != null) {
            // install invokedynamic bootstrapper
            // TODO need to abstract this setup behind another compiler interface
View Full Code Here

        ClassVisitor cv = scriptCompiler.getClassVisitor();

        {
            SkinnyMethodAdapter closureGetter = new SkinnyMethodAdapter(
                    cv.visitMethod(Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, closureMethodName,
                            sig(BlockBody.class, ThreadContext.class), null, null));

            closureGetter.aload(0);
            closureGetter.getfield(scriptCompiler.getClassname(), closureFieldName, ci(BlockBody.class));
            closureGetter.dup();
View Full Code Here

        ClassVisitor cv = scriptCompiler.getClassVisitor();

        {
            SkinnyMethodAdapter closureGetter = new SkinnyMethodAdapter(
                    cv.visitMethod(Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, closureMethodName,
                            sig(CompiledBlockCallback.class, Ruby.class), null, null));

            closureGetter.aload(0);
            closureGetter.getfield(scriptCompiler.getClassname(), closureFieldName, ci(CompiledBlockCallback.class));
            closureGetter.dup();
View Full Code Here

        cv.visit(V1_5, ACC_PUBLIC | ACC_FINAL, className, null, p(AbstractAsmLibraryInterface.class),
                new String[] { p(interfaceClass) });

        // Create the constructor to set the 'library' & functions fields
        SkinnyMethodAdapter init = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC, "<init>",
                sig(void.class, NativeLibrary.class, Object[].class),
                null, null));
        init.start();
        // Invokes the super class constructor as super(Library)
View Full Code Here

            nativeParameterClasses[i] = getNativeClass(parameterTypes[i].nativeType);
        }

        Class nativeResultClass = getNativeClass(resultType.nativeType);

        SkinnyMethodAdapter mv = new SkinnyMethodAdapter(closureClassVisitor.visitMethod(ACC_PUBLIC | ACC_FINAL, "invoke",
                sig(nativeResultClass, nativeParameterClasses),
                null, null));
        mv.start();

        // Cast the callable instance to the correct class
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.