类 Instruction

    • 构造器详细资料

      • Instruction

        public Instruction()
    • 方法详细资料

      • equals

        public abstract boolean equals​(java.lang.Object o)
        覆盖:
        equals 在类中 java.lang.Object
      • hashCode

        public abstract int hashCode()
        覆盖:
        hashCode 在类中 java.lang.Object
      • canonicalOpcode

        public byte canonicalOpcode()
        Returns the canonical opcode of this instruction, i.e. typically the opcode whose extension has been removed.
      • actualOpcode

        public byte actualOpcode()
        Returns the actual opcode of this instruction, i.e. the opcode that is stored in the bytecode.
      • shrink

        public abstract Instruction shrink()
        Shrinks this instruction to its shortest possible form.
        返回:
        this instruction.
      • write

        public final void write​(CodeAttribute codeAttribute,
                                int offset)
        Writes the Instruction at the given offset in the given code attribute.
      • write

        public void write​(byte[] code,
                          int offset)
        Writes the Instruction at the given offset in the given code array.
      • isWide

        protected boolean isWide()
        Returns whether the instruction is wide, i.e. preceded by a wide opcode. With the current specifications, only variable instructions can be wide.
      • readInfo

        protected abstract void readInfo​(byte[] code,
                                         int offset)
        Reads the data following the instruction opcode.
      • writeInfo

        protected abstract void writeInfo​(byte[] code,
                                          int offset)
        Writes data following the instruction opcode.
      • length

        public abstract int length​(int offset)
        Returns the length in bytes of the instruction.
      • toString

        public java.lang.String toString​(Clazz clazz,
                                         int offset)
        Returns a description of the instruction, at the given offset.
      • toString

        public java.lang.String toString​(int offset)
        Returns a description of the instruction, at the given offset.
      • getName

        public java.lang.String getName()
        Returns the name of the instruction.
      • mayThrowExceptions

        public boolean mayThrowExceptions()
        Returns whether the instruction may conservatively throw exceptions.
      • mayInstanceThrowExceptions

        public boolean mayInstanceThrowExceptions​(Clazz clazz)
        Returns whether a particular instance of an instruction may throw exceptions.
      • isCategory2

        public boolean isCategory2()
        Returns whether the instruction is a Category 2 instruction. This means that it operates on long or double arguments.
      • stackPopCount

        public int stackPopCount​(Clazz clazz)
        Returns the number of entries popped from the stack during the execution of the instruction.
      • stackPushCount

        public int stackPushCount​(Clazz clazz)
        Returns the number of entries pushed onto the stack during the execution of the instruction.
      • stackEntryIndexBefore

        public int stackEntryIndexBefore​(Clazz clazz,
                                         int stackEntryIndexAfter)
        Returns the stack entry index from which the specified stack entry is copied by a dup/swap/checkcast instruction, or -1 otherwise. Stack entry indices are counted from the top of the stack.
        • checkcast: after: 0 (before: 0 ) -- not anymore
        • dup: after: 0 0 (before: 0 )
        • dup_x1: after: 0 1 0 (before: 1 0 )
        • dup_x2: after: 0 2 1 0 (before: 2 1 0 )
        • dup2: after: 1 0 1 0 (before: 1 0 )
        • dup2_x1: after: 1 0 2 1 0 (before: 2 1 0 )
        • dup2_x2: after: 1 0 3 2 1 0 (before: 3 2 1 0)
      • readByte

        protected static int readByte​(byte[] code,
                                      int offset)
      • readShort

        protected static int readShort​(byte[] code,
                                       int offset)
      • readInt

        protected static int readInt​(byte[] code,
                                     int offset)
      • readValue

        protected static int readValue​(byte[] code,
                                       int offset,
                                       int valueSize)
      • readSignedByte

        protected static int readSignedByte​(byte[] code,
                                            int offset)
      • readSignedShort

        protected static int readSignedShort​(byte[] code,
                                             int offset)
      • readSignedValue

        protected static int readSignedValue​(byte[] code,
                                             int offset,
                                             int valueSize)
      • writeByte

        protected static void writeByte​(byte[] code,
                                        int offset,
                                        int value)
      • writeShort

        protected static void writeShort​(byte[] code,
                                         int offset,
                                         int value)
      • writeInt

        protected static void writeInt​(byte[] code,
                                       int offset,
                                       int value)
      • writeValue

        protected static void writeValue​(byte[] code,
                                         int offset,
                                         int value,
                                         int valueSize)
      • writeSignedByte

        protected static void writeSignedByte​(byte[] code,
                                              int offset,
                                              int value)
      • writeSignedShort

        protected static void writeSignedShort​(byte[] code,
                                               int offset,
                                               int value)
      • writeSignedValue

        protected static void writeSignedValue​(byte[] code,
                                               int offset,
                                               int value,
                                               int valueSize)