Class StackMapTable.Walker

  • Enclosing class:
    StackMapTable

    public static class StackMapTable.Walker
    extends java.lang.Object
    A code walker for a StackMapTable attribute.
    • Constructor Summary

      Constructors 
      Constructor Description
      Walker​(byte[] data)
      Constructs a walker.
      Walker​(StackMapTable smt)
      Constructs a walker.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendFrame​(int pos, int offsetDelta, int[] tags, int[] data)
      Invoked if the visited frame is a append_frame.
      void chopFrame​(int pos, int offsetDelta, int k)
      Invoked if the visited frame is a chop_frame.
      void fullFrame​(int pos, int offsetDelta, int[] localTags, int[] localData, int[] stackTags, int[] stackData)
      Invoked if the visited frame is full_frame.
      void objectOrUninitialized​(int tag, int data, int pos)
      Invoked if Object_variable_info or Uninitialized_variable_info is visited.
      void parse()
      Visits each entry of the stack map frames.
      void sameFrame​(int pos, int offsetDelta)
      Invoked if the visited frame is a same_frame or a same_frame_extended.
      void sameLocals​(int pos, int offsetDelta, int stackTag, int stackData)
      Invoked if the visited frame is a same_locals_1_stack_item_frame or a same_locals_1_stack_item_frame_extended.
      int size()
      Returns the number of the entries.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Walker

        public Walker​(StackMapTable smt)
        Constructs a walker.
        Parameters:
        smt - the StackMapTable that this walker walks around.
      • Walker

        public Walker​(byte[] data)
        Constructs a walker.
        Parameters:
        data - the info field of the attribute_info structure. It can be obtained by get() in the AttributeInfo class.
    • Method Detail

      • size

        public final int size()
        Returns the number of the entries.
      • parse

        public void parse()
                   throws BadBytecode
        Visits each entry of the stack map frames.
        Throws:
        BadBytecode
      • sameFrame

        public void sameFrame​(int pos,
                              int offsetDelta)
                       throws BadBytecode
        Invoked if the visited frame is a same_frame or a same_frame_extended.
        Parameters:
        pos - the position of this frame in the info field of attribute_info structure.
        offsetDelta -
        Throws:
        BadBytecode
      • sameLocals

        public void sameLocals​(int pos,
                               int offsetDelta,
                               int stackTag,
                               int stackData)
                        throws BadBytecode
        Invoked if the visited frame is a same_locals_1_stack_item_frame or a same_locals_1_stack_item_frame_extended.
        Parameters:
        pos - the position.
        offsetDelta -
        stackTag - stack[0].tag.
        stackData - stack[0].cpool_index if the tag is OBJECT, or stack[0].offset if the tag is UNINIT.
        Throws:
        BadBytecode
      • chopFrame

        public void chopFrame​(int pos,
                              int offsetDelta,
                              int k)
                       throws BadBytecode
        Invoked if the visited frame is a chop_frame.
        Parameters:
        pos - the position.
        offsetDelta -
        k - the k last locals are absent.
        Throws:
        BadBytecode
      • appendFrame

        public void appendFrame​(int pos,
                                int offsetDelta,
                                int[] tags,
                                int[] data)
                         throws BadBytecode
        Invoked if the visited frame is a append_frame.
        Parameters:
        pos - the position.
        offsetDelta -
        tags - locals[i].tag.
        data - locals[i].cpool_index or locals[i].offset.
        Throws:
        BadBytecode
      • fullFrame

        public void fullFrame​(int pos,
                              int offsetDelta,
                              int[] localTags,
                              int[] localData,
                              int[] stackTags,
                              int[] stackData)
                       throws BadBytecode
        Invoked if the visited frame is full_frame.
        Parameters:
        pos - the position.
        offsetDelta -
        localTags - locals[i].tag
        localData - locals[i].cpool_index or locals[i].offset
        stackTags - stack[i].tag
        stackData - stack[i].cpool_index or stack[i].offset
        Throws:
        BadBytecode
      • objectOrUninitialized

        public void objectOrUninitialized​(int tag,
                                          int data,
                                          int pos)
        Invoked if Object_variable_info or Uninitialized_variable_info is visited.
        Parameters:
        tag - OBJECT or UNINIT.
        data - the value of cpool_index or offset.
        pos - the position of cpool_index or offset.