Class ProbeInserter
java.lang.Object
org.objectweb.asm.MethodVisitor
org.jacoco.core.internal.instr.ProbeInserter
- All Implemented Interfaces:
IProbeInserter
Internal utility to add probes into the control flow of a method. The code
for a probe simply sets a certain slot of a boolean array to true. In
addition the probe array has to be retrieved at the beginning of the method
and stored in a local variable. For this two local variables will be reserved
immediately after the method parameters - the probe array will be stored in
the second one, and the first one is reserved for the case when the last
local variable of method parameters is overridden in the method body to store
a
value of type long or double which occupy two variables.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intMaximum stack usage of the code to access the probe array.private final IProbeArrayStrategyprivate final org.objectweb.asm.LabelLabel for the new beginning of the methodprivate final booleantrueif method is a class or interface initialization method.private final intPosition of the inserted variable.Fields inherited from class org.objectweb.asm.MethodVisitor
api, mv -
Constructor Summary
ConstructorsConstructorDescriptionProbeInserter(int access, String name, String desc, org.objectweb.asm.MethodVisitor mv, IProbeArrayStrategy arrayStrategy) Creates a newProbeInserter. -
Method Summary
Modifier and TypeMethodDescriptionvoidinsertProbe(int id) Inserts the probe with the given id.private intmap(int var) voidfinal voidvisitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) final voidvisitIincInsn(int var, int increment) final voidvisitLocalVariable(String name, String desc, String signature, org.objectweb.asm.Label start, org.objectweb.asm.Label end, int index) org.objectweb.asm.AnnotationVisitorvisitLocalVariableAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, org.objectweb.asm.Label[] start, org.objectweb.asm.Label[] end, int[] index, String descriptor, boolean visible) voidvisitMaxs(int maxStack, int maxLocals) final voidvisitVarInsn(int opcode, int var) Methods inherited from class org.objectweb.asm.MethodVisitor
getDelegate, visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitEnd, visitFieldInsn, visitInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLookupSwitchInsn, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitParameter, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation, visitTypeInsn
-
Field Details
-
arrayStrategy
-
clinit
private final boolean clinittrueif method is a class or interface initialization method. -
variable
private final int variablePosition of the inserted variable. -
beginLabel
private final org.objectweb.asm.Label beginLabelLabel for the new beginning of the method -
accessorStackSize
private int accessorStackSizeMaximum stack usage of the code to access the probe array.
-
-
Constructor Details
-
ProbeInserter
ProbeInserter(int access, String name, String desc, org.objectweb.asm.MethodVisitor mv, IProbeArrayStrategy arrayStrategy) Creates a newProbeInserter.- Parameters:
access- access flags of the adapted methodname- the method's namedesc- the method's descriptormv- the method visitor to which this adapter delegates callsarrayStrategy- callback to create the code that retrieves the reference to the probe array
-
-
Method Details
-
insertProbe
public void insertProbe(int id) Description copied from interface:IProbeInserterInserts the probe with the given id.- Specified by:
insertProbein interfaceIProbeInserter- Parameters:
id- id of the probe to insert
-
visitCode
public void visitCode()- Overrides:
visitCodein classorg.objectweb.asm.MethodVisitor
-
visitVarInsn
public final void visitVarInsn(int opcode, int var) - Overrides:
visitVarInsnin classorg.objectweb.asm.MethodVisitor
-
visitIincInsn
public final void visitIincInsn(int var, int increment) - Overrides:
visitIincInsnin classorg.objectweb.asm.MethodVisitor
-
visitLocalVariable
-
visitLocalVariableAnnotation
public org.objectweb.asm.AnnotationVisitor visitLocalVariableAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, org.objectweb.asm.Label[] start, org.objectweb.asm.Label[] end, int[] index, String descriptor, boolean visible) - Overrides:
visitLocalVariableAnnotationin classorg.objectweb.asm.MethodVisitor
-
visitMaxs
public void visitMaxs(int maxStack, int maxLocals) - Overrides:
visitMaxsin classorg.objectweb.asm.MethodVisitor
-
map
private int map(int var) -
visitFrame
-