/Users/lyon/j4p/src/javassist/bytecode/Opcode.java

1    /* 
2     * Javassist, a Java-bytecode translator toolkit. 
3     * Copyright (C) 1999-2003 Shigeru Chiba. All Rights Reserved. 
4     * 
5     * The contents of this file are subject to the Mozilla Public License Version 
6     * 1.1 (the "License"); you may not use this file except in compliance with 
7     * the License.  Alternatively, the contents of this file may be used under 
8     * the terms of the GNU Lesser General Public License Version 2.1 or later. 
9     * 
10    * Software distributed under the License is distributed on an "AS IS" basis, 
11    * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
12    * for the specific language governing rights and limitations under the 
13    * License. 
14    */ 
15    
16   package javassist.bytecode; 
17    
18   /** 
19    * JVM Instruction Set. 
20    * 
21    * <p>This interface defines opcodes and 
22    * array types for the NEWARRAY instruction. 
23    * 
24    * @see Mnemonic 
25    */ 
26   public interface Opcode { 
27       /* Opcodes */ 
28    
29       int AALOAD = 50; 
30       int AASTORE = 83; 
31       int ACONST_NULL = 1; 
32       int ALOAD = 25; 
33       int ALOAD_0 = 42; 
34       int ALOAD_1 = 43; 
35       int ALOAD_2 = 44; 
36       int ALOAD_3 = 45; 
37       int ANEWARRAY = 189; 
38       int ARETURN = 176; 
39       int ARRAYLENGTH = 190; 
40       int ASTORE = 58; 
41       int ASTORE_0 = 75; 
42       int ASTORE_1 = 76; 
43       int ASTORE_2 = 77; 
44       int ASTORE_3 = 78; 
45       int ATHROW = 191; 
46       int BALOAD = 51; 
47       int BASTORE = 84; 
48       int BIPUSH = 16; 
49       int CALOAD = 52; 
50       int CASTORE = 85; 
51       int CHECKCAST = 192; 
52       int D2F = 144; 
53       int D2I = 142; 
54       int D2L = 143; 
55       int DADD = 99; 
56       int DALOAD = 49; 
57       int DASTORE = 82; 
58       int DCMPG = 152; 
59       int DCMPL = 151; 
60       int DCONST_0 = 14; 
61       int DCONST_1 = 15; 
62       int DDIV = 111; 
63       int DLOAD = 24; 
64       int DLOAD_0 = 38; 
65       int DLOAD_1 = 39; 
66       int DLOAD_2 = 40; 
67       int DLOAD_3 = 41; 
68       int DMUL = 107; 
69       int DNEG = 119; 
70       int DREM = 115; 
71       int DRETURN = 175; 
72       int DSTORE = 57; 
73       int DSTORE_0 = 71; 
74       int DSTORE_1 = 72; 
75       int DSTORE_2 = 73; 
76       int DSTORE_3 = 74; 
77       int DSUB = 103; 
78       int DUP = 89; 
79       int DUP2 = 92; 
80       int DUP2_X1 = 93; 
81       int DUP2_X2 = 94; 
82       int DUP_X1 = 90; 
83       int DUP_X2 = 91; 
84       int F2D = 141; 
85       int F2I = 139; 
86       int F2L = 140; 
87       int FADD = 98; 
88       int FALOAD = 48; 
89       int FASTORE = 81; 
90       int FCMPG = 150; 
91       int FCMPL = 149; 
92       int FCONST_0 = 11; 
93       int FCONST_1 = 12; 
94       int FCONST_2 = 13; 
95       int FDIV = 110; 
96       int FLOAD = 23; 
97       int FLOAD_0 = 34; 
98       int FLOAD_1 = 35; 
99       int FLOAD_2 = 36; 
100      int FLOAD_3 = 37; 
101      int FMUL = 106; 
102      int FNEG = 118; 
103      int FREM = 114; 
104      int FRETURN = 174; 
105      int FSTORE = 56; 
106      int FSTORE_0 = 67; 
107      int FSTORE_1 = 68; 
108      int FSTORE_2 = 69; 
109      int FSTORE_3 = 70; 
110      int FSUB = 102; 
111      int GETFIELD = 180; 
112      int GETSTATIC = 178; 
113      int GOTO = 167; 
114      int GOTO_W = 200; 
115      int I2B = 145; 
116      int I2C = 146; 
117      int I2D = 135; 
118      int I2F = 134; 
119      int I2L = 133; 
120      int I2S = 147; 
121      int IADD = 96; 
122      int IALOAD = 46; 
123      int IAND = 126; 
124      int IASTORE = 79; 
125      int ICONST_0 = 3; 
126      int ICONST_1 = 4; 
127      int ICONST_2 = 5; 
128      int ICONST_3 = 6; 
129      int ICONST_4 = 7; 
130      int ICONST_5 = 8; 
131      int ICONST_M1 = 2; 
132      int IDIV = 108; 
133      int IFEQ = 153; 
134      int IFGE = 156; 
135      int IFGT = 157; 
136      int IFLE = 158; 
137      int IFLT = 155; 
138      int IFNE = 154; 
139      int IFNONNULL = 199; 
140      int IFNULL = 198; 
141      int IF_ACMPEQ = 165; 
142      int IF_ACMPNE = 166; 
143      int IF_ICMPEQ = 159; 
144      int IF_ICMPGE = 162; 
145      int IF_ICMPGT = 163; 
146      int IF_ICMPLE = 164; 
147      int IF_ICMPLT = 161; 
148      int IF_ICMPNE = 160; 
149      int IINC = 132; 
150      int ILOAD = 21; 
151      int ILOAD_0 = 26; 
152      int ILOAD_1 = 27; 
153      int ILOAD_2 = 28; 
154      int ILOAD_3 = 29; 
155      int IMUL = 104; 
156      int INEG = 116; 
157      int INSTANCEOF = 193; 
158      int INVOKEINTERFACE = 185; 
159      int INVOKESPECIAL = 183; 
160      int INVOKESTATIC = 184; 
161      int INVOKEVIRTUAL = 182; 
162      int IOR = 128; 
163      int IREM = 112; 
164      int IRETURN = 172; 
165      int ISHL = 120; 
166      int ISHR = 122; 
167      int ISTORE = 54; 
168      int ISTORE_0 = 59; 
169      int ISTORE_1 = 60; 
170      int ISTORE_2 = 61; 
171      int ISTORE_3 = 62; 
172      int ISUB = 100; 
173      int IUSHR = 124; 
174      int IXOR = 130; 
175      int JSR = 168; 
176      int JSR_W = 201; 
177      int L2D = 138; 
178      int L2F = 137; 
179      int L2I = 136; 
180      int LADD = 97; 
181      int LALOAD = 47; 
182      int LAND = 127; 
183      int LASTORE = 80; 
184      int LCMP = 148; 
185      int LCONST_0 = 9; 
186      int LCONST_1 = 10; 
187      int LDC = 18; 
188      int LDC2_W = 20; 
189      int LDC_W = 19; 
190      int LDIV = 109; 
191      int LLOAD = 22; 
192      int LLOAD_0 = 30; 
193      int LLOAD_1 = 31; 
194      int LLOAD_2 = 32; 
195      int LLOAD_3 = 33; 
196      int LMUL = 105; 
197      int LNEG = 117; 
198      int LOOKUPSWITCH = 171; 
199      int LOR = 129; 
200      int LREM = 113; 
201      int LRETURN = 173; 
202      int LSHL = 121; 
203      int LSHR = 123; 
204      int LSTORE = 55; 
205      int LSTORE_0 = 63; 
206      int LSTORE_1 = 64; 
207      int LSTORE_2 = 65; 
208      int LSTORE_3 = 66; 
209      int LSUB = 101; 
210      int LUSHR = 125; 
211      int LXOR = 131; 
212      int MONITORENTER = 194; 
213      int MONITOREXIT = 195; 
214      int MULTIANEWARRAY = 197; 
215      int NEW = 187; 
216      int NEWARRAY = 188; 
217      int NOP = 0; 
218      int POP = 87; 
219      int POP2 = 88; 
220      int PUTFIELD = 181; 
221      int PUTSTATIC = 179; 
222      int RET = 169; 
223      int RETURN = 177; 
224      int SALOAD = 53; 
225      int SASTORE = 86; 
226      int SIPUSH = 17; 
227      int SWAP = 95; 
228      int TABLESWITCH = 170; 
229      int WIDE = 196; 
230   
231      /* array-type code for the newarray instruction */ 
232   
233      int T_BOOLEAN = 4; 
234      int T_CHAR = 5; 
235      int T_FLOAT = 6; 
236      int T_DOUBLE = 7; 
237      int T_BYTE = 8; 
238      int T_SHORT = 9; 
239      int T_INT = 10; 
240      int T_LONG = 11; 
241   
242      /* how many values are pushed on the operand stack. */ 
243      int[] STACK_GROW = { 
244          0, // nop, 0 
245          1, // aconst_null, 1 
246          1, // iconst_m1, 2 
247          1, // iconst_0, 3 
248          1, // iconst_1, 4 
249          1, // iconst_2, 5 
250          1, // iconst_3, 6 
251          1, // iconst_4, 7 
252          1, // iconst_5, 8 
253          2, // lconst_0, 9 
254          2, // lconst_1, 10 
255          1, // fconst_0, 11 
256          1, // fconst_1, 12 
257          1, // fconst_2, 13 
258          2, // dconst_0, 14 
259          2, // dconst_1, 15 
260          1, // bipush, 16 
261          1, // sipush, 17 
262          1, // ldc, 18 
263          1, // ldc_w, 19 
264          2, // ldc2_w, 20 
265          1, // iload, 21 
266          2, // lload, 22 
267          1, // fload, 23 
268          2, // dload, 24 
269          1, // aload, 25 
270          1, // iload_0, 26 
271          1, // iload_1, 27 
272          1, // iload_2, 28 
273          1, // iload_3, 29 
274          2, // lload_0, 30 
275          2, // lload_1, 31 
276          2, // lload_2, 32 
277          2, // lload_3, 33 
278          1, // fload_0, 34 
279          1, // fload_1, 35 
280          1, // fload_2, 36 
281          1, // fload_3, 37 
282          2, // dload_0, 38 
283          2, // dload_1, 39 
284          2, // dload_2, 40 
285          2, // dload_3, 41 
286          1, // aload_0, 42 
287          1, // aload_1, 43 
288          1, // aload_2, 44 
289          1, // aload_3, 45 
290          -1, // iaload, 46 
291          0, // laload, 47 
292          -1, // faload, 48 
293          0, // daload, 49 
294          -1, // aaload, 50 
295          -1, // baload, 51 
296          -1, // caload, 52 
297          -1, // saload, 53 
298          -1, // istore, 54 
299          -2, // lstore, 55 
300          -1, // fstore, 56 
301          -2, // dstore, 57 
302          -1, // astore, 58 
303          -1, // istore_0, 59 
304          -1, // istore_1, 60 
305          -1, // istore_2, 61 
306          -1, // istore_3, 62 
307          -2, // lstore_0, 63 
308          -2, // lstore_1, 64 
309          -2, // lstore_2, 65 
310          -2, // lstore_3, 66 
311          -1, // fstore_0, 67 
312          -1, // fstore_1, 68 
313          -1, // fstore_2, 69 
314          -1, // fstore_3, 70 
315          -2, // dstore_0, 71 
316          -2, // dstore_1, 72 
317          -2, // dstore_2, 73 
318          -2, // dstore_3, 74 
319          -1, // astore_0, 75 
320          -1, // astore_1, 76 
321          -1, // astore_2, 77 
322          -1, // astore_3, 78 
323          -3, // iastore, 79 
324          -4, // lastore, 80 
325          -3, // fastore, 81 
326          -4, // dastore, 82 
327          -3, // aastore, 83 
328          -3, // bastore, 84 
329          -3, // castore, 85 
330          -3, // sastore, 86 
331          -1, // pop, 87 
332          -2, // pop2, 88 
333          1, // dup, 89 
334          1, // dup_x1, 90 
335          1, // dup_x2, 91 
336          2, // dup2, 92 
337          2, // dup2_x1, 93 
338          2, // dup2_x2, 94 
339          0, // swap, 95 
340          -1, // iadd, 96 
341          -2, // ladd, 97 
342          -1, // fadd, 98 
343          -2, // dadd, 99 
344          -1, // isub, 100 
345          -2, // lsub, 101 
346          -1, // fsub, 102 
347          -2, // dsub, 103 
348          -1, // imul, 104 
349          -2, // lmul, 105 
350          -1, // fmul, 106 
351          -2, // dmul, 107 
352          -1, // idiv, 108 
353          -2, // ldiv, 109 
354          -1, // fdiv, 110 
355          -2, // ddiv, 111 
356          -1, // irem, 112 
357          -2, // lrem, 113 
358          -1, // frem, 114 
359          -2, // drem, 115 
360          0, // ineg, 116 
361          0, // lneg, 117 
362          0, // fneg, 118 
363          0, // dneg, 119 
364          -1, // ishl, 120 
365          -1, // lshl, 121 
366          -1, // ishr, 122 
367          -1, // lshr, 123 
368          -1, // iushr, 124 
369          -1, // lushr, 125 
370          -1, // iand, 126 
371          -2, // land, 127 
372          -1, // ior, 128 
373          -2, // lor, 129 
374          -1, // ixor, 130 
375          -2, // lxor, 131 
376          0, // iinc, 132 
377          1, // i2l, 133 
378          0, // i2f, 134 
379          1, // i2d, 135 
380          -1, // l2i, 136 
381          -1, // l2f, 137 
382          0, // l2d, 138 
383          0, // f2i, 139 
384          1, // f2l, 140 
385          1, // f2d, 141 
386          -1, // d2i, 142 
387          0, // d2l, 143 
388          -1, // d2f, 144 
389          0, // i2b, 145 
390          0, // i2c, 146 
391          0, // i2s, 147 
392          -3, // lcmp, 148 
393          -1, // fcmpl, 149 
394          -1, // fcmpg, 150 
395          -3, // dcmpl, 151 
396          -3, // dcmpg, 152 
397          -1, // ifeq, 153 
398          -1, // ifne, 154 
399          -1, // iflt, 155 
400          -1, // ifge, 156 
401          -1, // ifgt, 157 
402          -1, // ifle, 158 
403          -2, // if_icmpeq, 159 
404          -2, // if_icmpne, 160 
405          -2, // if_icmplt, 161 
406          -2, // if_icmpge, 162 
407          -2, // if_icmpgt, 163 
408          -2, // if_icmple, 164 
409          -2, // if_acmpeq, 165 
410          -2, // if_acmpne, 166 
411          0, // goto, 167 
412          1, // jsr, 168 
413          0, // ret, 169 
414          -1, // tableswitch, 170 
415          -1, // lookupswitch, 171 
416          -1, // ireturn, 172 
417          -2, // lreturn, 173 
418          -1, // freturn, 174 
419          -2, // dreturn, 175 
420          -1, // areturn, 176 
421          0, // return, 177 
422          0, // getstatic, 178            depends on the type 
423          0, // putstatic, 179            depends on the type 
424          0, // getfield, 180             depends on the type 
425          0, // putfield, 181             depends on the type 
426          0, // invokevirtual, 182        depends on the type 
427          0, // invokespecial, 183        depends on the type 
428          0, // invokestatic, 184         depends on the type 
429          0, // invokeinterface, 185      depends on the type 
430          0, // undefined, 186 
431          1, // new, 187 
432          0, // newarray, 188 
433          0, // anewarray, 189 
434          0, // arraylength, 190 
435          0, // athrow, 191               stack is cleared 
436          0, // checkcast, 192 
437          0, // instanceof, 193 
438          -1, // monitorenter, 194 
439          -1, // monitorexit, 195 
440          0, // wide, 196                 depends on the following opcode 
441          0, // multianewarray, 197       depends on the dimensions 
442          -1, // ifnull, 198 
443          -1, // ifnonnull, 199 
444          0, // goto_w, 200 
445          1 // jsr_w, 201 
446      }; 
447  } 
448