Class ProbeInserter

  • All Implemented Interfaces:
    IProbeInserter

    class ProbeInserter
    extends org.objectweb.asm.MethodVisitor
    implements 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int accessorStackSize
      Maximum stack usage of the code to access the probe array.
      private IProbeArrayStrategy arrayStrategy  
      private boolean clinit
      true if method is a class or interface initialization method.
      private int variable
      Position of the inserted variable.
      • Fields inherited from class org.objectweb.asm.MethodVisitor

        api, mv
    • Constructor Summary

      Constructors 
      Constructor Description
      ProbeInserter​(int access, java.lang.String name, java.lang.String desc, org.objectweb.asm.MethodVisitor mv, IProbeArrayStrategy arrayStrategy)
      Creates a new ProbeInserter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void insertProbe​(int id)
      Inserts the probe with the given id.
      private int map​(int var)  
      void visitCode()  
      void visitFrame​(int type, int nLocal, java.lang.Object[] local, int nStack, java.lang.Object[] stack)  
      void visitIincInsn​(int var, int increment)  
      void visitLocalVariable​(java.lang.String name, java.lang.String desc, java.lang.String signature, org.objectweb.asm.Label start, org.objectweb.asm.Label end, int index)  
      org.objectweb.asm.AnnotationVisitor visitLocalVariableAnnotation​(int typeRef, org.objectweb.asm.TypePath typePath, org.objectweb.asm.Label[] start, org.objectweb.asm.Label[] end, int[] index, java.lang.String descriptor, boolean visible)  
      void visitMaxs​(int maxStack, int maxLocals)  
      void visitVarInsn​(int opcode, int var)  
      • Methods inherited from class org.objectweb.asm.MethodVisitor

        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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • clinit

        private final boolean clinit
        true if method is a class or interface initialization method.
      • variable

        private final int variable
        Position of the inserted variable.
      • accessorStackSize

        private int accessorStackSize
        Maximum stack usage of the code to access the probe array.
    • Constructor Detail

      • ProbeInserter

        ProbeInserter​(int access,
                      java.lang.String name,
                      java.lang.String desc,
                      org.objectweb.asm.MethodVisitor mv,
                      IProbeArrayStrategy arrayStrategy)
        Creates a new ProbeInserter.
        Parameters:
        access - access flags of the adapted method
        name - the method's name
        desc - the method's descriptor
        mv - the method visitor to which this adapter delegates calls
        arrayStrategy - callback to create the code that retrieves the reference to the probe array
    • Method Detail

      • insertProbe

        public void insertProbe​(int id)
        Description copied from interface: IProbeInserter
        Inserts the probe with the given id.
        Specified by:
        insertProbe in interface IProbeInserter
        Parameters:
        id - id of the probe to insert
      • visitCode

        public void visitCode()
        Overrides:
        visitCode in class org.objectweb.asm.MethodVisitor
      • visitVarInsn

        public final void visitVarInsn​(int opcode,
                                       int var)
        Overrides:
        visitVarInsn in class org.objectweb.asm.MethodVisitor
      • visitIincInsn

        public final void visitIincInsn​(int var,
                                        int increment)
        Overrides:
        visitIincInsn in class org.objectweb.asm.MethodVisitor
      • visitLocalVariable

        public final void visitLocalVariable​(java.lang.String name,
                                             java.lang.String desc,
                                             java.lang.String signature,
                                             org.objectweb.asm.Label start,
                                             org.objectweb.asm.Label end,
                                             int index)
        Overrides:
        visitLocalVariable in class org.objectweb.asm.MethodVisitor
      • 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,
                                                                                java.lang.String descriptor,
                                                                                boolean visible)
        Overrides:
        visitLocalVariableAnnotation in class org.objectweb.asm.MethodVisitor
      • visitMaxs

        public void visitMaxs​(int maxStack,
                              int maxLocals)
        Overrides:
        visitMaxs in class org.objectweb.asm.MethodVisitor
      • map

        private int map​(int var)
      • visitFrame

        public final void visitFrame​(int type,
                                     int nLocal,
                                     java.lang.Object[] local,
                                     int nStack,
                                     java.lang.Object[] stack)
        Overrides:
        visitFrame in class org.objectweb.asm.MethodVisitor