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