1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ByteCodes.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,310 @@ 1.4 +/* 1.5 + * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package com.sun.tools.javac.jvm; 1.30 + 1.31 + 1.32 +/** Bytecode instruction codes, as well as typecodes used as 1.33 + * instruction modifiers. 1.34 + * 1.35 + * <p><b>This is NOT part of any API supported by Sun Microsystems. If 1.36 + * you write code that depends on this, you do so at your own risk. 1.37 + * This code and its internal interfaces are subject to change or 1.38 + * deletion without notice.</b> 1.39 + */ 1.40 +public interface ByteCodes { 1.41 + 1.42 + /** Byte code instruction codes. 1.43 + */ 1.44 + int illegal = -1, 1.45 + nop = 0, 1.46 + aconst_null = 1, 1.47 + iconst_m1 = 2, 1.48 + iconst_0 = 3, 1.49 + iconst_1 = 4, 1.50 + iconst_2 = 5, 1.51 + iconst_3 = 6, 1.52 + iconst_4 = 7, 1.53 + iconst_5 = 8, 1.54 + lconst_0 = 9, 1.55 + lconst_1 = 10, 1.56 + fconst_0 = 11, 1.57 + fconst_1 = 12, 1.58 + fconst_2 = 13, 1.59 + dconst_0 = 14, 1.60 + dconst_1 = 15, 1.61 + bipush = 16, 1.62 + sipush = 17, 1.63 + ldc1 = 18, 1.64 + ldc2 = 19, 1.65 + ldc2w = 20, 1.66 + iload = 21, 1.67 + lload = 22, 1.68 + fload = 23, 1.69 + dload = 24, 1.70 + aload = 25, 1.71 + iload_0 = 26, 1.72 + iload_1 = 27, 1.73 + iload_2 = 28, 1.74 + iload_3 = 29, 1.75 + lload_0 = 30, 1.76 + lload_1 = 31, 1.77 + lload_2 = 32, 1.78 + lload_3 = 33, 1.79 + fload_0 = 34, 1.80 + fload_1 = 35, 1.81 + fload_2 = 36, 1.82 + fload_3 = 37, 1.83 + dload_0 = 38, 1.84 + dload_1 = 39, 1.85 + dload_2 = 40, 1.86 + dload_3 = 41, 1.87 + aload_0 = 42, 1.88 + aload_1 = 43, 1.89 + aload_2 = 44, 1.90 + aload_3 = 45, 1.91 + iaload = 46, 1.92 + laload = 47, 1.93 + faload = 48, 1.94 + daload = 49, 1.95 + aaload = 50, 1.96 + baload = 51, 1.97 + caload = 52, 1.98 + saload = 53, 1.99 + istore = 54, 1.100 + lstore = 55, 1.101 + fstore = 56, 1.102 + dstore = 57, 1.103 + astore = 58, 1.104 + istore_0 = 59, 1.105 + istore_1 = 60, 1.106 + istore_2 = 61, 1.107 + istore_3 = 62, 1.108 + lstore_0 = 63, 1.109 + lstore_1 = 64, 1.110 + lstore_2 = 65, 1.111 + lstore_3 = 66, 1.112 + fstore_0 = 67, 1.113 + fstore_1 = 68, 1.114 + fstore_2 = 69, 1.115 + fstore_3 = 70, 1.116 + dstore_0 = 71, 1.117 + dstore_1 = 72, 1.118 + dstore_2 = 73, 1.119 + dstore_3 = 74, 1.120 + astore_0 = 75, 1.121 + astore_1 = 76, 1.122 + astore_2 = 77, 1.123 + astore_3 = 78, 1.124 + iastore = 79, 1.125 + lastore = 80, 1.126 + fastore = 81, 1.127 + dastore = 82, 1.128 + aastore = 83, 1.129 + bastore = 84, 1.130 + castore = 85, 1.131 + sastore = 86, 1.132 + pop = 87, 1.133 + pop2 = 88, 1.134 + dup = 89, 1.135 + dup_x1 = 90, 1.136 + dup_x2 = 91, 1.137 + dup2 = 92, 1.138 + dup2_x1 = 93, 1.139 + dup2_x2 = 94, 1.140 + swap = 95, 1.141 + iadd = 96, 1.142 + ladd = 97, 1.143 + fadd = 98, 1.144 + dadd = 99, 1.145 + isub = 100, 1.146 + lsub = 101, 1.147 + fsub = 102, 1.148 + dsub = 103, 1.149 + imul = 104, 1.150 + lmul = 105, 1.151 + fmul = 106, 1.152 + dmul = 107, 1.153 + idiv = 108, 1.154 + ldiv = 109, 1.155 + fdiv = 110, 1.156 + ddiv = 111, 1.157 + imod = 112, 1.158 + lmod = 113, 1.159 + fmod = 114, 1.160 + dmod = 115, 1.161 + ineg = 116, 1.162 + lneg = 117, 1.163 + fneg = 118, 1.164 + dneg = 119, 1.165 + ishl = 120, 1.166 + lshl = 121, 1.167 + ishr = 122, 1.168 + lshr = 123, 1.169 + iushr = 124, 1.170 + lushr = 125, 1.171 + iand = 126, 1.172 + land = 127, 1.173 + ior = 128, 1.174 + lor = 129, 1.175 + ixor = 130, 1.176 + lxor = 131, 1.177 + iinc = 132, 1.178 + i2l = 133, 1.179 + i2f = 134, 1.180 + i2d = 135, 1.181 + l2i = 136, 1.182 + l2f = 137, 1.183 + l2d = 138, 1.184 + f2i = 139, 1.185 + f2l = 140, 1.186 + f2d = 141, 1.187 + d2i = 142, 1.188 + d2l = 143, 1.189 + d2f = 144, 1.190 + int2byte = 145, 1.191 + int2char = 146, 1.192 + int2short = 147, 1.193 + lcmp = 148, 1.194 + fcmpl = 149, 1.195 + fcmpg = 150, 1.196 + dcmpl = 151, 1.197 + dcmpg = 152, 1.198 + ifeq = 153, 1.199 + ifne = 154, 1.200 + iflt = 155, 1.201 + ifge = 156, 1.202 + ifgt = 157, 1.203 + ifle = 158, 1.204 + if_icmpeq = 159, 1.205 + if_icmpne = 160, 1.206 + if_icmplt = 161, 1.207 + if_icmpge = 162, 1.208 + if_icmpgt = 163, 1.209 + if_icmple = 164, 1.210 + if_acmpeq = 165, 1.211 + if_acmpne = 166, 1.212 + goto_ = 167, 1.213 + jsr = 168, 1.214 + ret = 169, 1.215 + tableswitch = 170, 1.216 + lookupswitch = 171, 1.217 + ireturn = 172, 1.218 + lreturn = 173, 1.219 + freturn = 174, 1.220 + dreturn = 175, 1.221 + areturn = 176, 1.222 + return_ = 177, 1.223 + getstatic = 178, 1.224 + putstatic = 179, 1.225 + getfield = 180, 1.226 + putfield = 181, 1.227 + invokevirtual = 182, 1.228 + invokespecial = 183, 1.229 + invokestatic = 184, 1.230 + invokeinterface = 185, 1.231 + // ___unused___ = 186, 1.232 + new_ = 187, 1.233 + newarray = 188, 1.234 + anewarray = 189, 1.235 + arraylength = 190, 1.236 + athrow = 191, 1.237 + checkcast = 192, 1.238 + instanceof_ = 193, 1.239 + monitorenter = 194, 1.240 + monitorexit = 195, 1.241 + wide = 196, 1.242 + multianewarray = 197, 1.243 + if_acmp_null = 198, 1.244 + if_acmp_nonnull = 199, 1.245 + goto_w = 200, 1.246 + jsr_w = 201, 1.247 + breakpoint = 202, 1.248 + ByteCodeCount = 203; 1.249 + 1.250 + /** Virtual instruction codes; used for constant folding. 1.251 + */ 1.252 + int string_add = 256, // string + 1.253 + bool_not = 257, // boolean ! 1.254 + bool_and = 258, // boolean && 1.255 + bool_or = 259; // boolean || 1.256 + 1.257 + /** Virtual opcodes; used for shifts with long shiftcount 1.258 + */ 1.259 + int ishll = 270, // int shift left with long count 1.260 + lshll = 271, // long shift left with long count 1.261 + ishrl = 272, // int shift right with long count 1.262 + lshrl = 273, // long shift right with long count 1.263 + iushrl = 274, // int unsigned shift right with long count 1.264 + lushrl = 275; // long unsigned shift right with long count 1.265 + 1.266 + /** Virtual opcode for null reference checks 1.267 + */ 1.268 + int nullchk = 276; // return operand if non-null, 1.269 + // otherwise throw NullPointerException. 1.270 + 1.271 + /** Virtual opcode for disallowed operations. 1.272 + */ 1.273 + int error = 277; 1.274 + 1.275 + /** All conditional jumps come in pairs. To streamline the 1.276 + * treatment of jumps, we also introduce a negation of an 1.277 + * unconditional jump. That opcode happens to be jsr. 1.278 + */ 1.279 + int dontgoto = jsr; 1.280 + 1.281 + /** Shift and mask constants for shifting prefix instructions. 1.282 + * a pair of instruction codes such as LCMP ; IFEQ is encoded 1.283 + * in Symtab as (LCMP << preShift) + IFEQ. 1.284 + */ 1.285 + int preShift = 9; 1.286 + int preMask = (1 << preShift) - 1; 1.287 + 1.288 + /** Type codes. 1.289 + */ 1.290 + int INTcode = 0, 1.291 + LONGcode = 1, 1.292 + FLOATcode = 2, 1.293 + DOUBLEcode = 3, 1.294 + OBJECTcode = 4, 1.295 + BYTEcode = 5, 1.296 + CHARcode = 6, 1.297 + SHORTcode = 7, 1.298 + VOIDcode = 8, 1.299 + TypeCodeCount = 9; 1.300 + 1.301 + static final String[] typecodeNames = { 1.302 + "int", 1.303 + "long", 1.304 + "float", 1.305 + "double", 1.306 + "object", 1.307 + "byte", 1.308 + "char", 1.309 + "short", 1.310 + "void", 1.311 + "oops" 1.312 + }; 1.313 +}