blob: 8906ba5f3908f9365f7e7ab10fdb21283c4599f8 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26#ifndef CLASSFILE_CONSTANTS_H
27#define CLASSFILE_CONSTANTS_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/* Flags */
34
35enum {
36 JVM_ACC_PUBLIC = 0x0001,
37 JVM_ACC_PRIVATE = 0x0002,
38 JVM_ACC_PROTECTED = 0x0004,
39 JVM_ACC_STATIC = 0x0008,
40 JVM_ACC_FINAL = 0x0010,
41 JVM_ACC_SYNCHRONIZED = 0x0020,
42 JVM_ACC_SUPER = 0x0020,
43 JVM_ACC_VOLATILE = 0x0040,
44 JVM_ACC_BRIDGE = 0x0040,
45 JVM_ACC_TRANSIENT = 0x0080,
46 JVM_ACC_VARARGS = 0x0080,
47 JVM_ACC_NATIVE = 0x0100,
48 JVM_ACC_INTERFACE = 0x0200,
49 JVM_ACC_ABSTRACT = 0x0400,
50 JVM_ACC_STRICT = 0x0800,
51 JVM_ACC_SYNTHETIC = 0x1000,
52 JVM_ACC_ANNOTATION = 0x2000,
53 JVM_ACC_ENUM = 0x4000
54};
55
56/* Used in newarray instruction. */
57
58enum {
59 JVM_T_BOOLEAN = 4,
60 JVM_T_CHAR = 5,
61 JVM_T_FLOAT = 6,
62 JVM_T_DOUBLE = 7,
63 JVM_T_BYTE = 8,
64 JVM_T_SHORT = 9,
65 JVM_T_INT = 10,
66 JVM_T_LONG = 11
67};
68
69/* Constant Pool Entries */
70
71enum {
72 JVM_CONSTANT_Utf8 = 1,
73 JVM_CONSTANT_Unicode = 2, /* unused */
74 JVM_CONSTANT_Integer = 3,
75 JVM_CONSTANT_Float = 4,
76 JVM_CONSTANT_Long = 5,
77 JVM_CONSTANT_Double = 6,
78 JVM_CONSTANT_Class = 7,
79 JVM_CONSTANT_String = 8,
80 JVM_CONSTANT_Fieldref = 9,
81 JVM_CONSTANT_Methodref = 10,
82 JVM_CONSTANT_InterfaceMethodref = 11,
83 JVM_CONSTANT_NameAndType = 12
84};
85
86/* StackMapTable type item numbers */
87
88enum {
89 JVM_ITEM_Top = 0,
90 JVM_ITEM_Integer = 1,
91 JVM_ITEM_Float = 2,
92 JVM_ITEM_Double = 3,
93 JVM_ITEM_Long = 4,
94 JVM_ITEM_Null = 5,
95 JVM_ITEM_UninitializedThis = 6,
96 JVM_ITEM_Object = 7,
97 JVM_ITEM_Uninitialized = 8
98};
99
100/* Type signatures */
101
102enum {
103 JVM_SIGNATURE_ARRAY = '[',
104 JVM_SIGNATURE_BYTE = 'B',
105 JVM_SIGNATURE_CHAR = 'C',
106 JVM_SIGNATURE_CLASS = 'L',
107 JVM_SIGNATURE_ENDCLASS = ';',
108 JVM_SIGNATURE_ENUM = 'E',
109 JVM_SIGNATURE_FLOAT = 'F',
110 JVM_SIGNATURE_DOUBLE = 'D',
111 JVM_SIGNATURE_FUNC = '(',
112 JVM_SIGNATURE_ENDFUNC = ')',
113 JVM_SIGNATURE_INT = 'I',
114 JVM_SIGNATURE_LONG = 'J',
115 JVM_SIGNATURE_SHORT = 'S',
116 JVM_SIGNATURE_VOID = 'V',
117 JVM_SIGNATURE_BOOLEAN = 'Z'
118};
119
120/* Opcodes */
121
122enum {
123 JVM_OPC_nop = 0,
124 JVM_OPC_aconst_null = 1,
125 JVM_OPC_iconst_m1 = 2,
126 JVM_OPC_iconst_0 = 3,
127 JVM_OPC_iconst_1 = 4,
128 JVM_OPC_iconst_2 = 5,
129 JVM_OPC_iconst_3 = 6,
130 JVM_OPC_iconst_4 = 7,
131 JVM_OPC_iconst_5 = 8,
132 JVM_OPC_lconst_0 = 9,
133 JVM_OPC_lconst_1 = 10,
134 JVM_OPC_fconst_0 = 11,
135 JVM_OPC_fconst_1 = 12,
136 JVM_OPC_fconst_2 = 13,
137 JVM_OPC_dconst_0 = 14,
138 JVM_OPC_dconst_1 = 15,
139 JVM_OPC_bipush = 16,
140 JVM_OPC_sipush = 17,
141 JVM_OPC_ldc = 18,
142 JVM_OPC_ldc_w = 19,
143 JVM_OPC_ldc2_w = 20,
144 JVM_OPC_iload = 21,
145 JVM_OPC_lload = 22,
146 JVM_OPC_fload = 23,
147 JVM_OPC_dload = 24,
148 JVM_OPC_aload = 25,
149 JVM_OPC_iload_0 = 26,
150 JVM_OPC_iload_1 = 27,
151 JVM_OPC_iload_2 = 28,
152 JVM_OPC_iload_3 = 29,
153 JVM_OPC_lload_0 = 30,
154 JVM_OPC_lload_1 = 31,
155 JVM_OPC_lload_2 = 32,
156 JVM_OPC_lload_3 = 33,
157 JVM_OPC_fload_0 = 34,
158 JVM_OPC_fload_1 = 35,
159 JVM_OPC_fload_2 = 36,
160 JVM_OPC_fload_3 = 37,
161 JVM_OPC_dload_0 = 38,
162 JVM_OPC_dload_1 = 39,
163 JVM_OPC_dload_2 = 40,
164 JVM_OPC_dload_3 = 41,
165 JVM_OPC_aload_0 = 42,
166 JVM_OPC_aload_1 = 43,
167 JVM_OPC_aload_2 = 44,
168 JVM_OPC_aload_3 = 45,
169 JVM_OPC_iaload = 46,
170 JVM_OPC_laload = 47,
171 JVM_OPC_faload = 48,
172 JVM_OPC_daload = 49,
173 JVM_OPC_aaload = 50,
174 JVM_OPC_baload = 51,
175 JVM_OPC_caload = 52,
176 JVM_OPC_saload = 53,
177 JVM_OPC_istore = 54,
178 JVM_OPC_lstore = 55,
179 JVM_OPC_fstore = 56,
180 JVM_OPC_dstore = 57,
181 JVM_OPC_astore = 58,
182 JVM_OPC_istore_0 = 59,
183 JVM_OPC_istore_1 = 60,
184 JVM_OPC_istore_2 = 61,
185 JVM_OPC_istore_3 = 62,
186 JVM_OPC_lstore_0 = 63,
187 JVM_OPC_lstore_1 = 64,
188 JVM_OPC_lstore_2 = 65,
189 JVM_OPC_lstore_3 = 66,
190 JVM_OPC_fstore_0 = 67,
191 JVM_OPC_fstore_1 = 68,
192 JVM_OPC_fstore_2 = 69,
193 JVM_OPC_fstore_3 = 70,
194 JVM_OPC_dstore_0 = 71,
195 JVM_OPC_dstore_1 = 72,
196 JVM_OPC_dstore_2 = 73,
197 JVM_OPC_dstore_3 = 74,
198 JVM_OPC_astore_0 = 75,
199 JVM_OPC_astore_1 = 76,
200 JVM_OPC_astore_2 = 77,
201 JVM_OPC_astore_3 = 78,
202 JVM_OPC_iastore = 79,
203 JVM_OPC_lastore = 80,
204 JVM_OPC_fastore = 81,
205 JVM_OPC_dastore = 82,
206 JVM_OPC_aastore = 83,
207 JVM_OPC_bastore = 84,
208 JVM_OPC_castore = 85,
209 JVM_OPC_sastore = 86,
210 JVM_OPC_pop = 87,
211 JVM_OPC_pop2 = 88,
212 JVM_OPC_dup = 89,
213 JVM_OPC_dup_x1 = 90,
214 JVM_OPC_dup_x2 = 91,
215 JVM_OPC_dup2 = 92,
216 JVM_OPC_dup2_x1 = 93,
217 JVM_OPC_dup2_x2 = 94,
218 JVM_OPC_swap = 95,
219 JVM_OPC_iadd = 96,
220 JVM_OPC_ladd = 97,
221 JVM_OPC_fadd = 98,
222 JVM_OPC_dadd = 99,
223 JVM_OPC_isub = 100,
224 JVM_OPC_lsub = 101,
225 JVM_OPC_fsub = 102,
226 JVM_OPC_dsub = 103,
227 JVM_OPC_imul = 104,
228 JVM_OPC_lmul = 105,
229 JVM_OPC_fmul = 106,
230 JVM_OPC_dmul = 107,
231 JVM_OPC_idiv = 108,
232 JVM_OPC_ldiv = 109,
233 JVM_OPC_fdiv = 110,
234 JVM_OPC_ddiv = 111,
235 JVM_OPC_irem = 112,
236 JVM_OPC_lrem = 113,
237 JVM_OPC_frem = 114,
238 JVM_OPC_drem = 115,
239 JVM_OPC_ineg = 116,
240 JVM_OPC_lneg = 117,
241 JVM_OPC_fneg = 118,
242 JVM_OPC_dneg = 119,
243 JVM_OPC_ishl = 120,
244 JVM_OPC_lshl = 121,
245 JVM_OPC_ishr = 122,
246 JVM_OPC_lshr = 123,
247 JVM_OPC_iushr = 124,
248 JVM_OPC_lushr = 125,
249 JVM_OPC_iand = 126,
250 JVM_OPC_land = 127,
251 JVM_OPC_ior = 128,
252 JVM_OPC_lor = 129,
253 JVM_OPC_ixor = 130,
254 JVM_OPC_lxor = 131,
255 JVM_OPC_iinc = 132,
256 JVM_OPC_i2l = 133,
257 JVM_OPC_i2f = 134,
258 JVM_OPC_i2d = 135,
259 JVM_OPC_l2i = 136,
260 JVM_OPC_l2f = 137,
261 JVM_OPC_l2d = 138,
262 JVM_OPC_f2i = 139,
263 JVM_OPC_f2l = 140,
264 JVM_OPC_f2d = 141,
265 JVM_OPC_d2i = 142,
266 JVM_OPC_d2l = 143,
267 JVM_OPC_d2f = 144,
268 JVM_OPC_i2b = 145,
269 JVM_OPC_i2c = 146,
270 JVM_OPC_i2s = 147,
271 JVM_OPC_lcmp = 148,
272 JVM_OPC_fcmpl = 149,
273 JVM_OPC_fcmpg = 150,
274 JVM_OPC_dcmpl = 151,
275 JVM_OPC_dcmpg = 152,
276 JVM_OPC_ifeq = 153,
277 JVM_OPC_ifne = 154,
278 JVM_OPC_iflt = 155,
279 JVM_OPC_ifge = 156,
280 JVM_OPC_ifgt = 157,
281 JVM_OPC_ifle = 158,
282 JVM_OPC_if_icmpeq = 159,
283 JVM_OPC_if_icmpne = 160,
284 JVM_OPC_if_icmplt = 161,
285 JVM_OPC_if_icmpge = 162,
286 JVM_OPC_if_icmpgt = 163,
287 JVM_OPC_if_icmple = 164,
288 JVM_OPC_if_acmpeq = 165,
289 JVM_OPC_if_acmpne = 166,
290 JVM_OPC_goto = 167,
291 JVM_OPC_jsr = 168,
292 JVM_OPC_ret = 169,
293 JVM_OPC_tableswitch = 170,
294 JVM_OPC_lookupswitch = 171,
295 JVM_OPC_ireturn = 172,
296 JVM_OPC_lreturn = 173,
297 JVM_OPC_freturn = 174,
298 JVM_OPC_dreturn = 175,
299 JVM_OPC_areturn = 176,
300 JVM_OPC_return = 177,
301 JVM_OPC_getstatic = 178,
302 JVM_OPC_putstatic = 179,
303 JVM_OPC_getfield = 180,
304 JVM_OPC_putfield = 181,
305 JVM_OPC_invokevirtual = 182,
306 JVM_OPC_invokespecial = 183,
307 JVM_OPC_invokestatic = 184,
308 JVM_OPC_invokeinterface = 185,
309 JVM_OPC_xxxunusedxxx = 186,
310 JVM_OPC_new = 187,
311 JVM_OPC_newarray = 188,
312 JVM_OPC_anewarray = 189,
313 JVM_OPC_arraylength = 190,
314 JVM_OPC_athrow = 191,
315 JVM_OPC_checkcast = 192,
316 JVM_OPC_instanceof = 193,
317 JVM_OPC_monitorenter = 194,
318 JVM_OPC_monitorexit = 195,
319 JVM_OPC_wide = 196,
320 JVM_OPC_multianewarray = 197,
321 JVM_OPC_ifnull = 198,
322 JVM_OPC_ifnonnull = 199,
323 JVM_OPC_goto_w = 200,
324 JVM_OPC_jsr_w = 201,
325 JVM_OPC_MAX = 201
326};
327
328/* Opcode length initializer, use with something like:
329 * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
330 */
331#define JVM_OPCODE_LENGTH_INITIALIZER { \
332 1, /* nop */ \
333 1, /* aconst_null */ \
334 1, /* iconst_m1 */ \
335 1, /* iconst_0 */ \
336 1, /* iconst_1 */ \
337 1, /* iconst_2 */ \
338 1, /* iconst_3 */ \
339 1, /* iconst_4 */ \
340 1, /* iconst_5 */ \
341 1, /* lconst_0 */ \
342 1, /* lconst_1 */ \
343 1, /* fconst_0 */ \
344 1, /* fconst_1 */ \
345 1, /* fconst_2 */ \
346 1, /* dconst_0 */ \
347 1, /* dconst_1 */ \
348 2, /* bipush */ \
349 3, /* sipush */ \
350 2, /* ldc */ \
351 3, /* ldc_w */ \
352 3, /* ldc2_w */ \
353 2, /* iload */ \
354 2, /* lload */ \
355 2, /* fload */ \
356 2, /* dload */ \
357 2, /* aload */ \
358 1, /* iload_0 */ \
359 1, /* iload_1 */ \
360 1, /* iload_2 */ \
361 1, /* iload_3 */ \
362 1, /* lload_0 */ \
363 1, /* lload_1 */ \
364 1, /* lload_2 */ \
365 1, /* lload_3 */ \
366 1, /* fload_0 */ \
367 1, /* fload_1 */ \
368 1, /* fload_2 */ \
369 1, /* fload_3 */ \
370 1, /* dload_0 */ \
371 1, /* dload_1 */ \
372 1, /* dload_2 */ \
373 1, /* dload_3 */ \
374 1, /* aload_0 */ \
375 1, /* aload_1 */ \
376 1, /* aload_2 */ \
377 1, /* aload_3 */ \
378 1, /* iaload */ \
379 1, /* laload */ \
380 1, /* faload */ \
381 1, /* daload */ \
382 1, /* aaload */ \
383 1, /* baload */ \
384 1, /* caload */ \
385 1, /* saload */ \
386 2, /* istore */ \
387 2, /* lstore */ \
388 2, /* fstore */ \
389 2, /* dstore */ \
390 2, /* astore */ \
391 1, /* istore_0 */ \
392 1, /* istore_1 */ \
393 1, /* istore_2 */ \
394 1, /* istore_3 */ \
395 1, /* lstore_0 */ \
396 1, /* lstore_1 */ \
397 1, /* lstore_2 */ \
398 1, /* lstore_3 */ \
399 1, /* fstore_0 */ \
400 1, /* fstore_1 */ \
401 1, /* fstore_2 */ \
402 1, /* fstore_3 */ \
403 1, /* dstore_0 */ \
404 1, /* dstore_1 */ \
405 1, /* dstore_2 */ \
406 1, /* dstore_3 */ \
407 1, /* astore_0 */ \
408 1, /* astore_1 */ \
409 1, /* astore_2 */ \
410 1, /* astore_3 */ \
411 1, /* iastore */ \
412 1, /* lastore */ \
413 1, /* fastore */ \
414 1, /* dastore */ \
415 1, /* aastore */ \
416 1, /* bastore */ \
417 1, /* castore */ \
418 1, /* sastore */ \
419 1, /* pop */ \
420 1, /* pop2 */ \
421 1, /* dup */ \
422 1, /* dup_x1 */ \
423 1, /* dup_x2 */ \
424 1, /* dup2 */ \
425 1, /* dup2_x1 */ \
426 1, /* dup2_x2 */ \
427 1, /* swap */ \
428 1, /* iadd */ \
429 1, /* ladd */ \
430 1, /* fadd */ \
431 1, /* dadd */ \
432 1, /* isub */ \
433 1, /* lsub */ \
434 1, /* fsub */ \
435 1, /* dsub */ \
436 1, /* imul */ \
437 1, /* lmul */ \
438 1, /* fmul */ \
439 1, /* dmul */ \
440 1, /* idiv */ \
441 1, /* ldiv */ \
442 1, /* fdiv */ \
443 1, /* ddiv */ \
444 1, /* irem */ \
445 1, /* lrem */ \
446 1, /* frem */ \
447 1, /* drem */ \
448 1, /* ineg */ \
449 1, /* lneg */ \
450 1, /* fneg */ \
451 1, /* dneg */ \
452 1, /* ishl */ \
453 1, /* lshl */ \
454 1, /* ishr */ \
455 1, /* lshr */ \
456 1, /* iushr */ \
457 1, /* lushr */ \
458 1, /* iand */ \
459 1, /* land */ \
460 1, /* ior */ \
461 1, /* lor */ \
462 1, /* ixor */ \
463 1, /* lxor */ \
464 3, /* iinc */ \
465 1, /* i2l */ \
466 1, /* i2f */ \
467 1, /* i2d */ \
468 1, /* l2i */ \
469 1, /* l2f */ \
470 1, /* l2d */ \
471 1, /* f2i */ \
472 1, /* f2l */ \
473 1, /* f2d */ \
474 1, /* d2i */ \
475 1, /* d2l */ \
476 1, /* d2f */ \
477 1, /* i2b */ \
478 1, /* i2c */ \
479 1, /* i2s */ \
480 1, /* lcmp */ \
481 1, /* fcmpl */ \
482 1, /* fcmpg */ \
483 1, /* dcmpl */ \
484 1, /* dcmpg */ \
485 3, /* ifeq */ \
486 3, /* ifne */ \
487 3, /* iflt */ \
488 3, /* ifge */ \
489 3, /* ifgt */ \
490 3, /* ifle */ \
491 3, /* if_icmpeq */ \
492 3, /* if_icmpne */ \
493 3, /* if_icmplt */ \
494 3, /* if_icmpge */ \
495 3, /* if_icmpgt */ \
496 3, /* if_icmple */ \
497 3, /* if_acmpeq */ \
498 3, /* if_acmpne */ \
499 3, /* goto */ \
500 3, /* jsr */ \
501 2, /* ret */ \
502 99, /* tableswitch */ \
503 99, /* lookupswitch */ \
504 1, /* ireturn */ \
505 1, /* lreturn */ \
506 1, /* freturn */ \
507 1, /* dreturn */ \
508 1, /* areturn */ \
509 1, /* return */ \
510 3, /* getstatic */ \
511 3, /* putstatic */ \
512 3, /* getfield */ \
513 3, /* putfield */ \
514 3, /* invokevirtual */ \
515 3, /* invokespecial */ \
516 3, /* invokestatic */ \
517 5, /* invokeinterface */ \
518 0, /* xxxunusedxxx */ \
519 3, /* new */ \
520 2, /* newarray */ \
521 3, /* anewarray */ \
522 1, /* arraylength */ \
523 1, /* athrow */ \
524 3, /* checkcast */ \
525 3, /* instanceof */ \
526 1, /* monitorenter */ \
527 1, /* monitorexit */ \
528 0, /* wide */ \
529 4, /* multianewarray */ \
530 3, /* ifnull */ \
531 3, /* ifnonnull */ \
532 5, /* goto_w */ \
533 5 /* jsr_w */ \
534}
535
536#ifdef __cplusplus
537} /* extern "C" */
538#endif /* __cplusplus */
539
540#endif /* CLASSFILE_CONSTANTS */