List of usage examples for org.objectweb.asm Opcodes INVOKESTATIC
int INVOKESTATIC
To view the source code for org.objectweb.asm Opcodes INVOKESTATIC.
Click Source Link
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
/** * @see com.devexperts.aprof.AProfOps#objectInit(Object) * @see com.devexperts.aprof.AProfOps#objectInitSize(Object) *//* ww w . j a v a 2 s .c om*/ @Override protected void visitObjectInit() { mv.loadThis(); if (context.getConfig().isSize()) { mv.visitMethodInsn(Opcodes.INVOKESTATIC, TransformerUtil.APROF_OPS, "objectInitSize", TransformerUtil.OBJECT_VOID, false); } else { mv.visitMethodInsn(Opcodes.INVOKESTATIC, TransformerUtil.APROF_OPS, "objectInit", TransformerUtil.OBJECT_VOID, false); } }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
/** * OPS implementation is chosen based on the class doing the allocation. * * @see com.devexperts.aprof.AProfOps#allocate(LocationStack, int) * @see com.devexperts.aprof.AProfOps#allocateSize(LocationStack, int, Class) *//*from w w w .jav a 2s . co m*/ private void visitAllocate(String desc) { pushLocationStack(); pushAllocationPoint(desc); if (context.getConfig().isSize()) { pushClass(desc); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), "allocateSize", TransformerUtil.STACK_INT_CLASS_VOID, false); } else mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), "allocate", TransformerUtil.STACK_INT_VOID, false); }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
/** * OPS implementation is chosen based on the class doing the allocation. *///from w ww . ja v a 2 s . co m protected void visitAllocateArray(String desc) { if (context.getConfig().isSize()) { pushLocationStack(); pushAllocationPoint(desc); Type type = Type.getType(desc); assert type.getSort() == Type.ARRAY; Type elementType = type.getElementType(); String name = elementType.getSort() == Type.OBJECT || elementType.getSort() == Type.ARRAY ? "object" : elementType.getClassName(); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), name + "AllocateArraySize", TransformerUtil.INT_STACK_INT_VOID, false); } else { pushLocationStack(); pushAllocationPoint(desc); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), "allocate", TransformerUtil.STACK_INT_VOID, false); } }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
@Override protected void visitAllocateArrayMulti(String desc) { if (context.getConfig().isSize()) { mv.dup();/*from w w w .ja va 2 s. c o m*/ pushLocationStack(); pushAllocationPoint(desc); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), "allocateArraySizeMulti", TransformerUtil.OBJECT_ARR_STACK_INT_VOID, false); } else { pushLocationStack(); pushAllocationPoint(desc); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), "allocate", TransformerUtil.STACK_INT_VOID, false); } }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
/** * @see com.devexperts.aprof.AProfOps#allocateReflect(Object, LocationStack, int) * @see com.devexperts.aprof.AProfOps#allocateReflectSize(Object, LocationStack, int) *//*from www .ja va2s.c o m*/ @Override protected void visitAllocateReflect(boolean objectCloneInvocation) { assert !context.isInternalLocation() : context; assert context.getConfig().isReflect() : context; mv.dup(); pushLocationStack(); mv.push(AProfRegistry.registerLocation(context.getLocation(), objectCloneInvocation)); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), context.getConfig().isSize() ? "allocateReflectSize" : "allocateReflect", TransformerUtil.OBJECT_STACK_INT_VOID, false); }
From source file:com.devexperts.aprof.transformer.MethodTransformer.java
License:Open Source License
/** * @see com.devexperts.aprof.AProfOps#allocateReflectVClone(Object, LocationStack, int) * @see com.devexperts.aprof.AProfOps#allocateReflectVCloneSize(Object, LocationStack, int) *//*w w w . ja v a 2 s . c om*/ @Override protected void visitAllocateReflectVClone() { assert !context.isInternalLocation() : context; assert context.getConfig().isReflect() : context; mv.dup(); pushLocationStack(); mv.push(AProfRegistry.registerLocation(context.getLocation(), true)); mv.visitMethodInsn(Opcodes.INVOKESTATIC, context.getAprofOpsImplementation(), context.getConfig().isSize() ? "allocateReflectVCloneSize" : "allocateReflectVClone", TransformerUtil.OBJECT_STACK_INT_VOID, false); }
From source file:com.dragome.callbackevictor.serverside.bytecode.transformation.asm.ContinuationMethodAnalyzer.java
License:Apache License
boolean needsFrameGuard(int opcode, String owner, String name, String desc) { /* TODO: need to customize a way enchancer skips classes/methods if (owner.startsWith("java/")) { System.out.println("SKIP:: " + owner + "." + name + desc); return false;//from w w w. j a va2s .c om } */ if (opcode == Opcodes.INVOKEINTERFACE || (opcode == Opcodes.INVOKESPECIAL && !"<init>".equals(name)) || opcode == Opcodes.INVOKESTATIC || opcode == Opcodes.INVOKEVIRTUAL) { return true; } return false; }
From source file:com.dragome.methodlogger.serverside.MethodLoggerAdapter.java
License:Apache License
protected void onMethodEnter() { if (!isStatic()) { l0 = new Label(); super.visitLabel(l0); super.visitVarInsn(Opcodes.ALOAD, 0); super.visitLdcInsn(name); super.visitMethodInsn(Opcodes.INVOKESTATIC, "com/dragome/methodlogger/enhancers/MethodInvocationLogger", "onMethodEnter", "(Ljava/lang/Object;Ljava/lang/String;)V", false); }/*ww w . j a v a 2 s . c o m*/ super.onMethodEnter(); }
From source file:com.dragome.methodlogger.serverside.MethodLoggerAdapter.java
License:Apache License
protected void onMethodExit(int opcode) { if (!isStatic()) { super.visitVarInsn(Opcodes.ALOAD, 0); super.visitLdcInsn(name); super.visitMethodInsn(Opcodes.INVOKESTATIC, "com/dragome/methodlogger/enhancers/MethodInvocationLogger", "onMethodExit", "(Ljava/lang/Object;Ljava/lang/String;)V", false); }/*from www.jav a 2 s . c o m*/ }
From source file:com.enea.jcarder.agent.instrument.InstrumentationUtilities.java
License:GNU General Public License
public static void pushClassReferenceToStack(MethodVisitor mv, String className) { /*/* ww w . j ava 2 s . com*/ * It is not possible to use: * * mv.visitLdcInsn(RuleType.getType(mClassName)); * * for class versions before 49.0 (introduced with java 1.5). Therefore * we use Class.forName instead. * * TODO It might be possible to do this more efficiently by caching the * result from Class.forName. But note that adding a new field (where * the cached class object can be stored) is only possible if the class * has not already been loaded by the JVM. */ mv.visitLdcInsn(className); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;"); }