1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.dx.io; 18 19 import com.android.dx.io.instructions.InstructionCodec; 20 import com.android.dx.util.Hex; 21 22 /** 23 * Information about each Dalvik opcode. 24 */ 25 public final class OpcodeInfo { 26 /* 27 * TODO: Merge at least most of the info from the Dops class into 28 * this one. 29 */ 30 31 /** non-null; array containing all the information */ 32 private static final Info[] INFO; 33 34 /** 35 * pseudo-opcode used for nonstandard formatted "instructions" 36 * (which are mostly not actually instructions, though they do 37 * appear in instruction lists). TODO: Retire the usage of this 38 * constant. 39 */ 40 public static final Info SPECIAL_FORMAT = 41 new Info(Opcodes.SPECIAL_FORMAT, "<special>", 42 InstructionCodec.FORMAT_00X, IndexType.NONE); 43 44 // TODO: These payload opcodes should be generated by opcode-gen. 45 46 public static final Info PACKED_SWITCH_PAYLOAD = 47 new Info(Opcodes.PACKED_SWITCH_PAYLOAD, "packed-switch-payload", 48 InstructionCodec.FORMAT_PACKED_SWITCH_PAYLOAD, 49 IndexType.NONE); 50 51 public static final Info SPARSE_SWITCH_PAYLOAD = 52 new Info(Opcodes.SPARSE_SWITCH_PAYLOAD, "sparse-switch-payload", 53 InstructionCodec.FORMAT_SPARSE_SWITCH_PAYLOAD, 54 IndexType.NONE); 55 56 public static final Info FILL_ARRAY_DATA_PAYLOAD = 57 new Info(Opcodes.FILL_ARRAY_DATA_PAYLOAD, "fill-array-data-payload", 58 InstructionCodec.FORMAT_FILL_ARRAY_DATA_PAYLOAD, 59 IndexType.NONE); 60 61 // BEGIN(opcode-info-defs); GENERATED AUTOMATICALLY BY opcode-gen 62 public static final Info NOP = 63 new Info(Opcodes.NOP, "nop", 64 InstructionCodec.FORMAT_10X, IndexType.NONE); 65 66 public static final Info MOVE = 67 new Info(Opcodes.MOVE, "move", 68 InstructionCodec.FORMAT_12X, IndexType.NONE); 69 70 public static final Info MOVE_FROM16 = 71 new Info(Opcodes.MOVE_FROM16, "move/from16", 72 InstructionCodec.FORMAT_22X, IndexType.NONE); 73 74 public static final Info MOVE_16 = 75 new Info(Opcodes.MOVE_16, "move/16", 76 InstructionCodec.FORMAT_32X, IndexType.NONE); 77 78 public static final Info MOVE_WIDE = 79 new Info(Opcodes.MOVE_WIDE, "move-wide", 80 InstructionCodec.FORMAT_12X, IndexType.NONE); 81 82 public static final Info MOVE_WIDE_FROM16 = 83 new Info(Opcodes.MOVE_WIDE_FROM16, "move-wide/from16", 84 InstructionCodec.FORMAT_22X, IndexType.NONE); 85 86 public static final Info MOVE_WIDE_16 = 87 new Info(Opcodes.MOVE_WIDE_16, "move-wide/16", 88 InstructionCodec.FORMAT_32X, IndexType.NONE); 89 90 public static final Info MOVE_OBJECT = 91 new Info(Opcodes.MOVE_OBJECT, "move-object", 92 InstructionCodec.FORMAT_12X, IndexType.NONE); 93 94 public static final Info MOVE_OBJECT_FROM16 = 95 new Info(Opcodes.MOVE_OBJECT_FROM16, "move-object/from16", 96 InstructionCodec.FORMAT_22X, IndexType.NONE); 97 98 public static final Info MOVE_OBJECT_16 = 99 new Info(Opcodes.MOVE_OBJECT_16, "move-object/16", 100 InstructionCodec.FORMAT_32X, IndexType.NONE); 101 102 public static final Info MOVE_RESULT = 103 new Info(Opcodes.MOVE_RESULT, "move-result", 104 InstructionCodec.FORMAT_11X, IndexType.NONE); 105 106 public static final Info MOVE_RESULT_WIDE = 107 new Info(Opcodes.MOVE_RESULT_WIDE, "move-result-wide", 108 InstructionCodec.FORMAT_11X, IndexType.NONE); 109 110 public static final Info MOVE_RESULT_OBJECT = 111 new Info(Opcodes.MOVE_RESULT_OBJECT, "move-result-object", 112 InstructionCodec.FORMAT_11X, IndexType.NONE); 113 114 public static final Info MOVE_EXCEPTION = 115 new Info(Opcodes.MOVE_EXCEPTION, "move-exception", 116 InstructionCodec.FORMAT_11X, IndexType.NONE); 117 118 public static final Info RETURN_VOID = 119 new Info(Opcodes.RETURN_VOID, "return-void", 120 InstructionCodec.FORMAT_10X, IndexType.NONE); 121 122 public static final Info RETURN = 123 new Info(Opcodes.RETURN, "return", 124 InstructionCodec.FORMAT_11X, IndexType.NONE); 125 126 public static final Info RETURN_WIDE = 127 new Info(Opcodes.RETURN_WIDE, "return-wide", 128 InstructionCodec.FORMAT_11X, IndexType.NONE); 129 130 public static final Info RETURN_OBJECT = 131 new Info(Opcodes.RETURN_OBJECT, "return-object", 132 InstructionCodec.FORMAT_11X, IndexType.NONE); 133 134 public static final Info CONST_4 = 135 new Info(Opcodes.CONST_4, "const/4", 136 InstructionCodec.FORMAT_11N, IndexType.NONE); 137 138 public static final Info CONST_16 = 139 new Info(Opcodes.CONST_16, "const/16", 140 InstructionCodec.FORMAT_21S, IndexType.NONE); 141 142 public static final Info CONST = 143 new Info(Opcodes.CONST, "const", 144 InstructionCodec.FORMAT_31I, IndexType.NONE); 145 146 public static final Info CONST_HIGH16 = 147 new Info(Opcodes.CONST_HIGH16, "const/high16", 148 InstructionCodec.FORMAT_21H, IndexType.NONE); 149 150 public static final Info CONST_WIDE_16 = 151 new Info(Opcodes.CONST_WIDE_16, "const-wide/16", 152 InstructionCodec.FORMAT_21S, IndexType.NONE); 153 154 public static final Info CONST_WIDE_32 = 155 new Info(Opcodes.CONST_WIDE_32, "const-wide/32", 156 InstructionCodec.FORMAT_31I, IndexType.NONE); 157 158 public static final Info CONST_WIDE = 159 new Info(Opcodes.CONST_WIDE, "const-wide", 160 InstructionCodec.FORMAT_51L, IndexType.NONE); 161 162 public static final Info CONST_WIDE_HIGH16 = 163 new Info(Opcodes.CONST_WIDE_HIGH16, "const-wide/high16", 164 InstructionCodec.FORMAT_21H, IndexType.NONE); 165 166 public static final Info CONST_STRING = 167 new Info(Opcodes.CONST_STRING, "const-string", 168 InstructionCodec.FORMAT_21C, IndexType.STRING_REF); 169 170 public static final Info CONST_STRING_JUMBO = 171 new Info(Opcodes.CONST_STRING_JUMBO, "const-string/jumbo", 172 InstructionCodec.FORMAT_31C, IndexType.STRING_REF); 173 174 public static final Info CONST_CLASS = 175 new Info(Opcodes.CONST_CLASS, "const-class", 176 InstructionCodec.FORMAT_21C, IndexType.TYPE_REF); 177 178 public static final Info MONITOR_ENTER = 179 new Info(Opcodes.MONITOR_ENTER, "monitor-enter", 180 InstructionCodec.FORMAT_11X, IndexType.NONE); 181 182 public static final Info MONITOR_EXIT = 183 new Info(Opcodes.MONITOR_EXIT, "monitor-exit", 184 InstructionCodec.FORMAT_11X, IndexType.NONE); 185 186 public static final Info CHECK_CAST = 187 new Info(Opcodes.CHECK_CAST, "check-cast", 188 InstructionCodec.FORMAT_21C, IndexType.TYPE_REF); 189 190 public static final Info INSTANCE_OF = 191 new Info(Opcodes.INSTANCE_OF, "instance-of", 192 InstructionCodec.FORMAT_22C, IndexType.TYPE_REF); 193 194 public static final Info ARRAY_LENGTH = 195 new Info(Opcodes.ARRAY_LENGTH, "array-length", 196 InstructionCodec.FORMAT_12X, IndexType.NONE); 197 198 public static final Info NEW_INSTANCE = 199 new Info(Opcodes.NEW_INSTANCE, "new-instance", 200 InstructionCodec.FORMAT_21C, IndexType.TYPE_REF); 201 202 public static final Info NEW_ARRAY = 203 new Info(Opcodes.NEW_ARRAY, "new-array", 204 InstructionCodec.FORMAT_22C, IndexType.TYPE_REF); 205 206 public static final Info FILLED_NEW_ARRAY = 207 new Info(Opcodes.FILLED_NEW_ARRAY, "filled-new-array", 208 InstructionCodec.FORMAT_35C, IndexType.TYPE_REF); 209 210 public static final Info FILLED_NEW_ARRAY_RANGE = 211 new Info(Opcodes.FILLED_NEW_ARRAY_RANGE, "filled-new-array/range", 212 InstructionCodec.FORMAT_3RC, IndexType.TYPE_REF); 213 214 public static final Info FILL_ARRAY_DATA = 215 new Info(Opcodes.FILL_ARRAY_DATA, "fill-array-data", 216 InstructionCodec.FORMAT_31T, IndexType.NONE); 217 218 public static final Info THROW = 219 new Info(Opcodes.THROW, "throw", 220 InstructionCodec.FORMAT_11X, IndexType.NONE); 221 222 public static final Info GOTO = 223 new Info(Opcodes.GOTO, "goto", 224 InstructionCodec.FORMAT_10T, IndexType.NONE); 225 226 public static final Info GOTO_16 = 227 new Info(Opcodes.GOTO_16, "goto/16", 228 InstructionCodec.FORMAT_20T, IndexType.NONE); 229 230 public static final Info GOTO_32 = 231 new Info(Opcodes.GOTO_32, "goto/32", 232 InstructionCodec.FORMAT_30T, IndexType.NONE); 233 234 public static final Info PACKED_SWITCH = 235 new Info(Opcodes.PACKED_SWITCH, "packed-switch", 236 InstructionCodec.FORMAT_31T, IndexType.NONE); 237 238 public static final Info SPARSE_SWITCH = 239 new Info(Opcodes.SPARSE_SWITCH, "sparse-switch", 240 InstructionCodec.FORMAT_31T, IndexType.NONE); 241 242 public static final Info CMPL_FLOAT = 243 new Info(Opcodes.CMPL_FLOAT, "cmpl-float", 244 InstructionCodec.FORMAT_23X, IndexType.NONE); 245 246 public static final Info CMPG_FLOAT = 247 new Info(Opcodes.CMPG_FLOAT, "cmpg-float", 248 InstructionCodec.FORMAT_23X, IndexType.NONE); 249 250 public static final Info CMPL_DOUBLE = 251 new Info(Opcodes.CMPL_DOUBLE, "cmpl-double", 252 InstructionCodec.FORMAT_23X, IndexType.NONE); 253 254 public static final Info CMPG_DOUBLE = 255 new Info(Opcodes.CMPG_DOUBLE, "cmpg-double", 256 InstructionCodec.FORMAT_23X, IndexType.NONE); 257 258 public static final Info CMP_LONG = 259 new Info(Opcodes.CMP_LONG, "cmp-long", 260 InstructionCodec.FORMAT_23X, IndexType.NONE); 261 262 public static final Info IF_EQ = 263 new Info(Opcodes.IF_EQ, "if-eq", 264 InstructionCodec.FORMAT_22T, IndexType.NONE); 265 266 public static final Info IF_NE = 267 new Info(Opcodes.IF_NE, "if-ne", 268 InstructionCodec.FORMAT_22T, IndexType.NONE); 269 270 public static final Info IF_LT = 271 new Info(Opcodes.IF_LT, "if-lt", 272 InstructionCodec.FORMAT_22T, IndexType.NONE); 273 274 public static final Info IF_GE = 275 new Info(Opcodes.IF_GE, "if-ge", 276 InstructionCodec.FORMAT_22T, IndexType.NONE); 277 278 public static final Info IF_GT = 279 new Info(Opcodes.IF_GT, "if-gt", 280 InstructionCodec.FORMAT_22T, IndexType.NONE); 281 282 public static final Info IF_LE = 283 new Info(Opcodes.IF_LE, "if-le", 284 InstructionCodec.FORMAT_22T, IndexType.NONE); 285 286 public static final Info IF_EQZ = 287 new Info(Opcodes.IF_EQZ, "if-eqz", 288 InstructionCodec.FORMAT_21T, IndexType.NONE); 289 290 public static final Info IF_NEZ = 291 new Info(Opcodes.IF_NEZ, "if-nez", 292 InstructionCodec.FORMAT_21T, IndexType.NONE); 293 294 public static final Info IF_LTZ = 295 new Info(Opcodes.IF_LTZ, "if-ltz", 296 InstructionCodec.FORMAT_21T, IndexType.NONE); 297 298 public static final Info IF_GEZ = 299 new Info(Opcodes.IF_GEZ, "if-gez", 300 InstructionCodec.FORMAT_21T, IndexType.NONE); 301 302 public static final Info IF_GTZ = 303 new Info(Opcodes.IF_GTZ, "if-gtz", 304 InstructionCodec.FORMAT_21T, IndexType.NONE); 305 306 public static final Info IF_LEZ = 307 new Info(Opcodes.IF_LEZ, "if-lez", 308 InstructionCodec.FORMAT_21T, IndexType.NONE); 309 310 public static final Info AGET = 311 new Info(Opcodes.AGET, "aget", 312 InstructionCodec.FORMAT_23X, IndexType.NONE); 313 314 public static final Info AGET_WIDE = 315 new Info(Opcodes.AGET_WIDE, "aget-wide", 316 InstructionCodec.FORMAT_23X, IndexType.NONE); 317 318 public static final Info AGET_OBJECT = 319 new Info(Opcodes.AGET_OBJECT, "aget-object", 320 InstructionCodec.FORMAT_23X, IndexType.NONE); 321 322 public static final Info AGET_BOOLEAN = 323 new Info(Opcodes.AGET_BOOLEAN, "aget-boolean", 324 InstructionCodec.FORMAT_23X, IndexType.NONE); 325 326 public static final Info AGET_BYTE = 327 new Info(Opcodes.AGET_BYTE, "aget-byte", 328 InstructionCodec.FORMAT_23X, IndexType.NONE); 329 330 public static final Info AGET_CHAR = 331 new Info(Opcodes.AGET_CHAR, "aget-char", 332 InstructionCodec.FORMAT_23X, IndexType.NONE); 333 334 public static final Info AGET_SHORT = 335 new Info(Opcodes.AGET_SHORT, "aget-short", 336 InstructionCodec.FORMAT_23X, IndexType.NONE); 337 338 public static final Info APUT = 339 new Info(Opcodes.APUT, "aput", 340 InstructionCodec.FORMAT_23X, IndexType.NONE); 341 342 public static final Info APUT_WIDE = 343 new Info(Opcodes.APUT_WIDE, "aput-wide", 344 InstructionCodec.FORMAT_23X, IndexType.NONE); 345 346 public static final Info APUT_OBJECT = 347 new Info(Opcodes.APUT_OBJECT, "aput-object", 348 InstructionCodec.FORMAT_23X, IndexType.NONE); 349 350 public static final Info APUT_BOOLEAN = 351 new Info(Opcodes.APUT_BOOLEAN, "aput-boolean", 352 InstructionCodec.FORMAT_23X, IndexType.NONE); 353 354 public static final Info APUT_BYTE = 355 new Info(Opcodes.APUT_BYTE, "aput-byte", 356 InstructionCodec.FORMAT_23X, IndexType.NONE); 357 358 public static final Info APUT_CHAR = 359 new Info(Opcodes.APUT_CHAR, "aput-char", 360 InstructionCodec.FORMAT_23X, IndexType.NONE); 361 362 public static final Info APUT_SHORT = 363 new Info(Opcodes.APUT_SHORT, "aput-short", 364 InstructionCodec.FORMAT_23X, IndexType.NONE); 365 366 public static final Info IGET = 367 new Info(Opcodes.IGET, "iget", 368 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 369 370 public static final Info IGET_WIDE = 371 new Info(Opcodes.IGET_WIDE, "iget-wide", 372 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 373 374 public static final Info IGET_OBJECT = 375 new Info(Opcodes.IGET_OBJECT, "iget-object", 376 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 377 378 public static final Info IGET_BOOLEAN = 379 new Info(Opcodes.IGET_BOOLEAN, "iget-boolean", 380 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 381 382 public static final Info IGET_BYTE = 383 new Info(Opcodes.IGET_BYTE, "iget-byte", 384 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 385 386 public static final Info IGET_CHAR = 387 new Info(Opcodes.IGET_CHAR, "iget-char", 388 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 389 390 public static final Info IGET_SHORT = 391 new Info(Opcodes.IGET_SHORT, "iget-short", 392 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 393 394 public static final Info IPUT = 395 new Info(Opcodes.IPUT, "iput", 396 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 397 398 public static final Info IPUT_WIDE = 399 new Info(Opcodes.IPUT_WIDE, "iput-wide", 400 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 401 402 public static final Info IPUT_OBJECT = 403 new Info(Opcodes.IPUT_OBJECT, "iput-object", 404 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 405 406 public static final Info IPUT_BOOLEAN = 407 new Info(Opcodes.IPUT_BOOLEAN, "iput-boolean", 408 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 409 410 public static final Info IPUT_BYTE = 411 new Info(Opcodes.IPUT_BYTE, "iput-byte", 412 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 413 414 public static final Info IPUT_CHAR = 415 new Info(Opcodes.IPUT_CHAR, "iput-char", 416 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 417 418 public static final Info IPUT_SHORT = 419 new Info(Opcodes.IPUT_SHORT, "iput-short", 420 InstructionCodec.FORMAT_22C, IndexType.FIELD_REF); 421 422 public static final Info SGET = 423 new Info(Opcodes.SGET, "sget", 424 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 425 426 public static final Info SGET_WIDE = 427 new Info(Opcodes.SGET_WIDE, "sget-wide", 428 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 429 430 public static final Info SGET_OBJECT = 431 new Info(Opcodes.SGET_OBJECT, "sget-object", 432 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 433 434 public static final Info SGET_BOOLEAN = 435 new Info(Opcodes.SGET_BOOLEAN, "sget-boolean", 436 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 437 438 public static final Info SGET_BYTE = 439 new Info(Opcodes.SGET_BYTE, "sget-byte", 440 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 441 442 public static final Info SGET_CHAR = 443 new Info(Opcodes.SGET_CHAR, "sget-char", 444 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 445 446 public static final Info SGET_SHORT = 447 new Info(Opcodes.SGET_SHORT, "sget-short", 448 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 449 450 public static final Info SPUT = 451 new Info(Opcodes.SPUT, "sput", 452 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 453 454 public static final Info SPUT_WIDE = 455 new Info(Opcodes.SPUT_WIDE, "sput-wide", 456 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 457 458 public static final Info SPUT_OBJECT = 459 new Info(Opcodes.SPUT_OBJECT, "sput-object", 460 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 461 462 public static final Info SPUT_BOOLEAN = 463 new Info(Opcodes.SPUT_BOOLEAN, "sput-boolean", 464 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 465 466 public static final Info SPUT_BYTE = 467 new Info(Opcodes.SPUT_BYTE, "sput-byte", 468 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 469 470 public static final Info SPUT_CHAR = 471 new Info(Opcodes.SPUT_CHAR, "sput-char", 472 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 473 474 public static final Info SPUT_SHORT = 475 new Info(Opcodes.SPUT_SHORT, "sput-short", 476 InstructionCodec.FORMAT_21C, IndexType.FIELD_REF); 477 478 public static final Info INVOKE_VIRTUAL = 479 new Info(Opcodes.INVOKE_VIRTUAL, "invoke-virtual", 480 InstructionCodec.FORMAT_35C, IndexType.METHOD_REF); 481 482 public static final Info INVOKE_SUPER = 483 new Info(Opcodes.INVOKE_SUPER, "invoke-super", 484 InstructionCodec.FORMAT_35C, IndexType.METHOD_REF); 485 486 public static final Info INVOKE_DIRECT = 487 new Info(Opcodes.INVOKE_DIRECT, "invoke-direct", 488 InstructionCodec.FORMAT_35C, IndexType.METHOD_REF); 489 490 public static final Info INVOKE_STATIC = 491 new Info(Opcodes.INVOKE_STATIC, "invoke-static", 492 InstructionCodec.FORMAT_35C, IndexType.METHOD_REF); 493 494 public static final Info INVOKE_INTERFACE = 495 new Info(Opcodes.INVOKE_INTERFACE, "invoke-interface", 496 InstructionCodec.FORMAT_35C, IndexType.METHOD_REF); 497 498 public static final Info INVOKE_VIRTUAL_RANGE = 499 new Info(Opcodes.INVOKE_VIRTUAL_RANGE, "invoke-virtual/range", 500 InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF); 501 502 public static final Info INVOKE_SUPER_RANGE = 503 new Info(Opcodes.INVOKE_SUPER_RANGE, "invoke-super/range", 504 InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF); 505 506 public static final Info INVOKE_DIRECT_RANGE = 507 new Info(Opcodes.INVOKE_DIRECT_RANGE, "invoke-direct/range", 508 InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF); 509 510 public static final Info INVOKE_STATIC_RANGE = 511 new Info(Opcodes.INVOKE_STATIC_RANGE, "invoke-static/range", 512 InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF); 513 514 public static final Info INVOKE_INTERFACE_RANGE = 515 new Info(Opcodes.INVOKE_INTERFACE_RANGE, "invoke-interface/range", 516 InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF); 517 518 public static final Info NEG_INT = 519 new Info(Opcodes.NEG_INT, "neg-int", 520 InstructionCodec.FORMAT_12X, IndexType.NONE); 521 522 public static final Info NOT_INT = 523 new Info(Opcodes.NOT_INT, "not-int", 524 InstructionCodec.FORMAT_12X, IndexType.NONE); 525 526 public static final Info NEG_LONG = 527 new Info(Opcodes.NEG_LONG, "neg-long", 528 InstructionCodec.FORMAT_12X, IndexType.NONE); 529 530 public static final Info NOT_LONG = 531 new Info(Opcodes.NOT_LONG, "not-long", 532 InstructionCodec.FORMAT_12X, IndexType.NONE); 533 534 public static final Info NEG_FLOAT = 535 new Info(Opcodes.NEG_FLOAT, "neg-float", 536 InstructionCodec.FORMAT_12X, IndexType.NONE); 537 538 public static final Info NEG_DOUBLE = 539 new Info(Opcodes.NEG_DOUBLE, "neg-double", 540 InstructionCodec.FORMAT_12X, IndexType.NONE); 541 542 public static final Info INT_TO_LONG = 543 new Info(Opcodes.INT_TO_LONG, "int-to-long", 544 InstructionCodec.FORMAT_12X, IndexType.NONE); 545 546 public static final Info INT_TO_FLOAT = 547 new Info(Opcodes.INT_TO_FLOAT, "int-to-float", 548 InstructionCodec.FORMAT_12X, IndexType.NONE); 549 550 public static final Info INT_TO_DOUBLE = 551 new Info(Opcodes.INT_TO_DOUBLE, "int-to-double", 552 InstructionCodec.FORMAT_12X, IndexType.NONE); 553 554 public static final Info LONG_TO_INT = 555 new Info(Opcodes.LONG_TO_INT, "long-to-int", 556 InstructionCodec.FORMAT_12X, IndexType.NONE); 557 558 public static final Info LONG_TO_FLOAT = 559 new Info(Opcodes.LONG_TO_FLOAT, "long-to-float", 560 InstructionCodec.FORMAT_12X, IndexType.NONE); 561 562 public static final Info LONG_TO_DOUBLE = 563 new Info(Opcodes.LONG_TO_DOUBLE, "long-to-double", 564 InstructionCodec.FORMAT_12X, IndexType.NONE); 565 566 public static final Info FLOAT_TO_INT = 567 new Info(Opcodes.FLOAT_TO_INT, "float-to-int", 568 InstructionCodec.FORMAT_12X, IndexType.NONE); 569 570 public static final Info FLOAT_TO_LONG = 571 new Info(Opcodes.FLOAT_TO_LONG, "float-to-long", 572 InstructionCodec.FORMAT_12X, IndexType.NONE); 573 574 public static final Info FLOAT_TO_DOUBLE = 575 new Info(Opcodes.FLOAT_TO_DOUBLE, "float-to-double", 576 InstructionCodec.FORMAT_12X, IndexType.NONE); 577 578 public static final Info DOUBLE_TO_INT = 579 new Info(Opcodes.DOUBLE_TO_INT, "double-to-int", 580 InstructionCodec.FORMAT_12X, IndexType.NONE); 581 582 public static final Info DOUBLE_TO_LONG = 583 new Info(Opcodes.DOUBLE_TO_LONG, "double-to-long", 584 InstructionCodec.FORMAT_12X, IndexType.NONE); 585 586 public static final Info DOUBLE_TO_FLOAT = 587 new Info(Opcodes.DOUBLE_TO_FLOAT, "double-to-float", 588 InstructionCodec.FORMAT_12X, IndexType.NONE); 589 590 public static final Info INT_TO_BYTE = 591 new Info(Opcodes.INT_TO_BYTE, "int-to-byte", 592 InstructionCodec.FORMAT_12X, IndexType.NONE); 593 594 public static final Info INT_TO_CHAR = 595 new Info(Opcodes.INT_TO_CHAR, "int-to-char", 596 InstructionCodec.FORMAT_12X, IndexType.NONE); 597 598 public static final Info INT_TO_SHORT = 599 new Info(Opcodes.INT_TO_SHORT, "int-to-short", 600 InstructionCodec.FORMAT_12X, IndexType.NONE); 601 602 public static final Info ADD_INT = 603 new Info(Opcodes.ADD_INT, "add-int", 604 InstructionCodec.FORMAT_23X, IndexType.NONE); 605 606 public static final Info SUB_INT = 607 new Info(Opcodes.SUB_INT, "sub-int", 608 InstructionCodec.FORMAT_23X, IndexType.NONE); 609 610 public static final Info MUL_INT = 611 new Info(Opcodes.MUL_INT, "mul-int", 612 InstructionCodec.FORMAT_23X, IndexType.NONE); 613 614 public static final Info DIV_INT = 615 new Info(Opcodes.DIV_INT, "div-int", 616 InstructionCodec.FORMAT_23X, IndexType.NONE); 617 618 public static final Info REM_INT = 619 new Info(Opcodes.REM_INT, "rem-int", 620 InstructionCodec.FORMAT_23X, IndexType.NONE); 621 622 public static final Info AND_INT = 623 new Info(Opcodes.AND_INT, "and-int", 624 InstructionCodec.FORMAT_23X, IndexType.NONE); 625 626 public static final Info OR_INT = 627 new Info(Opcodes.OR_INT, "or-int", 628 InstructionCodec.FORMAT_23X, IndexType.NONE); 629 630 public static final Info XOR_INT = 631 new Info(Opcodes.XOR_INT, "xor-int", 632 InstructionCodec.FORMAT_23X, IndexType.NONE); 633 634 public static final Info SHL_INT = 635 new Info(Opcodes.SHL_INT, "shl-int", 636 InstructionCodec.FORMAT_23X, IndexType.NONE); 637 638 public static final Info SHR_INT = 639 new Info(Opcodes.SHR_INT, "shr-int", 640 InstructionCodec.FORMAT_23X, IndexType.NONE); 641 642 public static final Info USHR_INT = 643 new Info(Opcodes.USHR_INT, "ushr-int", 644 InstructionCodec.FORMAT_23X, IndexType.NONE); 645 646 public static final Info ADD_LONG = 647 new Info(Opcodes.ADD_LONG, "add-long", 648 InstructionCodec.FORMAT_23X, IndexType.NONE); 649 650 public static final Info SUB_LONG = 651 new Info(Opcodes.SUB_LONG, "sub-long", 652 InstructionCodec.FORMAT_23X, IndexType.NONE); 653 654 public static final Info MUL_LONG = 655 new Info(Opcodes.MUL_LONG, "mul-long", 656 InstructionCodec.FORMAT_23X, IndexType.NONE); 657 658 public static final Info DIV_LONG = 659 new Info(Opcodes.DIV_LONG, "div-long", 660 InstructionCodec.FORMAT_23X, IndexType.NONE); 661 662 public static final Info REM_LONG = 663 new Info(Opcodes.REM_LONG, "rem-long", 664 InstructionCodec.FORMAT_23X, IndexType.NONE); 665 666 public static final Info AND_LONG = 667 new Info(Opcodes.AND_LONG, "and-long", 668 InstructionCodec.FORMAT_23X, IndexType.NONE); 669 670 public static final Info OR_LONG = 671 new Info(Opcodes.OR_LONG, "or-long", 672 InstructionCodec.FORMAT_23X, IndexType.NONE); 673 674 public static final Info XOR_LONG = 675 new Info(Opcodes.XOR_LONG, "xor-long", 676 InstructionCodec.FORMAT_23X, IndexType.NONE); 677 678 public static final Info SHL_LONG = 679 new Info(Opcodes.SHL_LONG, "shl-long", 680 InstructionCodec.FORMAT_23X, IndexType.NONE); 681 682 public static final Info SHR_LONG = 683 new Info(Opcodes.SHR_LONG, "shr-long", 684 InstructionCodec.FORMAT_23X, IndexType.NONE); 685 686 public static final Info USHR_LONG = 687 new Info(Opcodes.USHR_LONG, "ushr-long", 688 InstructionCodec.FORMAT_23X, IndexType.NONE); 689 690 public static final Info ADD_FLOAT = 691 new Info(Opcodes.ADD_FLOAT, "add-float", 692 InstructionCodec.FORMAT_23X, IndexType.NONE); 693 694 public static final Info SUB_FLOAT = 695 new Info(Opcodes.SUB_FLOAT, "sub-float", 696 InstructionCodec.FORMAT_23X, IndexType.NONE); 697 698 public static final Info MUL_FLOAT = 699 new Info(Opcodes.MUL_FLOAT, "mul-float", 700 InstructionCodec.FORMAT_23X, IndexType.NONE); 701 702 public static final Info DIV_FLOAT = 703 new Info(Opcodes.DIV_FLOAT, "div-float", 704 InstructionCodec.FORMAT_23X, IndexType.NONE); 705 706 public static final Info REM_FLOAT = 707 new Info(Opcodes.REM_FLOAT, "rem-float", 708 InstructionCodec.FORMAT_23X, IndexType.NONE); 709 710 public static final Info ADD_DOUBLE = 711 new Info(Opcodes.ADD_DOUBLE, "add-double", 712 InstructionCodec.FORMAT_23X, IndexType.NONE); 713 714 public static final Info SUB_DOUBLE = 715 new Info(Opcodes.SUB_DOUBLE, "sub-double", 716 InstructionCodec.FORMAT_23X, IndexType.NONE); 717 718 public static final Info MUL_DOUBLE = 719 new Info(Opcodes.MUL_DOUBLE, "mul-double", 720 InstructionCodec.FORMAT_23X, IndexType.NONE); 721 722 public static final Info DIV_DOUBLE = 723 new Info(Opcodes.DIV_DOUBLE, "div-double", 724 InstructionCodec.FORMAT_23X, IndexType.NONE); 725 726 public static final Info REM_DOUBLE = 727 new Info(Opcodes.REM_DOUBLE, "rem-double", 728 InstructionCodec.FORMAT_23X, IndexType.NONE); 729 730 public static final Info ADD_INT_2ADDR = 731 new Info(Opcodes.ADD_INT_2ADDR, "add-int/2addr", 732 InstructionCodec.FORMAT_12X, IndexType.NONE); 733 734 public static final Info SUB_INT_2ADDR = 735 new Info(Opcodes.SUB_INT_2ADDR, "sub-int/2addr", 736 InstructionCodec.FORMAT_12X, IndexType.NONE); 737 738 public static final Info MUL_INT_2ADDR = 739 new Info(Opcodes.MUL_INT_2ADDR, "mul-int/2addr", 740 InstructionCodec.FORMAT_12X, IndexType.NONE); 741 742 public static final Info DIV_INT_2ADDR = 743 new Info(Opcodes.DIV_INT_2ADDR, "div-int/2addr", 744 InstructionCodec.FORMAT_12X, IndexType.NONE); 745 746 public static final Info REM_INT_2ADDR = 747 new Info(Opcodes.REM_INT_2ADDR, "rem-int/2addr", 748 InstructionCodec.FORMAT_12X, IndexType.NONE); 749 750 public static final Info AND_INT_2ADDR = 751 new Info(Opcodes.AND_INT_2ADDR, "and-int/2addr", 752 InstructionCodec.FORMAT_12X, IndexType.NONE); 753 754 public static final Info OR_INT_2ADDR = 755 new Info(Opcodes.OR_INT_2ADDR, "or-int/2addr", 756 InstructionCodec.FORMAT_12X, IndexType.NONE); 757 758 public static final Info XOR_INT_2ADDR = 759 new Info(Opcodes.XOR_INT_2ADDR, "xor-int/2addr", 760 InstructionCodec.FORMAT_12X, IndexType.NONE); 761 762 public static final Info SHL_INT_2ADDR = 763 new Info(Opcodes.SHL_INT_2ADDR, "shl-int/2addr", 764 InstructionCodec.FORMAT_12X, IndexType.NONE); 765 766 public static final Info SHR_INT_2ADDR = 767 new Info(Opcodes.SHR_INT_2ADDR, "shr-int/2addr", 768 InstructionCodec.FORMAT_12X, IndexType.NONE); 769 770 public static final Info USHR_INT_2ADDR = 771 new Info(Opcodes.USHR_INT_2ADDR, "ushr-int/2addr", 772 InstructionCodec.FORMAT_12X, IndexType.NONE); 773 774 public static final Info ADD_LONG_2ADDR = 775 new Info(Opcodes.ADD_LONG_2ADDR, "add-long/2addr", 776 InstructionCodec.FORMAT_12X, IndexType.NONE); 777 778 public static final Info SUB_LONG_2ADDR = 779 new Info(Opcodes.SUB_LONG_2ADDR, "sub-long/2addr", 780 InstructionCodec.FORMAT_12X, IndexType.NONE); 781 782 public static final Info MUL_LONG_2ADDR = 783 new Info(Opcodes.MUL_LONG_2ADDR, "mul-long/2addr", 784 InstructionCodec.FORMAT_12X, IndexType.NONE); 785 786 public static final Info DIV_LONG_2ADDR = 787 new Info(Opcodes.DIV_LONG_2ADDR, "div-long/2addr", 788 InstructionCodec.FORMAT_12X, IndexType.NONE); 789 790 public static final Info REM_LONG_2ADDR = 791 new Info(Opcodes.REM_LONG_2ADDR, "rem-long/2addr", 792 InstructionCodec.FORMAT_12X, IndexType.NONE); 793 794 public static final Info AND_LONG_2ADDR = 795 new Info(Opcodes.AND_LONG_2ADDR, "and-long/2addr", 796 InstructionCodec.FORMAT_12X, IndexType.NONE); 797 798 public static final Info OR_LONG_2ADDR = 799 new Info(Opcodes.OR_LONG_2ADDR, "or-long/2addr", 800 InstructionCodec.FORMAT_12X, IndexType.NONE); 801 802 public static final Info XOR_LONG_2ADDR = 803 new Info(Opcodes.XOR_LONG_2ADDR, "xor-long/2addr", 804 InstructionCodec.FORMAT_12X, IndexType.NONE); 805 806 public static final Info SHL_LONG_2ADDR = 807 new Info(Opcodes.SHL_LONG_2ADDR, "shl-long/2addr", 808 InstructionCodec.FORMAT_12X, IndexType.NONE); 809 810 public static final Info SHR_LONG_2ADDR = 811 new Info(Opcodes.SHR_LONG_2ADDR, "shr-long/2addr", 812 InstructionCodec.FORMAT_12X, IndexType.NONE); 813 814 public static final Info USHR_LONG_2ADDR = 815 new Info(Opcodes.USHR_LONG_2ADDR, "ushr-long/2addr", 816 InstructionCodec.FORMAT_12X, IndexType.NONE); 817 818 public static final Info ADD_FLOAT_2ADDR = 819 new Info(Opcodes.ADD_FLOAT_2ADDR, "add-float/2addr", 820 InstructionCodec.FORMAT_12X, IndexType.NONE); 821 822 public static final Info SUB_FLOAT_2ADDR = 823 new Info(Opcodes.SUB_FLOAT_2ADDR, "sub-float/2addr", 824 InstructionCodec.FORMAT_12X, IndexType.NONE); 825 826 public static final Info MUL_FLOAT_2ADDR = 827 new Info(Opcodes.MUL_FLOAT_2ADDR, "mul-float/2addr", 828 InstructionCodec.FORMAT_12X, IndexType.NONE); 829 830 public static final Info DIV_FLOAT_2ADDR = 831 new Info(Opcodes.DIV_FLOAT_2ADDR, "div-float/2addr", 832 InstructionCodec.FORMAT_12X, IndexType.NONE); 833 834 public static final Info REM_FLOAT_2ADDR = 835 new Info(Opcodes.REM_FLOAT_2ADDR, "rem-float/2addr", 836 InstructionCodec.FORMAT_12X, IndexType.NONE); 837 838 public static final Info ADD_DOUBLE_2ADDR = 839 new Info(Opcodes.ADD_DOUBLE_2ADDR, "add-double/2addr", 840 InstructionCodec.FORMAT_12X, IndexType.NONE); 841 842 public static final Info SUB_DOUBLE_2ADDR = 843 new Info(Opcodes.SUB_DOUBLE_2ADDR, "sub-double/2addr", 844 InstructionCodec.FORMAT_12X, IndexType.NONE); 845 846 public static final Info MUL_DOUBLE_2ADDR = 847 new Info(Opcodes.MUL_DOUBLE_2ADDR, "mul-double/2addr", 848 InstructionCodec.FORMAT_12X, IndexType.NONE); 849 850 public static final Info DIV_DOUBLE_2ADDR = 851 new Info(Opcodes.DIV_DOUBLE_2ADDR, "div-double/2addr", 852 InstructionCodec.FORMAT_12X, IndexType.NONE); 853 854 public static final Info REM_DOUBLE_2ADDR = 855 new Info(Opcodes.REM_DOUBLE_2ADDR, "rem-double/2addr", 856 InstructionCodec.FORMAT_12X, IndexType.NONE); 857 858 public static final Info ADD_INT_LIT16 = 859 new Info(Opcodes.ADD_INT_LIT16, "add-int/lit16", 860 InstructionCodec.FORMAT_22S, IndexType.NONE); 861 862 public static final Info RSUB_INT = 863 new Info(Opcodes.RSUB_INT, "rsub-int", 864 InstructionCodec.FORMAT_22S, IndexType.NONE); 865 866 public static final Info MUL_INT_LIT16 = 867 new Info(Opcodes.MUL_INT_LIT16, "mul-int/lit16", 868 InstructionCodec.FORMAT_22S, IndexType.NONE); 869 870 public static final Info DIV_INT_LIT16 = 871 new Info(Opcodes.DIV_INT_LIT16, "div-int/lit16", 872 InstructionCodec.FORMAT_22S, IndexType.NONE); 873 874 public static final Info REM_INT_LIT16 = 875 new Info(Opcodes.REM_INT_LIT16, "rem-int/lit16", 876 InstructionCodec.FORMAT_22S, IndexType.NONE); 877 878 public static final Info AND_INT_LIT16 = 879 new Info(Opcodes.AND_INT_LIT16, "and-int/lit16", 880 InstructionCodec.FORMAT_22S, IndexType.NONE); 881 882 public static final Info OR_INT_LIT16 = 883 new Info(Opcodes.OR_INT_LIT16, "or-int/lit16", 884 InstructionCodec.FORMAT_22S, IndexType.NONE); 885 886 public static final Info XOR_INT_LIT16 = 887 new Info(Opcodes.XOR_INT_LIT16, "xor-int/lit16", 888 InstructionCodec.FORMAT_22S, IndexType.NONE); 889 890 public static final Info ADD_INT_LIT8 = 891 new Info(Opcodes.ADD_INT_LIT8, "add-int/lit8", 892 InstructionCodec.FORMAT_22B, IndexType.NONE); 893 894 public static final Info RSUB_INT_LIT8 = 895 new Info(Opcodes.RSUB_INT_LIT8, "rsub-int/lit8", 896 InstructionCodec.FORMAT_22B, IndexType.NONE); 897 898 public static final Info MUL_INT_LIT8 = 899 new Info(Opcodes.MUL_INT_LIT8, "mul-int/lit8", 900 InstructionCodec.FORMAT_22B, IndexType.NONE); 901 902 public static final Info DIV_INT_LIT8 = 903 new Info(Opcodes.DIV_INT_LIT8, "div-int/lit8", 904 InstructionCodec.FORMAT_22B, IndexType.NONE); 905 906 public static final Info REM_INT_LIT8 = 907 new Info(Opcodes.REM_INT_LIT8, "rem-int/lit8", 908 InstructionCodec.FORMAT_22B, IndexType.NONE); 909 910 public static final Info AND_INT_LIT8 = 911 new Info(Opcodes.AND_INT_LIT8, "and-int/lit8", 912 InstructionCodec.FORMAT_22B, IndexType.NONE); 913 914 public static final Info OR_INT_LIT8 = 915 new Info(Opcodes.OR_INT_LIT8, "or-int/lit8", 916 InstructionCodec.FORMAT_22B, IndexType.NONE); 917 918 public static final Info XOR_INT_LIT8 = 919 new Info(Opcodes.XOR_INT_LIT8, "xor-int/lit8", 920 InstructionCodec.FORMAT_22B, IndexType.NONE); 921 922 public static final Info SHL_INT_LIT8 = 923 new Info(Opcodes.SHL_INT_LIT8, "shl-int/lit8", 924 InstructionCodec.FORMAT_22B, IndexType.NONE); 925 926 public static final Info SHR_INT_LIT8 = 927 new Info(Opcodes.SHR_INT_LIT8, "shr-int/lit8", 928 InstructionCodec.FORMAT_22B, IndexType.NONE); 929 930 public static final Info USHR_INT_LIT8 = 931 new Info(Opcodes.USHR_INT_LIT8, "ushr-int/lit8", 932 InstructionCodec.FORMAT_22B, IndexType.NONE); 933 934 public static final Info INVOKE_POLYMORPHIC = 935 new Info(Opcodes.INVOKE_POLYMORPHIC, "invoke-polymorphic", 936 InstructionCodec.FORMAT_45CC, IndexType.METHOD_AND_PROTO_REF); 937 938 public static final Info INVOKE_POLYMORPHIC_RANGE = 939 new Info(Opcodes.INVOKE_POLYMORPHIC_RANGE, "invoke-polymorphic/range", 940 InstructionCodec.FORMAT_4RCC, IndexType.METHOD_AND_PROTO_REF); 941 942 public static final Info INVOKE_CUSTOM = 943 new Info(Opcodes.INVOKE_CUSTOM, "invoke-custom", 944 InstructionCodec.FORMAT_35C, IndexType.CALL_SITE_REF); 945 946 public static final Info INVOKE_CUSTOM_RANGE = 947 new Info(Opcodes.INVOKE_CUSTOM_RANGE, "invoke-custom/range", 948 InstructionCodec.FORMAT_3RC, IndexType.CALL_SITE_REF); 949 950 public static final Info CONST_METHOD_HANDLE = 951 new Info(Opcodes.CONST_METHOD_HANDLE, "const-method-handle", 952 InstructionCodec.FORMAT_21C, IndexType.METHOD_HANDLE_REF); 953 954 public static final Info CONST_METHOD_TYPE = 955 new Info(Opcodes.CONST_METHOD_TYPE, "const-method-type", 956 InstructionCodec.FORMAT_21C, IndexType.PROTO_REF); 957 958 // END(opcode-info-defs) 959 960 // Static initialization. 961 static { 962 INFO = new Info[Opcodes.MAX_VALUE - Opcodes.MIN_VALUE + 1]; 963 964 // TODO: Stop using this constant. 965 set(SPECIAL_FORMAT); 966 967 // TODO: These payload opcodes should be generated by opcode-gen. 968 set(PACKED_SWITCH_PAYLOAD); 969 set(SPARSE_SWITCH_PAYLOAD); 970 set(FILL_ARRAY_DATA_PAYLOAD); 971 972 // BEGIN(opcode-info-init); GENERATED AUTOMATICALLY BY opcode-gen 973 set(NOP); 974 set(MOVE); 975 set(MOVE_FROM16); 976 set(MOVE_16); 977 set(MOVE_WIDE); 978 set(MOVE_WIDE_FROM16); 979 set(MOVE_WIDE_16); 980 set(MOVE_OBJECT); 981 set(MOVE_OBJECT_FROM16); 982 set(MOVE_OBJECT_16); 983 set(MOVE_RESULT); 984 set(MOVE_RESULT_WIDE); 985 set(MOVE_RESULT_OBJECT); 986 set(MOVE_EXCEPTION); 987 set(RETURN_VOID); 988 set(RETURN); 989 set(RETURN_WIDE); 990 set(RETURN_OBJECT); 991 set(CONST_4); 992 set(CONST_16); 993 set(CONST); 994 set(CONST_HIGH16); 995 set(CONST_WIDE_16); 996 set(CONST_WIDE_32); 997 set(CONST_WIDE); 998 set(CONST_WIDE_HIGH16); 999 set(CONST_STRING); 1000 set(CONST_STRING_JUMBO); 1001 set(CONST_CLASS); 1002 set(MONITOR_ENTER); 1003 set(MONITOR_EXIT); 1004 set(CHECK_CAST); 1005 set(INSTANCE_OF); 1006 set(ARRAY_LENGTH); 1007 set(NEW_INSTANCE); 1008 set(NEW_ARRAY); 1009 set(FILLED_NEW_ARRAY); 1010 set(FILLED_NEW_ARRAY_RANGE); 1011 set(FILL_ARRAY_DATA); 1012 set(THROW); 1013 set(GOTO); 1014 set(GOTO_16); 1015 set(GOTO_32); 1016 set(PACKED_SWITCH); 1017 set(SPARSE_SWITCH); 1018 set(CMPL_FLOAT); 1019 set(CMPG_FLOAT); 1020 set(CMPL_DOUBLE); 1021 set(CMPG_DOUBLE); 1022 set(CMP_LONG); 1023 set(IF_EQ); 1024 set(IF_NE); 1025 set(IF_LT); 1026 set(IF_GE); 1027 set(IF_GT); 1028 set(IF_LE); 1029 set(IF_EQZ); 1030 set(IF_NEZ); 1031 set(IF_LTZ); 1032 set(IF_GEZ); 1033 set(IF_GTZ); 1034 set(IF_LEZ); 1035 set(AGET); 1036 set(AGET_WIDE); 1037 set(AGET_OBJECT); 1038 set(AGET_BOOLEAN); 1039 set(AGET_BYTE); 1040 set(AGET_CHAR); 1041 set(AGET_SHORT); 1042 set(APUT); 1043 set(APUT_WIDE); 1044 set(APUT_OBJECT); 1045 set(APUT_BOOLEAN); 1046 set(APUT_BYTE); 1047 set(APUT_CHAR); 1048 set(APUT_SHORT); 1049 set(IGET); 1050 set(IGET_WIDE); 1051 set(IGET_OBJECT); 1052 set(IGET_BOOLEAN); 1053 set(IGET_BYTE); 1054 set(IGET_CHAR); 1055 set(IGET_SHORT); 1056 set(IPUT); 1057 set(IPUT_WIDE); 1058 set(IPUT_OBJECT); 1059 set(IPUT_BOOLEAN); 1060 set(IPUT_BYTE); 1061 set(IPUT_CHAR); 1062 set(IPUT_SHORT); 1063 set(SGET); 1064 set(SGET_WIDE); 1065 set(SGET_OBJECT); 1066 set(SGET_BOOLEAN); 1067 set(SGET_BYTE); 1068 set(SGET_CHAR); 1069 set(SGET_SHORT); 1070 set(SPUT); 1071 set(SPUT_WIDE); 1072 set(SPUT_OBJECT); 1073 set(SPUT_BOOLEAN); 1074 set(SPUT_BYTE); 1075 set(SPUT_CHAR); 1076 set(SPUT_SHORT); 1077 set(INVOKE_VIRTUAL); 1078 set(INVOKE_SUPER); 1079 set(INVOKE_DIRECT); 1080 set(INVOKE_STATIC); 1081 set(INVOKE_INTERFACE); 1082 set(INVOKE_VIRTUAL_RANGE); 1083 set(INVOKE_SUPER_RANGE); 1084 set(INVOKE_DIRECT_RANGE); 1085 set(INVOKE_STATIC_RANGE); 1086 set(INVOKE_INTERFACE_RANGE); 1087 set(NEG_INT); 1088 set(NOT_INT); 1089 set(NEG_LONG); 1090 set(NOT_LONG); 1091 set(NEG_FLOAT); 1092 set(NEG_DOUBLE); 1093 set(INT_TO_LONG); 1094 set(INT_TO_FLOAT); 1095 set(INT_TO_DOUBLE); 1096 set(LONG_TO_INT); 1097 set(LONG_TO_FLOAT); 1098 set(LONG_TO_DOUBLE); 1099 set(FLOAT_TO_INT); 1100 set(FLOAT_TO_LONG); 1101 set(FLOAT_TO_DOUBLE); 1102 set(DOUBLE_TO_INT); 1103 set(DOUBLE_TO_LONG); 1104 set(DOUBLE_TO_FLOAT); 1105 set(INT_TO_BYTE); 1106 set(INT_TO_CHAR); 1107 set(INT_TO_SHORT); 1108 set(ADD_INT); 1109 set(SUB_INT); 1110 set(MUL_INT); 1111 set(DIV_INT); 1112 set(REM_INT); 1113 set(AND_INT); 1114 set(OR_INT); 1115 set(XOR_INT); 1116 set(SHL_INT); 1117 set(SHR_INT); 1118 set(USHR_INT); 1119 set(ADD_LONG); 1120 set(SUB_LONG); 1121 set(MUL_LONG); 1122 set(DIV_LONG); 1123 set(REM_LONG); 1124 set(AND_LONG); 1125 set(OR_LONG); 1126 set(XOR_LONG); 1127 set(SHL_LONG); 1128 set(SHR_LONG); 1129 set(USHR_LONG); 1130 set(ADD_FLOAT); 1131 set(SUB_FLOAT); 1132 set(MUL_FLOAT); 1133 set(DIV_FLOAT); 1134 set(REM_FLOAT); 1135 set(ADD_DOUBLE); 1136 set(SUB_DOUBLE); 1137 set(MUL_DOUBLE); 1138 set(DIV_DOUBLE); 1139 set(REM_DOUBLE); 1140 set(ADD_INT_2ADDR); 1141 set(SUB_INT_2ADDR); 1142 set(MUL_INT_2ADDR); 1143 set(DIV_INT_2ADDR); 1144 set(REM_INT_2ADDR); 1145 set(AND_INT_2ADDR); 1146 set(OR_INT_2ADDR); 1147 set(XOR_INT_2ADDR); 1148 set(SHL_INT_2ADDR); 1149 set(SHR_INT_2ADDR); 1150 set(USHR_INT_2ADDR); 1151 set(ADD_LONG_2ADDR); 1152 set(SUB_LONG_2ADDR); 1153 set(MUL_LONG_2ADDR); 1154 set(DIV_LONG_2ADDR); 1155 set(REM_LONG_2ADDR); 1156 set(AND_LONG_2ADDR); 1157 set(OR_LONG_2ADDR); 1158 set(XOR_LONG_2ADDR); 1159 set(SHL_LONG_2ADDR); 1160 set(SHR_LONG_2ADDR); 1161 set(USHR_LONG_2ADDR); 1162 set(ADD_FLOAT_2ADDR); 1163 set(SUB_FLOAT_2ADDR); 1164 set(MUL_FLOAT_2ADDR); 1165 set(DIV_FLOAT_2ADDR); 1166 set(REM_FLOAT_2ADDR); 1167 set(ADD_DOUBLE_2ADDR); 1168 set(SUB_DOUBLE_2ADDR); 1169 set(MUL_DOUBLE_2ADDR); 1170 set(DIV_DOUBLE_2ADDR); 1171 set(REM_DOUBLE_2ADDR); 1172 set(ADD_INT_LIT16); 1173 set(RSUB_INT); 1174 set(MUL_INT_LIT16); 1175 set(DIV_INT_LIT16); 1176 set(REM_INT_LIT16); 1177 set(AND_INT_LIT16); 1178 set(OR_INT_LIT16); 1179 set(XOR_INT_LIT16); 1180 set(ADD_INT_LIT8); 1181 set(RSUB_INT_LIT8); 1182 set(MUL_INT_LIT8); 1183 set(DIV_INT_LIT8); 1184 set(REM_INT_LIT8); 1185 set(AND_INT_LIT8); 1186 set(OR_INT_LIT8); 1187 set(XOR_INT_LIT8); 1188 set(SHL_INT_LIT8); 1189 set(SHR_INT_LIT8); 1190 set(USHR_INT_LIT8); 1191 set(INVOKE_POLYMORPHIC); 1192 set(INVOKE_POLYMORPHIC_RANGE); 1193 set(INVOKE_CUSTOM); 1194 set(INVOKE_CUSTOM_RANGE); 1195 set(CONST_METHOD_HANDLE); 1196 set(CONST_METHOD_TYPE); 1197 // END(opcode-info-init) 1198 } 1199 1200 /** 1201 * This class is uninstantiable. 1202 */ OpcodeInfo()1203 private OpcodeInfo() { 1204 // This space intentionally left blank. 1205 } 1206 1207 /** 1208 * Gets the {@link Info} for the given opcode value. 1209 * 1210 * @param opcode {@code Opcodes.MIN_VALUE..Opcodes.MAX_VALUE;} the 1211 * opcode value 1212 * @return non-null; the associated opcode information instance 1213 */ get(int opcode)1214 public static Info get(int opcode) { 1215 int idx = opcode - Opcodes.MIN_VALUE; 1216 1217 try { 1218 Info result = INFO[idx]; 1219 if (result != null) { 1220 return result; 1221 } 1222 } catch (ArrayIndexOutOfBoundsException ex) { 1223 // Fall through. 1224 } 1225 1226 throw new IllegalArgumentException("bogus opcode: " 1227 + Hex.u2or4(opcode)); 1228 } 1229 1230 /** 1231 * Gets the name of the given opcode. 1232 */ getName(int opcode)1233 public static String getName(int opcode) { 1234 return get(opcode).getName(); 1235 } 1236 1237 /** 1238 * Gets the format (an {@link InstructionCodec}) for the given opcode 1239 * value. 1240 */ getFormat(int opcode)1241 public static InstructionCodec getFormat(int opcode) { 1242 return get(opcode).getFormat(); 1243 } 1244 1245 /** 1246 * Gets the {@link IndexType} for the given opcode value. 1247 */ getIndexType(int opcode)1248 public static IndexType getIndexType(int opcode) { 1249 return get(opcode).getIndexType(); 1250 } 1251 1252 /** 1253 * Puts the given opcode into the table of all ops. 1254 * 1255 * @param opcode non-null; the opcode 1256 */ set(Info opcode)1257 private static void set(Info opcode) { 1258 int idx = opcode.getOpcode() - Opcodes.MIN_VALUE; 1259 INFO[idx] = opcode; 1260 } 1261 1262 /** 1263 * Information about an opcode. 1264 */ 1265 public static class Info { 1266 private final int opcode; 1267 private final String name; 1268 private final InstructionCodec format; 1269 private final IndexType indexType; 1270 Info(int opcode, String name, InstructionCodec format, IndexType indexType)1271 public Info(int opcode, String name, InstructionCodec format, 1272 IndexType indexType) { 1273 this.opcode = opcode; 1274 this.name = name; 1275 this.format = format; 1276 this.indexType = indexType; 1277 } 1278 getOpcode()1279 public int getOpcode() { 1280 return opcode; 1281 } 1282 getName()1283 public String getName() { 1284 return name; 1285 } 1286 getFormat()1287 public InstructionCodec getFormat() { 1288 return format; 1289 } 1290 getIndexType()1291 public IndexType getIndexType() { 1292 return indexType; 1293 } 1294 } 1295 } 1296