Opcode.java revision da3b7b1150f88b0105c38f30cd8204085c7d2acd
1/* 2 * [The "BSD licence"] 3 * Copyright (c) 2009 Ben Gruver 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29package org.jf.dexlib.Code; 30 31import org.jf.dexlib.Code.Format.Format; 32 33import java.util.HashMap; 34 35public enum Opcode 36{ 37 NOP((byte)0x00, "nop", ReferenceType.none, Format.Format10x), 38 MOVE((byte)0x01, "move", ReferenceType.none, Format.Format12x), 39 MOVE_FROM16((byte)0x02, "move/from16", ReferenceType.none, Format.Format22x), 40 MOVE_16((byte)0x03, "move/16", ReferenceType.none, Format.Format32x), 41 MOVE_WIDE((byte)0x04, "move-wide", ReferenceType.none, Format.Format12x), 42 MOVE_WIDE_FROM16((byte)0x05, "move-wide/from16", ReferenceType.none, Format.Format22x), 43 MOVE_WIDE_16((byte)0x06, "move-wide/16", ReferenceType.none, Format.Format32x), 44 MOVE_OBJECT((byte)0x07, "move-object", ReferenceType.none, Format.Format12x), 45 MOVE_OBJECT_FROM16((byte)0x08, "move-object/from16", ReferenceType.none, Format.Format22x), 46 MOVE_OBJECT_16((byte)0x09, "move-object/16", ReferenceType.none, Format.Format32x), 47 MOVE_RESULT((byte)0x0a, "move-result", ReferenceType.none, Format.Format11x), 48 MOVE_RESULT_WIDE((byte)0x0b, "move-result-wide", ReferenceType.none, Format.Format11x), 49 MOVE_RESULT_OBJECT((byte)0x0c, "move-result-object", ReferenceType.none, Format.Format11x), 50 MOVE_EXCEPTION((byte)0x0d, "move-exception", ReferenceType.none, Format.Format11x), 51 RETURN_VOID((byte)0x0e, "return-void", ReferenceType.none, Format.Format10x), 52 RETURN((byte)0x0f, "return", ReferenceType.none, Format.Format11x), 53 RETURN_WIDE((byte)0x10, "return-wide", ReferenceType.none, Format.Format11x), 54 RETURN_OBJECT((byte)0x11, "return-object", ReferenceType.none, Format.Format11x), 55 CONST_4((byte)0x12, "const/4", ReferenceType.none, Format.Format11n), 56 CONST_16((byte)0x13, "const/16", ReferenceType.none, Format.Format21s), 57 CONST((byte)0x14, "const", ReferenceType.none, Format.Format31i), 58 CONST_HIGH16((byte)0x15, "const/high16", ReferenceType.none, Format.Format21h), 59 CONST_WIDE_16((byte)0x16, "const-wide/16", ReferenceType.none, Format.Format21s), 60 CONST_WIDE_32((byte)0x17, "const-wide/32", ReferenceType.none, Format.Format31i), 61 CONST_WIDE((byte)0x18, "const-wide", ReferenceType.none, Format.Format51l), 62 CONST_WIDE_HIGH16((byte)0x19, "const-wide/high16", ReferenceType.none, Format.Format21h), 63 CONST_STRING((byte)0x1a, "const-string", ReferenceType.string, Format.Format21c), 64 CONST_STRING_JUMBO((byte)0x1b, "const-string/jumbo", ReferenceType.string, Format.Format31c), 65 CONST_CLASS((byte)0x1c, "const-class", ReferenceType.type, Format.Format21c), 66 MONITOR_ENTER((byte)0x1d, "monitor-enter", ReferenceType.none, Format.Format11x), 67 MONITOR_EXIT((byte)0x1e, "monitor-exit", ReferenceType.none, Format.Format11x), 68 CHECK_CAST((byte)0x1f, "check-cast", ReferenceType.type, Format.Format21c), 69 INSTANCE_OF((byte)0x20, "instance-of", ReferenceType.type, Format.Format22c), 70 ARRAY_LENGTH((byte)0x21, "array-length", ReferenceType.none, Format.Format12x), 71 NEW_INSTANCE((byte)0x22, "new-instance", ReferenceType.type, Format.Format21c), 72 NEW_ARRAY((byte)0x23, "new-array", ReferenceType.type, Format.Format22c), 73 FILLED_NEW_ARRAY((byte)0x24, "filled-new-array", ReferenceType.type, Format.Format35c), 74 FILLED_NEW_ARRAY_RANGE((byte)0x25, "filled-new-array/range", ReferenceType.type, Format.Format3rc), 75 FILL_ARRAY_DATA((byte)0x26, "fill-array-data", ReferenceType.none, Format.Format31t), 76 THROW((byte)0x27, "throw", ReferenceType.none, Format.Format11x), 77 GOTO((byte)0x28, "goto", ReferenceType.none, Format.Format10t), 78 GOTO_16((byte)0x29, "goto/16", ReferenceType.none, Format.Format20t), 79 GOTO_32((byte)0x2a, "goto/32", ReferenceType.none, Format.Format30t), 80 PACKED_SWITCH((byte)0x2b, "packed-switch", ReferenceType.none, Format.Format31t), 81 SPARSE_SWITCH((byte)0x2c, "sparse-switch", ReferenceType.none, Format.Format31t), 82 CMPL_FLOAT((byte)0x2d, "cmpl-float", ReferenceType.none, Format.Format23x), 83 CMPG_FLOAT((byte)0x2e, "cmpg-float", ReferenceType.none, Format.Format23x), 84 CMPL_DOUBLE((byte)0x2f, "cmpl-double", ReferenceType.none, Format.Format23x), 85 CMPG_DOUBLE((byte)0x30, "cmpg-double", ReferenceType.none, Format.Format23x), 86 CMP_LONG((byte)0x31, "cmp-long", ReferenceType.none, Format.Format23x), 87 IF_EQ((byte)0x32, "if-eq", ReferenceType.none, Format.Format22t), 88 IF_NE((byte)0x33, "if-ne", ReferenceType.none, Format.Format22t), 89 IF_LT((byte)0x34, "if-lt", ReferenceType.none, Format.Format22t), 90 IF_GE((byte)0x35, "if-ge", ReferenceType.none, Format.Format22t), 91 IF_GT((byte)0x36, "if-gt", ReferenceType.none, Format.Format22t), 92 IF_LE((byte)0x37, "if-le", ReferenceType.none, Format.Format22t), 93 IF_EQZ((byte)0x38, "if-eqz", ReferenceType.none, Format.Format21t), 94 IF_NEZ((byte)0x39, "if-nez", ReferenceType.none, Format.Format21t), 95 IF_LTZ((byte)0x3a, "if-ltz", ReferenceType.none, Format.Format21t), 96 IF_GEZ((byte)0x3b, "if-gez", ReferenceType.none, Format.Format21t), 97 IF_GTZ((byte)0x3c, "if-gtz", ReferenceType.none, Format.Format21t), 98 IF_LEZ((byte)0x3d, "if-lez", ReferenceType.none, Format.Format21t), 99 AGET((byte)0x44, "aget", ReferenceType.none, Format.Format23x), 100 AGET_WIDE((byte)0x45, "aget-wide", ReferenceType.none, Format.Format23x), 101 AGET_OBJECT((byte)0x46, "aget-object", ReferenceType.none, Format.Format23x), 102 AGET_BOOLEAN((byte)0x47, "aget-boolean", ReferenceType.none, Format.Format23x), 103 AGET_BYTE((byte)0x48, "aget-byte", ReferenceType.none, Format.Format23x), 104 AGET_CHAR((byte)0x49, "aget-char", ReferenceType.none, Format.Format23x), 105 AGET_SHORT((byte)0x4a, "aget-short", ReferenceType.none, Format.Format23x), 106 APUT((byte)0x4b, "aput", ReferenceType.none, Format.Format23x), 107 APUT_WIDE((byte)0x4c, "aput-wide", ReferenceType.none, Format.Format23x), 108 APUT_OBJECT((byte)0x4d, "aput-object", ReferenceType.none, Format.Format23x), 109 APUT_BOOLEAN((byte)0x4e, "aput-boolean", ReferenceType.none, Format.Format23x), 110 APUT_BYTE((byte)0x4f, "aput-byte", ReferenceType.none, Format.Format23x), 111 APUT_CHAR((byte)0x50, "aput-char", ReferenceType.none, Format.Format23x), 112 APUT_SHORT((byte)0x51, "aput-short", ReferenceType.none, Format.Format23x), 113 IGET((byte)0x52, "iget", ReferenceType.field, Format.Format22c), 114 IGET_WIDE((byte)0x53, "iget-wide", ReferenceType.field, Format.Format22c), 115 IGET_OBJECT((byte)0x54, "iget-object", ReferenceType.field, Format.Format22c), 116 IGET_BOOLEAN((byte)0x55, "iget-boolean", ReferenceType.field, Format.Format22c), 117 IGET_BYTE((byte)0x56, "iget-byte", ReferenceType.field, Format.Format22c), 118 IGET_CHAR((byte)0x57, "iget-char", ReferenceType.field, Format.Format22c), 119 IGET_SHORT((byte)0x58, "iget-short", ReferenceType.field, Format.Format22c), 120 IPUT((byte)0x59, "iput", ReferenceType.field, Format.Format22c), 121 IPUT_WIDE((byte)0x5a, "iput-wide", ReferenceType.field, Format.Format22c), 122 IPUT_OBJECT((byte)0x5b, "iput-object", ReferenceType.field, Format.Format22c), 123 IPUT_BOOLEAN((byte)0x5c, "iput-boolean", ReferenceType.field, Format.Format22c), 124 IPUT_BYTE((byte)0x5d, "iput-byte", ReferenceType.field, Format.Format22c), 125 IPUT_CHAR((byte)0x5e, "iput-char", ReferenceType.field, Format.Format22c), 126 IPUT_SHORT((byte)0x5f, "iput-short", ReferenceType.field, Format.Format22c), 127 SGET((byte)0x60, "sget", ReferenceType.field, Format.Format21c), 128 SGET_WIDE((byte)0x61, "sget-wide", ReferenceType.field, Format.Format21c), 129 SGET_OBJECT((byte)0x62, "sget-object", ReferenceType.field, Format.Format21c), 130 SGET_BOOLEAN((byte)0x63, "sget-boolean", ReferenceType.field, Format.Format21c), 131 SGET_BYTE((byte)0x64, "sget-byte", ReferenceType.field, Format.Format21c), 132 SGET_CHAR((byte)0x65, "sget-char", ReferenceType.field, Format.Format21c), 133 SGET_SHORT((byte)0x66, "sget-short", ReferenceType.field, Format.Format21c), 134 SPUT((byte)0x67, "sput", ReferenceType.field, Format.Format21c), 135 SPUT_WIDE((byte)0x68, "sput-wide", ReferenceType.field, Format.Format21c), 136 SPUT_OBJECT((byte)0x69, "sput-object", ReferenceType.field, Format.Format21c), 137 SPUT_BOOLEAN((byte)0x6a, "sput-boolean", ReferenceType.field, Format.Format21c), 138 SPUT_BYTE((byte)0x6b, "sput-byte", ReferenceType.field, Format.Format21c), 139 SPUT_CHAR((byte)0x6c, "sput-char", ReferenceType.field, Format.Format21c), 140 SPUT_SHORT((byte)0x6d, "sput-short", ReferenceType.field, Format.Format21c), 141 INVOKE_VIRTUAL((byte)0x6e, "invoke-virtual", ReferenceType.method, Format.Format35c), 142 INVOKE_SUPER((byte)0x6f, "invoke-super", ReferenceType.method, Format.Format35c), 143 INVOKE_DIRECT((byte)0x70, "invoke-direct", ReferenceType.method, Format.Format35c), 144 INVOKE_STATIC((byte)0x71, "invoke-static", ReferenceType.method, Format.Format35c), 145 INVOKE_INTERFACE((byte)0x72, "invoke-interface", ReferenceType.method, Format.Format35c), 146 INVOKE_VIRTUAL_RANGE((byte)0x74, "invoke-virtual/range", ReferenceType.method, Format.Format3rc), 147 INVOKE_SUPER_RANGE((byte)0x75, "invoke-super/range", ReferenceType.method, Format.Format3rc), 148 INVOKE_DIRECT_RANGE((byte)0x76, "invoke-direct/range", ReferenceType.method, Format.Format3rc), 149 INVOKE_STATIC_RANGE((byte)0x77, "invoke-static/range", ReferenceType.method, Format.Format3rc), 150 INVOKE_INTERFACE_RANGE((byte)0x78, "invoke-interface/range", ReferenceType.method, Format.Format3rc), 151 NEG_INT((byte)0x7b, "neg-int", ReferenceType.none, Format.Format12x), 152 NOT_INT((byte)0x7c, "not-int", ReferenceType.none, Format.Format12x), 153 NEG_LONG((byte)0x7d, "neg-long", ReferenceType.none, Format.Format12x), 154 NOT_LONG((byte)0x7e, "not-long", ReferenceType.none, Format.Format12x), 155 NEG_FLOAT((byte)0x7f, "neg-float", ReferenceType.none, Format.Format12x), 156 NEG_DOUBLE((byte)0x80, "neg-double", ReferenceType.none, Format.Format12x), 157 INT_TO_LONG((byte)0x81, "int-to-long", ReferenceType.none, Format.Format12x), 158 INT_TO_FLOAT((byte)0x82, "int-to-float", ReferenceType.none, Format.Format12x), 159 INT_TO_DOUBLE((byte)0x83, "int-to-double", ReferenceType.none, Format.Format12x), 160 LONG_TO_INT((byte)0x84, "long-to-int", ReferenceType.none, Format.Format12x), 161 LONG_TO_FLOAT((byte)0x85, "long-to-float", ReferenceType.none, Format.Format12x), 162 LONG_TO_DOUBLE((byte)0x86, "long-to-double", ReferenceType.none, Format.Format12x), 163 FLOAT_TO_INT((byte)0x87, "float-to-int", ReferenceType.none, Format.Format12x), 164 FLOAT_TO_LONG((byte)0x88, "float-to-long", ReferenceType.none, Format.Format12x), 165 FLOAT_TO_DOUBLE((byte)0x89, "float-to-double", ReferenceType.none, Format.Format12x), 166 DOUBLE_TO_INT((byte)0x8a, "double-to-int", ReferenceType.none, Format.Format12x), 167 DOUBLE_TO_LONG((byte)0x8b, "double-to-long", ReferenceType.none, Format.Format12x), 168 DOUBLE_TO_FLOAT((byte)0x8c, "double-to-float", ReferenceType.none, Format.Format12x), 169 INT_TO_BYTE((byte)0x8d, "int-to-byte", ReferenceType.none, Format.Format12x), 170 INT_TO_CHAR((byte)0x8e, "int-to-char", ReferenceType.none, Format.Format12x), 171 INT_TO_SHORT((byte)0x8f, "int-to-short", ReferenceType.none, Format.Format12x), 172 ADD_INT((byte)0x90, "add-int", ReferenceType.none, Format.Format23x), 173 SUB_INT((byte)0x91, "sub-int", ReferenceType.none, Format.Format23x), 174 MUL_INT((byte)0x92, "mul-int", ReferenceType.none, Format.Format23x), 175 DIV_INT((byte)0x93, "div-int", ReferenceType.none, Format.Format23x), 176 REM_INT((byte)0x94, "rem-int", ReferenceType.none, Format.Format23x), 177 AND_INT((byte)0x95, "and-int", ReferenceType.none, Format.Format23x), 178 OR_INT((byte)0x96, "or-int", ReferenceType.none, Format.Format23x), 179 XOR_INT((byte)0x97, "xor-int", ReferenceType.none, Format.Format23x), 180 SHL_INT((byte)0x98, "shl-int", ReferenceType.none, Format.Format23x), 181 SHR_INT((byte)0x99, "shr-int", ReferenceType.none, Format.Format23x), 182 USHR_INT((byte)0x9a, "ushr-int", ReferenceType.none, Format.Format23x), 183 ADD_LONG((byte)0x9b, "add-long", ReferenceType.none, Format.Format23x), 184 SUB_LONG((byte)0x9c, "sub-long", ReferenceType.none, Format.Format23x), 185 MUL_LONG((byte)0x9d, "mul-long", ReferenceType.none, Format.Format23x), 186 DIV_LONG((byte)0x9e, "div-long", ReferenceType.none, Format.Format23x), 187 REM_LONG((byte)0x9f, "rem-long", ReferenceType.none, Format.Format23x), 188 AND_LONG((byte)0xa0, "and-long", ReferenceType.none, Format.Format23x), 189 OR_LONG((byte)0xa1, "or-long", ReferenceType.none, Format.Format23x), 190 XOR_LONG((byte)0xa2, "xor-long", ReferenceType.none, Format.Format23x), 191 SHL_LONG((byte)0xa3, "shl-long", ReferenceType.none, Format.Format23x), 192 SHR_LONG((byte)0xa4, "shr-long", ReferenceType.none, Format.Format23x), 193 USHR_LONG((byte)0xa5, "ushr-long", ReferenceType.none, Format.Format23x), 194 ADD_FLOAT((byte)0xa6, "add-float", ReferenceType.none, Format.Format23x), 195 SUB_FLOAT((byte)0xa7, "sub-float", ReferenceType.none, Format.Format23x), 196 MUL_FLOAT((byte)0xa8, "mul-float", ReferenceType.none, Format.Format23x), 197 DIV_FLOAT((byte)0xa9, "div-float", ReferenceType.none, Format.Format23x), 198 REM_FLOAT((byte)0xaa, "rem-float", ReferenceType.none, Format.Format23x), 199 ADD_DOUBLE((byte)0xab, "add-double", ReferenceType.none, Format.Format23x), 200 SUB_DOUBLE((byte)0xac, "sub-double", ReferenceType.none, Format.Format23x), 201 MUL_DOUBLE((byte)0xad, "mul-double", ReferenceType.none, Format.Format23x), 202 DIV_DOUBLE((byte)0xae, "div-double", ReferenceType.none, Format.Format23x), 203 REM_DOUBLE((byte)0xaf, "rem-double", ReferenceType.none, Format.Format23x), 204 ADD_INT_2ADDR((byte)0xb0, "add-int/2addr", ReferenceType.none, Format.Format12x), 205 SUB_INT_2ADDR((byte)0xb1, "sub-int/2addr", ReferenceType.none, Format.Format12x), 206 MUL_INT_2ADDR((byte)0xb2, "mul-int/2addr", ReferenceType.none, Format.Format12x), 207 DIV_INT_2ADDR((byte)0xb3, "div-int/2addr", ReferenceType.none, Format.Format12x), 208 REM_INT_2ADDR((byte)0xb4, "rem-int/2addr", ReferenceType.none, Format.Format12x), 209 AND_INT_2ADDR((byte)0xb5, "and-int/2addr", ReferenceType.none, Format.Format12x), 210 OR_INT_2ADDR((byte)0xb6, "or-int/2addr", ReferenceType.none, Format.Format12x), 211 XOR_INT_2ADDR((byte)0xb7, "xor-int/2addr", ReferenceType.none, Format.Format12x), 212 SHL_INT_2ADDR((byte)0xb8, "shl-int/2addr", ReferenceType.none, Format.Format12x), 213 SHR_INT_2ADDR((byte)0xb9, "shr-int/2addr", ReferenceType.none, Format.Format12x), 214 USHR_INT_2ADDR((byte)0xba, "ushr-int/2addr", ReferenceType.none, Format.Format12x), 215 ADD_LONG_2ADDR((byte)0xbb, "add-long/2addr", ReferenceType.none, Format.Format12x), 216 SUB_LONG_2ADDR((byte)0xbc, "sub-long/2addr", ReferenceType.none, Format.Format12x), 217 MUL_LONG_2ADDR((byte)0xbd, "mul-long/2addr", ReferenceType.none, Format.Format12x), 218 DIV_LONG_2ADDR((byte)0xbe, "div-long/2addr", ReferenceType.none, Format.Format12x), 219 REM_LONG_2ADDR((byte)0xbf, "rem-long/2addr", ReferenceType.none, Format.Format12x), 220 AND_LONG_2ADDR((byte)0xc0, "and-long/2addr", ReferenceType.none, Format.Format12x), 221 OR_LONG_2ADDR((byte)0xc1, "or-long/2addr", ReferenceType.none, Format.Format12x), 222 XOR_LONG_2ADDR((byte)0xc2, "xor-long/2addr", ReferenceType.none, Format.Format12x), 223 SHL_LONG_2ADDR((byte)0xc3, "shl-long/2addr", ReferenceType.none, Format.Format12x), 224 SHR_LONG_2ADDR((byte)0xc4, "shr-long/2addr", ReferenceType.none, Format.Format12x), 225 USHR_LONG_2ADDR((byte)0xc5, "ushr-long/2addr", ReferenceType.none, Format.Format12x), 226 ADD_FLOAT_2ADDR((byte)0xc6, "add-float/2addr", ReferenceType.none, Format.Format12x), 227 SUB_FLOAT_2ADDR((byte)0xc7, "sub-float/2addr", ReferenceType.none, Format.Format12x), 228 MUL_FLOAT_2ADDR((byte)0xc8, "mul-float/2addr", ReferenceType.none, Format.Format12x), 229 DIV_FLOAT_2ADDR((byte)0xc9, "div-float/2addr", ReferenceType.none, Format.Format12x), 230 REM_FLOAT_2ADDR((byte)0xca, "rem-float/2addr", ReferenceType.none, Format.Format12x), 231 ADD_DOUBLE_2ADDR((byte)0xcb, "add-double/2addr", ReferenceType.none, Format.Format12x), 232 SUB_DOUBLE_2ADDR((byte)0xcc, "sub-double/2addr", ReferenceType.none, Format.Format12x), 233 MUL_DOUBLE_2ADDR((byte)0xcd, "mul-double/2addr", ReferenceType.none, Format.Format12x), 234 DIV_DOUBLE_2ADDR((byte)0xce, "div-double/2addr", ReferenceType.none, Format.Format12x), 235 REM_DOUBLE_2ADDR((byte)0xcf, "rem-double/2addr", ReferenceType.none, Format.Format12x), 236 ADD_INT_LIT16((byte)0xd0, "add-int/lit16", ReferenceType.none, Format.Format22s), 237 RSUB_INT((byte)0xd1, "rsub-int", ReferenceType.none, Format.Format22s), 238 MUL_INT_LIT16((byte)0xd2, "mul-int/lit16", ReferenceType.none, Format.Format22s), 239 DIV_INT_LIT16((byte)0xd3, "div-int/lit16", ReferenceType.none, Format.Format22s), 240 REM_INT_LIT16((byte)0xd4, "rem-int/lit16", ReferenceType.none, Format.Format22s), 241 AND_INT_LIT16((byte)0xd5, "and-int/lit16", ReferenceType.none, Format.Format22s), 242 OR_INT_LIT16((byte)0xd6, "or-int/lit16", ReferenceType.none, Format.Format22s), 243 XOR_INT_LIT16((byte)0xd7, "xor-int/lit16", ReferenceType.none, Format.Format22s), 244 ADD_INT_LIT8((byte)0xd8, "add-int/lit8", ReferenceType.none, Format.Format22b), 245 RSUB_INT_LIT8((byte)0xd9, "rsub-int/lit8", ReferenceType.none, Format.Format22b), 246 MUL_INT_LIT8((byte)0xda, "mul-int/lit8", ReferenceType.none, Format.Format22b), 247 DIV_INT_LIT8((byte)0xdb, "div-int/lit8", ReferenceType.none, Format.Format22b), 248 REM_INT_LIT8((byte)0xdc, "rem-int/lit8", ReferenceType.none, Format.Format22b), 249 AND_INT_LIT8((byte)0xdd, "and-int/lit8", ReferenceType.none, Format.Format22b), 250 OR_INT_LIT8((byte)0xde, "or-int/lit8", ReferenceType.none, Format.Format22b), 251 XOR_INT_LIT8((byte)0xdf, "xor-int/lit8", ReferenceType.none, Format.Format22b), 252 SHL_INT_LIT8((byte)0xe0, "shl-int/lit8", ReferenceType.none, Format.Format22b), 253 SHR_INT_LIT8((byte)0xe1, "shr-int/lit8", ReferenceType.none, Format.Format22b), 254 USHR_INT_LIT8((byte)0xe2, "ushr-int/lit8", ReferenceType.none, Format.Format22b), 255 256 257 INVOKE_EXECUTE_INLINE((byte)0xee, "execute-inline", ReferenceType.none, Format.Format35ms, true), 258 INVOKE_DIRECT_EMPTY((byte)0xf0, "invoke-direct-empty", ReferenceType.method, Format.Format35s, true), 259 IGET_QUICK((byte)0xf2, "iget-quick", ReferenceType.none, Format.Format22cs, true), 260 IGET_WIDE_QUICK((byte)0xf3, "iget-wide-quick", ReferenceType.none, Format.Format22cs, true), 261 IGET_OBJECT_QUICK((byte)0xf4, "iget-object-quick", ReferenceType.none, Format.Format22cs, true), 262 IPUT_QUICK((byte)0xf5, "iput-quick", ReferenceType.none, Format.Format22cs, true), 263 IPUT_WIDE_QUICK((byte)0xf6, "iput-wide-quick", ReferenceType.none, Format.Format22cs, true), 264 IPUT_OBJECT_QUICK((byte)0xf7, "iput-object-quick", ReferenceType.none, Format.Format22cs, true), 265 INVOKE_VIRTUAL_QUICK((byte)0xf8, "invoke-virtual-quick", ReferenceType.none, Format.Format35ms, true), 266 INVOKE_VIRTUAL_RANGE_QUICK((byte)0xf9, "invoke-virtual-range-quick", ReferenceType.none, Format.Format3rms, true), 267 INVOKE_SUPER_QUICK((byte)0xfa, "invoke-super-quick", ReferenceType.none, Format.Format35ms, true), 268 INVOKE_SUPER_RANGE_QUICK((byte)0xfb, "invoke-super-range-quick", ReferenceType.none, Format.Format3rms, true); 269 270 271 272 private static Opcode[] opcodesByValue; 273 private static HashMap<Integer, Opcode> opcodesByName; 274 275 static { 276 opcodesByValue = new Opcode[256]; 277 opcodesByName = new HashMap<Integer, Opcode>(); 278 279 for (Opcode opcode: Opcode.values()) { 280 opcodesByValue[opcode.value & 0xFF] = opcode; 281 opcodesByName.put(opcode.name.hashCode(), opcode); 282 } 283 } 284 285 public static Opcode getOpcodeByName(String opcodeName) { 286 return opcodesByName.get(opcodeName.toLowerCase().hashCode()); 287 } 288 289 public static Opcode getOpcodeByValue(byte opcodeValue) { 290 return opcodesByValue[opcodeValue & 0xFF]; 291 } 292 293 public final byte value; 294 public final String name; 295 public final ReferenceType referenceType; 296 public final Format format; 297 public final boolean odexOnly; 298 299 Opcode(byte opcodeValue, String opcodeName, ReferenceType referenceType, Format format) { 300 this(opcodeValue, opcodeName, referenceType, format, false); 301 } 302 303 Opcode(byte opcodeValue, String opcodeName, ReferenceType referenceType, Format format, boolean odexOnly) { 304 this.value = opcodeValue; 305 this.name = opcodeName; 306 this.referenceType = referenceType; 307 this.format = format; 308 this.odexOnly = odexOnly; 309 } 310} 311