1/* Table of opcodes for byte codes defined by the Java(TM) virtual 2 machine specification. 3 Copyright (C) 1998-2013 Free Software Foundation, Inc. 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 3, or (at your option) 10any later version. 11 12GCC is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with GCC; see the file COPYING3. If not see 19<http://www.gnu.org/licenses/>. 20 21Java and all Java-based marks are trademarks or registered trademarks 22of Sun Microsystems, Inc. in the United States and other countries. 23The Free Software Foundation is independent of Sun Microsystems, Inc. 24 25Written by Per Bothner <bothner@cygnus.com>, February 1996. 26*/ 27 28/* JAVAOP (OPNAME, OPCODE, OPKIND, OPERAND_TYPE, OPERAND_VALUE), where: 29 OPNAME is the name of the opcode. 30 OPCODE is the 1-byte opcode value. 31 OPKIND is the kind of operation. 32 OPERAND_TYPE is the type operands affected. 33 OPERAND_VALUE tells where to get the value. (Its meaning 34 depends on OPKIND.) */ 35 36/* Various macro used in OPERAND_VALUE: 37IMMEDIATE_s1: An immediate signed 1-byte value in the byte-code stream. 38IMMEDIATE_s2: An immediate signed 2-byte value in the byte-code stream. 39IMMEDIATE_u1: An immediate unsigned 1-byte value in the byte-code stream. 40IMMEDIATE_u2: An immediate unsigned 2-byte value in the byte-code stream. 41 42CONST_INDEX_1: An immediate unsigned 1-byte index into the constant pool. 43CONST_INDEX_2: An immediate unsigned 2-byte index into the constant pool. 44*/ 45 46/* More specifically, this is the meaning of the various OPKINDs: 47 48BINOP: binary operation 49 OPERAND_TYPE is the argument type. 50 OPERAND_VALUE is PLUS, MINUS, MULT, TRUNC_DIV, RDIV, REM, 51 LSHIFT, RSHIFT, URSHIFT, BIT_AND, BIT_IOR, BIT_XOR, 52 COMPARE, COMPARE_L, or COMPARE_G. 53 54UNOP: unary operation 55 OPERAND_TYPE is the argument type. 56 OPERAND_VALUE is NEG. 57 58INVOKE: invoke operations 59 OPERAND_TYPE is VIRTUAL, SPECIAL, STATIC, or INTERFACE. 60 OPERAND_VALUE is 1 if interface, 0 otherwise. 61 62OBJECT: new, checkcast, instanceof 63 OPERAND_TYPE is PTR. 64 OPERAND_VALUE is NEW, CHECKCAST, or INSTANCEOF. 65 66BRANCH: branch operations 67 OPERAND_TYPE is GOTO, CALL, or RETURN. 68 OPERAND_VALUE is IMMEDIATE_s2, VAR_INDEX_1, IMMEDIATE_s4, 69 or VAR_INDEX_2. 70 71STACK: Various stack operations. 72 73PUSHC: Push a constant onto the operand stack. 74 OPERAND_VALUE maybe be the value to push, 75 or IMMEDIATE_s1 or IMMEDIATE_s2 if the constant is immediate, 76 or CONST_INDEX_1 or CONST_INDEX_2 for a constant pool index. 77 78LOAD: Push a value from a local variable onto the operand stack. 79 OPERAND_VALUE is the index of the local variable in the current 80 Java frame. It can be a literal, or IMMEDIATE_i2. 81 82CONVERT: Convert top of stack value from one type to another. 83 OPERAND_TYPE is the argument type. 84 OPERAND_VALUE is the result type. 85 86TEST: Compares an integer (popped from the stack) against zero. 87 If the test (in OPERAND_VALUE) is true, goto a relative 88 offset given by the next two bytes. 89 90COND: Compares two values (popped from the stack) against each other. 91 If the test (in OPERAND_VALUE) is true, goto a relative 92 offset given by the next two bytes. 93 94SWITCH: 95 OPERAND_VALUE is either TABLE or LOOKUP. 96 97ARRAY: 98 OPERAND_VALUE is LOAD, STORE, LENGTH, or NEW. 99 100FIELD: Extracts from or stores into a field. 101 OPERAND_TYPE is 1 for a static field, 0 for a regular field. 102 OPERAND_VALUE is 1 for a put operation, 0 for a get operation. 103 104SPECIAL: 105 Random bunch of opcodes. 106 107*/ 108 109JAVAOP (nop, 0, STACK, POP, 0) 110JAVAOP (aconst_null, 1, PUSHC, PTR, 0) 111JAVAOP (iconst_m1, 2, PUSHC, INT, -1) 112JAVAOP (iconst_0, 3, PUSHC, INT, 0) 113JAVAOP (iconst_1, 4, PUSHC, INT, 1) 114JAVAOP (iconst_2, 5, PUSHC, INT, 2) 115JAVAOP (iconst_3, 6, PUSHC, INT, 3) 116JAVAOP (iconst_4, 7, PUSHC, INT, 4) 117JAVAOP (iconst_5, 8, PUSHC, INT, 5) 118JAVAOP (lconst_0, 9, PUSHC, LONG, 0) 119JAVAOP (lconst_1, 10, PUSHC, LONG, 1) 120JAVAOP (fconst_0, 11, PUSHC, FLOAT, 0) 121JAVAOP (fconst_1, 12, PUSHC, FLOAT, 1) 122JAVAOP (fconst_2, 13, PUSHC, FLOAT, 2) 123JAVAOP (dconst_0, 14, PUSHC, DOUBLE, 0) 124JAVAOP (dconst_1, 15, PUSHC, DOUBLE, 1) 125JAVAOP (bipush, 16, PUSHC, INT, IMMEDIATE_s1) 126JAVAOP (sipush, 17, PUSHC, INT, IMMEDIATE_s2) 127JAVAOP (ldc, 18, PUSHC, INT, CONST_INDEX_1) 128JAVAOP (ldc_w, 19, PUSHC, INT, CONST_INDEX_2) 129JAVAOP (ldc2_w, 20, PUSHC, LONG, CONST_INDEX_2) 130JAVAOP (iload, 21, LOAD, INT, IMMEDIATE_u1) 131JAVAOP (lload, 22, LOAD, LONG, IMMEDIATE_u1) 132JAVAOP (fload, 23, LOAD, FLOAT, IMMEDIATE_u1) 133JAVAOP (dload, 24, LOAD, DOUBLE, IMMEDIATE_u1) 134JAVAOP (aload, 25, LOAD, PTR, IMMEDIATE_u1) 135JAVAOP (iload_0, 26, LOAD, INT, 0) 136JAVAOP (iload_1, 27, LOAD, INT, 1) 137JAVAOP (iload_2, 28, LOAD, INT, 2) 138JAVAOP (iload_3, 29, LOAD, INT, 3) 139JAVAOP (lload_0, 30, LOAD, LONG, 0) 140JAVAOP (lload_1, 31, LOAD, LONG, 1) 141JAVAOP (lload_2, 32, LOAD, LONG, 2) 142JAVAOP (lload_3, 33, LOAD, LONG, 3) 143JAVAOP (fload_0, 34, LOAD, FLOAT, 0) 144JAVAOP (fload_1, 35, LOAD, FLOAT, 1) 145JAVAOP (fload_2, 36, LOAD, FLOAT, 2) 146JAVAOP (fload_3, 37, LOAD, FLOAT, 3) 147JAVAOP (dload_0, 38, LOAD, DOUBLE, 0) 148JAVAOP (dload_1, 39, LOAD, DOUBLE, 1) 149JAVAOP (dload_2, 40, LOAD, DOUBLE, 2) 150JAVAOP (dload_3, 41, LOAD, DOUBLE, 3) 151JAVAOP (aload_0, 42, LOAD, PTR, 0) 152JAVAOP (aload_1, 43, LOAD, PTR, 1) 153JAVAOP (aload_2, 44, LOAD, PTR, 2) 154JAVAOP (aload_3, 45, LOAD, PTR, 3) 155JAVAOP (iaload, 46, ARRAY, INT, LOAD) 156JAVAOP (laload, 47, ARRAY, LONG, LOAD) 157JAVAOP (faload, 48, ARRAY, FLOAT, LOAD) 158JAVAOP (daload, 49, ARRAY, DOUBLE, LOAD) 159JAVAOP (aaload, 50, ARRAY, PTR, LOAD) 160JAVAOP (baload, 51, ARRAY, BYTE, LOAD) 161JAVAOP (caload, 52, ARRAY, CHAR, LOAD) 162JAVAOP (saload, 53, ARRAY, SHORT, LOAD) 163JAVAOP (istore, 54, STORE, INT, IMMEDIATE_u1) 164JAVAOP (lstore, 55, STORE, LONG, IMMEDIATE_u1) 165JAVAOP (fstore, 56, STORE, FLOAT, IMMEDIATE_u1) 166JAVAOP (dstore, 57, STORE, DOUBLE, IMMEDIATE_u1) 167JAVAOP (astore, 58, STORE, PTR, IMMEDIATE_u1) 168JAVAOP (istore_0, 59, STORE, INT, 0) 169JAVAOP (istore_1, 60, STORE, INT, 1) 170JAVAOP (istore_2, 61, STORE, INT, 2) 171JAVAOP (istore_3, 62, STORE, INT, 3) 172JAVAOP (lstore_0, 63, STORE, LONG, 0) 173JAVAOP (lstore_1, 64, STORE, LONG, 1) 174JAVAOP (lstore_2, 65, STORE, LONG, 2) 175JAVAOP (lstore_3, 66, STORE, LONG, 3) 176JAVAOP (fstore_0, 67, STORE, FLOAT, 0) 177JAVAOP (fstore_1, 68, STORE, FLOAT, 1) 178JAVAOP (fstore_2, 69, STORE, FLOAT, 2) 179JAVAOP (fstore_3, 70, STORE, FLOAT, 3) 180JAVAOP (dstore_0, 71, STORE, DOUBLE, 0) 181JAVAOP (dstore_1, 72, STORE, DOUBLE, 1) 182JAVAOP (dstore_2, 73, STORE, DOUBLE, 2) 183JAVAOP (dstore_3, 74, STORE, DOUBLE, 3) 184JAVAOP (astore_0, 75, STORE, PTR, 0) 185JAVAOP (astore_1, 76, STORE, PTR, 1) 186JAVAOP (astore_2, 77, STORE, PTR, 2) 187JAVAOP (astore_3, 78, STORE, PTR, 3) 188JAVAOP (iastore, 79, ARRAY, INT, STORE) 189JAVAOP (lastore, 80, ARRAY, LONG, STORE) 190JAVAOP (fastore, 81, ARRAY, FLOAT, STORE) 191JAVAOP (dastore, 82, ARRAY, DOUBLE, STORE) 192JAVAOP (aastore, 83, ARRAY, PTR, STORE) 193JAVAOP (bastore, 84, ARRAY, BYTE, STORE) 194JAVAOP (castore, 85, ARRAY, CHAR, STORE) 195JAVAOP (sastore, 86, ARRAY, SHORT, STORE) 196JAVAOP (pop, 87, STACK, POP, 1) 197JAVAOP (pop2, 88, STACK, POP, 2) 198JAVAOP (dup, 89, STACK, DUP, 1) 199JAVAOP (dup_x1, 90, STACK, DUPx1, 1) 200JAVAOP (dup_x2, 91, STACK, DUPx2, 1) 201JAVAOP (dup2, 92, STACK, DUP, 2) 202JAVAOP (dup2_x1, 93, STACK, DUPx1, 2) 203JAVAOP (dup2_x2, 94, STACK, DUPx2, 2) 204JAVAOP (swap, 95, STACK, SWAP, 0) 205JAVAOP (iadd, 96, BINOP, INT, PLUS) 206JAVAOP (ladd, 97, BINOP, LONG, PLUS) 207JAVAOP (fadd, 98, BINOP, FLOAT, PLUS) 208JAVAOP (dadd, 99, BINOP, DOUBLE, PLUS) 209JAVAOP (isub, 100, BINOP, INT, MINUS) 210JAVAOP (lsub, 101, BINOP, LONG, MINUS) 211JAVAOP (fsub, 102, BINOP, FLOAT, MINUS) 212JAVAOP (dsub, 103, BINOP, DOUBLE, MINUS) 213JAVAOP (imul, 104, BINOP, INT, MULT) 214JAVAOP (lmul, 105, BINOP, LONG, MULT) 215JAVAOP (fmul, 106, BINOP, FLOAT, MULT) 216JAVAOP (dmul, 107, BINOP, DOUBLE, MULT) 217JAVAOP (idiv, 108, BINOP, INT, TRUNC_DIV) 218JAVAOP (ldiv, 109, BINOP, LONG, TRUNC_DIV) 219JAVAOP (fdiv, 110, BINOP, FLOAT, RDIV) 220JAVAOP (ddiv, 111, BINOP, DOUBLE, RDIV) 221JAVAOP (irem, 112, BINOP, INT, REM) 222JAVAOP (lrem, 113, BINOP, LONG, REM) 223JAVAOP (frem, 114, BINOP, FLOAT, REM) 224JAVAOP (drem, 115, BINOP, DOUBLE, REM) 225JAVAOP (ineg, 116, UNOP, INT, NEG) 226JAVAOP (lneg, 117, UNOP, LONG, NEG) 227JAVAOP (fneg, 118, UNOP, FLOAT, NEG) 228JAVAOP (dneg, 119, UNOP, DOUBLE, NEG) 229JAVAOP (ishl, 120, BINOP, INT, LSHIFT) 230JAVAOP (lshl, 121, BINOP, LONG, LSHIFT) 231JAVAOP (ishr, 122, BINOP, INT, RSHIFT) 232JAVAOP (lshr, 123, BINOP, LONG, RSHIFT) 233JAVAOP (iushr, 124, BINOP, INT, URSHIFT) 234JAVAOP (lushr, 125, BINOP, LONG, URSHIFT) 235JAVAOP (iand, 126, BINOP, INT, BIT_AND) 236JAVAOP (land, 127, BINOP, LONG, BIT_AND) 237JAVAOP (ior, 128, BINOP, INT, BIT_IOR) 238JAVAOP (lor, 129, BINOP, LONG, BIT_IOR) 239JAVAOP (ixor, 130, BINOP, INT, BIT_XOR) 240JAVAOP (lxor, 131, BINOP, LONG, BIT_XOR) 241JAVAOP (iinc, 132, SPECIAL, INT, IINC) 242JAVAOP (i2l, 133, CONVERT, INT, LONG) 243JAVAOP (i2f, 134, CONVERT, INT, FLOAT) 244JAVAOP (i2d, 135, CONVERT, INT, DOUBLE) 245JAVAOP (l2i, 136, CONVERT, LONG, INT) 246JAVAOP (l2f, 137, CONVERT, LONG, FLOAT) 247JAVAOP (l2d, 138, CONVERT, LONG, DOUBLE) 248JAVAOP (f2i, 139, CONVERT, FLOAT, INT) 249JAVAOP (f2l, 140, CONVERT, FLOAT, LONG) 250JAVAOP (f2d, 141, CONVERT, FLOAT, DOUBLE) 251JAVAOP (d2i, 142, CONVERT, DOUBLE, INT) 252JAVAOP (d2l, 143, CONVERT, DOUBLE, LONG) 253JAVAOP (d2f, 144, CONVERT, DOUBLE, FLOAT) 254JAVAOP (i2b, 145, CONVERT2, INT, BYTE) 255JAVAOP (i2c, 146, CONVERT2, INT, CHAR) 256JAVAOP (i2s, 147, CONVERT2, INT, SHORT) 257JAVAOP (lcmp, 148, BINOP, LONG, COMPARE) 258JAVAOP (fcmpl, 149, BINOP, FLOAT, COMPARE_L) 259JAVAOP (fcmpg, 150, BINOP, FLOAT, COMPARE_G) 260JAVAOP (dcmpl, 151, BINOP, DOUBLE, COMPARE_L) 261JAVAOP (dcmpg, 152, BINOP, DOUBLE, COMPARE_G) 262JAVAOP (ifeq, 153, TEST, INT, EQ) 263JAVAOP (ifne, 154, TEST, INT, NE) 264JAVAOP (iflt, 155, TEST, INT, LT) 265JAVAOP (ifge, 156, TEST, INT, GE) 266JAVAOP (ifgt, 157, TEST, INT, GT) 267JAVAOP (ifle, 158, TEST, INT, LE) 268JAVAOP (if_icmpeq, 159, COND, INT, EQ) 269JAVAOP (if_icmpne, 160, COND, INT, NE) 270JAVAOP (if_icmplt, 161, COND, INT, LT) 271JAVAOP (if_icmpge, 162, COND, INT, GE) 272JAVAOP (if_icmpgt, 163, COND, INT, GT) 273JAVAOP (if_icmple, 164, COND, INT, LE) 274JAVAOP (if_acmpeq, 165, COND, PTR, EQ) 275JAVAOP (if_acmpne, 166, COND, PTR, NE) 276JAVAOP (goto, 167, BRANCH, GOTO, IMMEDIATE_s2) 277JAVAOP (jsr, 168, JSR, CALL, IMMEDIATE_s2) 278JAVAOP (ret, 169, RET, RETURN, VAR_INDEX_1) 279JAVAOP (tableswitch, 170, SWITCH, INT, TABLE) 280JAVAOP (lookupswitch, 171, SWITCH, INT, LOOKUP) 281JAVAOP (ireturn, 172, RETURN, INT, 0) 282JAVAOP (lreturn, 173, RETURN, LONG, 0) 283JAVAOP (freturn, 174, RETURN, FLOAT, 0) 284JAVAOP (dreturn, 175, RETURN, DOUBLE, 0) 285JAVAOP (areturn, 176, RETURN, PTR, 0) 286JAVAOP (return, 177, RETURN, VOID, 0) 287JAVAOP (getstatic, 178, FIELD, 1, 0) 288JAVAOP (putstatic, 179, FIELD, 1, 1) 289JAVAOP (getfield, 180, FIELD, 0, 0) 290JAVAOP (putfield, 181, FIELD, 0, 1) 291JAVAOP (invokevirtual, 182, INVOKE, VIRTUAL,0) 292JAVAOP (invokespecial, 183, INVOKE, SPECIAL, 0) 293JAVAOP (invokestatic, 184, INVOKE, STATIC, 0) 294JAVAOP (invokeinterface,185, INVOKE, INTERFACE, 1) 295JAVAOP (invokedynamic, 186, INVOKE, DYNAMIC, 1) 296JAVAOP (new, 187, OBJECT, PTR, NEW) 297JAVAOP (newarray, 188, ARRAY, NUM, NEW) 298JAVAOP (anewarray, 189, ARRAY, PTR, NEW) 299JAVAOP (arraylength, 190, ARRAY, INT, LENGTH) 300JAVAOP (athrow, 191, SPECIAL, ANY, THROW) 301JAVAOP (checkcast, 192, OBJECT, PTR, CHECKCAST) 302JAVAOP (instanceof, 193, OBJECT, PTR, INSTANCEOF) 303JAVAOP (monitorenter, 194, SPECIAL, MONITOR, ENTER) 304JAVAOP (monitorexit, 195, SPECIAL, MONITOR, EXIT) 305JAVAOP (wide, 196, SPECIAL, ANY, WIDE) 306JAVAOP (multianewarray,197, ARRAY, MULTI, NEW) 307JAVAOP (ifnull, 198, TEST, PTR, EQ) 308JAVAOP (ifnonnull, 199, TEST, PTR, NE) 309JAVAOP (goto_w, 200, BRANCH, GOTO, IMMEDIATE_s4) 310JAVAOP (jsr_w, 201, JSR, CALL, IMMEDIATE_s4) 311JAVAOP (breakpoint, 202, SPECIAL, ANY, BREAK) 312JAVAOP (ret_w, 209, RET, RETURN, VAR_INDEX_2) 313JAVAOP (impdep1, 254, IMPL, ANY, 1) 314JAVAOP (impdep2, 255, IMPL, ANY, 2) 315