本文整理汇总了Java中org.objectweb.asm.commons.JSRInlinerAdapter类的典型用法代码示例。如果您正苦于以下问题:Java JSRInlinerAdapter类的具体用法?Java JSRInlinerAdapter怎么用?Java JSRInlinerAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSRInlinerAdapter类属于org.objectweb.asm.commons包,在下文中一共展示了JSRInlinerAdapter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadClass
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
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;
}
}
示例2: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
/**
* 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;
}
示例3: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
@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;
}
示例4: useJSRInlinerAdapter
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
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);
}
};
}
示例5: fixJSRInlining
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
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();
}
示例6: visitAllowedMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
@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);
}
示例7: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
@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;
}
示例8: toMethodVisitor
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
/**
* 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;
}
示例9: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
@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);
}
示例10: fixJSRInlining
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
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();
}
示例11: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
@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);
}
示例12: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
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);
}
示例13: visitMethod
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
@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);
}
示例14: toMethodVisitor
import org.objectweb.asm.commons.JSRInlinerAdapter; //导入依赖的package包/类
/**
* 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;
}