Class MFrame

  • All Implemented Interfaces:
    Serializable, xyz.cofe.collection.ImTree<ByteCode>, xyz.cofe.collection.ImTreeWalk<ByteCode>, ByteCode, MethodByteCode, MethodWriter

    public class MFrame
    extends MAbstractBC
    implements MethodWriter
    Visits the current state of the local variables and operand stack elements. This method must(*) be called just before any instruction i that follows an unconditional branch instruction such as GOTO or THROW, that is the target of a jump instruction, or that starts an exception handler block. The visited types must describe the values of the local variables and of the operand stack elements just before i is executed.

    (*) this is mandatory only for classes whose version is greater than or equal to Opcodes.V1_6.

    The frames of a method must be given either in expanded form, or in compressed form (all frames must use the same format, i.e. you must not mix expanded and compressed frames within a single method):
    • In expanded form, all frames must have the F_NEW type.
    • In compressed form, frames are basically "deltas" from the state of the previous frame:
      • Opcodes.F_SAME representing frame with exactly the same locals as the previous frame and with the empty stack.
      • Opcodes.F_SAME1 representing frame with exactly the same locals as the previous frame and with single value on the stack ( numStack is 1 and stack[0] contains value for the type of the stack item).
      • Opcodes.F_APPEND representing frame with current locals are the same as the locals in the previous frame, except that additional locals are defined ( numLocal is 1, 2 or 3 and local elements contains values representing added types).
      • Opcodes.F_CHOP representing frame with current locals are the same as the locals in the previous frame, except that the last 1-3 locals are absent and with the empty stack (numLocal is 1, 2 or 3).
      • Opcodes.F_FULL representing complete frame data.

    In both cases the first frame, corresponding to the method's parameters and access flags, is implicit and must not be visited. Also, it is illegal to visit two or more frames for the same code location (i.e., at least one instruction must be visited between two calls to visitFrame).
    • type the type of this stack map frame. Must be Opcodes.F_NEW for expanded frames, or Opcodes.F_FULL, Opcodes.F_APPEND, Opcodes.F_CHOP, Opcodes.F_SAME or Opcodes.F_APPEND, Opcodes.F_SAME1 for compressed frames.
    • numLocal the number of local variables in the visited frame.
    • local the local variable types in this frame. This array must not be modified. Primitive types are represented by Opcodes.TOP, Opcodes.INTEGER, Opcodes.FLOAT, Opcodes.LONG, Opcodes.DOUBLE, Opcodes.NULL or Opcodes.UNINITIALIZED_THIS (long and double are represented by a single element). Reference types are represented by String objects (representing internal names), and uninitialized types by Label objects (this label designates the NEW instruction that created this uninitialized value).
    • numStack the number of operand stack elements in the visited frame.
    • stack the operand stack types in this frame. This array must not be modified. Its content has the same format as the "local" array.
    throws IllegalStateException if a frame is visited just after another one, without any instruction between the two (unless this frame is a Opcodes#F_SAME frame, in which case it is silently ignored).
    See Also:
    Serialized Form
    • Constructor Detail

      • MFrame

        public MFrame()
      • MFrame

        public MFrame​(int type,
                      int numLocal,
                      List<Object> local,
                      int numStack,
                      List<Object> stack)
      • MFrame

        public MFrame​(int type,
                      int numLocal,
                      Object[] local,
                      int numStack,
                      Object[] stack)
      • MFrame

        public MFrame​(MFrame sample)
    • Method Detail

      • getType

        public int getType()
      • setType

        public void setType​(int type)
      • getNumLocal

        public int getNumLocal()
      • setNumLocal

        public void setNumLocal​(int numLocal)
      • setLocal

        public void setLocal​(List<Object> local)
      • getNumStack

        public int getNumStack()
      • setNumStack

        public void setNumStack​(int numStack)
      • setStack

        public void setStack​(List<Object> stack)