1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /* 17 * Table of Dalvik opcode names. 18 */ 19 #include "OpCodeNames.h" 20 21 /* 22 * The following two lines work, but slashes and dashes both turn into 23 * underscores, and the strings are all upper case. The output is easier 24 * to read if we do the strings by hand (could probably write a 25 * post-processing function easily enough if maintenance becomes annoying). 26 */ 27 //#define H(_op) #_op 28 //DEFINE_GOTO_TABLE(gOpNames) 29 30 /* 31 * Dalvik opcode names. 32 */ 33 static const char* gOpNames[256] = { 34 /* 0x00 */ 35 "nop", 36 "move", 37 "move/from16", 38 "move/16", 39 "move-wide", 40 "move-wide/from16", 41 "move-wide/16", 42 "move-object", 43 "move-object/from16", 44 "move-object/16", 45 "move-result", 46 "move-result-wide", 47 "move-result-object", 48 "move-exception", 49 "return-void", 50 "return", 51 52 /* 0x10 */ 53 "return-wide", 54 "return-object", 55 "const/4", 56 "const/16", 57 "const", 58 "const/high16", 59 "const-wide/16", 60 "const-wide/32", 61 "const-wide", 62 "const-wide/high16", 63 "const-string", 64 "const-string/jumbo", 65 "const-class", 66 "monitor-enter", 67 "monitor-exit", 68 "check-cast", 69 70 /* 0x20 */ 71 "instance-of", 72 "array-length", 73 "new-instance", 74 "new-array", 75 "filled-new-array", 76 "filled-new-array/range", 77 "fill-array-data", 78 "throw", 79 "goto", 80 "goto/16", 81 "goto/32", 82 "packed-switch", 83 "sparse-switch", 84 "cmpl-float", 85 "cmpg-float", 86 "cmpl-double", 87 88 /* 0x30 */ 89 "cmpg-double", 90 "cmp-long", 91 "if-eq", 92 "if-ne", 93 "if-lt", 94 "if-ge", 95 "if-gt", 96 "if-le", 97 "if-eqz", 98 "if-nez", 99 "if-ltz", 100 "if-gez", 101 "if-gtz", 102 "if-lez", 103 "UNUSED", 104 "UNUSED", 105 106 /* 0x40 */ 107 "UNUSED", 108 "UNUSED", 109 "UNUSED", 110 "UNUSED", 111 "aget", 112 "aget-wide", 113 "aget-object", 114 "aget-boolean", 115 "aget-byte", 116 "aget-char", 117 "aget-short", 118 "aput", 119 "aput-wide", 120 "aput-object", 121 "aput-boolean", 122 "aput-byte", 123 124 /* 0x50 */ 125 "aput-char", 126 "aput-short", 127 "iget", 128 "iget-wide", 129 "iget-object", 130 "iget-boolean", 131 "iget-byte", 132 "iget-char", 133 "iget-short", 134 "iput", 135 "iput-wide", 136 "iput-object", 137 "iput-boolean", 138 "iput-byte", 139 "iput-char", 140 "iput-short", 141 142 /* 0x60 */ 143 "sget", 144 "sget-wide", 145 "sget-object", 146 "sget-boolean", 147 "sget-byte", 148 "sget-char", 149 "sget-short", 150 "sput", 151 "sput-wide", 152 "sput-object", 153 "sput-boolean", 154 "sput-byte", 155 "sput-char", 156 "sput-short", 157 "invoke-virtual", 158 "invoke-super", 159 160 /* 0x70 */ 161 "invoke-direct", 162 "invoke-static", 163 "invoke-interface", 164 "UNUSED", 165 "invoke-virtual/range", 166 "invoke-super/range", 167 "invoke-direct/range", 168 "invoke-static/range", 169 "invoke-interface/range", 170 "UNUSED", 171 "UNUSED", 172 "neg-int", 173 "not-int", 174 "neg-long", 175 "not-long", 176 "neg-float", 177 178 /* 0x80 */ 179 "neg-double", 180 "int-to-long", 181 "int-to-float", 182 "int-to-double", 183 "long-to-int", 184 "long-to-float", 185 "long-to-double", 186 "float-to-int", 187 "float-to-long", 188 "float-to-double", 189 "double-to-int", 190 "double-to-long", 191 "double-to-float", 192 "int-to-byte", 193 "int-to-char", 194 "int-to-short", 195 196 /* 0x90 */ 197 "add-int", 198 "sub-int", 199 "mul-int", 200 "div-int", 201 "rem-int", 202 "and-int", 203 "or-int", 204 "xor-int", 205 "shl-int", 206 "shr-int", 207 "ushr-int", 208 "add-long", 209 "sub-long", 210 "mul-long", 211 "div-long", 212 "rem-long", 213 214 /* 0xa0 */ 215 "and-long", 216 "or-long", 217 "xor-long", 218 "shl-long", 219 "shr-long", 220 "ushr-long", 221 "add-float", 222 "sub-float", 223 "mul-float", 224 "div-float", 225 "rem-float", 226 "add-double", 227 "sub-double", 228 "mul-double", 229 "div-double", 230 "rem-double", 231 232 /* 0xb0 */ 233 "add-int/2addr", 234 "sub-int/2addr", 235 "mul-int/2addr", 236 "div-int/2addr", 237 "rem-int/2addr", 238 "and-int/2addr", 239 "or-int/2addr", 240 "xor-int/2addr", 241 "shl-int/2addr", 242 "shr-int/2addr", 243 "ushr-int/2addr", 244 "add-long/2addr", 245 "sub-long/2addr", 246 "mul-long/2addr", 247 "div-long/2addr", 248 "rem-long/2addr", 249 250 /* 0xc0 */ 251 "and-long/2addr", 252 "or-long/2addr", 253 "xor-long/2addr", 254 "shl-long/2addr", 255 "shr-long/2addr", 256 "ushr-long/2addr", 257 "add-float/2addr", 258 "sub-float/2addr", 259 "mul-float/2addr", 260 "div-float/2addr", 261 "rem-float/2addr", 262 "add-double/2addr", 263 "sub-double/2addr", 264 "mul-double/2addr", 265 "div-double/2addr", 266 "rem-double/2addr", 267 268 /* 0xd0 */ 269 "add-int/lit16", 270 "rsub-int", 271 "mul-int/lit16", 272 "div-int/lit16", 273 "rem-int/lit16", 274 "and-int/lit16", 275 "or-int/lit16", 276 "xor-int/lit16", 277 "add-int/lit8", 278 "rsub-int/lit8", 279 "mul-int/lit8", 280 "div-int/lit8", 281 "rem-int/lit8", 282 "and-int/lit8", 283 "or-int/lit8", 284 "xor-int/lit8", 285 286 /* 0xe0 */ 287 "shl-int/lit8", 288 "shr-int/lit8", 289 "ushr-int/lit8", 290 "UNUSED", 291 "UNUSED", 292 "UNUSED", 293 "UNUSED", 294 "UNUSED", 295 "UNUSED", 296 "UNUSED", 297 "UNUSED", 298 "UNUSED", 299 "^breakpoint", // does not appear in DEX files 300 "^throw-verification-error", // does not appear in DEX files 301 "+execute-inline", 302 "+execute-inline/range", 303 304 /* 0xf0 */ 305 "+invoke-direct-empty", 306 "UNUSED", 307 "+iget-quick", 308 "+iget-wide-quick", 309 "+iget-object-quick", 310 "+iput-quick", 311 "+iput-wide-quick", 312 "+iput-object-quick", 313 "+invoke-virtual-quick", 314 "+invoke-virtual-quick/range", 315 "+invoke-super-quick", 316 "+invoke-super-quick/range", 317 "UNUSED", 318 "UNUSED", 319 "UNUSED", 320 "UNUSED", 321 }; 322 323 /* 324 * Return the name of an opcode. 325 */ 326 const char* getOpcodeName(OpCode op) 327 { 328 return gOpNames[op]; 329 } 330 331