1 /* 2 * Copyright (c) 1998, 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 it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * 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 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.tools.java; 27 28 /** 29 * WARNING: The contents of this source file are not part of any 30 * supported API. Code that depends on them does so at its own risk: 31 * they are subject to change or removal without notice. 32 */ 33 public interface RuntimeConstants { 34 35 /* Signature Characters */ 36 char SIGC_VOID = 'V'; 37 String SIG_VOID = "V"; 38 char SIGC_BOOLEAN = 'Z'; 39 String SIG_BOOLEAN = "Z"; 40 char SIGC_BYTE = 'B'; 41 String SIG_BYTE = "B"; 42 char SIGC_CHAR = 'C'; 43 String SIG_CHAR = "C"; 44 char SIGC_SHORT = 'S'; 45 String SIG_SHORT = "S"; 46 char SIGC_INT = 'I'; 47 String SIG_INT = "I"; 48 char SIGC_LONG = 'J'; 49 String SIG_LONG = "J"; 50 char SIGC_FLOAT = 'F'; 51 String SIG_FLOAT = "F"; 52 char SIGC_DOUBLE = 'D'; 53 String SIG_DOUBLE = "D"; 54 char SIGC_ARRAY = '['; 55 String SIG_ARRAY = "["; 56 char SIGC_CLASS = 'L'; 57 String SIG_CLASS = "L"; 58 char SIGC_METHOD = '('; 59 String SIG_METHOD = "("; 60 char SIGC_ENDCLASS = ';'; 61 String SIG_ENDCLASS = ";"; 62 char SIGC_ENDMETHOD = ')'; 63 String SIG_ENDMETHOD = ")"; 64 char SIGC_PACKAGE = '/'; 65 String SIG_PACKAGE = "/"; 66 67 /* Class File Constants */ 68 int JAVA_MAGIC = 0xcafebabe; 69 int JAVA_MIN_SUPPORTED_VERSION = 45; 70 int JAVA_MAX_SUPPORTED_VERSION = 58; 71 int JAVA_MAX_SUPPORTED_MINOR_VERSION = 0; 72 int JAVA_MIN_PREVIEW_MAJOR_VERSION = 55; // preview intro'd in JDK 11 73 int JAVA_PREVIEW_MINOR_VERSION = 0xffff; 74 75 /* Generate class file version for 1.1 by default */ 76 int JAVA_DEFAULT_VERSION = 45; 77 int JAVA_DEFAULT_MINOR_VERSION = 3; 78 79 /* Constant table */ 80 int CONSTANT_UTF8 = 1; 81 int CONSTANT_UNICODE = 2; 82 int CONSTANT_INTEGER = 3; 83 int CONSTANT_FLOAT = 4; 84 int CONSTANT_LONG = 5; 85 int CONSTANT_DOUBLE = 6; 86 int CONSTANT_CLASS = 7; 87 int CONSTANT_STRING = 8; 88 int CONSTANT_FIELD = 9; 89 int CONSTANT_METHOD = 10; 90 int CONSTANT_INTERFACEMETHOD = 11; 91 int CONSTANT_NAMEANDTYPE = 12; 92 int CONSTANT_METHODHANDLE = 15; 93 int CONSTANT_METHODTYPE = 16; 94 int CONSTANT_INVOKEDYNAMIC = 18; 95 96 /* Access and modifier flags */ 97 int ACC_PUBLIC = 0x00000001; 98 int ACC_PRIVATE = 0x00000002; 99 int ACC_PROTECTED = 0x00000004; 100 int ACC_STATIC = 0x00000008; 101 int ACC_FINAL = 0x00000010; 102 int ACC_SYNCHRONIZED = 0x00000020; 103 int ACC_VOLATILE = 0x00000040; 104 int ACC_TRANSIENT = 0x00000080; 105 int ACC_NATIVE = 0x00000100; 106 int ACC_INTERFACE = 0x00000200; 107 int ACC_ABSTRACT = 0x00000400; 108 int ACC_SUPER = 0x00000020; 109 int ACC_STRICT = 0x00000800; 110 111 /* Type codes */ 112 int T_CLASS = 0x00000002; 113 int T_BOOLEAN = 0x00000004; 114 int T_CHAR = 0x00000005; 115 int T_FLOAT = 0x00000006; 116 int T_DOUBLE = 0x00000007; 117 int T_BYTE = 0x00000008; 118 int T_SHORT = 0x00000009; 119 int T_INT = 0x0000000a; 120 int T_LONG = 0x0000000b; 121 122 /* Opcodes */ 123 int opc_try = -3; 124 int opc_dead = -2; 125 int opc_label = -1; 126 int opc_nop = 0; 127 int opc_aconst_null = 1; 128 int opc_iconst_m1 = 2; 129 int opc_iconst_0 = 3; 130 int opc_iconst_1 = 4; 131 int opc_iconst_2 = 5; 132 int opc_iconst_3 = 6; 133 int opc_iconst_4 = 7; 134 int opc_iconst_5 = 8; 135 int opc_lconst_0 = 9; 136 int opc_lconst_1 = 10; 137 int opc_fconst_0 = 11; 138 int opc_fconst_1 = 12; 139 int opc_fconst_2 = 13; 140 int opc_dconst_0 = 14; 141 int opc_dconst_1 = 15; 142 int opc_bipush = 16; 143 int opc_sipush = 17; 144 int opc_ldc = 18; 145 int opc_ldc_w = 19; 146 int opc_ldc2_w = 20; 147 int opc_iload = 21; 148 int opc_lload = 22; 149 int opc_fload = 23; 150 int opc_dload = 24; 151 int opc_aload = 25; 152 int opc_iload_0 = 26; 153 int opc_iload_1 = 27; 154 int opc_iload_2 = 28; 155 int opc_iload_3 = 29; 156 int opc_lload_0 = 30; 157 int opc_lload_1 = 31; 158 int opc_lload_2 = 32; 159 int opc_lload_3 = 33; 160 int opc_fload_0 = 34; 161 int opc_fload_1 = 35; 162 int opc_fload_2 = 36; 163 int opc_fload_3 = 37; 164 int opc_dload_0 = 38; 165 int opc_dload_1 = 39; 166 int opc_dload_2 = 40; 167 int opc_dload_3 = 41; 168 int opc_aload_0 = 42; 169 int opc_aload_1 = 43; 170 int opc_aload_2 = 44; 171 int opc_aload_3 = 45; 172 int opc_iaload = 46; 173 int opc_laload = 47; 174 int opc_faload = 48; 175 int opc_daload = 49; 176 int opc_aaload = 50; 177 int opc_baload = 51; 178 int opc_caload = 52; 179 int opc_saload = 53; 180 int opc_istore = 54; 181 int opc_lstore = 55; 182 int opc_fstore = 56; 183 int opc_dstore = 57; 184 int opc_astore = 58; 185 int opc_istore_0 = 59; 186 int opc_istore_1 = 60; 187 int opc_istore_2 = 61; 188 int opc_istore_3 = 62; 189 int opc_lstore_0 = 63; 190 int opc_lstore_1 = 64; 191 int opc_lstore_2 = 65; 192 int opc_lstore_3 = 66; 193 int opc_fstore_0 = 67; 194 int opc_fstore_1 = 68; 195 int opc_fstore_2 = 69; 196 int opc_fstore_3 = 70; 197 int opc_dstore_0 = 71; 198 int opc_dstore_1 = 72; 199 int opc_dstore_2 = 73; 200 int opc_dstore_3 = 74; 201 int opc_astore_0 = 75; 202 int opc_astore_1 = 76; 203 int opc_astore_2 = 77; 204 int opc_astore_3 = 78; 205 int opc_iastore = 79; 206 int opc_lastore = 80; 207 int opc_fastore = 81; 208 int opc_dastore = 82; 209 int opc_aastore = 83; 210 int opc_bastore = 84; 211 int opc_castore = 85; 212 int opc_sastore = 86; 213 int opc_pop = 87; 214 int opc_pop2 = 88; 215 int opc_dup = 89; 216 int opc_dup_x1 = 90; 217 int opc_dup_x2 = 91; 218 int opc_dup2 = 92; 219 int opc_dup2_x1 = 93; 220 int opc_dup2_x2 = 94; 221 int opc_swap = 95; 222 int opc_iadd = 96; 223 int opc_ladd = 97; 224 int opc_fadd = 98; 225 int opc_dadd = 99; 226 int opc_isub = 100; 227 int opc_lsub = 101; 228 int opc_fsub = 102; 229 int opc_dsub = 103; 230 int opc_imul = 104; 231 int opc_lmul = 105; 232 int opc_fmul = 106; 233 int opc_dmul = 107; 234 int opc_idiv = 108; 235 int opc_ldiv = 109; 236 int opc_fdiv = 110; 237 int opc_ddiv = 111; 238 int opc_irem = 112; 239 int opc_lrem = 113; 240 int opc_frem = 114; 241 int opc_drem = 115; 242 int opc_ineg = 116; 243 int opc_lneg = 117; 244 int opc_fneg = 118; 245 int opc_dneg = 119; 246 int opc_ishl = 120; 247 int opc_lshl = 121; 248 int opc_ishr = 122; 249 int opc_lshr = 123; 250 int opc_iushr = 124; 251 int opc_lushr = 125; 252 int opc_iand = 126; 253 int opc_land = 127; 254 int opc_ior = 128; 255 int opc_lor = 129; 256 int opc_ixor = 130; 257 int opc_lxor = 131; 258 int opc_iinc = 132; 259 int opc_i2l = 133; 260 int opc_i2f = 134; 261 int opc_i2d = 135; 262 int opc_l2i = 136; 263 int opc_l2f = 137; 264 int opc_l2d = 138; 265 int opc_f2i = 139; 266 int opc_f2l = 140; 267 int opc_f2d = 141; 268 int opc_d2i = 142; 269 int opc_d2l = 143; 270 int opc_d2f = 144; 271 int opc_i2b = 145; 272 int opc_i2c = 146; 273 int opc_i2s = 147; 274 int opc_lcmp = 148; 275 int opc_fcmpl = 149; 276 int opc_fcmpg = 150; 277 int opc_dcmpl = 151; 278 int opc_dcmpg = 152; 279 int opc_ifeq = 153; 280 int opc_ifne = 154; 281 int opc_iflt = 155; 282 int opc_ifge = 156; 283 int opc_ifgt = 157; 284 int opc_ifle = 158; 285 int opc_if_icmpeq = 159; 286 int opc_if_icmpne = 160; 287 int opc_if_icmplt = 161; 288 int opc_if_icmpge = 162; 289 int opc_if_icmpgt = 163; 290 int opc_if_icmple = 164; 291 int opc_if_acmpeq = 165; 292 int opc_if_acmpne = 166; 293 int opc_goto = 167; 294 int opc_jsr = 168; 295 int opc_ret = 169; 296 int opc_tableswitch = 170; 297 int opc_lookupswitch = 171; 298 int opc_ireturn = 172; 299 int opc_lreturn = 173; 300 int opc_freturn = 174; 301 int opc_dreturn = 175; 302 int opc_areturn = 176; 303 int opc_return = 177; 304 int opc_getstatic = 178; 305 int opc_putstatic = 179; 306 int opc_getfield = 180; 307 int opc_putfield = 181; 308 int opc_invokevirtual = 182; 309 int opc_invokespecial = 183; 310 int opc_invokestatic = 184; 311 int opc_invokeinterface = 185; 312 int opc_invokedynamic = 186; 313 int opc_new = 187; 314 int opc_newarray = 188; 315 int opc_anewarray = 189; 316 int opc_arraylength = 190; 317 int opc_athrow = 191; 318 int opc_checkcast = 192; 319 int opc_instanceof = 193; 320 int opc_monitorenter = 194; 321 int opc_monitorexit = 195; 322 int opc_wide = 196; 323 int opc_multianewarray = 197; 324 int opc_ifnull = 198; 325 int opc_ifnonnull = 199; 326 int opc_goto_w = 200; 327 int opc_jsr_w = 201; 328 int opc_breakpoint = 202; 329 330 /* Opcode Names */ 331 String opcNames[] = { 332 "nop", 333 "aconst_null", 334 "iconst_m1", 335 "iconst_0", 336 "iconst_1", 337 "iconst_2", 338 "iconst_3", 339 "iconst_4", 340 "iconst_5", 341 "lconst_0", 342 "lconst_1", 343 "fconst_0", 344 "fconst_1", 345 "fconst_2", 346 "dconst_0", 347 "dconst_1", 348 "bipush", 349 "sipush", 350 "ldc", 351 "ldc_w", 352 "ldc2_w", 353 "iload", 354 "lload", 355 "fload", 356 "dload", 357 "aload", 358 "iload_0", 359 "iload_1", 360 "iload_2", 361 "iload_3", 362 "lload_0", 363 "lload_1", 364 "lload_2", 365 "lload_3", 366 "fload_0", 367 "fload_1", 368 "fload_2", 369 "fload_3", 370 "dload_0", 371 "dload_1", 372 "dload_2", 373 "dload_3", 374 "aload_0", 375 "aload_1", 376 "aload_2", 377 "aload_3", 378 "iaload", 379 "laload", 380 "faload", 381 "daload", 382 "aaload", 383 "baload", 384 "caload", 385 "saload", 386 "istore", 387 "lstore", 388 "fstore", 389 "dstore", 390 "astore", 391 "istore_0", 392 "istore_1", 393 "istore_2", 394 "istore_3", 395 "lstore_0", 396 "lstore_1", 397 "lstore_2", 398 "lstore_3", 399 "fstore_0", 400 "fstore_1", 401 "fstore_2", 402 "fstore_3", 403 "dstore_0", 404 "dstore_1", 405 "dstore_2", 406 "dstore_3", 407 "astore_0", 408 "astore_1", 409 "astore_2", 410 "astore_3", 411 "iastore", 412 "lastore", 413 "fastore", 414 "dastore", 415 "aastore", 416 "bastore", 417 "castore", 418 "sastore", 419 "pop", 420 "pop2", 421 "dup", 422 "dup_x1", 423 "dup_x2", 424 "dup2", 425 "dup2_x1", 426 "dup2_x2", 427 "swap", 428 "iadd", 429 "ladd", 430 "fadd", 431 "dadd", 432 "isub", 433 "lsub", 434 "fsub", 435 "dsub", 436 "imul", 437 "lmul", 438 "fmul", 439 "dmul", 440 "idiv", 441 "ldiv", 442 "fdiv", 443 "ddiv", 444 "irem", 445 "lrem", 446 "frem", 447 "drem", 448 "ineg", 449 "lneg", 450 "fneg", 451 "dneg", 452 "ishl", 453 "lshl", 454 "ishr", 455 "lshr", 456 "iushr", 457 "lushr", 458 "iand", 459 "land", 460 "ior", 461 "lor", 462 "ixor", 463 "lxor", 464 "iinc", 465 "i2l", 466 "i2f", 467 "i2d", 468 "l2i", 469 "l2f", 470 "l2d", 471 "f2i", 472 "f2l", 473 "f2d", 474 "d2i", 475 "d2l", 476 "d2f", 477 "i2b", 478 "i2c", 479 "i2s", 480 "lcmp", 481 "fcmpl", 482 "fcmpg", 483 "dcmpl", 484 "dcmpg", 485 "ifeq", 486 "ifne", 487 "iflt", 488 "ifge", 489 "ifgt", 490 "ifle", 491 "if_icmpeq", 492 "if_icmpne", 493 "if_icmplt", 494 "if_icmpge", 495 "if_icmpgt", 496 "if_icmple", 497 "if_acmpeq", 498 "if_acmpne", 499 "goto", 500 "jsr", 501 "ret", 502 "tableswitch", 503 "lookupswitch", 504 "ireturn", 505 "lreturn", 506 "freturn", 507 "dreturn", 508 "areturn", 509 "return", 510 "getstatic", 511 "putstatic", 512 "getfield", 513 "putfield", 514 "invokevirtual", 515 "invokespecial", 516 "invokestatic", 517 "invokeinterface", 518 "invokedynamic", 519 "new", 520 "newarray", 521 "anewarray", 522 "arraylength", 523 "athrow", 524 "checkcast", 525 "instanceof", 526 "monitorenter", 527 "monitorexit", 528 "wide", 529 "multianewarray", 530 "ifnull", 531 "ifnonnull", 532 "goto_w", 533 "jsr_w", 534 "breakpoint" 535 }; 536 537 /* Opcode Lengths */ 538 int opcLengths[] = { 539 1, 540 1, 541 1, 542 1, 543 1, 544 1, 545 1, 546 1, 547 1, 548 1, 549 1, 550 1, 551 1, 552 1, 553 1, 554 1, 555 2, 556 3, 557 2, 558 3, 559 3, 560 2, 561 2, 562 2, 563 2, 564 2, 565 1, 566 1, 567 1, 568 1, 569 1, 570 1, 571 1, 572 1, 573 1, 574 1, 575 1, 576 1, 577 1, 578 1, 579 1, 580 1, 581 1, 582 1, 583 1, 584 1, 585 1, 586 1, 587 1, 588 1, 589 1, 590 1, 591 1, 592 1, 593 2, 594 2, 595 2, 596 2, 597 2, 598 1, 599 1, 600 1, 601 1, 602 1, 603 1, 604 1, 605 1, 606 1, 607 1, 608 1, 609 1, 610 1, 611 1, 612 1, 613 1, 614 1, 615 1, 616 1, 617 1, 618 1, 619 1, 620 1, 621 1, 622 1, 623 1, 624 1, 625 1, 626 1, 627 1, 628 1, 629 1, 630 1, 631 1, 632 1, 633 1, 634 1, 635 1, 636 1, 637 1, 638 1, 639 1, 640 1, 641 1, 642 1, 643 1, 644 1, 645 1, 646 1, 647 1, 648 1, 649 1, 650 1, 651 1, 652 1, 653 1, 654 1, 655 1, 656 1, 657 1, 658 1, 659 1, 660 1, 661 1, 662 1, 663 1, 664 1, 665 1, 666 1, 667 1, 668 1, 669 1, 670 1, 671 3, 672 1, 673 1, 674 1, 675 1, 676 1, 677 1, 678 1, 679 1, 680 1, 681 1, 682 1, 683 1, 684 1, 685 1, 686 1, 687 1, 688 1, 689 1, 690 1, 691 1, 692 3, 693 3, 694 3, 695 3, 696 3, 697 3, 698 3, 699 3, 700 3, 701 3, 702 3, 703 3, 704 3, 705 3, 706 3, 707 3, 708 2, 709 99, 710 99, 711 1, 712 1, 713 1, 714 1, 715 1, 716 1, 717 3, 718 3, 719 3, 720 3, 721 3, 722 3, 723 3, 724 5, 725 5, 726 3, 727 2, 728 3, 729 1, 730 1, 731 3, 732 3, 733 1, 734 1, 735 0, 736 4, 737 3, 738 3, 739 5, 740 5, 741 1 742 }; 743 744 }