Java 类org.objectweb.asm.commons.JSRInlinerAdapter 实例源码

项目:NeonObf    文件:CustomClassWriter.java   
public static ClassNode loadClass(InputStream is, int mode) {
    try {
        final ClassReader reader = new ClassReader(is);
        final ClassNode node = new ClassNode();

        reader.accept(node, mode);
        for(int i = 0; i < node.methods.size(); ++i) {
            final MethodNode methodNode2 = (MethodNode) node.methods.get(i);
            final JSRInlinerAdapter adapter = new JSRInlinerAdapter(methodNode2, methodNode2.access, methodNode2.name, methodNode2.desc, methodNode2.signature, (String[]) methodNode2.exceptions.toArray(new String[0]));
            methodNode2.accept(adapter);
            node.methods.set(i, adapter);
        }

        Main.getInstance().nameToNode.put(node.name, node);
        Main.getInstance().nodeToName.put(node, node.name);

        return node;
    } catch(Throwable t) {
        t.printStackTrace();
        return null;
    }
}
项目:allocation-instrumenter    文件:AllocationClassAdapter.java   
/**
 * For each method in the class being instrumented, <code>visitMethod</code>
 * is called and the returned MethodVisitor is used to visit the method.
 * Note that a new MethodVisitor is constructed for each method.
 */
@Override
public MethodVisitor visitMethod(int access, String base, String desc,
    String signature, String[] exceptions) {
  MethodVisitor mv =
    cv.visitMethod(access, base, desc, signature, exceptions);

  if (mv != null) {
    // We need to compute stackmaps (see
    // AllocationInstrumenter#instrument).  This can't really be
    // done for old bytecode that contains JSR and RET instructions.
    // So, we remove JSRs and RETs.
    JSRInlinerAdapter jsria = new JSRInlinerAdapter(
        mv, access, base, desc, signature, exceptions);
    AllocationMethodAdapter aimv =
      new AllocationMethodAdapter(jsria, recorderClass, recorderMethod);
    LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, aimv);
    aimv.lvs = lvs;
    mv = lvs;
  }
  return mv;
}
项目:r8    文件:JarCode.java   
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
    String[] exceptions) {
  MethodNode node = new JSRInlinerAdapter(null, access, name, desc, signature, exceptions);
  JarCode code = context.lookupMap.get(application.getMethod(context.owner.type, name, desc));
  if (code != null) {
    code.context = null;
    code.node = node;
    return node;
  }
  return null;
}
项目:light    文件:ASMUtil.java   
private static ClassVisitor useJSRInlinerAdapter(ClassVisitor visitor)
{
    return new ClassVisitor(Opcodes.ASM5, visitor)
    {
        @Override
        public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
        {
            return new JSRInlinerAdapter(super.visitMethod(access, name, desc, signature, exceptions), access, name, desc, signature, exceptions);
        }
    };
}
项目:lombok-ianchiu    文件:AsmUtil.java   
static byte[] fixJSRInlining(byte[] byteCode) {
    ClassReader reader = new ClassReader(byteCode);
    ClassWriter writer = new FixedClassWriter(reader, 0);

    ClassVisitor visitor = new ClassVisitor(Opcodes.ASM5, writer) {
        @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
            return new JSRInlinerAdapter(super.visitMethod(access, name, desc, signature, exceptions), access, name, desc, signature, exceptions);
        }
    };

    reader.accept(visitor, 0);
    return writer.toByteArray();
}
项目:EasyMPermission    文件:AsmUtil.java   
static byte[] fixJSRInlining(byte[] byteCode) {
    ClassReader reader = new ClassReader(byteCode);
    ClassWriter writer = new FixedClassWriter(reader, 0);

    ClassVisitor visitor = new ClassVisitor(Opcodes.ASM5, writer) {
        @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
            return new JSRInlinerAdapter(super.visitMethod(access, name, desc, signature, exceptions), access, name, desc, signature, exceptions);
        }
    };

    reader.accept(visitor, 0);
    return writer.toByteArray();
}
项目:metrics-agent    文件:MetricClassVisitor.java   
@Override
public MethodVisitor visitAllowedMethod(MethodVisitor mv, int access, String name, String desc, String signature, String[] exceptions) {
    List<Metric> metadata = config.findMetrics(className, name, desc);

    mv = new MetricAdapter(mv, className, access, name, desc, metadata);
    return new JSRInlinerAdapter(mv, access, name, desc, signature, exceptions);
}
项目:CodenameOne    文件:Parser.java   
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    BytecodeMethod mtd = new BytecodeMethod(clsName, access, name, desc, signature, exceptions);
    cls.addMethod(mtd);
    JSRInlinerAdapter a = new JSRInlinerAdapter(new MethodVisitorWrapper(super.visitMethod(access, name, desc, signature, exceptions), mtd), access, name, desc, signature, exceptions);
    return a; 
}
项目:peg4d-java    文件:ClassBuilder.java   
/**
 * helper method for method visitor generation
 * @param access
 * @param method
 * @param cv
 * @return
 */
