Tue, 24 Feb 2009 17:48:53 -0800
6498938: Faulty comparison of TypeMirror objects in getElementsAnnotatedWith implementation
Reviewed-by: jjg
jjg@46 | 1 | /* |
xdono@54 | 2 | * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. |
jjg@46 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@46 | 4 | * |
jjg@46 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@46 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@46 | 7 | * published by the Free Software Foundation. Sun designates this |
jjg@46 | 8 | * particular file as subject to the "Classpath" exception as provided |
jjg@46 | 9 | * by Sun in the LICENSE file that accompanied this code. |
jjg@46 | 10 | * |
jjg@46 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@46 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@46 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@46 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@46 | 15 | * accompanied this code). |
jjg@46 | 16 | * |
jjg@46 | 17 | * You should have received a copy of the GNU General Public License version |
jjg@46 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@46 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@46 | 20 | * |
jjg@46 | 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
jjg@46 | 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
jjg@46 | 23 | * have any questions. |
jjg@46 | 24 | */ |
jjg@46 | 25 | |
jjg@46 | 26 | package com.sun.tools.classfile; |
jjg@46 | 27 | |
jjg@46 | 28 | import java.util.HashMap; |
jjg@46 | 29 | |
jjg@46 | 30 | /** |
jjg@46 | 31 | * See JVMS3, section 6. |
jjg@46 | 32 | * |
jjg@46 | 33 | * <p><b>This is NOT part of any API supported by Sun Microsystems. If |
jjg@46 | 34 | * you write code that depends on this, you do so at your own risk. |
jjg@46 | 35 | * This code and its internal interfaces are subject to change or |
jjg@46 | 36 | * deletion without notice.</b> |
jjg@46 | 37 | */ |
jjg@46 | 38 | public class OpCodes { |
jjg@46 | 39 | |
jjg@46 | 40 | public static int opcLength(int opc) throws IllegalArgumentException { |
jjg@46 | 41 | switch (opc >> 8) { |
jjg@46 | 42 | case 0: |
jjg@46 | 43 | return opcLengthsTab[opc]; |
jjg@46 | 44 | case opc_wide: |
jjg@46 | 45 | switch (opc & 0xFF) { |
jjg@46 | 46 | case opc_aload: |
jjg@46 | 47 | case opc_astore: |
jjg@46 | 48 | case opc_fload: |
jjg@46 | 49 | case opc_fstore: |
jjg@46 | 50 | case opc_iload: |
jjg@46 | 51 | case opc_istore: |
jjg@46 | 52 | case opc_lload: |
jjg@46 | 53 | case opc_lstore: |
jjg@46 | 54 | case opc_dload: |
jjg@46 | 55 | case opc_dstore: |
jjg@46 | 56 | case opc_ret: |
jjg@46 | 57 | return 4; |
jjg@46 | 58 | case opc_iinc: |
jjg@46 | 59 | return 6; |
jjg@46 | 60 | default: |
jjg@46 | 61 | throw new IllegalArgumentException(); |
jjg@46 | 62 | } |
jjg@46 | 63 | case opc_nonpriv: |
jjg@46 | 64 | case opc_priv: |
jjg@46 | 65 | return 2; |
jjg@46 | 66 | default: |
jjg@46 | 67 | throw new IllegalArgumentException(); |
jjg@46 | 68 | } |
jjg@46 | 69 | } |
jjg@46 | 70 | |
jjg@46 | 71 | public static String opcName(int opc) { |
jjg@46 | 72 | try { |
jjg@46 | 73 | switch (opc >> 8) { |
jjg@46 | 74 | case 0: |
jjg@46 | 75 | return opcNamesTab[opc]; |
jjg@46 | 76 | case opc_wide: |
jjg@46 | 77 | { |
jjg@46 | 78 | String mnem = opcNamesTab[opc & 0xFF] + "_w"; |
jjg@46 | 79 | if (mnemocodes.get(mnem) == null) { |
jjg@46 | 80 | return null; // non-existent opcode |
jjg@46 | 81 | } |
jjg@46 | 82 | return mnem; |
jjg@46 | 83 | } |
jjg@46 | 84 | case opc_nonpriv: |
jjg@46 | 85 | return opcExtNamesTab[opc & 0xFF]; |
jjg@46 | 86 | case opc_priv: |
jjg@46 | 87 | return opcPrivExtNamesTab[opc & 0xFF]; |
jjg@46 | 88 | default: |
jjg@46 | 89 | return null; |
jjg@46 | 90 | } |
jjg@46 | 91 | } catch (ArrayIndexOutOfBoundsException e) { |
jjg@46 | 92 | switch (opc) { |
jjg@46 | 93 | case opc_nonpriv: |
jjg@46 | 94 | return "nonpriv"; |
jjg@46 | 95 | case opc_priv: |
jjg@46 | 96 | return "priv"; |
jjg@46 | 97 | default: |
jjg@46 | 98 | return null; |
jjg@46 | 99 | } |
jjg@46 | 100 | } |
jjg@46 | 101 | } |
jjg@46 | 102 | |
jjg@46 | 103 | /* Opcodes */ |
jjg@46 | 104 | public static final int opc_dead = -2; |
jjg@46 | 105 | public static final int opc_label = -1; |
jjg@46 | 106 | public static final int opc_nop = 0; |
jjg@46 | 107 | public static final int opc_aconst_null = 1; |
jjg@46 | 108 | public static final int opc_iconst_m1 = 2; |
jjg@46 | 109 | public static final int opc_iconst_0 = 3; |
jjg@46 | 110 | public static final int opc_iconst_1 = 4; |
jjg@46 | 111 | public static final int opc_iconst_2 = 5; |
jjg@46 | 112 | public static final int opc_iconst_3 = 6; |
jjg@46 | 113 | public static final int opc_iconst_4 = 7; |
jjg@46 | 114 | public static final int opc_iconst_5 = 8; |
jjg@46 | 115 | public static final int opc_lconst_0 = 9; |
jjg@46 | 116 | public static final int opc_lconst_1 = 10; |
jjg@46 | 117 | public static final int opc_fconst_0 = 11; |
jjg@46 | 118 | public static final int opc_fconst_1 = 12; |
jjg@46 | 119 | public static final int opc_fconst_2 = 13; |
jjg@46 | 120 | public static final int opc_dconst_0 = 14; |
jjg@46 | 121 | public static final int opc_dconst_1 = 15; |
jjg@46 | 122 | public static final int opc_bipush = 16; |
jjg@46 | 123 | public static final int opc_sipush = 17; |
jjg@46 | 124 | public static final int opc_ldc = 18; |
jjg@46 | 125 | public static final int opc_ldc_w = 19; |
jjg@46 | 126 | public static final int opc_ldc2_w = 20; |
jjg@46 | 127 | public static final int opc_iload = 21; |
jjg@46 | 128 | public static final int opc_lload = 22; |
jjg@46 | 129 | public static final int opc_fload = 23; |
jjg@46 | 130 | public static final int opc_dload = 24; |
jjg@46 | 131 | public static final int opc_aload = 25; |
jjg@46 | 132 | public static final int opc_iload_0 = 26; |
jjg@46 | 133 | public static final int opc_iload_1 = 27; |
jjg@46 | 134 | public static final int opc_iload_2 = 28; |
jjg@46 | 135 | public static final int opc_iload_3 = 29; |
jjg@46 | 136 | public static final int opc_lload_0 = 30; |
jjg@46 | 137 | public static final int opc_lload_1 = 31; |
jjg@46 | 138 | public static final int opc_lload_2 = 32; |
jjg@46 | 139 | public static final int opc_lload_3 = 33; |
jjg@46 | 140 | public static final int opc_fload_0 = 34; |
jjg@46 | 141 | public static final int opc_fload_1 = 35; |
jjg@46 | 142 | public static final int opc_fload_2 = 36; |
jjg@46 | 143 | public static final int opc_fload_3 = 37; |
jjg@46 | 144 | public static final int opc_dload_0 = 38; |
jjg@46 | 145 | public static final int opc_dload_1 = 39; |
jjg@46 | 146 | public static final int opc_dload_2 = 40; |
jjg@46 | 147 | public static final int opc_dload_3 = 41; |
jjg@46 | 148 | public static final int opc_aload_0 = 42; |
jjg@46 | 149 | public static final int opc_aload_1 = 43; |
jjg@46 | 150 | public static final int opc_aload_2 = 44; |
jjg@46 | 151 | public static final int opc_aload_3 = 45; |
jjg@46 | 152 | public static final int opc_iaload = 46; |
jjg@46 | 153 | public static final int opc_laload = 47; |
jjg@46 | 154 | public static final int opc_faload = 48; |
jjg@46 | 155 | public static final int opc_daload = 49; |
jjg@46 | 156 | public static final int opc_aaload = 50; |
jjg@46 | 157 | public static final int opc_baload = 51; |
jjg@46 | 158 | public static final int opc_caload = 52; |
jjg@46 | 159 | public static final int opc_saload = 53; |
jjg@46 | 160 | public static final int opc_istore = 54; |
jjg@46 | 161 | public static final int opc_lstore = 55; |
jjg@46 | 162 | public static final int opc_fstore = 56; |
jjg@46 | 163 | public static final int opc_dstore = 57; |
jjg@46 | 164 | public static final int opc_astore = 58; |
jjg@46 | 165 | public static final int opc_istore_0 = 59; |
jjg@46 | 166 | public static final int opc_istore_1 = 60; |
jjg@46 | 167 | public static final int opc_istore_2 = 61; |
jjg@46 | 168 | public static final int opc_istore_3 = 62; |
jjg@46 | 169 | public static final int opc_lstore_0 = 63; |
jjg@46 | 170 | public static final int opc_lstore_1 = 64; |
jjg@46 | 171 | public static final int opc_lstore_2 = 65; |
jjg@46 | 172 | public static final int opc_lstore_3 = 66; |
jjg@46 | 173 | public static final int opc_fstore_0 = 67; |
jjg@46 | 174 | public static final int opc_fstore_1 = 68; |
jjg@46 | 175 | public static final int opc_fstore_2 = 69; |
jjg@46 | 176 | public static final int opc_fstore_3 = 70; |
jjg@46 | 177 | public static final int opc_dstore_0 = 71; |
jjg@46 | 178 | public static final int opc_dstore_1 = 72; |
jjg@46 | 179 | public static final int opc_dstore_2 = 73; |
jjg@46 | 180 | public static final int opc_dstore_3 = 74; |
jjg@46 | 181 | public static final int opc_astore_0 = 75; |
jjg@46 | 182 | public static final int opc_astore_1 = 76; |
jjg@46 | 183 | public static final int opc_astore_2 = 77; |
jjg@46 | 184 | public static final int opc_astore_3 = 78; |
jjg@46 | 185 | public static final int opc_iastore = 79; |
jjg@46 | 186 | public static final int opc_lastore = 80; |
jjg@46 | 187 | public static final int opc_fastore = 81; |
jjg@46 | 188 | public static final int opc_dastore = 82; |
jjg@46 | 189 | public static final int opc_aastore = 83; |
jjg@46 | 190 | public static final int opc_bastore = 84; |
jjg@46 | 191 | public static final int opc_castore = 85; |
jjg@46 | 192 | public static final int opc_sastore = 86; |
jjg@46 | 193 | public static final int opc_pop = 87; |
jjg@46 | 194 | public static final int opc_pop2 = 88; |
jjg@46 | 195 | public static final int opc_dup = 89; |
jjg@46 | 196 | public static final int opc_dup_x1 = 90; |
jjg@46 | 197 | public static final int opc_dup_x2 = 91; |
jjg@46 | 198 | public static final int opc_dup2 = 92; |
jjg@46 | 199 | public static final int opc_dup2_x1 = 93; |
jjg@46 | 200 | public static final int opc_dup2_x2 = 94; |
jjg@46 | 201 | public static final int opc_swap = 95; |
jjg@46 | 202 | public static final int opc_iadd = 96; |
jjg@46 | 203 | public static final int opc_ladd = 97; |
jjg@46 | 204 | public static final int opc_fadd = 98; |
jjg@46 | 205 | public static final int opc_dadd = 99; |
jjg@46 | 206 | public static final int opc_isub = 100; |
jjg@46 | 207 | public static final int opc_lsub = 101; |
jjg@46 | 208 | public static final int opc_fsub = 102; |
jjg@46 | 209 | public static final int opc_dsub = 103; |
jjg@46 | 210 | public static final int opc_imul = 104; |
jjg@46 | 211 | public static final int opc_lmul = 105; |
jjg@46 | 212 | public static final int opc_fmul = 106; |
jjg@46 | 213 | public static final int opc_dmul = 107; |
jjg@46 | 214 | public static final int opc_idiv = 108; |
jjg@46 | 215 | public static final int opc_ldiv = 109; |
jjg@46 | 216 | public static final int opc_fdiv = 110; |
jjg@46 | 217 | public static final int opc_ddiv = 111; |
jjg@46 | 218 | public static final int opc_irem = 112; |
jjg@46 | 219 | public static final int opc_lrem = 113; |
jjg@46 | 220 | public static final int opc_frem = 114; |
jjg@46 | 221 | public static final int opc_drem = 115; |
jjg@46 | 222 | public static final int opc_ineg = 116; |
jjg@46 | 223 | public static final int opc_lneg = 117; |
jjg@46 | 224 | public static final int opc_fneg = 118; |
jjg@46 | 225 | public static final int opc_dneg = 119; |
jjg@46 | 226 | public static final int opc_ishl = 120; |
jjg@46 | 227 | public static final int opc_lshl = 121; |
jjg@46 | 228 | public static final int opc_ishr = 122; |
jjg@46 | 229 | public static final int opc_lshr = 123; |
jjg@46 | 230 | public static final int opc_iushr = 124; |
jjg@46 | 231 | public static final int opc_lushr = 125; |
jjg@46 | 232 | public static final int opc_iand = 126; |
jjg@46 | 233 | public static final int opc_land = 127; |
jjg@46 | 234 | public static final int opc_ior = 128; |
jjg@46 | 235 | public static final int opc_lor = 129; |
jjg@46 | 236 | public static final int opc_ixor = 130; |
jjg@46 | 237 | public static final int opc_lxor = 131; |
jjg@46 | 238 | public static final int opc_iinc = 132; |
jjg@46 | 239 | public static final int opc_i2l = 133; |
jjg@46 | 240 | public static final int opc_i2f = 134; |
jjg@46 | 241 | public static final int opc_i2d = 135; |
jjg@46 | 242 | public static final int opc_l2i = 136; |
jjg@46 | 243 | public static final int opc_l2f = 137; |
jjg@46 | 244 | public static final int opc_l2d = 138; |
jjg@46 | 245 | public static final int opc_f2i = 139; |
jjg@46 | 246 | public static final int opc_f2l = 140; |
jjg@46 | 247 | public static final int opc_f2d = 141; |
jjg@46 | 248 | public static final int opc_d2i = 142; |
jjg@46 | 249 | public static final int opc_d2l = 143; |
jjg@46 | 250 | public static final int opc_d2f = 144; |
jjg@46 | 251 | public static final int opc_i2b = 145; |
jjg@46 | 252 | public static final int opc_int2byte = 145; |
jjg@46 | 253 | public static final int opc_i2c = 146; |
jjg@46 | 254 | public static final int opc_int2char = 146; |
jjg@46 | 255 | public static final int opc_i2s = 147; |
jjg@46 | 256 | public static final int opc_int2short = 147; |
jjg@46 | 257 | public static final int opc_lcmp = 148; |
jjg@46 | 258 | public static final int opc_fcmpl = 149; |
jjg@46 | 259 | public static final int opc_fcmpg = 150; |
jjg@46 | 260 | public static final int opc_dcmpl = 151; |
jjg@46 | 261 | public static final int opc_dcmpg = 152; |
jjg@46 | 262 | public static final int opc_ifeq = 153; |
jjg@46 | 263 | public static final int opc_ifne = 154; |
jjg@46 | 264 | public static final int opc_iflt = 155; |
jjg@46 | 265 | public static final int opc_ifge = 156; |
jjg@46 | 266 | public static final int opc_ifgt = 157; |
jjg@46 | 267 | public static final int opc_ifle = 158; |
jjg@46 | 268 | public static final int opc_if_icmpeq = 159; |
jjg@46 | 269 | public static final int opc_if_icmpne = 160; |
jjg@46 | 270 | public static final int opc_if_icmplt = 161; |
jjg@46 | 271 | public static final int opc_if_icmpge = 162; |
jjg@46 | 272 | public static final int opc_if_icmpgt = 163; |
jjg@46 | 273 | public static final int opc_if_icmple = 164; |
jjg@46 | 274 | public static final int opc_if_acmpeq = 165; |
jjg@46 | 275 | public static final int opc_if_acmpne = 166; |
jjg@46 | 276 | public static final int opc_goto = 167; |
jjg@46 | 277 | public static final int opc_jsr = 168; |
jjg@46 | 278 | public static final int opc_ret = 169; |
jjg@46 | 279 | public static final int opc_tableswitch = 170; |
jjg@46 | 280 | public static final int opc_lookupswitch = 171; |
jjg@46 | 281 | public static final int opc_ireturn = 172; |
jjg@46 | 282 | public static final int opc_lreturn = 173; |
jjg@46 | 283 | public static final int opc_freturn = 174; |
jjg@46 | 284 | public static final int opc_dreturn = 175; |
jjg@46 | 285 | public static final int opc_areturn = 176; |
jjg@46 | 286 | public static final int opc_return = 177; |
jjg@46 | 287 | public static final int opc_getstatic = 178; |
jjg@46 | 288 | public static final int opc_putstatic = 179; |
jjg@46 | 289 | public static final int opc_getfield = 180; |
jjg@46 | 290 | public static final int opc_putfield = 181; |
jjg@46 | 291 | public static final int opc_invokevirtual = 182; |
jjg@46 | 292 | public static final int opc_invokenonvirtual = 183; |
jjg@46 | 293 | public static final int opc_invokespecial = 183; |
jjg@46 | 294 | public static final int opc_invokestatic = 184; |
jjg@46 | 295 | public static final int opc_invokeinterface = 185; |
jjg@46 | 296 | // public static final int opc_xxxunusedxxx = 186; |
jjg@46 | 297 | public static final int opc_new = 187; |
jjg@46 | 298 | public static final int opc_newarray = 188; |
jjg@46 | 299 | public static final int opc_anewarray = 189; |
jjg@46 | 300 | public static final int opc_arraylength = 190; |
jjg@46 | 301 | public static final int opc_athrow = 191; |
jjg@46 | 302 | public static final int opc_checkcast = 192; |
jjg@46 | 303 | public static final int opc_instanceof = 193; |
jjg@46 | 304 | public static final int opc_monitorenter = 194; |
jjg@46 | 305 | public static final int opc_monitorexit = 195; |
jjg@46 | 306 | public static final int opc_wide = 196; |
jjg@46 | 307 | public static final int opc_multianewarray = 197; |
jjg@46 | 308 | public static final int opc_ifnull = 198; |
jjg@46 | 309 | public static final int opc_ifnonnull = 199; |
jjg@46 | 310 | public static final int opc_goto_w = 200; |
jjg@46 | 311 | public static final int opc_jsr_w = 201; |
jjg@46 | 312 | |
jjg@46 | 313 | /* Pseudo-instructions */ |
jjg@46 | 314 | public static final int opc_bytecode = 203; |
jjg@46 | 315 | public static final int opc_try = 204; |
jjg@46 | 316 | public static final int opc_endtry = 205; |
jjg@46 | 317 | public static final int opc_catch = 206; |
jjg@46 | 318 | public static final int opc_var = 207; |
jjg@46 | 319 | public static final int opc_endvar = 208; |
jjg@46 | 320 | public static final int opc_localsmap = 209; |
jjg@46 | 321 | public static final int opc_stackmap = 210; |
jjg@46 | 322 | |
jjg@46 | 323 | /* PicoJava prefixes */ |
jjg@46 | 324 | public static final int opc_nonpriv = 254; |
jjg@46 | 325 | public static final int opc_priv = 255; |
jjg@46 | 326 | |
jjg@46 | 327 | /* Wide instructions */ |
jjg@46 | 328 | public static final int opc_iload_w = (opc_wide << 8 ) | opc_iload; |
jjg@46 | 329 | public static final int opc_lload_w = (opc_wide << 8 ) | opc_lload; |
jjg@46 | 330 | public static final int opc_fload_w = (opc_wide << 8 ) | opc_fload; |
jjg@46 | 331 | public static final int opc_dload_w = (opc_wide << 8 ) | opc_dload; |
jjg@46 | 332 | public static final int opc_aload_w = (opc_wide << 8 ) | opc_aload; |
jjg@46 | 333 | public static final int opc_istore_w = (opc_wide << 8 ) | opc_istore; |
jjg@46 | 334 | public static final int opc_lstore_w = (opc_wide << 8 ) | opc_lstore; |
jjg@46 | 335 | public static final int opc_fstore_w = (opc_wide << 8 ) | opc_fstore; |
jjg@46 | 336 | public static final int opc_dstore_w = (opc_wide << 8 ) | opc_dstore; |
jjg@46 | 337 | public static final int opc_astore_w = (opc_wide << 8 ) | opc_astore; |
jjg@46 | 338 | public static final int opc_ret_w = (opc_wide << 8 ) | opc_ret; |
jjg@46 | 339 | public static final int opc_iinc_w = (opc_wide << 8 ) | opc_iinc; |
jjg@46 | 340 | |
jjg@46 | 341 | /* Opcode Names */ |
jjg@46 | 342 | private static final String opcNamesTab[] = { |
jjg@46 | 343 | "nop", |
jjg@46 | 344 | "aconst_null", |
jjg@46 | 345 | "iconst_m1", |
jjg@46 | 346 | "iconst_0", |
jjg@46 | 347 | "iconst_1", |
jjg@46 | 348 | "iconst_2", |
jjg@46 | 349 | "iconst_3", |
jjg@46 | 350 | "iconst_4", |
jjg@46 | 351 | "iconst_5", |
jjg@46 | 352 | "lconst_0", |
jjg@46 | 353 | "lconst_1", |
jjg@46 | 354 | "fconst_0", |
jjg@46 | 355 | "fconst_1", |
jjg@46 | 356 | "fconst_2", |
jjg@46 | 357 | "dconst_0", |
jjg@46 | 358 | "dconst_1", |
jjg@46 | 359 | "bipush", |
jjg@46 | 360 | "sipush", |
jjg@46 | 361 | "ldc", |
jjg@46 | 362 | "ldc_w", |
jjg@46 | 363 | "ldc2_w", |
jjg@46 | 364 | "iload", |
jjg@46 | 365 | "lload", |
jjg@46 | 366 | "fload", |
jjg@46 | 367 | "dload", |
jjg@46 | 368 | "aload", |
jjg@46 | 369 | "iload_0", |
jjg@46 | 370 | "iload_1", |
jjg@46 | 371 | "iload_2", |
jjg@46 | 372 | "iload_3", |
jjg@46 | 373 | "lload_0", |
jjg@46 | 374 | "lload_1", |
jjg@46 | 375 | "lload_2", |
jjg@46 | 376 | "lload_3", |
jjg@46 | 377 | "fload_0", |
jjg@46 | 378 | "fload_1", |
jjg@46 | 379 | "fload_2", |
jjg@46 | 380 | "fload_3", |
jjg@46 | 381 | "dload_0", |
jjg@46 | 382 | "dload_1", |
jjg@46 | 383 | "dload_2", |
jjg@46 | 384 | "dload_3", |
jjg@46 | 385 | "aload_0", |
jjg@46 | 386 | "aload_1", |
jjg@46 | 387 | "aload_2", |
jjg@46 | 388 | "aload_3", |
jjg@46 | 389 | "iaload", |
jjg@46 | 390 | "laload", |
jjg@46 | 391 | "faload", |
jjg@46 | 392 | "daload", |
jjg@46 | 393 | "aaload", |
jjg@46 | 394 | "baload", |
jjg@46 | 395 | "caload", |
jjg@46 | 396 | "saload", |
jjg@46 | 397 | "istore", |
jjg@46 | 398 | "lstore", |
jjg@46 | 399 | "fstore", |
jjg@46 | 400 | "dstore", |
jjg@46 | 401 | "astore", |
jjg@46 | 402 | "istore_0", |
jjg@46 | 403 | "istore_1", |
jjg@46 | 404 | "istore_2", |
jjg@46 | 405 | "istore_3", |
jjg@46 | 406 | "lstore_0", |
jjg@46 | 407 | "lstore_1", |
jjg@46 | 408 | "lstore_2", |
jjg@46 | 409 | "lstore_3", |
jjg@46 | 410 | "fstore_0", |
jjg@46 | 411 | "fstore_1", |
jjg@46 | 412 | "fstore_2", |
jjg@46 | 413 | "fstore_3", |
jjg@46 | 414 | "dstore_0", |
jjg@46 | 415 | "dstore_1", |
jjg@46 | 416 | "dstore_2", |
jjg@46 | 417 | "dstore_3", |
jjg@46 | 418 | "astore_0", |
jjg@46 | 419 | "astore_1", |
jjg@46 | 420 | "astore_2", |
jjg@46 | 421 | "astore_3", |
jjg@46 | 422 | "iastore", |
jjg@46 | 423 | "lastore", |
jjg@46 | 424 | "fastore", |
jjg@46 | 425 | "dastore", |
jjg@46 | 426 | "aastore", |
jjg@46 | 427 | "bastore", |
jjg@46 | 428 | "castore", |
jjg@46 | 429 | "sastore", |
jjg@46 | 430 | "pop", |
jjg@46 | 431 | "pop2", |
jjg@46 | 432 | "dup", |
jjg@46 | 433 | "dup_x1", |
jjg@46 | 434 | "dup_x2", |
jjg@46 | 435 | "dup2", |
jjg@46 | 436 | "dup2_x1", |
jjg@46 | 437 | "dup2_x2", |
jjg@46 | 438 | "swap", |
jjg@46 | 439 | "iadd", |
jjg@46 | 440 | "ladd", |
jjg@46 | 441 | "fadd", |
jjg@46 | 442 | "dadd", |
jjg@46 | 443 | "isub", |
jjg@46 | 444 | "lsub", |
jjg@46 | 445 | "fsub", |
jjg@46 | 446 | "dsub", |
jjg@46 | 447 | "imul", |
jjg@46 | 448 | "lmul", |
jjg@46 | 449 | "fmul", |
jjg@46 | 450 | "dmul", |
jjg@46 | 451 | "idiv", |
jjg@46 | 452 | "ldiv", |
jjg@46 | 453 | "fdiv", |
jjg@46 | 454 | "ddiv", |
jjg@46 | 455 | "irem", |
jjg@46 | 456 | "lrem", |
jjg@46 | 457 | "frem", |
jjg@46 | 458 | "drem", |
jjg@46 | 459 | "ineg", |
jjg@46 | 460 | "lneg", |
jjg@46 | 461 | "fneg", |
jjg@46 | 462 | "dneg", |
jjg@46 | 463 | "ishl", |
jjg@46 | 464 | "lshl", |
jjg@46 | 465 | "ishr", |
jjg@46 | 466 | "lshr", |
jjg@46 | 467 | "iushr", |
jjg@46 | 468 | "lushr", |
jjg@46 | 469 | "iand", |
jjg@46 | 470 | "land", |
jjg@46 | 471 | "ior", |
jjg@46 | 472 | "lor", |
jjg@46 | 473 | "ixor", |
jjg@46 | 474 | "lxor", |
jjg@46 | 475 | "iinc", |
jjg@46 | 476 | "i2l", |
jjg@46 | 477 | "i2f", |
jjg@46 | 478 | "i2d", |
jjg@46 | 479 | "l2i", |
jjg@46 | 480 | "l2f", |
jjg@46 | 481 | "l2d", |
jjg@46 | 482 | "f2i", |
jjg@46 | 483 | "f2l", |
jjg@46 | 484 | "f2d", |
jjg@46 | 485 | "d2i", |
jjg@46 | 486 | "d2l", |
jjg@46 | 487 | "d2f", |
jjg@46 | 488 | "i2b", |
jjg@46 | 489 | "i2c", |
jjg@46 | 490 | "i2s", |
jjg@46 | 491 | "lcmp", |
jjg@46 | 492 | "fcmpl", |
jjg@46 | 493 | "fcmpg", |
jjg@46 | 494 | "dcmpl", |
jjg@46 | 495 | "dcmpg", |
jjg@46 | 496 | "ifeq", |
jjg@46 | 497 | "ifne", |
jjg@46 | 498 | "iflt", |
jjg@46 | 499 | "ifge", |
jjg@46 | 500 | "ifgt", |
jjg@46 | 501 | "ifle", |
jjg@46 | 502 | "if_icmpeq", |
jjg@46 | 503 | "if_icmpne", |
jjg@46 | 504 | "if_icmplt", |
jjg@46 | 505 | "if_icmpge", |
jjg@46 | 506 | "if_icmpgt", |
jjg@46 | 507 | "if_icmple", |
jjg@46 | 508 | "if_acmpeq", |
jjg@46 | 509 | "if_acmpne", |
jjg@46 | 510 | "goto", |
jjg@46 | 511 | "jsr", |
jjg@46 | 512 | "ret", |
jjg@46 | 513 | "tableswitch", |
jjg@46 | 514 | "lookupswitch", |
jjg@46 | 515 | "ireturn", |
jjg@46 | 516 | "lreturn", |
jjg@46 | 517 | "freturn", |
jjg@46 | 518 | "dreturn", |
jjg@46 | 519 | "areturn", |
jjg@46 | 520 | "return", |
jjg@46 | 521 | "getstatic", |
jjg@46 | 522 | "putstatic", |
jjg@46 | 523 | "getfield", |
jjg@46 | 524 | "putfield", |
jjg@46 | 525 | "invokevirtual", |
jjg@46 | 526 | "invokespecial", // was "invokenonvirtual", |
jjg@46 | 527 | "invokestatic", |
jjg@46 | 528 | "invokeinterface", |
jjg@46 | 529 | "bytecode 186", //"xxxunusedxxx", |
jjg@46 | 530 | "new", |
jjg@46 | 531 | "newarray", |
jjg@46 | 532 | "anewarray", |
jjg@46 | 533 | "arraylength", |
jjg@46 | 534 | "athrow", |
jjg@46 | 535 | "checkcast", |
jjg@46 | 536 | "instanceof", |
jjg@46 | 537 | "monitorenter", |
jjg@46 | 538 | "monitorexit", |
jjg@46 | 539 | null, // "wide", |
jjg@46 | 540 | "multianewarray", |
jjg@46 | 541 | "ifnull", |
jjg@46 | 542 | "ifnonnull", |
jjg@46 | 543 | "goto_w", |
jjg@46 | 544 | "jsr_w", |
jjg@46 | 545 | "bytecode 202", // "breakpoint", |
jjg@46 | 546 | "bytecode", |
jjg@46 | 547 | "try", |
jjg@46 | 548 | "endtry", |
jjg@46 | 549 | "catch", |
jjg@46 | 550 | "var", |
jjg@46 | 551 | "endvar", |
jjg@46 | 552 | "locals_map", |
jjg@46 | 553 | "stack_map" |
jjg@46 | 554 | }; |
jjg@46 | 555 | |
jjg@46 | 556 | /* Opcode Lengths */ |
jjg@46 | 557 | private static final int opcLengthsTab[] = { |
jjg@46 | 558 | 1, |
jjg@46 | 559 | 1, |
jjg@46 | 560 | 1, |
jjg@46 | 561 | 1, |
jjg@46 | 562 | 1, |
jjg@46 | 563 | 1, |
jjg@46 | 564 | 1, |
jjg@46 | 565 | 1, |
jjg@46 | 566 | 1, |
jjg@46 | 567 | 1, |
jjg@46 | 568 | 1, |
jjg@46 | 569 | 1, |
jjg@46 | 570 | 1, |
jjg@46 | 571 | 1, |
jjg@46 | 572 | 1, |
jjg@46 | 573 | 1, |
jjg@46 | 574 | 2, |
jjg@46 | 575 | 3, |
jjg@46 | 576 | 2, |
jjg@46 | 577 | 3, |
jjg@46 | 578 | 3, |
jjg@46 | 579 | 2, |
jjg@46 | 580 | 2, |
jjg@46 | 581 | 2, |
jjg@46 | 582 | 2, |
jjg@46 | 583 | 2, |
jjg@46 | 584 | 1, |
jjg@46 | 585 | 1, |
jjg@46 | 586 | 1, |
jjg@46 | 587 | 1, |
jjg@46 | 588 | 1, |
jjg@46 | 589 | 1, |
jjg@46 | 590 | 1, |
jjg@46 | 591 | 1, |
jjg@46 | 592 | 1, |
jjg@46 | 593 | 1, |
jjg@46 | 594 | 1, |
jjg@46 | 595 | 1, |
jjg@46 | 596 | 1, |
jjg@46 | 597 | 1, |
jjg@46 | 598 | 1, |
jjg@46 | 599 | 1, |
jjg@46 | 600 | 1, |
jjg@46 | 601 | 1, |
jjg@46 | 602 | 1, |
jjg@46 | 603 | 1, |
jjg@46 | 604 | 1, |
jjg@46 | 605 | 1, |
jjg@46 | 606 | 1, |
jjg@46 | 607 | 1, |
jjg@46 | 608 | 1, |
jjg@46 | 609 | 1, |
jjg@46 | 610 | 1, |
jjg@46 | 611 | 1, |
jjg@46 | 612 | 2, |
jjg@46 | 613 | 2, |
jjg@46 | 614 | 2, |
jjg@46 | 615 | 2, |
jjg@46 | 616 | 2, |
jjg@46 | 617 | 1, |
jjg@46 | 618 | 1, |
jjg@46 | 619 | 1, |
jjg@46 | 620 | 1, |
jjg@46 | 621 | 1, |
jjg@46 | 622 | 1, |
jjg@46 | 623 | 1, |
jjg@46 | 624 | 1, |
jjg@46 | 625 | 1, |
jjg@46 | 626 | 1, |
jjg@46 | 627 | 1, |
jjg@46 | 628 | 1, |
jjg@46 | 629 | 1, |
jjg@46 | 630 | 1, |
jjg@46 | 631 | 1, |
jjg@46 | 632 | 1, |
jjg@46 | 633 | 1, |
jjg@46 | 634 | 1, |
jjg@46 | 635 | 1, |
jjg@46 | 636 | 1, |
jjg@46 | 637 | 1, |
jjg@46 | 638 | 1, |
jjg@46 | 639 | 1, |
jjg@46 | 640 | 1, |
jjg@46 | 641 | 1, |
jjg@46 | 642 | 1, |
jjg@46 | 643 | 1, |
jjg@46 | 644 | 1, |
jjg@46 | 645 | 1, |
jjg@46 | 646 | 1, |
jjg@46 | 647 | 1, |
jjg@46 | 648 | 1, |
jjg@46 | 649 | 1, |
jjg@46 | 650 | 1, |
jjg@46 | 651 | 1, |
jjg@46 | 652 | 1, |
jjg@46 | 653 | 1, |
jjg@46 | 654 | 1, |
jjg@46 | 655 | 1, |
jjg@46 | 656 | 1, |
jjg@46 | 657 | 1, |
jjg@46 | 658 | 1, |
jjg@46 | 659 | 1, |
jjg@46 | 660 | 1, |
jjg@46 | 661 | 1, |
jjg@46 | 662 | 1, |
jjg@46 | 663 | 1, |
jjg@46 | 664 | 1, |
jjg@46 | 665 | 1, |
jjg@46 | 666 | 1, |
jjg@46 | 667 | 1, |
jjg@46 | 668 | 1, |
jjg@46 | 669 | 1, |
jjg@46 | 670 | 1, |
jjg@46 | 671 | 1, |
jjg@46 | 672 | 1, |
jjg@46 | 673 | 1, |
jjg@46 | 674 | 1, |
jjg@46 | 675 | 1, |
jjg@46 | 676 | 1, |
jjg@46 | 677 | 1, |
jjg@46 | 678 | 1, |
jjg@46 | 679 | 1, |
jjg@46 | 680 | 1, |
jjg@46 | 681 | 1, |
jjg@46 | 682 | 1, |
jjg@46 | 683 | 1, |
jjg@46 | 684 | 1, |
jjg@46 | 685 | 1, |
jjg@46 | 686 | 1, |
jjg@46 | 687 | 1, |
jjg@46 | 688 | 1, |
jjg@46 | 689 | 1, |
jjg@46 | 690 | 3, |
jjg@46 | 691 | 1, |
jjg@46 | 692 | 1, |
jjg@46 | 693 | 1, |
jjg@46 | 694 | 1, |
jjg@46 | 695 | 1, |
jjg@46 | 696 | 1, |
jjg@46 | 697 | 1, |
jjg@46 | 698 | 1, |
jjg@46 | 699 | 1, |
jjg@46 | 700 | 1, |
jjg@46 | 701 | 1, |
jjg@46 | 702 | 1, |
jjg@46 | 703 | 1, |
jjg@46 | 704 | 1, |
jjg@46 | 705 | 1, |
jjg@46 | 706 | 1, |
jjg@46 | 707 | 1, |
jjg@46 | 708 | 1, |
jjg@46 | 709 | 1, |
jjg@46 | 710 | 1, |
jjg@46 | 711 | 3, |
jjg@46 | 712 | 3, |
jjg@46 | 713 | 3, |
jjg@46 | 714 | 3, |
jjg@46 | 715 | 3, |
jjg@46 | 716 | 3, |
jjg@46 | 717 | 3, |
jjg@46 | 718 | 3, |
jjg@46 | 719 | 3, |
jjg@46 | 720 | 3, |
jjg@46 | 721 | 3, |
jjg@46 | 722 | 3, |
jjg@46 | 723 | 3, |
jjg@46 | 724 | 3, |
jjg@46 | 725 | 3, |
jjg@46 | 726 | 3, |
jjg@46 | 727 | 2, |
jjg@46 | 728 | 99, |
jjg@46 | 729 | 99, |
jjg@46 | 730 | 1, |
jjg@46 | 731 | 1, |
jjg@46 | 732 | 1, |
jjg@46 | 733 | 1, |
jjg@46 | 734 | 1, |
jjg@46 | 735 | 1, |
jjg@46 | 736 | 3, |
jjg@46 | 737 | 3, |
jjg@46 | 738 | 3, |
jjg@46 | 739 | 3, |
jjg@46 | 740 | 3, |
jjg@46 | 741 | 3, |
jjg@46 | 742 | 3, |
jjg@46 | 743 | 5, |
jjg@46 | 744 | 0, |
jjg@46 | 745 | 3, |
jjg@46 | 746 | 2, |
jjg@46 | 747 | 3, |
jjg@46 | 748 | 1, |
jjg@46 | 749 | 1, |
jjg@46 | 750 | 3, |
jjg@46 | 751 | 3, |
jjg@46 | 752 | 1, |
jjg@46 | 753 | 1, |
jjg@46 | 754 | 0, // wide |
jjg@46 | 755 | 4, |
jjg@46 | 756 | 3, |
jjg@46 | 757 | 3, |
jjg@46 | 758 | 5, |
jjg@46 | 759 | 5, |
jjg@46 | 760 | 1, |
jjg@46 | 761 | 1, 0, 0, 0, 0, 0 // pseudo |
jjg@46 | 762 | }; |
jjg@46 | 763 | |
jjg@46 | 764 | /* Type codes, used in newarray opcode */ |
jjg@46 | 765 | public static final int T_CLASS = 0x00000002; |
jjg@46 | 766 | public static final int T_BOOLEAN = 0x00000004; |
jjg@46 | 767 | public static final int T_CHAR = 0x00000005; |
jjg@46 | 768 | public static final int T_FLOAT = 0x00000006; |
jjg@46 | 769 | public static final int T_DOUBLE = 0x00000007; |
jjg@46 | 770 | public static final int T_BYTE = 0x00000008; |
jjg@46 | 771 | public static final int T_SHORT = 0x00000009; |
jjg@46 | 772 | public static final int T_INT = 0x0000000a; |
jjg@46 | 773 | public static final int T_LONG = 0x0000000b; |
jjg@46 | 774 | |
jjg@46 | 775 | private static HashMap<String,Integer> mnemocodes = new HashMap<String,Integer>(301, 0.5f); |
jjg@46 | 776 | private static String opcExtNamesTab[]=new String[128]; |
jjg@46 | 777 | private static String opcPrivExtNamesTab[]=new String[128]; |
jjg@46 | 778 | |
jjg@46 | 779 | private static void defineNonPriv(int opc, String mnem) { |
jjg@46 | 780 | mnemocodes.put(opcExtNamesTab[opc] = mnem, opc_nonpriv * 256 + opc); |
jjg@46 | 781 | } |
jjg@46 | 782 | |
jjg@46 | 783 | private static void definePriv(int opc, String mnem) { |
jjg@46 | 784 | mnemocodes.put(opcPrivExtNamesTab[opc] = "priv_" + mnem, opc_priv * 256 + opc); |
jjg@46 | 785 | } |
jjg@46 | 786 | |
jjg@46 | 787 | private static void defineExt(int opc, String mnem) { |
jjg@46 | 788 | defineNonPriv(opc, mnem); |
jjg@46 | 789 | definePriv(opc, mnem); |
jjg@46 | 790 | } |
jjg@46 | 791 | |
jjg@46 | 792 | static { |
jjg@46 | 793 | for (int i = 0; i < opc_wide; i++) { |
jjg@46 | 794 | mnemocodes.put(opcNamesTab[i], i); |
jjg@46 | 795 | } |
jjg@46 | 796 | for (int i = opc_wide + 1; i < opcNamesTab.length; i++) { |
jjg@46 | 797 | mnemocodes.put(opcNamesTab[i], i); |
jjg@46 | 798 | } |
jjg@46 | 799 | mnemocodes.put("invokenonvirtual", opc_invokespecial); |
jjg@46 | 800 | |
jjg@46 | 801 | mnemocodes.put("iload_w", opc_iload_w); |
jjg@46 | 802 | mnemocodes.put("lload_w", opc_lload_w); |
jjg@46 | 803 | mnemocodes.put("fload_w", opc_fload_w); |
jjg@46 | 804 | mnemocodes.put("dload_w", opc_dload_w); |
jjg@46 | 805 | mnemocodes.put("aload_w", opc_aload_w); |
jjg@46 | 806 | mnemocodes.put("istore_w", opc_istore_w); |
jjg@46 | 807 | mnemocodes.put("lstore_w", opc_lstore_w); |
jjg@46 | 808 | mnemocodes.put("fstore_w", opc_fstore_w); |
jjg@46 | 809 | mnemocodes.put("dstore_w", opc_dstore_w); |
jjg@46 | 810 | mnemocodes.put("astore_w", opc_astore_w); |
jjg@46 | 811 | mnemocodes.put("ret_w", opc_ret_w); |
jjg@46 | 812 | mnemocodes.put("iinc_w", opc_iinc_w); |
jjg@46 | 813 | |
jjg@46 | 814 | mnemocodes.put("nonpriv", opc_nonpriv); |
jjg@46 | 815 | mnemocodes.put("priv", opc_priv); |
jjg@46 | 816 | |
jjg@46 | 817 | defineExt(0, "load_ubyte"); |
jjg@46 | 818 | defineExt(1, "load_byte"); |
jjg@46 | 819 | defineExt(2, "load_char"); |
jjg@46 | 820 | defineExt(3, "load_short"); |
jjg@46 | 821 | defineExt(4, "load_word"); |
jjg@46 | 822 | defineExt(10, "load_char_oe"); |
jjg@46 | 823 | defineExt(11, "load_short_oe"); |
jjg@46 | 824 | defineExt(12, "load_word_oe"); |
jjg@46 | 825 | defineExt(16, "ncload_ubyte"); |
jjg@46 | 826 | defineExt(17, "ncload_byte"); |
jjg@46 | 827 | defineExt(18, "ncload_char"); |
jjg@46 | 828 | defineExt(19, "ncload_short"); |
jjg@46 | 829 | defineExt(20, "ncload_word"); |
jjg@46 | 830 | defineExt(26, "ncload_char_oe"); |
jjg@46 | 831 | defineExt(27, "ncload_short_oe"); |
jjg@46 | 832 | defineExt(28, "ncload_word_oe"); |
jjg@46 | 833 | defineExt(30, "cache_flush"); |
jjg@46 | 834 | defineExt(32, "store_byte"); |
jjg@46 | 835 | defineExt(34, "store_short"); |
jjg@46 | 836 | defineExt(36, "store_word"); |
jjg@46 | 837 | defineExt(42, "store_short_oe"); |
jjg@46 | 838 | defineExt(44, "store_word_oe"); |
jjg@46 | 839 | defineExt(48, "ncstore_byte"); |
jjg@46 | 840 | defineExt(50, "ncstore_short"); |
jjg@46 | 841 | defineExt(52, "ncstore_word"); |
jjg@46 | 842 | defineExt(58, "ncstore_short_oe"); |
jjg@46 | 843 | defineExt(60, "ncstore_word_oe"); |
jjg@46 | 844 | defineExt(62, "zero_line"); |
jjg@46 | 845 | defineNonPriv(5, "ret_from_sub"); |
jjg@46 | 846 | defineNonPriv(63, "enter_sync_method"); |
jjg@46 | 847 | definePriv(5, "ret_from_trap"); |
jjg@46 | 848 | definePriv(6, "read_dcache_tag"); |
jjg@46 | 849 | definePriv(7, "read_dcache_data"); |
jjg@46 | 850 | definePriv(14, "read_icache_tag"); |
jjg@46 | 851 | definePriv(15, "read_icache_data"); |
jjg@46 | 852 | definePriv(22, "powerdown"); |
jjg@46 | 853 | definePriv(23, "read_scache_data"); |
jjg@46 | 854 | definePriv(31, "cache_index_flush"); |
jjg@46 | 855 | definePriv(38, "write_dcache_tag"); |
jjg@46 | 856 | definePriv(39, "write_dcache_data"); |
jjg@46 | 857 | definePriv(46, "write_icache_tag"); |
jjg@46 | 858 | definePriv(47, "write_icache_data"); |
jjg@46 | 859 | definePriv(54, "reset"); |
jjg@46 | 860 | definePriv(55, "write_scache_data"); |
jjg@46 | 861 | for (int i = 0; i < 32; i++) { |
jjg@46 | 862 | definePriv(i + 64, "read_reg_" + i); |
jjg@46 | 863 | } |
jjg@46 | 864 | for (int i = 0; i < 32; i++) { |
jjg@46 | 865 | definePriv(i + 96, "write_reg_" + i); |
jjg@46 | 866 | } |
jjg@46 | 867 | } |
jjg@46 | 868 | } |