Class LocalVariableInstruction

    • Field Detail

      • n

        @Deprecated
        protected int n
        Deprecated.
        (since 6.0) will be made private; do not access directly, use getter/setter
      • cTag

        private short cTag
      • canonTag

        private short canonTag
    • Constructor Detail

      • LocalVariableInstruction

        LocalVariableInstruction()
        Empty constructor needed for Instruction.readInstruction. Also used by IINC()!
      • LocalVariableInstruction

        LocalVariableInstruction​(short canonTag,
                                 short cTag)
        Empty constructor needed for Instruction.readInstruction. Not to be used otherwise. tag and length are defined in readInstruction and initFromFile, respectively.
      • LocalVariableInstruction

        protected LocalVariableInstruction​(short opcode,
                                           short cTag,
                                           int n)
        Parameters:
        opcode - Instruction opcode
        cTag - Instruction number for compact version, ALOAD_0, e.g.
        n - local variable index (unsigned short)
    • Method Detail

      • dump

        public void dump​(java.io.DataOutputStream out)
                  throws java.io.IOException
        Dump instruction as byte code to stream out.
        Overrides:
        dump in class Instruction
        Parameters:
        out - Output stream
        Throws:
        java.io.IOException - Thrown when an I/O exception of some sort has occurred.
      • getCanonicalTag

        public short getCanonicalTag()
        Returns:
        canonical tag for instruction, e.g., ALOAD for ALOAD_0
      • getIndex

        public final int getIndex()
        Specified by:
        getIndex in interface IndexedInstruction
        Returns:
        local variable index (n) referred by this instruction.
      • getType

        public Type getType​(ConstantPoolGen cp)
        Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned. This is just a bit incorrect, because ALOAD and ASTORE may work on every ReferenceType (including Type.NULL) and ASTORE may even work on a ReturnaddressType .
        Specified by:
        getType in interface TypedInstruction
        Returns:
        type associated with the instruction
      • initFromFile

        protected void initFromFile​(ByteSequence bytes,
                                    boolean wide)
                             throws java.io.IOException
        Read needed data (e.g. index) from file.
         (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)
         
        Overrides:
        initFromFile in class Instruction
        Parameters:
        bytes - byte sequence to read from
        wide - "wide" instruction flag
        Throws:
        java.io.IOException - may be thrown if the implementation needs to read data from the file
      • setIndexOnly

        final void setIndexOnly​(int n)
        Sets the index of the referenced variable (n) only
        Since:
        6.0
        See Also:
        setIndex(int)
      • toString

        public java.lang.String toString​(boolean verbose)
        Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< local variable index>">"
        Overrides:
        toString in class Instruction
        Parameters:
        verbose - long/short format switch
        Returns:
        mnemonic for instruction
      • wide

        private boolean wide()