Package org.jacoco.core.internal.instr
Class ClassFieldProbeArrayStrategy
- java.lang.Object
-
- org.jacoco.core.internal.instr.ClassFieldProbeArrayStrategy
-
- All Implemented Interfaces:
IProbeArrayStrategy
class ClassFieldProbeArrayStrategy extends java.lang.Object implements IProbeArrayStrategy
The strategy for regular classes adds a static field to hold the probe array and a static initialization method requesting the probe array from the runtime.
-
-
Field Summary
Fields Modifier and Type Field Description private IExecutionDataAccessorGenerator
accessorGenerator
private long
classId
private java.lang.String
className
private static java.lang.Object[]
FRAME_LOCALS_EMPTY
Empty frame locals.private static java.lang.Object[]
FRAME_STACK_ARRZ
Frame stack with a single boolean array.private boolean
withFrames
-
Constructor Summary
Constructors Constructor Description ClassFieldProbeArrayStrategy(java.lang.String className, long classId, boolean withFrames, IExecutionDataAccessorGenerator accessorGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMembers(org.objectweb.asm.ClassVisitor cv, int probeCount)
Adds additional class members required by this strategy.private void
createDataField(org.objectweb.asm.ClassVisitor cv)
private void
createInitMethod(org.objectweb.asm.ClassVisitor cv, int probeCount)
private int
genInitializeDataField(org.objectweb.asm.MethodVisitor mv, int probeCount)
Generates the byte code to initialize the static coverage data field within this class.int
storeInstance(org.objectweb.asm.MethodVisitor mv, boolean clinit, int variable)
Creates code that stores the probe array instance in the given variable.
-
-
-
Field Detail
-
FRAME_STACK_ARRZ
private static final java.lang.Object[] FRAME_STACK_ARRZ
Frame stack with a single boolean array.
-
FRAME_LOCALS_EMPTY
private static final java.lang.Object[] FRAME_LOCALS_EMPTY
Empty frame locals.
-
className
private final java.lang.String className
-
classId
private final long classId
-
withFrames
private final boolean withFrames
-
accessorGenerator
private final IExecutionDataAccessorGenerator accessorGenerator
-
-
Constructor Detail
-
ClassFieldProbeArrayStrategy
ClassFieldProbeArrayStrategy(java.lang.String className, long classId, boolean withFrames, IExecutionDataAccessorGenerator accessorGenerator)
-
-
Method Detail
-
storeInstance
public int storeInstance(org.objectweb.asm.MethodVisitor mv, boolean clinit, int variable)
Description copied from interface:IProbeArrayStrategy
Creates code that stores the probe array instance in the given variable.- Specified by:
storeInstance
in interfaceIProbeArrayStrategy
- Parameters:
mv
- visitor to create codeclinit
- true in case of<clinit>
methodvariable
- variable index to store probe array to- Returns:
- maximum stack size required by the generated code
-
addMembers
public void addMembers(org.objectweb.asm.ClassVisitor cv, int probeCount)
Description copied from interface:IProbeArrayStrategy
Adds additional class members required by this strategy. This method is called after all original members of the class has been processed.- Specified by:
addMembers
in interfaceIProbeArrayStrategy
- Parameters:
cv
- visitor to create fields and classesprobeCount
- total number of probes required for this class
-
createDataField
private void createDataField(org.objectweb.asm.ClassVisitor cv)
-
createInitMethod
private void createInitMethod(org.objectweb.asm.ClassVisitor cv, int probeCount)
-
genInitializeDataField
private int genInitializeDataField(org.objectweb.asm.MethodVisitor mv, int probeCount)
Generates the byte code to initialize the static coverage data field within this class. The code will push the [Z data array on the operand stack.- Parameters:
mv
- generator to emit code to
-
-