IFilterOutput
public class MethodAnalyzer extends MethodProbesVisitor implements IFilterOutput
MethodProbesVisitor
that analyzes which statements and branches of
a method have been executed based on given probe data.Modifier and Type | Method | Description |
---|---|---|
void |
accept(org.objectweb.asm.tree.MethodNode methodNode,
org.objectweb.asm.MethodVisitor methodVisitor) |
MethodNode.accept(MethodVisitor) |
IMethodCoverage |
getCoverage() |
Returns the coverage data for this method after this visitor has been
processed.
|
void |
ignore(org.objectweb.asm.tree.AbstractInsnNode fromInclusive,
org.objectweb.asm.tree.AbstractInsnNode toInclusive) |
Marks sequence of instructions that should be ignored during computation
of coverage.
|
void |
merge(org.objectweb.asm.tree.AbstractInsnNode i1,
org.objectweb.asm.tree.AbstractInsnNode i2) |
Marks two instructions that should be merged during computation of
coverage.
|
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) |
|
void |
visitInsnWithProbe(int opcode,
int probeId) |
Visits a zero operand instruction with a probe.
|
void |
visitIntInsn(int opcode,
int operand) |
|
void |
visitInvokeDynamicInsn(java.lang.String name,
java.lang.String desc,
org.objectweb.asm.Handle bsm,
java.lang.Object... bsmArgs) |
|
void |
visitJumpInsn(int opcode,
org.objectweb.asm.Label label) |
|
void |
visitJumpInsnWithProbe(int opcode,
org.objectweb.asm.Label label,
int probeId,
IFrame frame) |
Visits a jump instruction.
|
void |
visitLabel(org.objectweb.asm.Label label) |
|
void |
visitLdcInsn(java.lang.Object cst) |
|
void |
visitLineNumber(int line,
org.objectweb.asm.Label start) |
|
void |
visitLookupSwitchInsn(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels) |
|
void |
visitLookupSwitchInsnWithProbes(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels,
IFrame frame) |
Visits a LOOKUPSWITCH instruction with optional probes for each target
label.
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc,
boolean itf) |
|
void |
visitMultiANewArrayInsn(java.lang.String desc,
int dims) |
|
void |
visitProbe(int probeId) |
Visits an unconditional probe that should be inserted at the current
position.
|
void |
visitTableSwitchInsn(int min,
int max,
org.objectweb.asm.Label dflt,
org.objectweb.asm.Label... labels) |
|
void |
visitTableSwitchInsnWithProbes(int min,
int max,
org.objectweb.asm.Label dflt,
org.objectweb.asm.Label[] labels,
IFrame frame) |
Visits a TABLESWITCH instruction with optional probes for each target
label.
|
void |
visitTypeInsn(int opcode,
java.lang.String type) |
|
void |
visitVarInsn(int opcode,
int var) |
visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitFrame, visitInsnAnnotation, visitLocalVariable, visitLocalVariableAnnotation, visitMaxs, visitMethodInsn, visitParameter, visitParameterAnnotation, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation
public IMethodCoverage getCoverage()
public void accept(org.objectweb.asm.tree.MethodNode methodNode, org.objectweb.asm.MethodVisitor methodVisitor)
MethodNode.accept(MethodVisitor)
accept
in class MethodProbesVisitor
methodNode
- the content to emitmethodVisitor
- A visitor to emit the content to. Note that this is not
necessarily this visitor instance but some wrapper which
calculates the probes.public void ignore(org.objectweb.asm.tree.AbstractInsnNode fromInclusive, org.objectweb.asm.tree.AbstractInsnNode toInclusive)
IFilterOutput
ignore
in interface IFilterOutput
fromInclusive
- first instruction that should be ignored, inclusivetoInclusive
- last instruction coming after fromInclusive
that
should be ignored, inclusivepublic void merge(org.objectweb.asm.tree.AbstractInsnNode i1, org.objectweb.asm.tree.AbstractInsnNode i2)
IFilterOutput
merge
in interface IFilterOutput
i1
- first instructioni2
- second instructionpublic void visitLabel(org.objectweb.asm.Label label)
visitLabel
in class org.objectweb.asm.MethodVisitor
public void visitLineNumber(int line, org.objectweb.asm.Label start)
visitLineNumber
in class org.objectweb.asm.MethodVisitor
public void visitInsn(int opcode)
visitInsn
in class org.objectweb.asm.MethodVisitor
public void visitIntInsn(int opcode, int operand)
visitIntInsn
in class org.objectweb.asm.MethodVisitor
public void visitVarInsn(int opcode, int var)
visitVarInsn
in class org.objectweb.asm.MethodVisitor
public void visitTypeInsn(int opcode, java.lang.String type)
visitTypeInsn
in class org.objectweb.asm.MethodVisitor
public void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
visitFieldInsn
in class org.objectweb.asm.MethodVisitor
public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc, boolean itf)
visitMethodInsn
in class org.objectweb.asm.MethodVisitor
public void visitInvokeDynamicInsn(java.lang.String name, java.lang.String desc, org.objectweb.asm.Handle bsm, java.lang.Object... bsmArgs)
visitInvokeDynamicInsn
in class org.objectweb.asm.MethodVisitor
public void visitJumpInsn(int opcode, org.objectweb.asm.Label label)
visitJumpInsn
in class org.objectweb.asm.MethodVisitor
public void visitLdcInsn(java.lang.Object cst)
visitLdcInsn
in class org.objectweb.asm.MethodVisitor
public void visitIincInsn(int var, int increment)
visitIincInsn
in class org.objectweb.asm.MethodVisitor
public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
visitTableSwitchInsn
in class org.objectweb.asm.MethodVisitor
public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
visitLookupSwitchInsn
in class org.objectweb.asm.MethodVisitor
public void visitMultiANewArrayInsn(java.lang.String desc, int dims)
visitMultiANewArrayInsn
in class org.objectweb.asm.MethodVisitor
public void visitProbe(int probeId)
MethodProbesVisitor
visitProbe
in class MethodProbesVisitor
probeId
- id of the probe to insertpublic void visitJumpInsnWithProbe(int opcode, org.objectweb.asm.Label label, int probeId, IFrame frame)
MethodProbesVisitor
visitJumpInsnWithProbe
in class MethodProbesVisitor
opcode
- the opcode of the type instruction to be visited. This opcode
is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ,
IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
IF_ACMPEQ, IF_ACMPNE, GOTO, IFNULL or IFNONNULL.label
- the operand of the instruction to be visited. This operand is
a label that designates the instruction to which the jump
instruction may jump.probeId
- id of the probeframe
- stackmap frame status after the execution of the jump
instruction. The instance is only valid with the call of this
method.MethodVisitor.visitJumpInsn(int, Label)
public void visitInsnWithProbe(int opcode, int probeId)
MethodProbesVisitor
visitInsnWithProbe
in class MethodProbesVisitor
opcode
- the opcode of the instruction to be visited. This opcode is
either IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN or
ATHROW.probeId
- id of the probeMethodVisitor.visitInsn(int)
public void visitTableSwitchInsnWithProbes(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels, IFrame frame)
MethodProbesVisitor
LabelInfo.getProbeId(Label)
.visitTableSwitchInsnWithProbes
in class MethodProbesVisitor
min
- the minimum key value.max
- the maximum key value.dflt
- beginning of the default handler block.labels
- beginnings of the handler blocks. labels[i]
is
the beginning of the handler block for the
min + i
key.frame
- stackmap frame status after the execution of the switch
instruction. The instance is only valid with the call of this
method.MethodVisitor.visitTableSwitchInsn(int, int, Label, Label[])
public void visitLookupSwitchInsnWithProbes(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels, IFrame frame)
MethodProbesVisitor
LabelInfo.getProbeId(Label)
.visitLookupSwitchInsnWithProbes
in class MethodProbesVisitor
dflt
- beginning of the default handler block.keys
- the values of the keys.labels
- beginnings of the handler blocks. labels[i]
is
the beginning of the handler block for the
keys[i]
key.frame
- stackmap frame status after the execution of the switch
instruction. The instance is only valid with the call of this
method.MethodVisitor.visitLookupSwitchInsn(Label, int[], Label[])
public void visitEnd()
visitEnd
in class org.objectweb.asm.MethodVisitor
Copyright © 2018. All rights reserved.