Examples of visitCode()


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

    }

    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

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

    @Deprecated
    public static void genInvokeXxxWithArray(ClassWriter cw, Method method) {
        MethodVisitor mv;
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "invoke", "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;", null, EXCEPTIONS);
        mv.visitCode();

        Class callClass = method.getDeclaringClass();
        boolean useInterface = callClass.isInterface();

        String type = BytecodeHelper.getClassInternalName(callClass.getName());
View Full Code Here

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

              pdescb.append("Ljava/lang/Object;");

            String pdesc = pdescb.toString();

            mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "invoke", "(Ljava/lang/Object;" + pdesc + ")Ljava/lang/Object;", null, EXCEPTIONS);
            mv.visitCode();

            Class callClass = method.getDeclaringClass();
            boolean useInterface = callClass.isInterface();

            String type = BytecodeHelper.getClassInternalName(callClass.getName());
View Full Code Here

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

              return;

            String pdesc = pdescb.toString();

            mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "invoke", "(Ljava/lang/Object;" + pdesc + ")Ljava/lang/Object;", null, EXCEPTIONS);
            mv.visitCode();

            Class callClass = method.getDeclaringClass();
            boolean useInterface = callClass.isInterface();

            String type = BytecodeHelper.getClassInternalName(callClass.getName());
View Full Code Here

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

   
    private CallSiteGenerator () {}
   
    private static MethodVisitor writeMethod(ClassWriter cw, String name, int argumentCount, final String superClass, CachedMethod cachedMethod, String receiverType, String parameterDescription, boolean useArray) {
        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "call" + name, "(L" + receiverType + ";" + parameterDescription + ")Ljava/lang/Object;", null, null);
        mv.visitCode();
       
        final Label tryStart = new Label();
        mv.visitLabel(tryStart);
       
        // call for checking if method is still valid
View Full Code Here

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

    }

    private static void genConstructor(ClassWriter cw, final String superClass, String internalName) {
        MethodVisitor mv;
        mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "(Lorg/codehaus/groovy/runtime/callsite/CallSite;Lgroovy/lang/MetaClassImpl;Lgroovy/lang/MetaMethod;[Ljava/lang/Class;Ljava/lang/reflect/Constructor;)V", null, null);
        mv.visitCode();
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitVarInsn(Opcodes.ALOAD, 1);
        mv.visitVarInsn(Opcodes.ALOAD, 2);
        mv.visitVarInsn(Opcodes.ALOAD, 3);
        mv.visitVarInsn(Opcodes.ALOAD, 4);
View Full Code Here

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

public class RemoveAddZeroAdapterTest extends AbstractTestCase {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodVisitor mv = new RemoveAddZeroAdapter(tmv);
    mv.visitCode();
    mv.visitVarInsn(ILOAD, 1);
    mv.visitInsn(ICONST_0);
    mv.visitInsn(IADD);
    mv.visitInsn(IRETURN);
    mv.visitMaxs(0, 0);
View Full Code Here

Examples of org.objectweb.asm.commons.AnalyzerAdapter.visitCode()

    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    RemoveUnusedCastAdapter rc = new RemoveUnusedCastAdapter(tmv);
    AnalyzerAdapter aa = new AnalyzerAdapter("C", ACC_PUBLIC, "m",
        "(Ljava/lang/Integer;)I", rc);
    rc.aa = aa;
    aa.visitCode();
    aa.visitVarInsn(ALOAD, 1);
    aa.visitTypeInsn(CHECKCAST, "java/lang/Number");
    aa.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "intValue",
        "()I");
    aa.visitInsn(IRETURN);
View Full Code Here

Examples of org.objectweb.asm.commons.GeneratorAdapter.visitCode()

    MethodVisitor mv;
    mv = cv.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    if (mv != null) {
      Method m = Method.getMethod("void <init>()");
      GeneratorAdapter ga = new GeneratorAdapter(ACC_PUBLIC, m, mv);
      ga.visitCode();
      ga.loadThis();
      ga.invokeConstructor(Type.getType("Ljava/lang/Object;"), m);
      ga.returnValue();
      ga.endMethod();
    }
View Full Code Here

Examples of org.objectweb.asm.tree.MethodNode.visitCode()

    RemoveAddZeroAdapterTest {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodNode mn = new MethodNode(0, null, null, null, null);
    mn.visitCode();
    mn.visitVarInsn(ILOAD, 1);
    mn.visitInsn(ICONST_0);
    mn.visitInsn(IADD);
    mn.visitInsn(IRETURN);
    mn.visitMaxs(0, 0);
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.