20 */
21
22 package com.sun.org.apache.bcel.internal.generic;
23
24 import com.sun.org.apache.bcel.internal.Const;
25
26 /**
27 * This interface contains shareable instruction objects.
28 *
29 * In order to save memory you can use some instructions multiply,
30 * since they have an immutable state and are directly derived from
31 * Instruction. I.e. they have no instance fields that could be
32 * changed. Since some of these instructions like ICONST_0 occur
33 * very frequently this can save a lot of time and space. This
34 * feature is an adaptation of the FlyWeight design pattern, we
35 * just use an array instead of a factory.
36 *
37 * The Instructions can also accessed directly under their names, so
38 * it's possible to write il.append(Instruction.ICONST_0);
39 *
40 * @version $Id: InstructionConstants.java 1695415 2015-08-12 01:02:39Z chas $
41 */
42 public final class InstructionConst {
43
44 /**
45 * Predefined instruction objects
46 */
47 /*
48 * NOTE these are not currently immutable, because Instruction
49 * has mutable protected fields opcode and length.
50 */
51 public static final Instruction NOP = new NOP();
52 public static final Instruction ACONST_NULL = new ACONST_NULL();
53 public static final Instruction ICONST_M1 = new ICONST(-1);
54 public static final Instruction ICONST_0 = new ICONST(0);
55 public static final Instruction ICONST_1 = new ICONST(1);
56 public static final Instruction ICONST_2 = new ICONST(2);
57 public static final Instruction ICONST_3 = new ICONST(3);
58 public static final Instruction ICONST_4 = new ICONST(4);
59 public static final Instruction ICONST_5 = new ICONST(5);
60 public static final Instruction LCONST_0 = new LCONST(0);
|
20 */
21
22 package com.sun.org.apache.bcel.internal.generic;
23
24 import com.sun.org.apache.bcel.internal.Const;
25
26 /**
27 * This interface contains shareable instruction objects.
28 *
29 * In order to save memory you can use some instructions multiply,
30 * since they have an immutable state and are directly derived from
31 * Instruction. I.e. they have no instance fields that could be
32 * changed. Since some of these instructions like ICONST_0 occur
33 * very frequently this can save a lot of time and space. This
34 * feature is an adaptation of the FlyWeight design pattern, we
35 * just use an array instead of a factory.
36 *
37 * The Instructions can also accessed directly under their names, so
38 * it's possible to write il.append(Instruction.ICONST_0);
39 *
40 */
41 public final class InstructionConst {
42
43 /**
44 * Predefined instruction objects
45 */
46 /*
47 * NOTE these are not currently immutable, because Instruction
48 * has mutable protected fields opcode and length.
49 */
50 public static final Instruction NOP = new NOP();
51 public static final Instruction ACONST_NULL = new ACONST_NULL();
52 public static final Instruction ICONST_M1 = new ICONST(-1);
53 public static final Instruction ICONST_0 = new ICONST(0);
54 public static final Instruction ICONST_1 = new ICONST(1);
55 public static final Instruction ICONST_2 = new ICONST(2);
56 public static final Instruction ICONST_3 = new ICONST(3);
57 public static final Instruction ICONST_4 = new ICONST(4);
58 public static final Instruction ICONST_5 = new ICONST(5);
59 public static final Instruction LCONST_0 = new LCONST(0);
|