private static MethodVisitor toMethodVisitor(int access, Method method, ClassVisitor cv) {
    MethodVisitor visitor = 
            cv.visitMethod(access, method.getName(), method.getDescriptor(), null, null);
    JSRInlinerAdapter inlinerAdapter = 
            new JSRInlinerAdapter(visitor, access, method.getName(), method.getDescriptor(), null, null);
    return inlinerAdapter;
}
项目:glowroot    文件:Weaver.java   
@Override
public MethodVisitor visitMethod(int access, String name, String desc,
        @Nullable String signature, String /*@Nullable*/ [] exceptions) {
    MethodVisitor mv =
            checkNotNull(cv).visitMethod(access, name, desc, signature, exceptions);
    return new JSRInlinerAdapter(mv, access, name, desc, signature, exceptions);
}
项目:lombok    文件:AsmUtil.java   
static byte[] fixJSRInlining(byte[] byteCode) {
    ClassReader reader = new ClassReader(byteCode);
    ClassWriter writer = new FixedClassWriter(reader, 0);

    ClassVisitor visitor = new ClassVisitor(Opcodes.ASM4, writer) {
        @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
            return new JSRInlinerAdapter(super.visitMethod(access, name, desc, signature, exceptions), access, name, desc, signature, exceptions);
        }
    };

    reader.accept(visitor, 0);
    return writer.toByteArray();
}
项目:coroutines    文件:SimpleClassNode.java   
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    MethodVisitor origVisitor = super.visitMethod(access, name, desc, signature, exceptions);
    return new JSRInlinerAdapter(origVisitor, access, name, desc, signature, exceptions);
}
项目:minha    文件:JSRInlinerClassVisitor.java   
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    return new JSRInlinerAdapter(super.visitMethod(access, name, desc, signature, exceptions), access, name, desc, signature, exceptions); 
}
项目:javaslicer    文件:JSRInliner.java   
@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
    final MethodVisitor visitor = super.visitMethod(access, name, desc, signature, exceptions);
    return visitor == null ? null : new JSRInlinerAdapter(visitor, access, name, desc, signature, exceptions);
}
项目:konoha    文件:MethodBuilder.java   
/**
 * helper method for method visitor generation
 * 
 * @param access
 * @param method
 * @param cv
 * @return
 */

private static MethodVisitor toMethodVisitor(int access, Method method, ClassVisitor cv) {
    MethodVisitor visitor = cv.visitMethod(access, method.getName(), method.getDescriptor(), null, null);
    JSRInlinerAdapter inlinerAdapter = new JSRInlinerAdapter(visitor, access, method.getName(), method.getDescriptor(), null, null);
    return inlinerAdapter;
    // return visitor;
}