src/share/classes/com/sun/tools/javac/jvm/ByteCodes.java

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.tools.javac.jvm;
aoqi@0 27
aoqi@0 28
aoqi@0 29 /** Bytecode instruction codes, as well as typecodes used as
aoqi@0 30 * instruction modifiers.
aoqi@0 31 *
aoqi@0 32 * <p><b>This is NOT part of any supported API.
aoqi@0 33 * If you write code that depends on this, you do so at your own risk.
aoqi@0 34 * This code and its internal interfaces are subject to change or
aoqi@0 35 * deletion without notice.</b>
aoqi@0 36 */
aoqi@0 37 public interface ByteCodes {
aoqi@0 38
aoqi@0 39 /** Byte code instruction codes.
aoqi@0 40 */
aoqi@0 41 int illegal = -1,
aoqi@0 42 nop = 0,
aoqi@0 43 aconst_null = 1,
aoqi@0 44 iconst_m1 = 2,
aoqi@0 45 iconst_0 = 3,
aoqi@0 46 iconst_1 = 4,
aoqi@0 47 iconst_2 = 5,
aoqi@0 48 iconst_3 = 6,
aoqi@0 49 iconst_4 = 7,
aoqi@0 50 iconst_5 = 8,
aoqi@0 51 lconst_0 = 9,
aoqi@0 52 lconst_1 = 10,
aoqi@0 53 fconst_0 = 11,
aoqi@0 54 fconst_1 = 12,
aoqi@0 55 fconst_2 = 13,
aoqi@0 56 dconst_0 = 14,
aoqi@0 57 dconst_1 = 15,
aoqi@0 58 bipush = 16,
aoqi@0 59 sipush = 17,
aoqi@0 60 ldc1 = 18,
aoqi@0 61 ldc2 = 19,
aoqi@0 62 ldc2w = 20,
aoqi@0 63 iload = 21,
aoqi@0 64 lload = 22,
aoqi@0 65 fload = 23,
aoqi@0 66 dload = 24,
aoqi@0 67 aload = 25,
aoqi@0 68 iload_0 = 26,
aoqi@0 69 iload_1 = 27,
aoqi@0 70 iload_2 = 28,
aoqi@0 71 iload_3 = 29,
aoqi@0 72 lload_0 = 30,
aoqi@0 73 lload_1 = 31,
aoqi@0 74 lload_2 = 32,
aoqi@0 75 lload_3 = 33,
aoqi@0 76 fload_0 = 34,
aoqi@0 77 fload_1 = 35,
aoqi@0 78 fload_2 = 36,
aoqi@0 79 fload_3 = 37,
aoqi@0 80 dload_0 = 38,
aoqi@0 81 dload_1 = 39,
aoqi@0 82 dload_2 = 40,
aoqi@0 83 dload_3 = 41,
aoqi@0 84 aload_0 = 42,
aoqi@0 85 aload_1 = 43,
aoqi@0 86 aload_2 = 44,
aoqi@0 87 aload_3 = 45,
aoqi@0 88 iaload = 46,
aoqi@0 89 laload = 47,
aoqi@0 90 faload = 48,
aoqi@0 91 daload = 49,
aoqi@0 92 aaload = 50,
aoqi@0 93 baload = 51,
aoqi@0 94 caload = 52,
aoqi@0 95 saload = 53,
aoqi@0 96 istore = 54,
aoqi@0 97 lstore = 55,
aoqi@0 98 fstore = 56,
aoqi@0 99 dstore = 57,
aoqi@0 100 astore = 58,
aoqi@0 101 istore_0 = 59,
aoqi@0 102 istore_1 = 60,
aoqi@0 103 istore_2 = 61,
aoqi@0 104 istore_3 = 62,
aoqi@0 105 lstore_0 = 63,
aoqi@0 106 lstore_1 = 64,
aoqi@0 107 lstore_2 = 65,
aoqi@0 108 lstore_3 = 66,
aoqi@0 109 fstore_0 = 67,
aoqi@0 110 fstore_1 = 68,
aoqi@0 111 fstore_2 = 69,
aoqi@0 112 fstore_3 = 70,
aoqi@0 113 dstore_0 = 71,
aoqi@0 114 dstore_1 = 72,
aoqi@0 115 dstore_2 = 73,
aoqi@0 116 dstore_3 = 74,
aoqi@0 117 astore_0 = 75,
aoqi@0 118 astore_1 = 76,
aoqi@0 119 astore_2 = 77,
aoqi@0 120 astore_3 = 78,
aoqi@0 121 iastore = 79,
aoqi@0 122 lastore = 80,
aoqi@0 123 fastore = 81,
aoqi@0 124 dastore = 82,
aoqi@0 125 aastore = 83,
aoqi@0 126 bastore = 84,
aoqi@0 127 castore = 85,
aoqi@0 128 sastore = 86,
aoqi@0 129 pop = 87,
aoqi@0 130 pop2 = 88,
aoqi@0 131 dup = 89,
aoqi@0 132 dup_x1 = 90,
aoqi@0 133 dup_x2 = 91,
aoqi@0 134 dup2 = 92,
aoqi@0 135 dup2_x1 = 93,
aoqi@0 136 dup2_x2 = 94,
aoqi@0 137 swap = 95,
aoqi@0 138 iadd = 96,
aoqi@0 139 ladd = 97,
aoqi@0 140 fadd = 98,
aoqi@0 141 dadd = 99,
aoqi@0 142 isub = 100,
aoqi@0 143 lsub = 101,
aoqi@0 144 fsub = 102,
aoqi@0 145 dsub = 103,
aoqi@0 146 imul = 104,
aoqi@0 147 lmul = 105,
aoqi@0 148 fmul = 106,
aoqi@0 149 dmul = 107,
aoqi@0 150 idiv = 108,
aoqi@0 151 ldiv = 109,
aoqi@0 152 fdiv = 110,
aoqi@0 153 ddiv = 111,
aoqi@0 154 imod = 112,
aoqi@0 155 lmod = 113,
aoqi@0 156 fmod = 114,
aoqi@0 157 dmod = 115,
aoqi@0 158 ineg = 116,
aoqi@0 159 lneg = 117,
aoqi@0 160 fneg = 118,
aoqi@0 161 dneg = 119,
aoqi@0 162 ishl = 120,
aoqi@0 163 lshl = 121,
aoqi@0 164 ishr = 122,
aoqi@0 165 lshr = 123,
aoqi@0 166 iushr = 124,
aoqi@0 167 lushr = 125,
aoqi@0 168 iand = 126,
aoqi@0 169 land = 127,
aoqi@0 170 ior = 128,
aoqi@0 171 lor = 129,
aoqi@0 172 ixor = 130,
aoqi@0 173 lxor = 131,
aoqi@0 174 iinc = 132,
aoqi@0 175 i2l = 133,
aoqi@0 176 i2f = 134,
aoqi@0 177 i2d = 135,
aoqi@0 178 l2i = 136,
aoqi@0 179 l2f = 137,
aoqi@0 180 l2d = 138,
aoqi@0 181 f2i = 139,
aoqi@0 182 f2l = 140,
aoqi@0 183 f2d = 141,
aoqi@0 184 d2i = 142,
aoqi@0 185 d2l = 143,
aoqi@0 186 d2f = 144,
aoqi@0 187 int2byte = 145,
aoqi@0 188 int2char = 146,
aoqi@0 189 int2short = 147,
aoqi@0 190 lcmp = 148,
aoqi@0 191 fcmpl = 149,
aoqi@0 192 fcmpg = 150,
aoqi@0 193 dcmpl = 151,
aoqi@0 194 dcmpg = 152,
aoqi@0 195 ifeq = 153,
aoqi@0 196 ifne = 154,
aoqi@0 197 iflt = 155,
aoqi@0 198 ifge = 156,
aoqi@0 199 ifgt = 157,
aoqi@0 200 ifle = 158,
aoqi@0 201 if_icmpeq = 159,
aoqi@0 202 if_icmpne = 160,
aoqi@0 203 if_icmplt = 161,
aoqi@0 204 if_icmpge = 162,
aoqi@0 205 if_icmpgt = 163,
aoqi@0 206 if_icmple = 164,
aoqi@0 207 if_acmpeq = 165,
aoqi@0 208 if_acmpne = 166,
aoqi@0 209 goto_ = 167,
aoqi@0 210 jsr = 168,
aoqi@0 211 ret = 169,
aoqi@0 212 tableswitch = 170,
aoqi@0 213 lookupswitch = 171,
aoqi@0 214 ireturn = 172,
aoqi@0 215 lreturn = 173,
aoqi@0 216 freturn = 174,
aoqi@0 217 dreturn = 175,
aoqi@0 218 areturn = 176,
aoqi@0 219 return_ = 177,
aoqi@0 220 getstatic = 178,
aoqi@0 221 putstatic = 179,
aoqi@0 222 getfield = 180,
aoqi@0 223 putfield = 181,
aoqi@0 224 invokevirtual = 182,
aoqi@0 225 invokespecial = 183,
aoqi@0 226 invokestatic = 184,
aoqi@0 227 invokeinterface = 185,
aoqi@0 228 invokedynamic = 186,
aoqi@0 229 new_ = 187,
aoqi@0 230 newarray = 188,
aoqi@0 231 anewarray = 189,
aoqi@0 232 arraylength = 190,
aoqi@0 233 athrow = 191,
aoqi@0 234 checkcast = 192,
aoqi@0 235 instanceof_ = 193,
aoqi@0 236 monitorenter = 194,
aoqi@0 237 monitorexit = 195,
aoqi@0 238 wide = 196,
aoqi@0 239 multianewarray = 197,
aoqi@0 240 if_acmp_null = 198,
aoqi@0 241 if_acmp_nonnull = 199,
aoqi@0 242 goto_w = 200,
aoqi@0 243 jsr_w = 201,
aoqi@0 244 breakpoint = 202,
aoqi@0 245 ByteCodeCount = 203;
aoqi@0 246
aoqi@0 247 /** Virtual instruction codes; used for constant folding.
aoqi@0 248 */
aoqi@0 249 int string_add = 256, // string +
aoqi@0 250 bool_not = 257, // boolean !
aoqi@0 251 bool_and = 258, // boolean &&
aoqi@0 252 bool_or = 259; // boolean ||
aoqi@0 253
aoqi@0 254 /** Virtual opcodes; used for shifts with long shiftcount
aoqi@0 255 */
aoqi@0 256 int ishll = 270, // int shift left with long count
aoqi@0 257 lshll = 271, // long shift left with long count
aoqi@0 258 ishrl = 272, // int shift right with long count
aoqi@0 259 lshrl = 273, // long shift right with long count
aoqi@0 260 iushrl = 274, // int unsigned shift right with long count
aoqi@0 261 lushrl = 275; // long unsigned shift right with long count
aoqi@0 262
aoqi@0 263 /** Virtual opcode for null reference checks
aoqi@0 264 */
aoqi@0 265 int nullchk = 276; // return operand if non-null,
aoqi@0 266 // otherwise throw NullPointerException.
aoqi@0 267
aoqi@0 268 /** Virtual opcode for disallowed operations.
aoqi@0 269 */
aoqi@0 270 int error = 277;
aoqi@0 271
aoqi@0 272 /** All conditional jumps come in pairs. To streamline the
aoqi@0 273 * treatment of jumps, we also introduce a negation of an
aoqi@0 274 * unconditional jump. That opcode happens to be jsr.
aoqi@0 275 */
aoqi@0 276 int dontgoto = jsr;
aoqi@0 277
aoqi@0 278 /** Shift and mask constants for shifting prefix instructions.
aoqi@0 279 * a pair of instruction codes such as LCMP ; IFEQ is encoded
aoqi@0 280 * in Symtab as {@literal (LCMP << preShift) + IFEQ }.
aoqi@0 281 */
aoqi@0 282 int preShift = 9;
aoqi@0 283 int preMask = (1 << preShift) - 1;
aoqi@0 284
aoqi@0 285 /** Type codes.
aoqi@0 286 */
aoqi@0 287 int INTcode = 0,
aoqi@0 288 LONGcode = 1,
aoqi@0 289 FLOATcode = 2,
aoqi@0 290 DOUBLEcode = 3,
aoqi@0 291 OBJECTcode = 4,
aoqi@0 292 BYTEcode = 5,
aoqi@0 293 CHARcode = 6,
aoqi@0 294 SHORTcode = 7,
aoqi@0 295 VOIDcode = 8,
aoqi@0 296 TypeCodeCount = 9;
aoqi@0 297
aoqi@0 298 static final String[] typecodeNames = {
aoqi@0 299 "int",
aoqi@0 300 "long",
aoqi@0 301 "float",
aoqi@0 302 "double",
aoqi@0 303 "object",
aoqi@0 304 "byte",
aoqi@0 305 "char",
aoqi@0 306 "short",
aoqi@0 307 "void",
aoqi@0 308 "oops"
aoqi@0 309 };
aoqi@0 310 }

mercurial