001: /*
002: * Javassist, a Java-bytecode translator toolkit.
003: * Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.
004: *
005: * The contents of this file are subject to the Mozilla Public License Version
006: * 1.1 (the "License"); you may not use this file except in compliance with
007: * the License. Alternatively, the contents of this file may be used under
008: * the terms of the GNU Lesser General Public License Version 2.1 or later.
009: *
010: * Software distributed under the License is distributed on an "AS IS" basis,
011: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
012: * for the specific language governing rights and limitations under the
013: * License.
014: */
015:
016: package javassist.bytecode;
017:
018: /**
019: * JVM Instruction Set.
020: *
021: * <p>This interface defines opcodes and
022: * array types for the NEWARRAY instruction.
023: *
024: * @see Mnemonic
025: */
026: public interface Opcode {
027: /* Opcodes */
028:
029: int AALOAD = 50;
030: int AASTORE = 83;
031: int ACONST_NULL = 1;
032: int ALOAD = 25;
033: int ALOAD_0 = 42;
034: int ALOAD_1 = 43;
035: int ALOAD_2 = 44;
036: int ALOAD_3 = 45;
037: int ANEWARRAY = 189;
038: int ARETURN = 176;
039: int ARRAYLENGTH = 190;
040: int ASTORE = 58;
041: int ASTORE_0 = 75;
042: int ASTORE_1 = 76;
043: int ASTORE_2 = 77;
044: int ASTORE_3 = 78;
045: int ATHROW = 191;
046: int BALOAD = 51;
047: int BASTORE = 84;
048: int BIPUSH = 16;
049: int CALOAD = 52;
050: int CASTORE = 85;
051: int CHECKCAST = 192;
052: int D2F = 144;
053: int D2I = 142;
054: int D2L = 143;
055: int DADD = 99;
056: int DALOAD = 49;
057: int DASTORE = 82;
058: int DCMPG = 152;
059: int DCMPL = 151;
060: int DCONST_0 = 14;
061: int DCONST_1 = 15;
062: int DDIV = 111;
063: int DLOAD = 24;
064: int DLOAD_0 = 38;
065: int DLOAD_1 = 39;
066: int DLOAD_2 = 40;
067: int DLOAD_3 = 41;
068: int DMUL = 107;
069: int DNEG = 119;
070: int DREM = 115;
071: int DRETURN = 175;
072: int DSTORE = 57;
073: int DSTORE_0 = 71;
074: int DSTORE_1 = 72;
075: int DSTORE_2 = 73;
076: int DSTORE_3 = 74;
077: int DSUB = 103;
078: int DUP = 89;
079: int DUP2 = 92;
080: int DUP2_X1 = 93;
081: int DUP2_X2 = 94;
082: int DUP_X1 = 90;
083: int DUP_X2 = 91;
084: int F2D = 141;
085: int F2I = 139;
086: int F2L = 140;
087: int FADD = 98;
088: int FALOAD = 48;
089: int FASTORE = 81;
090: int FCMPG = 150;
091: int FCMPL = 149;
092: int FCONST_0 = 11;
093: int FCONST_1 = 12;
094: int FCONST_2 = 13;
095: int FDIV = 110;
096: int FLOAD = 23;
097: int FLOAD_0 = 34;
098: int FLOAD_1 = 35;
099: 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 = { 0, // nop, 0
244: 1, // aconst_null, 1
245: 1, // iconst_m1, 2
246: 1, // iconst_0, 3
247: 1, // iconst_1, 4
248: 1, // iconst_2, 5
249: 1, // iconst_3, 6
250: 1, // iconst_4, 7
251: 1, // iconst_5, 8
252: 2, // lconst_0, 9
253: 2, // lconst_1, 10
254: 1, // fconst_0, 11
255: 1, // fconst_1, 12
256: 1, // fconst_2, 13
257: 2, // dconst_0, 14
258: 2, // dconst_1, 15
259: 1, // bipush, 16
260: 1, // sipush, 17
261: 1, // ldc, 18
262: 1, // ldc_w, 19
263: 2, // ldc2_w, 20
264: 1, // iload, 21
265: 2, // lload, 22
266: 1, // fload, 23
267: 2, // dload, 24
268: 1, // aload, 25
269: 1, // iload_0, 26
270: 1, // iload_1, 27
271: 1, // iload_2, 28
272: 1, // iload_3, 29
273: 2, // lload_0, 30
274: 2, // lload_1, 31
275: 2, // lload_2, 32
276: 2, // lload_3, 33
277: 1, // fload_0, 34
278: 1, // fload_1, 35
279: 1, // fload_2, 36
280: 1, // fload_3, 37
281: 2, // dload_0, 38
282: 2, // dload_1, 39
283: 2, // dload_2, 40
284: 2, // dload_3, 41
285: 1, // aload_0, 42
286: 1, // aload_1, 43
287: 1, // aload_2, 44
288: 1, // aload_3, 45
289: -1, // iaload, 46
290: 0, // laload, 47
291: -1, // faload, 48
292: 0, // daload, 49
293: -1, // aaload, 50
294: -1, // baload, 51
295: -1, // caload, 52
296: -1, // saload, 53
297: -1, // istore, 54
298: -2, // lstore, 55
299: -1, // fstore, 56
300: -2, // dstore, 57
301: -1, // astore, 58
302: -1, // istore_0, 59
303: -1, // istore_1, 60
304: -1, // istore_2, 61
305: -1, // istore_3, 62
306: -2, // lstore_0, 63
307: -2, // lstore_1, 64
308: -2, // lstore_2, 65
309: -2, // lstore_3, 66
310: -1, // fstore_0, 67
311: -1, // fstore_1, 68
312: -1, // fstore_2, 69
313: -1, // fstore_3, 70
314: -2, // dstore_0, 71
315: -2, // dstore_1, 72
316: -2, // dstore_2, 73
317: -2, // dstore_3, 74
318: -1, // astore_0, 75
319: -1, // astore_1, 76
320: -1, // astore_2, 77
321: -1, // astore_3, 78
322: -3, // iastore, 79
323: -4, // lastore, 80
324: -3, // fastore, 81
325: -4, // dastore, 82
326: -3, // aastore, 83
327: -3, // bastore, 84
328: -3, // castore, 85
329: -3, // sastore, 86
330: -1, // pop, 87
331: -2, // pop2, 88
332: 1, // dup, 89
333: 1, // dup_x1, 90
334: 1, // dup_x2, 91
335: 2, // dup2, 92
336: 2, // dup2_x1, 93
337: 2, // dup2_x2, 94
338: 0, // swap, 95
339: -1, // iadd, 96
340: -2, // ladd, 97
341: -1, // fadd, 98
342: -2, // dadd, 99
343: -1, // isub, 100
344: -2, // lsub, 101
345: -1, // fsub, 102
346: -2, // dsub, 103
347: -1, // imul, 104
348: -2, // lmul, 105
349: -1, // fmul, 106
350: -2, // dmul, 107
351: -1, // idiv, 108
352: -2, // ldiv, 109
353: -1, // fdiv, 110
354: -2, // ddiv, 111
355: -1, // irem, 112
356: -2, // lrem, 113
357: -1, // frem, 114
358: -2, // drem, 115
359: 0, // ineg, 116
360: 0, // lneg, 117
361: 0, // fneg, 118
362: 0, // dneg, 119
363: -1, // ishl, 120
364: -1, // lshl, 121
365: -1, // ishr, 122
366: -1, // lshr, 123
367: -1, // iushr, 124
368: -1, // lushr, 125
369: -1, // iand, 126
370: -2, // land, 127
371: -1, // ior, 128
372: -2, // lor, 129
373: -1, // ixor, 130
374: -2, // lxor, 131
375: 0, // iinc, 132
376: 1, // i2l, 133
377: 0, // i2f, 134
378: 1, // i2d, 135
379: -1, // l2i, 136
380: -1, // l2f, 137
381: 0, // l2d, 138
382: 0, // f2i, 139
383: 1, // f2l, 140
384: 1, // f2d, 141
385: -1, // d2i, 142
386: 0, // d2l, 143
387: -1, // d2f, 144
388: 0, // i2b, 145
389: 0, // i2c, 146
390: 0, // i2s, 147
391: -3, // lcmp, 148
392: -1, // fcmpl, 149
393: -1, // fcmpg, 150
394: -3, // dcmpl, 151
395: -3, // dcmpg, 152
396: -1, // ifeq, 153
397: -1, // ifne, 154
398: -1, // iflt, 155
399: -1, // ifge, 156
400: -1, // ifgt, 157
401: -1, // ifle, 158
402: -2, // if_icmpeq, 159
403: -2, // if_icmpne, 160
404: -2, // if_icmplt, 161
405: -2, // if_icmpge, 162
406: -2, // if_icmpgt, 163
407: -2, // if_icmple, 164
408: -2, // if_acmpeq, 165
409: -2, // if_acmpne, 166
410: 0, // goto, 167
411: 1, // jsr, 168
412: 0, // ret, 169
413: -1, // tableswitch, 170
414: -1, // lookupswitch, 171
415: -1, // ireturn, 172
416: -2, // lreturn, 173
417: -1, // freturn, 174
418: -2, // dreturn, 175
419: -1, // areturn, 176
420: 0, // return, 177
421: 0, // getstatic, 178 depends on the type
422: 0, // putstatic, 179 depends on the type
423: 0, // getfield, 180 depends on the type
424: 0, // putfield, 181 depends on the type
425: 0, // invokevirtual, 182 depends on the type
426: 0, // invokespecial, 183 depends on the type
427: 0, // invokestatic, 184 depends on the type
428: 0, // invokeinterface, 185 depends on the type
429: 0, // undefined, 186
430: 1, // new, 187
431: 0, // newarray, 188
432: 0, // anewarray, 189
433: 0, // arraylength, 190
434: 0, // athrow, 191 stack is cleared
435: 0, // checkcast, 192
436: 0, // instanceof, 193
437: -1, // monitorenter, 194
438: -1, // monitorexit, 195
439: 0, // wide, 196 depends on the following opcode
440: 0, // multianewarray, 197 depends on the dimensions
441: -1, // ifnull, 198
442: -1, // ifnonnull, 199
443: 0, // goto_w, 200
444: 1 // jsr_w, 201
445: };
446: }
|