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