org.apache.bcel.generic

## Class InstructionConst

- java.lang.Object
- - org.apache.bcel.generic.InstructionConst

-     public final class InstructionConst
      extends Object

  Contains shareable instruction objects.

  In order to save memory you can use some instructions multiply, since they have an immutable state and are directly derived from Instruction. I.e. they have no instance fields that could be changed. Since some of these instructions like ICONST_0 occur very frequently this can save a lot of time and space. This feature is an adaptation of the FlyWeight design pattern, we just use an array instead of a factory.

  The Instructions can also accessed directly under their names, so it's possible to write il.append(Instruction.ICONST_0);

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ArrayInstruction` | `AALOAD`
    `static ArrayInstruction` | `AASTORE`
    `static Instruction` | `ACONST_NULL`
    `static LocalVariableInstruction` | `ALOAD_0`
    `static LocalVariableInstruction` | `ALOAD_1`
    `static LocalVariableInstruction` | `ALOAD_2`
    `static ReturnInstruction` | `ARETURN`
    `static Instruction` | `ARRAYLENGTH`
    `static LocalVariableInstruction` | `ASTORE_0`
    `static LocalVariableInstruction` | `ASTORE_1`
    `static LocalVariableInstruction` | `ASTORE_2`
    `static Instruction` | `ATHROW`
    `static ArrayInstruction` | `BALOAD`
    `static ArrayInstruction` | `BASTORE`
    `static ArrayInstruction` | `CALOAD`
    `static ArrayInstruction` | `CASTORE`
    `static ConversionInstruction` | `D2F`
    `static ConversionInstruction` | `D2I`
    `static ConversionInstruction` | `D2L`
    `static ArithmeticInstruction` | `DADD`
    `static ArrayInstruction` | `DALOAD`
    `static ArrayInstruction` | `DASTORE`
    `static Instruction` | `DCMPG`
    `static Instruction` | `DCMPL`
    `static Instruction` | `DCONST_0`
    `static Instruction` | `DCONST_1`
    `static ArithmeticInstruction` | `DDIV`
    `static ArithmeticInstruction` | `DMUL`
    `static ArithmeticInstruction` | `DNEG`
    `static ArithmeticInstruction` | `DREM`
    `static ReturnInstruction` | `DRETURN`
    `static ArithmeticInstruction` | `DSUB`
    `static StackInstruction` | `DUP`
    `static StackInstruction` | `DUP_X1`
    `static StackInstruction` | `DUP_X2`
    `static StackInstruction` | `DUP2`
    `static StackInstruction` | `DUP2_X1`
    `static StackInstruction` | `DUP2_X2`
    `static ConversionInstruction` | `F2D`
    `static ConversionInstruction` | `F2I`
    `static ConversionInstruction` | `F2L`
    `static ArithmeticInstruction` | `FADD`
    `static ArrayInstruction` | `FALOAD`
    `static ArrayInstruction` | `FASTORE`
    `static Instruction` | `FCMPG`
    `static Instruction` | `FCMPL`
    `static Instruction` | `FCONST_0`
    `static Instruction` | `FCONST_1`
    `static Instruction` | `FCONST_2`
    `static ArithmeticInstruction` | `FDIV`
    `static ArithmeticInstruction` | `FMUL`
    `static ArithmeticInstruction` | `FNEG`
    `static ArithmeticInstruction` | `FREM`
    `static ReturnInstruction` | `FRETURN`
    `static ArithmeticInstruction` | `FSUB`
    `static ConversionInstruction` | `I2B`
    `static ConversionInstruction` | `I2C`
    `static ConversionInstruction` | `I2D`
    `static ConversionInstruction` | `I2F`
    `static ConversionInstruction` | `I2L`
    `static ConversionInstruction` | `I2S`
    `static ArithmeticInstruction` | `IADD`
    `static ArrayInstruction` | `IALOAD`
    `static ArithmeticInstruction` | `IAND`
    `static ArrayInstruction` | `IASTORE`
    `static Instruction` | `ICONST_0`
    `static Instruction` | `ICONST_1`
    `static Instruction` | `ICONST_2`
    `static Instruction` | `ICONST_3`
    `static Instruction` | `ICONST_4`
    `static Instruction` | `ICONST_5`
    `static Instruction` | `ICONST_M1`
    `static ArithmeticInstruction` | `IDIV`
    `static LocalVariableInstruction` | `ILOAD_0`
    `static LocalVariableInstruction` | `ILOAD_1`
    `static LocalVariableInstruction` | `ILOAD_2`
    `static ArithmeticInstruction` | `IMUL`
    `static ArithmeticInstruction` | `INEG`
    `static ArithmeticInstruction` | `IOR`
    `static ArithmeticInstruction` | `IREM`
    `static ReturnInstruction` | `IRETURN`
    `static ArithmeticInstruction` | `ISHL`
    `static ArithmeticInstruction` | `ISHR`
    `static LocalVariableInstruction` | `ISTORE_0`
    `static LocalVariableInstruction` | `ISTORE_1`
    `static LocalVariableInstruction` | `ISTORE_2`
    `static ArithmeticInstruction` | `ISUB`
    `static ArithmeticInstruction` | `IUSHR`
    `static ArithmeticInstruction` | `IXOR`
    `static ConversionInstruction` | `L2D`
    `static ConversionInstruction` | `L2F`
    `static ConversionInstruction` | `L2I`
    `static ArithmeticInstruction` | `LADD`
    `static ArrayInstruction` | `LALOAD`
    `static ArithmeticInstruction` | `LAND`
    `static ArrayInstruction` | `LASTORE`
    `static Instruction` | `LCMP`
    `static Instruction` | `LCONST_0`
    `static Instruction` | `LCONST_1`
    `static ArithmeticInstruction` | `LDIV`
    `static ArithmeticInstruction` | `LMUL`
    `static ArithmeticInstruction` | `LNEG`
    `static ArithmeticInstruction` | `LOR`
    `static ArithmeticInstruction` | `LREM`
    `static ReturnInstruction` | `LRETURN`
    `static ArithmeticInstruction` | `LSHL`
    `static ArithmeticInstruction` | `LSHR`
    `static ArithmeticInstruction` | `LSUB`
    `static ArithmeticInstruction` | `LUSHR`
    `static ArithmeticInstruction` | `LXOR`
    `static Instruction` | `MONITORENTER`
    `static Instruction` | `MONITOREXIT`
    `static Instruction` | `NOP` Predefined instruction objects.
    `static StackInstruction` | `POP`
    `static StackInstruction` | `POP2`
    `static ReturnInstruction` | `RETURN`
    `static ArrayInstruction` | `SALOAD`
    `static ArrayInstruction` | `SASTORE`
    `static StackInstruction` | `SWAP`
    `static LocalVariableInstruction` | `THIS` You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, e.g.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Instruction` | `getInstruction(int index)` Gets the Instruction.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NOP

          public static final Instruction NOP

      Predefined instruction objects. NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length.

    - #### ACONST_NULL

          public static final Instruction ACONST_NULL

    - #### ICONST_M1

          public static final Instruction ICONST_M1

    - #### ICONST_0

          public static final Instruction ICONST_0

    - #### ICONST_1

          public static final Instruction ICONST_1

    - #### ICONST_2

          public static final Instruction ICONST_2

    - #### ICONST_3

          public static final Instruction ICONST_3

    - #### ICONST_4

          public static final Instruction ICONST_4

    - #### ICONST_5

          public static final Instruction ICONST_5

    - #### LCONST_0

          public static final Instruction LCONST_0

    - #### LCONST_1

          public static final Instruction LCONST_1

    - #### FCONST_0

          public static final Instruction FCONST_0

    - #### FCONST_1

          public static final Instruction FCONST_1

    - #### FCONST_2

          public static final Instruction FCONST_2

    - #### DCONST_0

          public static final Instruction DCONST_0

    - #### DCONST_1

          public static final Instruction DCONST_1

    - #### IALOAD

          public static final ArrayInstruction IALOAD

    - #### LALOAD

          public static final ArrayInstruction LALOAD

    - #### FALOAD

          public static final ArrayInstruction FALOAD

    - #### DALOAD

          public static final ArrayInstruction DALOAD

    - #### AALOAD

          public static final ArrayInstruction AALOAD

    - #### BALOAD

          public static final ArrayInstruction BALOAD

    - #### CALOAD

          public static final ArrayInstruction CALOAD

    - #### SALOAD

          public static final ArrayInstruction SALOAD

    - #### IASTORE

          public static final ArrayInstruction IASTORE

    - #### LASTORE

          public static final ArrayInstruction LASTORE

    - #### FASTORE

          public static final ArrayInstruction FASTORE

    - #### DASTORE

          public static final ArrayInstruction DASTORE

    - #### AASTORE

          public static final ArrayInstruction AASTORE

    - #### BASTORE

          public static final ArrayInstruction BASTORE

    - #### CASTORE

          public static final ArrayInstruction CASTORE

    - #### SASTORE

          public static final ArrayInstruction SASTORE

    - #### POP

          public static final StackInstruction POP

    - #### POP2

          public static final StackInstruction POP2

    - #### DUP

          public static final StackInstruction DUP

    - #### DUP_X1

          public static final StackInstruction DUP_X1

    - #### DUP_X2

          public static final StackInstruction DUP_X2

    - #### DUP2

          public static final StackInstruction DUP2

    - #### DUP2_X1

          public static final StackInstruction DUP2_X1

    - #### DUP2_X2

          public static final StackInstruction DUP2_X2

    - #### SWAP

          public static final StackInstruction SWAP

    - #### IADD

          public static final ArithmeticInstruction IADD

    - #### LADD

          public static final ArithmeticInstruction LADD

    - #### FADD

          public static final ArithmeticInstruction FADD

    - #### DADD

          public static final ArithmeticInstruction DADD

    - #### ISUB

          public static final ArithmeticInstruction ISUB

    - #### LSUB

          public static final ArithmeticInstruction LSUB

    - #### FSUB

          public static final ArithmeticInstruction FSUB

    - #### DSUB

          public static final ArithmeticInstruction DSUB

    - #### IMUL

          public static final ArithmeticInstruction IMUL

    - #### LMUL

          public static final ArithmeticInstruction LMUL

    - #### FMUL

          public static final ArithmeticInstruction FMUL

    - #### DMUL

          public static final ArithmeticInstruction DMUL

    - #### IDIV

          public static final ArithmeticInstruction IDIV

    - #### LDIV

          public static final ArithmeticInstruction LDIV

    - #### FDIV

          public static final ArithmeticInstruction FDIV

    - #### DDIV

          public static final ArithmeticInstruction DDIV

    - #### IREM

          public static final ArithmeticInstruction IREM

    - #### LREM

          public static final ArithmeticInstruction LREM

    - #### FREM

          public static final ArithmeticInstruction FREM

    - #### DREM

          public static final ArithmeticInstruction DREM

    - #### INEG

          public static final ArithmeticInstruction INEG

    - #### LNEG

          public static final ArithmeticInstruction LNEG

    - #### FNEG

          public static final ArithmeticInstruction FNEG

    - #### DNEG

          public static final ArithmeticInstruction DNEG

    - #### ISHL

          public static final ArithmeticInstruction ISHL

    - #### LSHL

          public static final ArithmeticInstruction LSHL

    - #### ISHR

          public static final ArithmeticInstruction ISHR

    - #### LSHR

          public static final ArithmeticInstruction LSHR

    - #### IUSHR

          public static final ArithmeticInstruction IUSHR

    - #### LUSHR

          public static final ArithmeticInstruction LUSHR

    - #### IAND

          public static final ArithmeticInstruction IAND

    - #### LAND

          public static final ArithmeticInstruction LAND

    - #### IOR

          public static final ArithmeticInstruction IOR

    - #### LOR

          public static final ArithmeticInstruction LOR

    - #### IXOR

          public static final ArithmeticInstruction IXOR

    - #### LXOR

          public static final ArithmeticInstruction LXOR

    - #### I2L

          public static final ConversionInstruction I2L

    - #### I2F

          public static final ConversionInstruction I2F

    - #### I2D

          public static final ConversionInstruction I2D

    - #### L2I

          public static final ConversionInstruction L2I

    - #### L2F

          public static final ConversionInstruction L2F

    - #### L2D

          public static final ConversionInstruction L2D

    - #### F2I

          public static final ConversionInstruction F2I

    - #### F2L

          public static final ConversionInstruction F2L

    - #### F2D

          public static final ConversionInstruction F2D

    - #### D2I

          public static final ConversionInstruction D2I

    - #### D2L

          public static final ConversionInstruction D2L

    - #### D2F

          public static final ConversionInstruction D2F

    - #### I2B

          public static final ConversionInstruction I2B

    - #### I2C

          public static final ConversionInstruction I2C

    - #### I2S

          public static final ConversionInstruction I2S

    - #### LCMP

          public static final Instruction LCMP

    - #### FCMPL

          public static final Instruction FCMPL

    - #### FCMPG

          public static final Instruction FCMPG

    - #### DCMPL

          public static final Instruction DCMPL

    - #### DCMPG

          public static final Instruction DCMPG

    - #### IRETURN

          public static final ReturnInstruction IRETURN

    - #### LRETURN

          public static final ReturnInstruction LRETURN

    - #### FRETURN

          public static final ReturnInstruction FRETURN

    - #### DRETURN

          public static final ReturnInstruction DRETURN

    - #### ARETURN

          public static final ReturnInstruction ARETURN

    - #### RETURN

          public static final ReturnInstruction RETURN

    - #### ARRAYLENGTH

          public static final Instruction ARRAYLENGTH

    - #### ATHROW

          public static final Instruction ATHROW

    - #### MONITORENTER

          public static final Instruction MONITORENTER

    - #### MONITOREXIT

          public static final Instruction MONITOREXIT

    - #### THIS

          public static final LocalVariableInstruction THIS

      You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, e.g. call setIndex().

    - #### ALOAD_0

          public static final LocalVariableInstruction ALOAD_0

    - #### ALOAD_1

          public static final LocalVariableInstruction ALOAD_1

    - #### ALOAD_2

          public static final LocalVariableInstruction ALOAD_2

    - #### ILOAD_0

          public static final LocalVariableInstruction ILOAD_0

    - #### ILOAD_1

          public static final LocalVariableInstruction ILOAD_1

    - #### ILOAD_2

          public static final LocalVariableInstruction ILOAD_2

    - #### ASTORE_0

          public static final LocalVariableInstruction ASTORE_0

    - #### ASTORE_1

          public static final LocalVariableInstruction ASTORE_1

    - #### ASTORE_2

          public static final LocalVariableInstruction ASTORE_2

    - #### ISTORE_0

          public static final LocalVariableInstruction ISTORE_0

    - #### ISTORE_1

          public static final LocalVariableInstruction ISTORE_1

    - #### ISTORE_2

          public static final LocalVariableInstruction ISTORE_2

  - ### Method Detail

    - #### getInstruction

          public static Instruction getInstruction(int index)

      Gets the Instruction.
      Parameters:
        `index` - the index, e.g. `Const.RETURN`
      Returns:
        the entry from the private INSTRUCTIONS table

Copyright © 2004–2022 The Apache Software Foundation. All rights reserved.