KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > enhancer > classfile > VMOp


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.jdo.api.persistence.enhancer.classfile;
26
27 /**
28  * Description of the VM opcodes
29  */

30 public class VMOp implements VMConstants {
31   /* The opcode value */
32   private int opcodeValue;
33
34   /* The name of the opcode */
35   private String JavaDoc opcodeName;
36
37   /* The number of stack argument words */
38   private int stackArgs;
39
40   /* The number of stack result words */
41   private int stackResults;
42
43     /* The "type" signature of the stack argument words *///NOI18N
44
private String JavaDoc stackArgTypes;
45
46     /* The "type" signature of the stack result words *///NOI18N
47
private String JavaDoc stackResultTypes;
48
49   /* public accessors */
50
51   /**
52    * Return the opcode value
53    */

54   final public int opcode() {
55     return opcodeValue;
56   }
57
58   /**
59    * Return the opcode name
60    */

61   final public String JavaDoc name() {
62     return opcodeName;
63   }
64
65   /**
66    * Return the number of words of stack arguments expected by this operation.
67    * If the number is not a fixed value, return -1;
68    */

69   final public int nStackArgs() {
70     return stackArgs;
71   }
72
73   /**
74    * Return the number of words of stack results produced by this operation.
75    * If the number is not a fixed value, return -1;
76    */

77   final public int nStackResults() {
78     return stackResults;
79   }
80
81   /**
82    * Return the type descriptor for the stack arguments to the operation.
83    */

84   final public String JavaDoc argTypes() {
85     return stackArgTypes;
86   }
87
88   /**
89    * Return the type descriptor for the stack results of the operation.
90    */

91   final public String JavaDoc resultTypes() {
92     return stackResultTypes;
93   }
94
95   /**
96    * constructor for a VMOp
97    */

98    
99   public VMOp(int theOpcode, String JavaDoc theOpcodeName, int nArgs, int nResults,
100           String JavaDoc argDescr, String JavaDoc resultDescr) {
101     opcodeValue = theOpcode;
102     opcodeName = theOpcodeName;
103     stackArgs = nArgs;
104     stackResults = nResults;
105     stackArgTypes = argDescr;
106     stackResultTypes = resultDescr;
107   }
108
109   /* package local methods */
110
111   static VMOp[] ops = {
112     /* | no change*/
113       new VMOp(opc_nop, "nop", 0, 0, "", ""),//NOI18N
114
/* | ... -> ..., null */
115       new VMOp(opc_aconst_null, "aconst_null", 0, 1, "", "A"),//NOI18N
116
/* | ... -> ..., -1 */
117       new VMOp(opc_iconst_m1, "iconst_m1", 0, 1, "", "I"),//NOI18N
118
/* | ... -> ..., 0 */
119       new VMOp(opc_iconst_0, "iconst_0", 0, 1, "", "I"),//NOI18N
120
/* | ... -> ..., 1 */
121       new VMOp(opc_iconst_1, "iconst_1", 0, 1, "", "I"),//NOI18N
122
/* | ... -> ..., 2 */
123       new VMOp(opc_iconst_2, "iconst_2", 0, 1, "", "I"),//NOI18N
124
/* | ... -> ..., 3 */
125       new VMOp(opc_iconst_3, "iconst_3", 0, 1, "", "I"),//NOI18N
126
/* | ... -> ..., 4 */
127       new VMOp(opc_iconst_4, "iconst_4", 0, 1, "", "I"),//NOI18N
128
/* | ... -> ..., 5 */
129       new VMOp(opc_iconst_5, "iconst_5", 0, 1, "", "I"),//NOI18N
130
/* | ... -> ..., 0<high/low>, 0<high/low> */
131       new VMOp(opc_lconst_0, "lconst_0", 0, 2, "", "J"),//NOI18N
132
/* | ... -> ..., 1<high/low>, 1<high/low> */
133       new VMOp(opc_lconst_1, "lconst_1", 0, 2, "", "J"),//NOI18N
134
/* | ... -> ..., 0.0f */
135       new VMOp(opc_fconst_0, "fconst_0", 0, 1, "", "F"),//NOI18N
136
/* | ... -> ..., 1.0f */
137       new VMOp(opc_fconst_1, "fconst_1", 0, 1, "", "F"),//NOI18N
138
/* | ... -> ..., 2.0f */
139       new VMOp(opc_fconst_2, "fconst_2", 0, 1, "", "F"),//NOI18N
140
/* | ... -> ..., 0.0<high/low>, 0.0<high/low> */
141       new VMOp(opc_dconst_0, "dconst_0", 0, 2, "", "D"),//NOI18N
142
/* | ... -> ..., 1.0<high/low>, 1.0<high/low> */
143       new VMOp(opc_dconst_1, "dconst_1", 0, 2, "", "D"),//NOI18N
144
/* byte1 | ... => ..., value */
145       new VMOp(opc_bipush, "bipush", 0, 1, "", "I"),//NOI18N
146
/* byte1 byte2 | ... => ..., value */
147       new VMOp(opc_sipush, "sipush", 0, 1, "", "I"),//NOI18N
148
/* indexbyte1 | ... => ..., item */
149       new VMOp(opc_ldc, "ldc", 0, 1, "", "W"),//NOI18N
150
/* indexbyte1 indexbyte2 | ... => ..., item */
151       new VMOp(opc_ldc_w, "ldc_w", 0, 1, "", "W"),//NOI18N
152
/* indexbyte1 indexbyte2 | ... => ..., item1, item2 */
153       new VMOp(opc_ldc2_w, "ldc2_w", 0, 2, "", "X"),//NOI18N
154
/* vindex | ... => ..., value<vindex> */
155       new VMOp(opc_iload, "iload", 0, 1, "", "I"),//NOI18N
156
/* vindex | ... => ..., value<vindex><h/l>, value<vindex><h/l> */
157       new VMOp(opc_lload, "lload", 0, 2, "", "J"),//NOI18N
158
/* vindex | ... => ..., value<vindex> */
159       new VMOp(opc_fload, "fload", 0, 1, "", "F"),//NOI18N
160
/* vindex | ... => ..., value<vindex><h/l>, value<vindex><h/l> */
161       new VMOp(opc_dload, "dload", 0, 2, "", "D"),//NOI18N
162
/* vindex | ... => ..., value<vindex> */
163       new VMOp(opc_aload, "aload", 0, 1, "", "A"),//NOI18N
164
/* | ... => ..., value<0> */
165       new VMOp(opc_iload_0, "iload_0", 0, 1, "", "I"),//NOI18N
166
/* | ... => ..., value<1> */
167       new VMOp(opc_iload_1, "iload_1", 0, 1, "", "I"),//NOI18N
168
/* | ... => ..., value<2> */
169       new VMOp(opc_iload_2, "iload_2", 0, 1, "", "I"),//NOI18N
170
/* | ... => ..., value<3> */
171       new VMOp(opc_iload_3, "iload_3", 0, 1, "", "I"),//NOI18N
172
/* | ... => ..., value<0><h/l>, value<0><h/l> */
173       new VMOp(opc_lload_0, "lload_0", 0, 2, "", "J"),//NOI18N
174
/* | ... => ..., value<1><h/l>, value<1><h/l> */
175       new VMOp(opc_lload_1, "lload_1", 0, 2, "", "J"),//NOI18N
176
/* | ... => ..., value<2><h/l>, value<2><h/l> */
177       new VMOp(opc_lload_2, "lload_2", 0, 2, "", "J"),//NOI18N
178
/* | ... => ..., value<3><h/l>, value<3><h/l> */
179       new VMOp(opc_lload_3, "lload_3", 0, 2, "", "J"),//NOI18N
180
/* | ... => ..., value<0> */
181       new VMOp(opc_fload_0, "fload_0", 0, 1, "", "F"),//NOI18N
182
/* | ... => ..., value<1> */
183       new VMOp(opc_fload_1, "fload_1", 0, 1, "", "F"),//NOI18N
184
/* | ... => ..., value<2> */
185       new VMOp(opc_fload_2, "fload_2", 0, 1, "", "F"),//NOI18N
186
/* | ... => ..., value<3> */
187       new VMOp(opc_fload_3, "fload_3", 0, 1, "", "F"),//NOI18N
188
/* | ... => ..., value<0><h/l>, value<0><h/l> */
189       new VMOp(opc_dload_0, "dload_0", 0, 2, "", "D"),//NOI18N
190
/* | ... => ..., value<1><h/l>, value<1><h/l> */
191       new VMOp(opc_dload_1, "dload_1", 0, 2, "", "D"),//NOI18N
192
/* | ... => ..., value<2><h/l>, value<2><h/l> */
193       new VMOp(opc_dload_2, "dload_2", 0, 2, "", "D"),//NOI18N
194
/* | ... => ..., value<3><h/l>, value<3><h/l> */
195       new VMOp(opc_dload_3, "dload_3", 0, 2, "", "D"),//NOI18N
196
/* | ... => ..., value<0> */
197       new VMOp(opc_aload_0, "aload_0", 0, 1, "", "A"),//NOI18N
198
/* | ... => ..., value<1> */
199       new VMOp(opc_aload_1, "aload_1", 0, 1, "", "A"),//NOI18N
200
/* | ... => ..., value<2> */
201       new VMOp(opc_aload_2, "aload_2", 0, 1, "", "A"),//NOI18N
202
/* | ... => ..., value<3> */
203       new VMOp(opc_aload_3, "aload_3", 0, 1, "", "A"),//NOI18N
204
/* | ..., arrayref, index => ..., value */
205       new VMOp(opc_iaload, "iaload", 2, 1, "AI", "I"),//NOI18N
206
/* | ..., arrayref, index => ..., value<h/l>, value<h/l> */
207       new VMOp(opc_laload, "laload", 2, 2, "AI", "J"),//NOI18N
208
/* | ..., arrayref, index => ..., value */
209       new VMOp(opc_faload, "faload", 2, 1, "AI", "F"),//NOI18N
210
/* | ..., arrayref, index => ..., value<h/l>, value<h/l> */
211       new VMOp(opc_daload, "daload", 2, 2, "AI", "D"),//NOI18N
212
/* | ..., arrayref, index => ..., value */
213       new VMOp(opc_aaload, "aaload", 2, 1, "AI", "A"),//NOI18N
214
/* | ..., arrayref, index => ..., value */
215       new VMOp(opc_baload, "baload", 2, 1, "AI", "I"),//NOI18N
216
/* | ..., arrayref, index => ..., value */
217       new VMOp(opc_caload, "caload", 2, 1, "AI", "I"),//NOI18N
218
/* | ..., arrayref, index => ..., value */
219       new VMOp(opc_saload, "saload", 2, 1, "AI", "I"),//NOI18N
220
/* vindex | ..., value => ... */
221       new VMOp(opc_istore, "istore", 1, 0, "I", ""),//NOI18N
222
/* vindex | ..., value<h/l>, value<h/l> => ... */
223       new VMOp(opc_lstore, "lstore", 2, 0, "J", ""),//NOI18N
224
/* vindex | ..., value => ... */
225       new VMOp(opc_fstore, "fstore", 1, 0, "F", ""),//NOI18N
226
/* vindex | ..., value<h/l>, value<h/l> => ... */
227       new VMOp(opc_dstore, "dstore", 2, 0, "D", ""),//NOI18N
228
/* vindex | ..., value => ... */
229       new VMOp(opc_astore, "astore", 1, 0, "A", ""),//NOI18N
230
/* | ..., value => ... */
231       new VMOp(opc_istore_0, "istore_0", 1, 0, "I", ""),//NOI18N
232
/* | ..., value => ... */
233       new VMOp(opc_istore_1, "istore_1", 1, 0, "I", ""),//NOI18N
234
/* | ..., value => ... */
235       new VMOp(opc_istore_2, "istore_2", 1, 0, "I", ""),//NOI18N
236
/* | ..., value => ... */
237       new VMOp(opc_istore_3, "istore_3", 1, 0, "I", ""),//NOI18N
238
/* | ..., value<h/l>, value<h/l> => ... */
239       new VMOp(opc_lstore_0, "lstore_0", 2, 0, "J", ""),//NOI18N
240
/* | ..., value<h/l>, value<h/l> => ... */
241       new VMOp(opc_lstore_1, "lstore_1", 2, 0, "J", ""),//NOI18N
242
/* | ..., value<h/l>, value<h/l> => ... */
243       new VMOp(opc_lstore_2, "lstore_2", 2, 0, "J", ""),//NOI18N
244
/* | ..., value<h/l>, value<h/l> => ... */
245       new VMOp(opc_lstore_3, "lstore_3", 2, 0, "J", ""),//NOI18N
246
/* | ..., value => ... */
247       new VMOp(opc_fstore_0, "fstore_0", 1, 0, "F", ""),//NOI18N
248
/* | ..., value => ... */
249       new VMOp(opc_fstore_1, "fstore_1", 1, 0, "F", ""),//NOI18N
250
/* | ..., value => ... */
251       new VMOp(opc_fstore_2, "fstore_2", 1, 0, "F", ""),//NOI18N
252
/* | ..., value => ... */
253       new VMOp(opc_fstore_3, "fstore_3", 1, 0, "F", ""),//NOI18N
254
/* | ..., value<h/l>, value<h/l> => ... */
255       new VMOp(opc_dstore_0, "dstore_0", 2, 0, "D", ""),//NOI18N
256
/* | ..., value<h/l>, value<h/l> => ... */
257       new VMOp(opc_dstore_1, "dstore_1", 2, 0, "D", ""),//NOI18N
258
/* | ..., value<h/l>, value<h/l> => ... */
259       new VMOp(opc_dstore_2, "dstore_2", 2, 0, "D", ""),//NOI18N
260
/* | ..., value<h/l>, value<h/l> => ... */
261       new VMOp(opc_dstore_3, "dstore_3", 2, 0, "D", ""),//NOI18N
262
/* | ..., value => ... */
263       new VMOp(opc_astore_0, "astore_0", 1, 0, "A", ""),//NOI18N
264
/* | ..., value => ... */
265       new VMOp(opc_astore_1, "astore_1", 1, 0, "A", ""),//NOI18N
266
/* | ..., value => ... */
267       new VMOp(opc_astore_2, "astore_2", 1, 0, "A", ""),//NOI18N
268
/* | ..., value => ... */
269       new VMOp(opc_astore_3, "astore_3", 1, 0, "A", ""),//NOI18N
270
/* | ..., arrayref, index, value => ... */
271       new VMOp(opc_iastore, "iastore", 3, 0, "AII", ""),//NOI18N
272
/* | ..., arrayref, index, value<h/l>, value<h/l> => ... */
273       new VMOp(opc_lastore, "lastore", 4, 0, "AIJ", ""),//NOI18N
274
/* | ..., arrayref, index, value => ... */
275       new VMOp(opc_fastore, "fastore", 3, 0, "AIF", ""),//NOI18N
276
/* | ..., arrayref, index, value<h/l>, value<h/l> => ... */
277       new VMOp(opc_dastore, "dastore", 4, 0, "AID", ""),//NOI18N
278
/* | ..., arrayref, index, value => ... */
279       new VMOp(opc_aastore, "aastore", 3, 0, "AIA", ""),//NOI18N
280
/* | ..., arrayref, index, value => ... */
281       new VMOp(opc_bastore, "bastore", 3, 0, "AII", ""),//NOI18N
282
/* | ..., arrayref, index, value => ... */
283       new VMOp(opc_castore, "castore", 3, 0, "AII", ""),//NOI18N
284
/* | ..., arrayref, index, value => ... */
285       new VMOp(opc_sastore, "sastore", 3, 0, "AII", ""),//NOI18N
286
/* | ..., any => ... */
287       new VMOp(opc_pop, "pop", 1, 0, "W", ""),//NOI18N
288
/* | ..., any1, any2 => ... */
289       new VMOp(opc_pop2, "pop2", 2, 0, "WW", ""),//NOI18N
290
/* | ..., any => ..., any, any */
291       new VMOp(opc_dup, "dup", 1, 2, "W", "WW"),//NOI18N
292
/* | ..., any1, any2 => ..., any2, any1, any2 */
293       new VMOp(opc_dup_x1, "dup_x1", 2, 3, "WW", "WWW"),//NOI18N
294
/* | ..., any1, any2, any3 => ..., any3, any1, any2, any3 */
295       new VMOp(opc_dup_x2, "dup_x2", 3, 4, "WWW", "WWWW"),//NOI18N
296
/* | ..., any1, any2 => ..., any1, any2, any1, any2 */
297       new VMOp(opc_dup2, "dup2", 2, 4, "WW", "WWWW"),//NOI18N
298
/* | ..., any1, any2, any3 => ..., any2, any3, any1, any2, any3 */
299       new VMOp(opc_dup2_x1, "dup2_x1", 3, 5, "WWW", "WWWWW"),//NOI18N
300
/* | ..., any1, any2, any3, any4 => ..., any3, any4, any1, any2, any3, any4 */
301       new VMOp(opc_dup2_x2, "dup2_x2", 4, 6, "WWWW", "WWWWWW"),//NOI18N
302
/* | ..., any1, any2 => ..., any2, any1 */
303       new VMOp(opc_swap, "swap", 2, 2, "WW", "WW"),//NOI18N
304
/* | ..., value1, value2 => ..., result */
305       new VMOp(opc_iadd, "iadd", 2, 1, "II", "I"),//NOI18N
306
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
307       new VMOp(opc_ladd, "ladd", 4, 2, "JJ", "J"),//NOI18N
308
/* | ..., value1, value2 => ..., result */
309       new VMOp(opc_fadd, "fadd", 2, 1, "FF", "F"),//NOI18N
310
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
311       new VMOp(opc_dadd, "dadd", 4, 2, "DD", "D"),//NOI18N
312
/* | ..., value1, value2 => ..., result */
313       new VMOp(opc_isub, "isub", 2, 1, "II", "I"),//NOI18N
314
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
315       new VMOp(opc_lsub, "lsub", 4, 2, "JJ", "J"),//NOI18N
316
/* | ..., value1, value2 => ..., result */
317       new VMOp(opc_fsub, "fsub", 2, 1, "FF", "F"),//NOI18N
318
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
319       new VMOp(opc_dsub, "dsub", 4, 2, "DD", "D"),//NOI18N
320
/* | ..., value1, value2 => ..., result */
321       new VMOp(opc_imul, "imul", 2, 1, "II", "I"),//NOI18N
322
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
323       new VMOp(opc_lmul, "lmul", 4, 2, "JJ", "J"),//NOI18N
324
/* | ..., value1, value2 => ..., result */
325       new VMOp(opc_fmul, "fmul", 2, 1, "FF", "F"),//NOI18N
326
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
327       new VMOp(opc_dmul, "dmul", 4, 2, "DD", "D"),//NOI18N
328
/* | ..., value1, value2 => ..., result */
329       new VMOp(opc_idiv, "idiv", 2, 1, "II", "I"),//NOI18N
330
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
331       new VMOp(opc_ldiv, "ldiv", 4, 2, "JJ", "J"),//NOI18N
332
/* | ..., value1, value2 => ..., result */
333       new VMOp(opc_fdiv, "fdiv", 2, 1, "FF", "F"),//NOI18N
334
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
335       new VMOp(opc_ddiv, "ddiv", 4, 2, "DD", "D"),//NOI18N
336
/* | ..., value1, value2 => ..., result */
337       new VMOp(opc_irem, "irem", 2, 1, "II", "I"),//NOI18N
338
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
339       new VMOp(opc_lrem, "lrem", 4, 2, "JJ", "J"),//NOI18N
340
/* | ..., value1, value2 => ..., result */
341       new VMOp(opc_frem, "frem", 2, 1, "FF", "F"),//NOI18N
342
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
343       new VMOp(opc_drem, "drem", 4, 2, "DD", "D"),//NOI18N
344
/* | ..., value => ..., result */
345       new VMOp(opc_ineg, "ineg", 1, 1, "I", "I"),//NOI18N
346
/* | ..., value<h/l>, value<h/l> => ..., result<h/l>, result<h/l> */
347       new VMOp(opc_lneg, "lneg", 2, 2, "J", "J"),//NOI18N
348
/* | ..., value => ..., result */
349       new VMOp(opc_fneg, "fneg", 1, 1, "F", "F"),//NOI18N
350
/* | ..., value<h/l>, value<h/l> => ..., result<h/l>, result<h/l> */
351       new VMOp(opc_dneg, "dneg", 2, 2, "D", "D"),//NOI18N
352
/* | ..., value1, value2 => ..., result */
353       new VMOp(opc_ishl, "ishl", 2, 1, "II", "I"),//NOI18N
354
/* | ..., value1<h/l>, value1<h/l>, value2 => ..., result */
355       new VMOp(opc_lshl, "lshl", 3, 2, "JI", "J"),//NOI18N
356
/* | ..., value1, value2 => ..., result */
357       new VMOp(opc_ishr, "ishr", 2, 1, "II", "I"),//NOI18N
358
/* | ..., value1<h/l>, value1<h/l>, value2 => ..., result<h/l>, result<h/l> */
359       new VMOp(opc_lshr, "lshr", 3, 2, "JI", "J"),//NOI18N
360
/* | ..., value1, value2 => ..., result */
361       new VMOp(opc_iushr, "iushr", 2, 1, "II", "I"),//NOI18N
362
/* | ..., value1<h/l>, value1<h/l>, value2 => ..., result<h/l>, result<h/l> */
363       new VMOp(opc_lushr, "lushr", 3, 2, "JI", "J"),//NOI18N
364
/* | ..., value1, value2 => ..., result */
365       new VMOp(opc_iand, "iand", 2, 1, "II", "I"),//NOI18N
366
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
367       new VMOp(opc_land, "land", 4, 2, "JJ", "J"),//NOI18N
368
/* | ..., value1, value2 => ..., result */
369       new VMOp(opc_ior, "ior", 2, 1, "II", "I"),//NOI18N
370
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
371       new VMOp(opc_lor, "lor", 4, 2, "JJ", "J"),//NOI18N
372
/* | ..., value1, value2 => ..., result */
373       new VMOp(opc_ixor, "ixor", 2, 1, "II", "I"),//NOI18N
374
/* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
375       new VMOp(opc_lxor, "lxor", 4, 2, "JJ", "J"),//NOI18N
376
/* vindex, const | no change */
377       new VMOp(opc_iinc, "iinc", 0, 0, "", ""),//NOI18N
378
/* | ..., value => ..., value<h/l>, value<h/l> */
379       new VMOp(opc_i2l, "i2l", 1, 2, "I", "J"),//NOI18N
380
/* | ..., value => ..., value */
381       new VMOp(opc_i2f, "i2f", 1, 1, "I", "F"),//NOI18N
382
/* | ..., value => ..., value<h/l>, value<h/l> */
383       new VMOp(opc_i2d, "i2d", 1, 2, "I", "D"),//NOI18N
384
/* | ..., value<h/l>, value<h/l> => ..., value */
385       new VMOp(opc_l2i, "l2i", 2, 1, "J", "I"),//NOI18N
386
/* | ..., value<h/l>, value<h/l> => ..., value */
387       new VMOp(opc_l2f, "l2f", 2, 1, "J", "F"),//NOI18N
388
/* | ..., value<h/l>, value<h/l> => ..., value<h/l>, value<h/l> */
389       new VMOp(opc_l2d, "l2d", 2, 2, "J", "D"),//NOI18N
390
/* | ..., value => ..., value */
391       new VMOp(opc_f2i, "f2i", 1, 1, "F", "I"),//NOI18N
392
/* | ..., value => ..., value<h/l>, value<h/l> */
393       new VMOp(opc_f2l, "f2l", 1, 2, "F", "J"),//NOI18N
394
/* | ..., value => ..., value<h/l>, value<h/l> */
395       new VMOp(opc_f2d, "f2d", 1, 2, "F", "D"),//NOI18N
396
/* | ..., value<h/l>, value<h/l> => ..., value */
397       new VMOp(opc_d2i, "d2i", 2, 1, "D", "I"),//NOI18N
398
/* | ..., value<h/l>, value<h/l> => ..., value<h/l>, value<h/l> */
399       new VMOp(opc_d2l, "d2l", 2, 2, "D", "J"),//NOI18N
400
/* | ..., value<h/l>, value<h/l> => ..., value */
401       new VMOp(opc_d2f, "d2f", 2, 1, "D", "F"),//NOI18N
402
/* | ..., value => ..., result */
403       new VMOp(opc_i2b, "i2b", 1, 1, "I", "I"),//NOI18N
404
/* | ..., value => ..., result */
405       new VMOp(opc_i2c, "i2c", 1, 1, "I", "I"),//NOI18N
406
/* | ..., value => ..., result */
407       new VMOp(opc_i2s, "i2s", 1, 1, "I", "I"),//NOI18N
408
/* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
409       new VMOp(opc_lcmp, "lcmp", 4, 1, "JJ", "I"),//NOI18N
410
/* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
411       new VMOp(opc_fcmpl, "fcmpl", 2, 1, "FF", "I"),//NOI18N
412
/* | ..., v1, v2 => ..., result */
413       new VMOp(opc_fcmpg, "fcmpg", 2, 1, "FF", "I"),//NOI18N
414
/* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
415       new VMOp(opc_dcmpl, "dcmpl", 4, 1, "DD", "I"),//NOI18N
416
/* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
417       new VMOp(opc_dcmpg, "dcmpg", 4, 1, "DD", "I"),//NOI18N
418
/* brbyte1, brbyte2 | ..., value => ... */
419       new VMOp(opc_ifeq, "ifeq", 1, 0, "I", ""),//NOI18N
420
/* brbyte1, brbyte2 | ..., value => ... */
421       new VMOp(opc_ifne, "ifne", 1, 0, "I", ""),//NOI18N
422
/* brbyte1, brbyte2 | ..., value => ... */
423       new VMOp(opc_iflt, "iflt", 1, 0, "I", ""),//NOI18N
424
/* brbyte1, brbyte2 | ..., value => ... */
425       new VMOp(opc_ifge, "ifge", 1, 0, "I", ""),//NOI18N
426
/* brbyte1, brbyte2 | ..., value => ... */
427       new VMOp(opc_ifgt, "ifgt", 1, 0, "I", ""),//NOI18N
428
/* brbyte1, brbyte2 | ..., value => ... */
429       new VMOp(opc_ifle, "ifle", 1, 0, "I", ""),//NOI18N
430
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
431       new VMOp(opc_if_icmpeq, "if_icmpeq", 2, 0, "II", ""),//NOI18N
432
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
433       new VMOp(opc_if_icmpne, "if_icmpne", 2, 0, "II", ""),//NOI18N
434
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
435       new VMOp(opc_if_icmplt, "if_icmplt", 2, 0, "II", ""),//NOI18N
436
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
437       new VMOp(opc_if_icmpge, "if_icmpge", 2, 0, "II", ""),//NOI18N
438
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
439       new VMOp(opc_if_icmpgt, "if_icmpgt", 2, 0, "II", ""),//NOI18N
440
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
441       new VMOp(opc_if_icmple, "if_icmple", 2, 0, "II", ""),//NOI18N
442
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
443       new VMOp(opc_if_acmpeq, "if_acmpeq", 2, 0, "AA", ""),//NOI18N
444
/* brbyte1, brbyte2 | ..., value1, value2 => ... */
445       new VMOp(opc_if_acmpne, "if_acmpne", 2, 0, "AA", ""),//NOI18N
446
/* brbyte1, brbyte2 | no change */
447       new VMOp(opc_goto, "goto", 0, 0, "", ""),//NOI18N
448
/* brbyte1, brbyte2 | ... => ..., return_addr */
449       new VMOp(opc_jsr, "jsr", 0, 1, "", "W"),//NOI18N
450
/* vindex | no change */
451       new VMOp(opc_ret, "ret", 0, 0, "", ""),//NOI18N
452
/* ??? | ..., index => ... */
453       new VMOp(opc_tableswitch, "tableswitch", 1, 0, "I", ""),//NOI18N
454
/* ??? | ..., key => ... */
455       new VMOp(opc_lookupswitch, "lookupswitch", 1, 0, "I", ""),//NOI18N
456
/* | ..., value => [empty] */
457       new VMOp(opc_ireturn, "ireturn", 1, 0, "I", ""),//NOI18N
458
/* | ..., value<h/l>, value<h/l> => [empty] */
459       new VMOp(opc_lreturn, "lreturn", 2, 0, "J", ""),//NOI18N
460
/* | ..., value => [empty] */
461       new VMOp(opc_freturn, "freturn", 1, 0, "F", ""),//NOI18N
462
/* | ..., value<h/l>, value<h/l> => [empty] */
463       new VMOp(opc_dreturn, "dreturn", 2, 0, "D", ""),//NOI18N
464
/* | ..., value => [empty] */
465       new VMOp(opc_areturn, "areturn", 1, 0, "A", ""),//NOI18N
466
/* | ... => [empty] */
467       new VMOp(opc_return, "return", 0, 0, "", ""),//NOI18N
468
/* idxbyte1, idxbyte2 | ... => ..., value [ value2 ] */
469       new VMOp(opc_getstatic, "getstatic", 0, -1, "", "?"),//NOI18N
470
/* idxbyte1, idxbyte2 | ..., value [ value2 ] => ... */
471       new VMOp(opc_putstatic, "putstatic", -1, 0, "?", ""),//NOI18N
472
/* idxbyte1, idxbyte2 | ..., objectref => ..., value [ value2 ] */
473       new VMOp(opc_getfield, "getfield", 1, -1, "A", "?"),//NOI18N
474
/* idxbyte1, idxbyte2 | ..., objectref, value [ value2 ] => ... */
475       new VMOp(opc_putfield, "putfield", -1, 0, "A?", ""),//NOI18N
476
/* idxbyte1, idxbyte2 | ..., objectref, [args] => ... */
477       new VMOp(opc_invokevirtual, "invokevirtual", -1, -1, "A?", "?"),//NOI18N
478
/* idxbyte1, idxbyte2 | ..., objectref, [args] => ... */
479       new VMOp(opc_invokespecial, "invokespecial", -1, -1, "A?", "?"),//NOI18N
480
/* idxbyte1, idxbyte2 | ..., [args] => ... */
481       new VMOp(opc_invokestatic, "invokestatic", -1, -1, "?", "?"),//NOI18N
482
/* idxbyte1, idxbyte2, nargs, rsvd | ..., objectref, [args] => ... */
483       new VMOp(opc_invokeinterface, "invokeinterface", -1, -1, "A?", "?"),//NOI18N
484
/* */
485       new VMOp(opc_xxxunusedxxx, "xxxunusedxxx", 0, 0, "", ""),//NOI18N
486
/* idxbyte1, idxbyte2 | ... => ..., objectref */
487       new VMOp(opc_new, "new", 0, 1, "", "A"),//NOI18N
488
/* atype | ..., size => ..., result */
489       new VMOp(opc_newarray, "newarray", 1, 1, "I", "A"),//NOI18N
490
/* indexbyte1, indexbyte2 | ..., size => ..., result */
491       new VMOp(opc_anewarray, "anewarray", 1, 1, "I", "A"),//NOI18N
492
/* | ..., objectref => ..., length */
493       new VMOp(opc_arraylength, "arraylength", 1, 1, "A", "I"),//NOI18N
494
/* | ..., objectref => [undefined] */
495       new VMOp(opc_athrow, "athrow", 1, 0, "A", "?"),//NOI18N
496
/* idxbyte1, idxbyte2 | ..., objectref => ..., objectref */
497       new VMOp(opc_checkcast, "checkcast", 1, 1, "A", "A"),//NOI18N
498
/* idxbyte1, idxbyte2 | ..., objectref => ..., result */
499       new VMOp(opc_instanceof, "instanceof", 1, 1, "A", "I"),//NOI18N
500
/* | ..., objectref => ... */
501       new VMOp(opc_monitorenter, "monitorenter", 1, 0, "A", ""),//NOI18N
502
/* | ..., objectref => ... */
503       new VMOp(opc_monitorexit, "monitorexit", 1, 0, "A", ""),//NOI18N
504
/* an instruction | special */
505       new VMOp(opc_wide, "wide", 0, 0, "", ""),//NOI18N
506
/* indexbyte1, indexbyte2, dimensions | ..., size1, ..., sizen => ..., result*/
507       new VMOp(opc_multianewarray, "multianewarray", -1, 1, "?", "A"),//NOI18N
508
/* brbyte1, brbyte2 | ..., value => ... */
509       new VMOp(opc_ifnull, "ifnull", 1, 0, "A", ""),//NOI18N
510
/* brbyte1, brbyte2 | ..., value => ... */
511       new VMOp(opc_ifnonnull, "ifnonnull", 1, 0, "A", ""),//NOI18N
512
/* brbyte1, brbyte2, brbyte3, brbyte4 | no change */
513       new VMOp(opc_goto_w, "goto_w", 0, 0, "", ""),//NOI18N
514
/* brbyte1, brbyte2, brbyte3, brbyte4 | ... => ..., return_addr */
515       new VMOp(opc_jsr_w, "jsr_w", 0, 1, "", "W") };//NOI18N
516

517   /**
518    * Check that each entry in the ops array has a valid VMOp entry
519    */

520   private static void check() {
521     for (int i=0; i<=opc_jsr_w; i++) {
522       VMOp op = ops[i];
523       if (op == null)
524           throw new InsnError ("null VMOp for " + i);//NOI18N
525
if (op.opcode() != i)
526           throw new InsnError ("bad opcode for " + i);//NOI18N
527

528       if (1 == 0) {
529     /* check arg/result data */
530     checkTypes(op.argTypes(), op.nStackArgs(), op);
531     checkTypes(op.resultTypes(), op.nStackResults(), op);
532       }
533     }
534   }
535
536   private static void checkTypes(String JavaDoc types, int n, VMOp op) {
537     for (int i=0; i<types.length(); i++) {
538       char c = types.charAt(i);
539       if (c == '?')
540     return;
541       if (c == 'J' || c == 'X' || c == 'D')
542     n -= 2;
543       else
544     n -= 1;
545     }
546     if (n != 0)
547         throw new InsnError ("Bad arg/result for VMOp " + op.opcodeName);//NOI18N
548
}
549
550   static {
551     check();
552   }
553 }
554
Popular Tags