org.jacoco.core.internal.flow
Class MethodProbesVisitor

java.lang.Object
  extended by org.objectweb.asm.MethodVisitor
      extended by org.jacoco.core.internal.flow.MethodProbesVisitor
Direct Known Subclasses:
MethodAnalyzer

public abstract class MethodProbesVisitor
extends org.objectweb.asm.MethodVisitor

A MethodVisitor with additional methods to get probe insertion information.


Field Summary
 
Fields inherited from class org.objectweb.asm.MethodVisitor
api, mv
 
Constructor Summary
MethodProbesVisitor()
          New visitor instance without delegate visitor.
MethodProbesVisitor(org.objectweb.asm.MethodVisitor mv)
          New visitor instance that delegates to the given visitor.
 
Method Summary
abstract  void visitInsnWithProbe(int opcode, int probeId)
          Visits a zero operand instruction with a probe.
abstract  void visitJumpInsnWithProbe(int opcode, org.objectweb.asm.Label label, int probeId)
          Visits a jump instruction.
abstract  void visitLookupSwitchInsnWithProbes(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
          Visits a LOOKUPSWITCH instruction with optional probes for each target label.
abstract  void visitProbe(int probeId)
          Visits an unconditional probe that should be inserted at the current position.
abstract  void visitTableSwitchInsnWithProbes(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels)
          Visits a TABLESWITCH instruction with optional probes for each target label.
 
Methods inherited from class org.objectweb.asm.MethodVisitor
visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMultiANewArrayInsn, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodProbesVisitor

public MethodProbesVisitor()
New visitor instance without delegate visitor.


MethodProbesVisitor

public MethodProbesVisitor(org.objectweb.asm.MethodVisitor mv)
New visitor instance that delegates to the given visitor.

Parameters:
mv - optional next visitor in chain
Method Detail

visitProbe

public abstract void visitProbe(int probeId)
Visits an unconditional probe that should be inserted at the current position.

Parameters:
probeId - id of the probe to insert

visitJumpInsnWithProbe

public abstract void visitJumpInsnWithProbe(int opcode,
                                            org.objectweb.asm.Label label,
                                            int probeId)
Visits a jump instruction. A probe with the given id should be inserted in a way that it is executed only when the jump to the given label is executed.

Parameters:
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 probe
See Also:
MethodVisitor.visitJumpInsn(int, Label)

visitInsnWithProbe

public abstract void visitInsnWithProbe(int opcode,
                                        int probeId)
Visits a zero operand instruction with a probe. This event is used only for instructions that terminate the method. Therefore the probe must be inserted before the actual instruction.

Parameters:
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 probe
See Also:
MethodVisitor.visitInsn(int)

visitTableSwitchInsnWithProbes

public abstract void visitTableSwitchInsnWithProbes(int min,
                                                    int max,
                                                    org.objectweb.asm.Label dflt,
                                                    org.objectweb.asm.Label[] labels)
Visits a TABLESWITCH instruction with optional probes for each target label. Implementations can be optimized based on the fact that the same target labels will always have the same probe id within a call to this method. The probe id for each label can be obtained with LabelInfo.getProbeId(Label).

Parameters:
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.
See Also:
MethodVisitor.visitTableSwitchInsn(int, int, Label, Label[])

visitLookupSwitchInsnWithProbes

public abstract void visitLookupSwitchInsnWithProbes(org.objectweb.asm.Label dflt,
                                                     int[] keys,
                                                     org.objectweb.asm.Label[] labels)
Visits a LOOKUPSWITCH instruction with optional probes for each target label. Implementations can be optimized based on the fact that the same target labels will always have the same probe id within a call to this method. The probe id for each label can be obtained with LabelInfo.getProbeId(Label).

Parameters:
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.
See Also:
MethodVisitor.visitLookupSwitchInsn(Label, int[], Label[])


Copyright © 2009-2013 Mountainminds GmbH & Co. KG. All Rights Reserved.