001 /* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013 package org.jikesrvm.classloader; 014 015 /** 016 * Information about java byte codes that appear in the "code" attribute 017 * of a .class file. 018 */ 019 public interface BytecodeConstants { 020 // The following mnemonics are defined in Chapter 10 of The Java Virtual Machine Specification. 021 // 022 int JBC_nop = 0; 023 int JBC_aconst_null = 1; 024 int JBC_iconst_m1 = 2; 025 int JBC_iconst_0 = 3; 026 int JBC_iconst_1 = 4; 027 int JBC_iconst_2 = 5; 028 int JBC_iconst_3 = 6; 029 int JBC_iconst_4 = 7; 030 int JBC_iconst_5 = 8; 031 int JBC_lconst_0 = 9; 032 int JBC_lconst_1 = 10; 033 int JBC_fconst_0 = 11; 034 int JBC_fconst_1 = 12; 035 int JBC_fconst_2 = 13; 036 int JBC_dconst_0 = 14; 037 int JBC_dconst_1 = 15; 038 int JBC_bipush = 16; 039 int JBC_sipush = 17; 040 int JBC_ldc = 18; 041 int JBC_ldc_w = 19; 042 int JBC_ldc2_w = 20; 043 int JBC_iload = 21; 044 int JBC_lload = 22; 045 int JBC_fload = 23; 046 int JBC_dload = 24; 047 int JBC_aload = 25; 048 int JBC_iload_0 = 26; 049 int JBC_iload_1 = 27; 050 int JBC_iload_2 = 28; 051 int JBC_iload_3 = 29; 052 int JBC_lload_0 = 30; 053 int JBC_lload_1 = 31; 054 int JBC_lload_2 = 32; 055 int JBC_lload_3 = 33; 056 int JBC_fload_0 = 34; 057 int JBC_fload_1 = 35; 058 int JBC_fload_2 = 36; 059 int JBC_fload_3 = 37; 060 int JBC_dload_0 = 38; 061 int JBC_dload_1 = 39; 062 int JBC_dload_2 = 40; 063 int JBC_dload_3 = 41; 064 int JBC_aload_0 = 42; 065 int JBC_aload_1 = 43; 066 int JBC_aload_2 = 44; 067 int JBC_aload_3 = 45; 068 int JBC_iaload = 46; 069 int JBC_laload = 47; 070 int JBC_faload = 48; 071 int JBC_daload = 49; 072 int JBC_aaload = 50; 073 int JBC_baload = 51; 074 int JBC_caload = 52; 075 int JBC_saload = 53; 076 int JBC_istore = 54; 077 int JBC_lstore = 55; 078 int JBC_fstore = 56; 079 int JBC_dstore = 57; 080 int JBC_astore = 58; 081 int JBC_istore_0 = 59; 082 int JBC_istore_1 = 60; 083 int JBC_istore_2 = 61; 084 int JBC_istore_3 = 62; 085 int JBC_lstore_0 = 63; 086 int JBC_lstore_1 = 64; 087 int JBC_lstore_2 = 65; 088 int JBC_lstore_3 = 66; 089 int JBC_fstore_0 = 67; 090 int JBC_fstore_1 = 68; 091 int JBC_fstore_2 = 69; 092 int JBC_fstore_3 = 70; 093 int JBC_dstore_0 = 71; 094 int JBC_dstore_1 = 72; 095 int JBC_dstore_2 = 73; 096 int JBC_dstore_3 = 74; 097 int JBC_astore_0 = 75; 098 int JBC_astore_1 = 76; 099 int JBC_astore_2 = 77; 100 int JBC_astore_3 = 78; 101 int JBC_iastore = 79; 102 int JBC_lastore = 80; 103 int JBC_fastore = 81; 104 int JBC_dastore = 82; 105 int JBC_aastore = 83; 106 int JBC_bastore = 84; 107 int JBC_castore = 85; 108 int JBC_sastore = 86; 109 int JBC_pop = 87; 110 int JBC_pop2 = 88; 111 int JBC_dup = 89; 112 int JBC_dup_x1 = 90; 113 int JBC_dup_x2 = 91; 114 int JBC_dup2 = 92; 115 int JBC_dup2_x1 = 93; 116 int JBC_dup2_x2 = 94; 117 int JBC_swap = 95; 118 int JBC_iadd = 96; 119 int JBC_ladd = 97; 120 int JBC_fadd = 98; 121 int JBC_dadd = 99; 122 int JBC_isub = 100; 123 int JBC_lsub = 101; 124 int JBC_fsub = 102; 125 int JBC_dsub = 103; 126 int JBC_imul = 104; 127 int JBC_lmul = 105; 128 int JBC_fmul = 106; 129 int JBC_dmul = 107; 130 int JBC_idiv = 108; 131 int JBC_ldiv = 109; 132 int JBC_fdiv = 110; 133 int JBC_ddiv = 111; 134 int JBC_irem = 112; 135 int JBC_lrem = 113; 136 int JBC_frem = 114; 137 int JBC_drem = 115; 138 int JBC_ineg = 116; 139 int JBC_lneg = 117; 140 int JBC_fneg = 118; 141 int JBC_dneg = 119; 142 int JBC_ishl = 120; 143 int JBC_lshl = 121; 144 int JBC_ishr = 122; 145 int JBC_lshr = 123; 146 int JBC_iushr = 124; 147 int JBC_lushr = 125; 148 int JBC_iand = 126; 149 int JBC_land = 127; 150 int JBC_ior = 128; 151 int JBC_lor = 129; 152 int JBC_ixor = 130; 153 int JBC_lxor = 131; 154 int JBC_iinc = 132; 155 int JBC_i2l = 133; 156 int JBC_i2f = 134; 157 int JBC_i2d = 135; 158 int JBC_l2i = 136; 159 int JBC_l2f = 137; 160 int JBC_l2d = 138; 161 int JBC_f2i = 139; 162 int JBC_f2l = 140; 163 int JBC_f2d = 141; 164 int JBC_d2i = 142; 165 int JBC_d2l = 143; 166 int JBC_d2f = 144; 167 int JBC_int2byte = 145; 168 int JBC_int2char = 146; 169 int JBC_int2short = 147; 170 int JBC_lcmp = 148; 171 int JBC_fcmpl = 149; 172 int JBC_fcmpg = 150; 173 int JBC_dcmpl = 151; 174 int JBC_dcmpg = 152; 175 int JBC_ifeq = 153; 176 int JBC_ifne = 154; 177 int JBC_iflt = 155; 178 int JBC_ifge = 156; 179 int JBC_ifgt = 157; 180 int JBC_ifle = 158; 181 int JBC_if_icmpeq = 159; 182 int JBC_if_icmpne = 160; 183 int JBC_if_icmplt = 161; 184 int JBC_if_icmpge = 162; 185 int JBC_if_icmpgt = 163; 186 int JBC_if_icmple = 164; 187 int JBC_if_acmpeq = 165; 188 int JBC_if_acmpne = 166; 189 int JBC_goto = 167; 190 int JBC_jsr = 168; 191 int JBC_ret = 169; 192 int JBC_tableswitch = 170; 193 int JBC_lookupswitch = 171; 194 int JBC_ireturn = 172; 195 int JBC_lreturn = 173; 196 int JBC_freturn = 174; 197 int JBC_dreturn = 175; 198 int JBC_areturn = 176; 199 int JBC_return = 177; 200 int JBC_getstatic = 178; 201 int JBC_putstatic = 179; 202 int JBC_getfield = 180; 203 int JBC_putfield = 181; 204 int JBC_invokevirtual = 182; 205 int JBC_invokespecial = 183; 206 int JBC_invokestatic = 184; 207 int JBC_invokeinterface = 185; 208 int JBC_xxxunusedxxx = 186; 209 int JBC_new = 187; 210 int JBC_newarray = 188; 211 int JBC_anewarray = 189; 212 int JBC_arraylength = 190; 213 int JBC_athrow = 191; 214 int JBC_checkcast = 192; 215 int JBC_instanceof = 193; 216 int JBC_monitorenter = 194; 217 int JBC_monitorexit = 195; 218 int JBC_wide = 196; 219 int JBC_multianewarray = 197; 220 int JBC_ifnull = 198; 221 int JBC_ifnonnull = 199; 222 int JBC_goto_w = 200; 223 int JBC_jsr_w = 201; 224 225 int JBC_impdep1 = 254; 226 int JBC_impdep2 = 255; 227 228 // Length of each instruction introduced by the above bytecodes. 229 // -1 indicates a variable length instruction. 230 // -2 indicates an unused instruction. 231 // 232 byte[] JBC_length = {1, // nop 233 1, // aconst_null 234 1, // iconst_m1 235 1, // iconst_0 236 1, // iconst_1 237 1, // iconst_2 238 1, // iconst_3 239 1, // iconst_4 240 1, // iconst_5 241 1, // lconst_0 242 1, // lconst_1 243 1, // fconst_0 244 1, // fconst_1 245 1, // fconst_2 246 1, // dconst_0 247 1, // dconst_1 248 2, // bipush 249 3, // sipush 250 2, // ldc 251 3, // ldc_w 252 3, // ldc2_w 253 2, // iload 254 2, // lload 255 2, // fload 256 2, // dload 257 2, // aload 258 1, // iload_0 259 1, // iload_1 260 1, // iload_2 261 1, // iload_3 262 1, // lload_0 263 1, // lload_1 264 1, // lload_2 265 1, // lload_3 266 1, // fload_0 267 1, // fload_1 268 1, // fload_2 269 1, // fload_3 270 1, // dload_0 271 1, // dload_1 272 1, // dload_2 273 1, // dload_3 274 1, // aload_0 275 1, // aload_1 276 1, // aload_2 277 1, // aload_3 278 1, // iaload 279 1, // laload 280 1, // faload 281 1, // daload 282 1, // aaload 283 1, // baload 284 1, // caload 285 1, // saload 286 2, // istore 287 2, // lstore 288 2, // fstore 289 2, // dstore 290 2, // astore 291 1, // istore_0 292 1, // istore_1 293 1, // istore_2 294 1, // istore_3 295 1, // lstore_0 296 1, // lstore_1 297 1, // lstore_2 298 1, // lstore_3 299 1, // fstore_0 300 1, // fstore_1 301 1, // fstore_2 302 1, // fstore_3 303 1, // dstore_0 304 1, // dstore_1 305 1, // dstore_2 306 1, // dstore_3 307 1, // astore_0 308 1, // astore_1 309 1, // astore_2 310 1, // astore_3 311 1, // iastore 312 1, // lastore 313 1, // fastore 314 1, // dastore 315 1, // aastore 316 1, // bastore 317 1, // castore 318 1, // sastore 319 1, // pop 320 1, // pop2 321 1, // dup 322 1, // dup_x1 323 1, // dup_x2 324 1, // dup2 325 1, // dup2_x1 326 1, // dup2_x2 327 1, // swap 328 1, // iadd 329 1, // ladd 330 1, // fadd 331 1, // dadd 332 1, // isub 333 1, // lsub 334 1, // fsub 335 1, // dsub 336 1, // imul 337 1, // lmul 338 1, // fmul 339 1, // dmul 340 1, // idiv 341 1, // ldiv 342 1, // fdiv 343 1, // ddiv 344 1, // irem 345 1, // lrem 346 1, // frem 347 1, // drem 348 1, // ineg 349 1, // lneg 350 1, // fneg 351 1, // dneg 352 1, // ishl 353 1, // lshl 354 1, // ishr 355 1, // lshr 356 1, // iushr 357 1, // lushr 358 1, // iand 359 1, // land 360 1, // ior 361 1, // lor 362 1, // ixor 363 1, // lxor 364 3, // iinc 365 1, // i2l 366 1, // i2f 367 1, // i2d 368 1, // l2i 369 1, // l2f 370 1, // l2d 371 1, // f2i 372 1, // f2l 373 1, // f2d 374 1, // d2i 375 1, // d2l 376 1, // d2f 377 1, // int2byte 378 1, // int2char 379 1, // int2short 380 1, // lcmp 381 1, // fcmpl 382 1, // fcmpg 383 1, // dcmpl 384 1, // dcmpg 385 3, // ifeq 386 3, // ifne 387 3, // iflt 388 3, // ifge 389 3, // ifgt 390 3, // ifle 391 3, // if_icmpeq 392 3, // if_icmpne 393 3, // if_icmplt 394 3, // if_icmpge 395 3, // if_icmpgt 396 3, // if_icmple 397 3, // if_acmpeq 398 3, // if_acmpne 399 3, // goto 400 3, // jsr 401 2, // ret 402 -1, // tableswitch 403 -1, // lookupswitch 404 1, // ireturn 405 1, // lreturn 406 1, // freturn 407 1, // dreturn 408 1, // areturn 409 1, // return 410 3, // getstatic 411 3, // putstatic 412 3, // getfield 413 3, // putfield 414 3, // invokevirtual 415 3, // invokenonvirtual 416 3, // invokestatic 417 5, // invokeinterface 418 -2, // xxxunusedxxx 419 3, // new 420 2, // newarray 421 3, // anewarray 422 1, // arraylength 423 1, // athrow 424 3, // checkcast 425 3, // instanceof 426 1, // monitorenter 427 1, // monitorexit 428 -1, // wide 429 4, // multianewarray 430 3, // ifnull 431 3, // ifnonnull 432 5, // goto_w 433 5, // jsr_w 434 -2, // 202 435 -2, // 203 436 -2, // 204 437 -2, // 205 438 -2, // 206 439 -2, // 207 440 -2, // 208 441 -2, // 209 442 -2, // 210 443 -2, // 211 444 -2, // 212 445 -2, // 213 446 -2, // 214 447 -2, // 215 448 -2, // 216 449 -2, // 217 450 -2, // 218 451 -2, // 219 452 -2, // 220 453 -2, // 221 454 -2, // 222 455 -2, // 223 456 -2, // 224 457 -2, // 225 458 -2, // 226 459 -2, // 227 460 -2, // 228 461 -2, // 229 462 -2, // 230 463 -2, // 231 464 -2, // 232 465 -2, // 233 466 -2, // 234 467 -2, // 235 468 -2, // 236 469 -2, // 237 470 -2, // 238 471 -2, // 239 472 -2, // 240 473 -2, // 241 474 -2, // 242 475 -2, // 243 476 -2, // 244 477 -2, // 245 478 -2, // 246 479 -2, // 247 480 -2, // 248 481 -2, // 249 482 -2, // 250 483 -2, // 251 484 -2, // 252 485 -2, // 253 486 -1, // impdep1 254 487 -2, // 255 488 }; 489 490 /** 491 * Bytecode names (for debugging/printing) 492 */ 493 String[] JBC_name = 494 {"nop", 495 "aconst_null", 496 "iconst_m1", 497 "iconst_0", 498 "iconst_1", 499 "iconst_2", 500 "iconst_3", 501 "iconst_4", 502 "iconst_5", 503 "lconst_0", 504 "lconst_1", 505 "fconst_0", 506 "fconst_1", 507 "fconst_2", 508 "dconst_0", 509 "dconst_1", 510 "bipush", 511 "sipush", 512 "ldc", 513 "ldc_w", 514 "ldc2_w", 515 "iload", 516 "lload", 517 "fload", 518 "dload", 519 "aload", 520 "iload_0", 521 "iload_1", 522 "iload_2", 523 "iload_3", 524 "lload_0", 525 "lload_1", 526 "lload_2", 527 "lload_3", 528 "fload_0", 529 "fload_1", 530 "fload_2", 531 " fload_3", 532 " dload_0", 533 " dload_1", 534 " dload_2", 535 " dload_3", 536 " aload_0", 537 " aload_1", 538 " aload_2", 539 " aload_3", 540 " iaload", 541 " laload", 542 " faload", 543 " daload", 544 " aaload", 545 " baload", 546 " caload", 547 " saload", 548 " istore", 549 " lstore", 550 " fstore", 551 " dstore", 552 " astore", 553 " istore_0", 554 " istore_1", 555 " istore_2", 556 " istore_3", 557 " lstore_0", 558 " lstore_1", 559 " lstore_2", 560 " lstore_3", 561 " fstore_0", 562 " fstore_1", 563 " fstore_2", 564 " fstore_3", 565 " dstore_0", 566 " dstore_1", 567 " dstore_2", 568 " dstore_3", 569 " astore_0", 570 " astore_1", 571 " astore_2", 572 " astore_3", 573 "iastore", 574 "lastore", 575 "fastore", 576 "dastore", 577 "aastore", 578 "bastore", 579 "castore", 580 "sastore", 581 "pop", 582 "pop2", 583 "dup", 584 "dup_x1", 585 "dup_x2", 586 "dup2", 587 "dup2_x1", 588 "dup2_x2", 589 "swap", 590 "iadd", 591 "ladd", 592 "fadd", 593 "dadd", 594 "isub", 595 "lsub", 596 "fsub", 597 "dsub", 598 "imul", 599 "lmul", 600 "fmul", 601 "dmul", 602 "idiv", 603 "ldiv", 604 "fdiv", 605 "ddiv", 606 "irem", 607 "lrem", 608 "frem", 609 "drem", 610 "ineg", 611 "lneg", 612 "fneg", 613 "dneg", 614 "ishl", 615 "lshl", 616 "ishr", 617 "lshr", 618 "iushr", 619 "lushr", 620 "iand", 621 "land", 622 "ior", 623 "lor", 624 "ixor", 625 "lxor", 626 "iinc", 627 "i2l", 628 "i2f", 629 "i2d", 630 "l2i", 631 "l2f", 632 "l2d", 633 "f2i", 634 "f2l", 635 "f2d", 636 "d2i", 637 "d2l", 638 "d2f", 639 "int2byte", 640 "int2char", 641 "int2short", 642 "lcmp", 643 "fcmpl", 644 "fcmpg", 645 "dcmpl", 646 "dcmpg", 647 "ifeq", 648 "ifne", 649 "iflt", 650 "ifge", 651 "ifgt", 652 "ifle", 653 "if_icmpeq", 654 "if_icmpne", 655 "if_icmplt", 656 "if_icmpge", 657 "if_icmpgt", 658 "if_icmple", 659 "if_acmpeq", 660 "if_acmpne", 661 "goto", 662 "jsr", 663 "ret", 664 " tableswitch", 665 " lookupswitch", 666 "ireturn", 667 "lreturn", 668 "freturn", 669 "dreturn", 670 "areturn", 671 "return", 672 "getstatic", 673 "putstatic", 674 "getfield", 675 "putfield", 676 "invokevirtual", 677 "invokenonvirtual", 678 "invokestatic", 679 "invokeinterface", 680 " xxxunusedxxx", 681 "new", 682 "newarray", 683 "anewarray", 684 "arraylength", 685 "athrow", 686 "checkcast", 687 "instanceof", 688 "monitorenter", 689 "monitorexit", 690 " wide", 691 "multianewarray", 692 "ifnull", 693 "ifnonnull", 694 "goto_w", 695 "jsr_w",}; 696 697 }