001: /*
002: * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.javac.jvm;
027:
028: import com.sun.tools.javac.util.Version;
029:
030: /** Bytecode instruction codes, as well as typecodes used as
031: * instruction modifiers.
032: *
033: * <p><b>This is NOT part of any API supported by Sun Microsystems. If
034: * you write code that depends on this, you do so at your own risk.
035: * This code and its internal interfaces are subject to change or
036: * deletion without notice.</b>
037: */
038: @Version("@(#)ByteCodes.java 1.26 07/05/05")
039: public interface ByteCodes {
040:
041: /** Byte code instruction codes.
042: */
043: int illegal = -1, nop = 0, aconst_null = 1, iconst_m1 = 2,
044: iconst_0 = 3, iconst_1 = 4, iconst_2 = 5, iconst_3 = 6,
045: iconst_4 = 7, iconst_5 = 8, lconst_0 = 9, lconst_1 = 10,
046: fconst_0 = 11, fconst_1 = 12, fconst_2 = 13, dconst_0 = 14,
047: dconst_1 = 15, bipush = 16, sipush = 17, ldc1 = 18,
048: ldc2 = 19, ldc2w = 20, iload = 21, lload = 22, fload = 23,
049: dload = 24, aload = 25, iload_0 = 26, iload_1 = 27,
050: iload_2 = 28, iload_3 = 29, lload_0 = 30, lload_1 = 31,
051: lload_2 = 32, lload_3 = 33, fload_0 = 34, fload_1 = 35,
052: fload_2 = 36, fload_3 = 37, dload_0 = 38, dload_1 = 39,
053: dload_2 = 40, dload_3 = 41, aload_0 = 42, aload_1 = 43,
054: aload_2 = 44, aload_3 = 45, iaload = 46, laload = 47,
055: faload = 48, daload = 49, aaload = 50, baload = 51,
056: caload = 52, saload = 53, istore = 54, lstore = 55,
057: fstore = 56, dstore = 57, astore = 58, istore_0 = 59,
058: istore_1 = 60, istore_2 = 61, istore_3 = 62, lstore_0 = 63,
059: lstore_1 = 64, lstore_2 = 65, lstore_3 = 66, fstore_0 = 67,
060: fstore_1 = 68, fstore_2 = 69, fstore_3 = 70, dstore_0 = 71,
061: dstore_1 = 72, dstore_2 = 73, dstore_3 = 74, astore_0 = 75,
062: astore_1 = 76, astore_2 = 77, astore_3 = 78, iastore = 79,
063: lastore = 80, fastore = 81, dastore = 82, aastore = 83,
064: bastore = 84, castore = 85, sastore = 86, pop = 87,
065: pop2 = 88, dup = 89, dup_x1 = 90, dup_x2 = 91, dup2 = 92,
066: dup2_x1 = 93, dup2_x2 = 94, swap = 95, iadd = 96,
067: ladd = 97, fadd = 98, dadd = 99, isub = 100, lsub = 101,
068: fsub = 102, dsub = 103, imul = 104, lmul = 105, fmul = 106,
069: dmul = 107, idiv = 108, ldiv = 109, fdiv = 110, ddiv = 111,
070: imod = 112, lmod = 113, fmod = 114, dmod = 115, ineg = 116,
071: lneg = 117, fneg = 118, dneg = 119, ishl = 120, lshl = 121,
072: ishr = 122, lshr = 123, iushr = 124, lushr = 125,
073: iand = 126, land = 127, ior = 128, lor = 129, ixor = 130,
074: lxor = 131, iinc = 132, i2l = 133, i2f = 134, i2d = 135,
075: l2i = 136, l2f = 137, l2d = 138, f2i = 139, f2l = 140,
076: f2d = 141, d2i = 142, d2l = 143, d2f = 144, int2byte = 145,
077: int2char = 146, int2short = 147, lcmp = 148, fcmpl = 149,
078: fcmpg = 150, dcmpl = 151, dcmpg = 152, ifeq = 153,
079: ifne = 154, iflt = 155, ifge = 156, ifgt = 157, ifle = 158,
080: if_icmpeq = 159, if_icmpne = 160, if_icmplt = 161,
081: if_icmpge = 162, if_icmpgt = 163, if_icmple = 164,
082: if_acmpeq = 165, if_acmpne = 166, goto_ = 167, jsr = 168,
083: ret = 169, tableswitch = 170, lookupswitch = 171,
084: ireturn = 172, lreturn = 173, freturn = 174, dreturn = 175,
085: areturn = 176, return_ = 177, getstatic = 178,
086: putstatic = 179,
087: getfield = 180,
088: putfield = 181,
089: invokevirtual = 182,
090: invokespecial = 183,
091: invokestatic = 184,
092: invokeinterface = 185,
093: // ___unused___ = 186,
094: new_ = 187, newarray = 188, anewarray = 189,
095: arraylength = 190, athrow = 191, checkcast = 192,
096: instanceof _ = 193, monitorenter = 194, monitorexit = 195,
097: wide = 196, multianewarray = 197, if_acmp_null = 198,
098: if_acmp_nonnull = 199, goto_w = 200, jsr_w = 201,
099: breakpoint = 202, ByteCodeCount = 203;
100:
101: /** Virtual instruction codes; used for constant folding.
102: */
103: int string_add = 256, // string +
104: bool_not = 257, // boolean !
105: bool_and = 258, // boolean &&
106: bool_or = 259; // boolean ||
107:
108: /** Virtual opcodes; used for shifts with long shiftcount
109: */
110: int ishll = 270, // int shift left with long count
111: lshll = 271, // long shift left with long count
112: ishrl = 272, // int shift right with long count
113: lshrl = 273, // long shift right with long count
114: iushrl = 274, // int unsigned shift right with long count
115: lushrl = 275; // long unsigned shift right with long count
116:
117: /** Virtual opcode for null reference checks
118: */
119: int nullchk = 276; // return operand if non-null,
120: // otherwise throw NullPointerException.
121:
122: /** Virtual opcode for disallowed operations.
123: */
124: int error = 277;
125:
126: /** All conditional jumps come in pairs. To streamline the
127: * treatment of jumps, we also introduce a negation of an
128: * unconditional jump. That opcode happens to be jsr.
129: */
130: int dontgoto = jsr;
131:
132: /** Shift and mask constants for shifting prefix instructions.
133: * a pair of instruction codes such as LCMP ; IFEQ is encoded
134: * in Symtab as (LCMP << preShift) + IFEQ.
135: */
136: int preShift = 9;
137: int preMask = (1 << preShift) - 1;
138:
139: /** Type codes.
140: */
141: int INTcode = 0, LONGcode = 1, FLOATcode = 2, DOUBLEcode = 3,
142: OBJECTcode = 4, BYTEcode = 5, CHARcode = 6, SHORTcode = 7,
143: VOIDcode = 8, TypeCodeCount = 9;
144:
145: static final String[] typecodeNames = { "int", "long", "float",
146: "double", "object", "byte", "char", "short", "void", "oops" };
147: }
|