|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.asm.MethodAdapter
de.uka.ipd.sdq.ByCounter.instrumentation.MethodCountMethodAdapter
public final class MethodCountMethodAdapter
Visitor for a method declaration. This class implements the method modifying instrumentation.
It creates initialisation code for local variables that hold counters,
it insert incrementing code for these counters. Finally, it inserts code
that creates arrays and fills them with the values of the counter variables.
These arrays are then used as parameters for the code that calls
CountingResultCollector
on method exit.
There are separate counter variables/arrays for
Basic block and range blocks work not by counting opcodes but by incrementing counters whenever the label a block starts with is visited. Results are then reported with a mark that allows for identifying the blocks.
Field Summary | |
---|---|
static java.lang.String |
INSTRUMENTATION_MARKER
This is the magic string constant that is inserted (loaded and popped off the stack again) at the beginning of instrumented methods to mark them as instrumented. |
int |
statNumberOfCountingStatementsAdded
Statistical counter. |
Fields inherited from interface org.objectweb.asm.Opcodes |
---|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEDYNAMIC_OWNER, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7 |
Constructor Summary | |
---|---|
MethodCountMethodAdapter(org.objectweb.asm.MethodVisitor v,
int access,
java.lang.String superName,
java.lang.String className,
java.lang.String qualifyingMethodName,
java.lang.String desc,
InstrumentationParameters instrumentationParameters,
InstrumentationState instrumentationState,
MethodDescriptor method)
Creates the method adapter. |
Method Summary | |
---|---|
void |
registerCharacterisationHook(ICharacterisationHook hook)
Register a ICharacterisationHook . |
void |
setIsAlreadyInstrumented(boolean isInstrumented,
java.lang.String name,
java.lang.String signature)
|
void |
setLVS(org.objectweb.asm.commons.LocalVariablesSorter pLvars)
Sets the LocalVariableSorter that is used to generate new locals. |
void |
setMethodInvocations(AdditionalOpcodeInformation additionalOpcInfo)
Sets the MethodInvocationsFinder that is used to determine registers for method invocation counts. |
void |
visitCode()
This is being called at the beginning of the method. |
void |
visitEnd()
|
void |
visitFieldInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc)
|
void |
visitIincInsn(int var,
int increment)
|
void |
visitInsn(int opcode)
Step into every call to insert counters. |
void |
visitIntInsn(int opcode,
int operand)
|
void |
visitJumpInsn(int opcode,
org.objectweb.asm.Label label)
|
void |
visitLabel(org.objectweb.asm.Label label)
|
void |
visitLdcInsn(java.lang.Object constant)
|
void |
visitLookupSwitchInsn(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels)
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc)
|
void |
visitMultiANewArrayInsn(java.lang.String desc,
int dims)
|
void |
visitTableSwitchInsn(int min,
int max,
org.objectweb.asm.Label dflt,
org.objectweb.asm.Label[] labels)
|
void |
visitTypeInsn(int opcode,
java.lang.String desc)
|
void |
visitVarInsn(int opcode,
int var)
|
Methods inherited from class org.objectweb.asm.MethodAdapter |
---|
visitAnnotation, visitAnnotationDefault, visitAttribute, visitFrame, visitLineNumber, visitLocalVariable, visitMaxs, visitParameterAnnotation, visitTryCatchBlock |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int statNumberOfCountingStatementsAdded
public static final java.lang.String INSTRUMENTATION_MARKER
Constructor Detail |
---|
public MethodCountMethodAdapter(org.objectweb.asm.MethodVisitor v, int access, java.lang.String superName, java.lang.String className, java.lang.String qualifyingMethodName, java.lang.String desc, InstrumentationParameters instrumentationParameters, InstrumentationState instrumentationState, MethodDescriptor method)
v
- Preceding visitor in the chain.access
- Access flags for this method.superName
- Name of the superclass.qualifyingMethodName
- Qualifying name of the method (used for reporting).desc
- Parameter descriptor in Java bytecode notation.instrumentationParameters
- User specified parameters.instrumentationState
- Intermediate instrumention state.Method Detail |
---|
public void registerCharacterisationHook(ICharacterisationHook hook)
ICharacterisationHook
.
hook
- ICharacterisationHook
public void setLVS(org.objectweb.asm.commons.LocalVariablesSorter pLvars)
pLvars
- LocalVariableSorterpublic void setMethodInvocations(AdditionalOpcodeInformation additionalOpcInfo)
additionalOpcInfo
- Finder instance.public void visitCode()
visitCode
in interface org.objectweb.asm.MethodVisitor
visitCode
in class org.objectweb.asm.MethodAdapter
public void visitEnd()
visitEnd
in interface org.objectweb.asm.MethodVisitor
visitEnd
in class org.objectweb.asm.MethodAdapter
public void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
visitFieldInsn
in interface org.objectweb.asm.MethodVisitor
visitFieldInsn
in class org.objectweb.asm.MethodAdapter
public void visitIincInsn(int var, int increment)
visitIincInsn
in interface org.objectweb.asm.MethodVisitor
visitIincInsn
in class org.objectweb.asm.MethodAdapter
public void visitInsn(int opcode)
visitInsn
in interface org.objectweb.asm.MethodVisitor
visitInsn
in class org.objectweb.asm.MethodAdapter
public void visitIntInsn(int opcode, int operand)
visitIntInsn
in interface org.objectweb.asm.MethodVisitor
visitIntInsn
in class org.objectweb.asm.MethodAdapter
public void visitJumpInsn(int opcode, org.objectweb.asm.Label label)
visitJumpInsn
in interface org.objectweb.asm.MethodVisitor
visitJumpInsn
in class org.objectweb.asm.MethodAdapter
public void visitLabel(org.objectweb.asm.Label label)
visitLabel
in interface org.objectweb.asm.MethodVisitor
visitLabel
in class org.objectweb.asm.MethodAdapter
public void visitLdcInsn(java.lang.Object constant)
visitLdcInsn
in interface org.objectweb.asm.MethodVisitor
visitLdcInsn
in class org.objectweb.asm.MethodAdapter
public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
visitLookupSwitchInsn
in interface org.objectweb.asm.MethodVisitor
visitLookupSwitchInsn
in class org.objectweb.asm.MethodAdapter
public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
visitMethodInsn
in interface org.objectweb.asm.MethodVisitor
visitMethodInsn
in class org.objectweb.asm.MethodAdapter
public void visitMultiANewArrayInsn(java.lang.String desc, int dims)
visitMultiANewArrayInsn
in interface org.objectweb.asm.MethodVisitor
visitMultiANewArrayInsn
in class org.objectweb.asm.MethodAdapter
public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels)
visitTableSwitchInsn
in interface org.objectweb.asm.MethodVisitor
visitTableSwitchInsn
in class org.objectweb.asm.MethodAdapter
public void visitTypeInsn(int opcode, java.lang.String desc)
visitTypeInsn
in interface org.objectweb.asm.MethodVisitor
visitTypeInsn
in class org.objectweb.asm.MethodAdapter
public void visitVarInsn(int opcode, int var)
visitVarInsn
in interface org.objectweb.asm.MethodVisitor
visitVarInsn
in class org.objectweb.asm.MethodAdapter
public void setIsAlreadyInstrumented(boolean isInstrumented, java.lang.String name, java.lang.String signature)
isInstrumented
- When true, this method will not be instrumented
again.signature
- name
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |