Generate the contents of OpCodeNames.c.

This was another one that was pretty easy to add to opcode-gen. I did
end up tweaking opcode-gen to make it obvious that the two forms of
name are different by more than just upper vs. lower case, especially
because I duplicated the original distinction of the optimized opcodes
having extra prefix characters in their human-oriented names but not
in the names when used as programming constants.

Change-Id: I5062442540d26318914964bd2722cc32380b19ca
diff --git a/libdex/OpCode.h b/libdex/OpCode.h
index 2ff73bc..32d3b3e 100644
--- a/libdex/OpCode.h
+++ b/libdex/OpCode.h
@@ -44,7 +44,6 @@
  *  - update the instruction info table generators and (if you changed an
  *    instruction format) instruction decoder in InstrUtils.c
  *  - update the instruction format list in InstrUtils.h, if necessary
- *  - update the gOpNames table in OpCodeNames.c
  *  - update the parallel definitions in the class dalvik.bytecode.Opcodes
  *
  * Interpreter:
diff --git a/libdex/OpCodeNames.c b/libdex/OpCodeNames.c
index fca249f..81e6c88 100644
--- a/libdex/OpCodeNames.c
+++ b/libdex/OpCodeNames.c
@@ -16,25 +16,20 @@
 
 /*
  * Table of Dalvik opcode names.
+ *
+ * IMPORTANT NOTE: The contents of this file are mostly generated
+ * automatically by the opcode-gen tool. Any edits to the generated
+ * sections will get wiped out the next time the tool is run.
  */
+
 #include "OpCodeNames.h"
-
 #include <assert.h>
 
 /*
- * The following two lines work, but slashes and dashes both turn into
- * underscores, and the strings are all upper case.  The output is easier
- * to read if we do the strings by hand (could probably write a
- * post-processing function easily enough if maintenance becomes annoying).
- */
-//#define H(_op) #_op
-//DEFINE_GOTO_TABLE(gOpNames)
-
-/*
  * Dalvik opcode names.
  */
-static const char* gOpNames[256] = {
-    /* 0x00 */
+static const char* gOpNames[kNumDalvikInstructions] = {
+    // BEGIN(libdex-opcode-names); GENERATED AUTOMATICALLY BY opcode-gen
     "nop",
     "move",
     "move/from16",
@@ -51,8 +46,6 @@
     "move-exception",
     "return-void",
     "return",
-
-    /* 0x10 */
     "return-wide",
     "return-object",
     "const/4",
@@ -69,8 +62,6 @@
     "monitor-enter",
     "monitor-exit",
     "check-cast",
-
-    /* 0x20 */
     "instance-of",
     "array-length",
     "new-instance",
@@ -87,8 +78,6 @@
     "cmpl-float",
     "cmpg-float",
     "cmpl-double",
-
-    /* 0x30 */
     "cmpg-double",
     "cmp-long",
     "if-eq",
@@ -103,14 +92,12 @@
     "if-gez",
     "if-gtz",
     "if-lez",
-    "UNUSED",
-    "UNUSED",
-
-    /* 0x40 */
-    "UNUSED",
-    "UNUSED",
-    "UNUSED",
-    "UNUSED",
+    "unused-3e",
+    "unused-3f",
+    "unused-40",
+    "unused-41",
+    "unused-42",
+    "unused-43",
     "aget",
     "aget-wide",
     "aget-object",
@@ -123,8 +110,6 @@
     "aput-object",
     "aput-boolean",
     "aput-byte",
-
-    /* 0x50 */
     "aput-char",
     "aput-short",
     "iget",
@@ -141,8 +126,6 @@
     "iput-byte",
     "iput-char",
     "iput-short",
-
-    /* 0x60 */
     "sget",
     "sget-wide",
     "sget-object",
@@ -159,26 +142,22 @@
     "sput-short",
     "invoke-virtual",
     "invoke-super",
-
-    /* 0x70 */
     "invoke-direct",
     "invoke-static",
     "invoke-interface",
-    "UNUSED",
+    "unused-73",
     "invoke-virtual/range",
     "invoke-super/range",
     "invoke-direct/range",
     "invoke-static/range",
     "invoke-interface/range",
-    "UNUSED",
-    "UNUSED",
+    "unused-79",
+    "unused-7a",
     "neg-int",
     "not-int",
     "neg-long",
     "not-long",
     "neg-float",
-
-    /* 0x80 */
     "neg-double",
     "int-to-long",
     "int-to-float",
@@ -195,8 +174,6 @@
     "int-to-byte",
     "int-to-char",
     "int-to-short",
-
-    /* 0x90 */
     "add-int",
     "sub-int",
     "mul-int",
@@ -213,8 +190,6 @@
     "mul-long",
     "div-long",
     "rem-long",
-
-    /* 0xa0 */
     "and-long",
     "or-long",
     "xor-long",
@@ -231,8 +206,6 @@
     "mul-double",
     "div-double",
     "rem-double",
-
-    /* 0xb0 */
     "add-int/2addr",
     "sub-int/2addr",
     "mul-int/2addr",
@@ -249,8 +222,6 @@
     "mul-long/2addr",
     "div-long/2addr",
     "rem-long/2addr",
-
-    /* 0xc0 */
     "and-long/2addr",
     "or-long/2addr",
     "xor-long/2addr",
@@ -267,8 +238,6 @@
     "mul-double/2addr",
     "div-double/2addr",
     "rem-double/2addr",
-
-    /* 0xd0 */
     "add-int/lit16",
     "rsub-int",
     "mul-int/lit16",
@@ -285,8 +254,6 @@
     "and-int/lit8",
     "or-int/lit8",
     "xor-int/lit8",
-
-    /* 0xe0 */
     "shl-int/lit8",
     "shr-int/lit8",
     "ushr-int/lit8",
@@ -299,12 +266,10 @@
     "+iput-wide-volatile",
     "+sget-wide-volatile",
     "+sput-wide-volatile",
-    "^breakpoint",                  // does not appear in DEX files
-    "^throw-verification-error",    // does not appear in DEX files
+    "^breakpoint",
+    "^throw-verification-error",
     "+execute-inline",
     "+execute-inline/range",
-
-    /* 0xf0 */
     "+invoke-direct-empty",
     "+return-void-barrier",
     "+iget-quick",
@@ -320,7 +285,8 @@
     "+iput-object-volatile",
     "+sget-object-volatile",
     "+sput-object-volatile",
-    "UNUSED",
+    "unused-ff",
+    // END(libdex-opcode-names)
 };
 
 /*
diff --git a/opcode-gen/bytecode.txt b/opcode-gen/bytecode.txt
index 1dfd9f1..4462dac 100644
--- a/opcode-gen/bytecode.txt
+++ b/opcode-gen/bytecode.txt
@@ -76,299 +76,299 @@
 #     invoke        -- is a method invoke
 
 # Regular opcodes (with a couple holes)
-op   00 nop                        10x  n none          continue
-op   01 move                       12x  y none          continue
-op   02 move/from16                22x  y none          continue
-op   03 move/16                    32x  y none          continue
-op   04 move-wide                  12x  y none          continue
-op   05 move-wide/from16           22x  y none          continue
-op   06 move-wide/16               32x  y none          continue
-op   07 move-object                12x  y none          continue
-op   08 move-object/from16         22x  y none          continue
-op   09 move-object/16             32x  y none          continue
-op   0a move-result                11x  y none          continue
-op   0b move-result-wide           11x  y none          continue
-op   0c move-result-object         11x  y none          continue
-op   0d move-exception             11x  y none          continue
-op   0e return-void                10x  n none          return
-op   0f return                     11x  n none          return
-op   10 return-wide                11x  n none          return
-op   11 return-object              11x  n none          return
-op   12 const/4                    11n  y none          continue
-op   13 const/16                   21s  y none          continue
-op   14 const                      31i  y none          continue
-op   15 const/high16               21h  y none          continue
-op   16 const-wide/16              21s  y none          continue
-op   17 const-wide/32              31i  y none          continue
-op   18 const-wide                 51l  y none          continue
-op   19 const-wide/high16          21h  y none          continue
-op   1a const-string               21c  y string-ref    continue|throw
-op   1b const-string/jumbo         31c  y string-ref    continue|throw
-op   1c const-class                21c  y type-ref      continue|throw
-op   1d monitor-enter              11x  n none          continue|throw
-op   1e monitor-exit               11x  n none          continue|throw
-op   1f check-cast                 21c  y type-ref      continue|throw
-op   20 instance-of                22c  y type-ref      continue|throw
-op   21 array-length               12x  y none          continue|throw
-op   22 new-instance               21c  y type-ref      continue|throw
-op   23 new-array                  22c  y type-ref      continue|throw
-op   24 filled-new-array           35c  n type-ref      continue|throw
-op   25 filled-new-array/range     3rc  n type-ref      continue|throw
-op   26 fill-array-data            31t  n none          continue
-op   27 throw                      11x  n none          throw
-op   28 goto                       10t  n none          branch
-op   29 goto/16                    20t  n none          branch
-op   2a goto/32                    30t  n none          branch
-op   2b packed-switch              31t  n none          continue|switch
-op   2c sparse-switch              31t  n none          continue|switch
-op   2d cmpl-float                 23x  y none          continue
-op   2e cmpg-float                 23x  y none          continue
-op   2f cmpl-double                23x  y none          continue
-op   30 cmpg-double                23x  y none          continue
-op   31 cmp-long                   23x  y none          continue
-op   32 if-eq                      22t  n none          continue|branch
-op   33 if-ne                      22t  n none          continue|branch
-op   34 if-lt                      22t  n none          continue|branch
-op   35 if-ge                      22t  n none          continue|branch
-op   36 if-gt                      22t  n none          continue|branch
-op   37 if-le                      22t  n none          continue|branch
-op   38 if-eqz                     21t  n none          continue|branch
-op   39 if-nez                     21t  n none          continue|branch
-op   3a if-ltz                     21t  n none          continue|branch
-op   3b if-gez                     21t  n none          continue|branch
-op   3c if-gtz                     21t  n none          continue|branch
-op   3d if-lez                     21t  n none          continue|branch
+op   00 nop                         10x  n none          continue
+op   01 move                        12x  y none          continue
+op   02 move/from16                 22x  y none          continue
+op   03 move/16                     32x  y none          continue
+op   04 move-wide                   12x  y none          continue
+op   05 move-wide/from16            22x  y none          continue
+op   06 move-wide/16                32x  y none          continue
+op   07 move-object                 12x  y none          continue
+op   08 move-object/from16          22x  y none          continue
+op   09 move-object/16              32x  y none          continue
+op   0a move-result                 11x  y none          continue
+op   0b move-result-wide            11x  y none          continue
+op   0c move-result-object          11x  y none          continue
+op   0d move-exception              11x  y none          continue
+op   0e return-void                 10x  n none          return
+op   0f return                      11x  n none          return
+op   10 return-wide                 11x  n none          return
+op   11 return-object               11x  n none          return
+op   12 const/4                     11n  y none          continue
+op   13 const/16                    21s  y none          continue
+op   14 const                       31i  y none          continue
+op   15 const/high16                21h  y none          continue
+op   16 const-wide/16               21s  y none          continue
+op   17 const-wide/32               31i  y none          continue
+op   18 const-wide                  51l  y none          continue
+op   19 const-wide/high16           21h  y none          continue
+op   1a const-string                21c  y string-ref    continue|throw
+op   1b const-string/jumbo          31c  y string-ref    continue|throw
+op   1c const-class                 21c  y type-ref      continue|throw
+op   1d monitor-enter               11x  n none          continue|throw
+op   1e monitor-exit                11x  n none          continue|throw
+op   1f check-cast                  21c  y type-ref      continue|throw
+op   20 instance-of                 22c  y type-ref      continue|throw
+op   21 array-length                12x  y none          continue|throw
+op   22 new-instance                21c  y type-ref      continue|throw
+op   23 new-array                   22c  y type-ref      continue|throw
+op   24 filled-new-array            35c  n type-ref      continue|throw
+op   25 filled-new-array/range      3rc  n type-ref      continue|throw
+op   26 fill-array-data             31t  n none          continue
+op   27 throw                       11x  n none          throw
+op   28 goto                        10t  n none          branch
+op   29 goto/16                     20t  n none          branch
+op   2a goto/32                     30t  n none          branch
+op   2b packed-switch               31t  n none          continue|switch
+op   2c sparse-switch               31t  n none          continue|switch
+op   2d cmpl-float                  23x  y none          continue
+op   2e cmpg-float                  23x  y none          continue
+op   2f cmpl-double                 23x  y none          continue
+op   30 cmpg-double                 23x  y none          continue
+op   31 cmp-long                    23x  y none          continue
+op   32 if-eq                       22t  n none          continue|branch
+op   33 if-ne                       22t  n none          continue|branch
+op   34 if-lt                       22t  n none          continue|branch
+op   35 if-ge                       22t  n none          continue|branch
+op   36 if-gt                       22t  n none          continue|branch
+op   37 if-le                       22t  n none          continue|branch
+op   38 if-eqz                      21t  n none          continue|branch
+op   39 if-nez                      21t  n none          continue|branch
+op   3a if-ltz                      21t  n none          continue|branch
+op   3b if-gez                      21t  n none          continue|branch
+op   3c if-gtz                      21t  n none          continue|branch
+op   3d if-lez                      21t  n none          continue|branch
 # unused: op 3e..43
-op   44 aget                       23x  y none          continue|throw
-op   45 aget-wide                  23x  y none          continue|throw
-op   46 aget-object                23x  y none          continue|throw
-op   47 aget-boolean               23x  y none          continue|throw
-op   48 aget-byte                  23x  y none          continue|throw
-op   49 aget-char                  23x  y none          continue|throw
-op   4a aget-short                 23x  y none          continue|throw
-op   4b aput                       23x  n none          continue|throw
-op   4c aput-wide                  23x  n none          continue|throw
-op   4d aput-object                23x  n none          continue|throw
-op   4e aput-boolean               23x  n none          continue|throw
-op   4f aput-byte                  23x  n none          continue|throw
-op   50 aput-char                  23x  n none          continue|throw
-op   51 aput-short                 23x  n none          continue|throw
-op   52 iget                       22c  y field-ref     continue|throw
-op   53 iget-wide                  22c  y field-ref     continue|throw
-op   54 iget-object                22c  y field-ref     continue|throw
-op   55 iget-boolean               22c  y field-ref     continue|throw
-op   56 iget-byte                  22c  y field-ref     continue|throw
-op   57 iget-char                  22c  y field-ref     continue|throw
-op   58 iget-short                 22c  y field-ref     continue|throw
-op   59 iput                       22c  n field-ref     continue|throw
-op   5a iput-wide                  22c  n field-ref     continue|throw
-op   5b iput-object                22c  n field-ref     continue|throw
-op   5c iput-boolean               22c  n field-ref     continue|throw
-op   5d iput-byte                  22c  n field-ref     continue|throw
-op   5e iput-char                  22c  n field-ref     continue|throw
-op   5f iput-short                 22c  n field-ref     continue|throw
-op   60 sget                       21c  y field-ref     continue|throw
-op   61 sget-wide                  21c  y field-ref     continue|throw
-op   62 sget-object                21c  y field-ref     continue|throw
-op   63 sget-boolean               21c  y field-ref     continue|throw
-op   64 sget-byte                  21c  y field-ref     continue|throw
-op   65 sget-char                  21c  y field-ref     continue|throw
-op   66 sget-short                 21c  y field-ref     continue|throw
-op   67 sput                       21c  n field-ref     continue|throw
-op   68 sput-wide                  21c  n field-ref     continue|throw
-op   69 sput-object                21c  n field-ref     continue|throw
-op   6a sput-boolean               21c  n field-ref     continue|throw
-op   6b sput-byte                  21c  n field-ref     continue|throw
-op   6c sput-char                  21c  n field-ref     continue|throw
-op   6d sput-short                 21c  n field-ref     continue|throw
-op   6e invoke-virtual             35c  n method-ref    continue|throw|invoke
-op   6f invoke-super               35c  n method-ref    continue|throw|invoke
-op   70 invoke-direct              35c  n method-ref    continue|throw|invoke
-op   71 invoke-static              35c  n method-ref    continue|throw|invoke
-op   72 invoke-interface           35c  n method-ref    continue|throw|invoke
+op   44 aget                        23x  y none          continue|throw
+op   45 aget-wide                   23x  y none          continue|throw
+op   46 aget-object                 23x  y none          continue|throw
+op   47 aget-boolean                23x  y none          continue|throw
+op   48 aget-byte                   23x  y none          continue|throw
+op   49 aget-char                   23x  y none          continue|throw
+op   4a aget-short                  23x  y none          continue|throw
+op   4b aput                        23x  n none          continue|throw
+op   4c aput-wide                   23x  n none          continue|throw
+op   4d aput-object                 23x  n none          continue|throw
+op   4e aput-boolean                23x  n none          continue|throw
+op   4f aput-byte                   23x  n none          continue|throw
+op   50 aput-char                   23x  n none          continue|throw
+op   51 aput-short                  23x  n none          continue|throw
+op   52 iget                        22c  y field-ref     continue|throw
+op   53 iget-wide                   22c  y field-ref     continue|throw
+op   54 iget-object                 22c  y field-ref     continue|throw
+op   55 iget-boolean                22c  y field-ref     continue|throw
+op   56 iget-byte                   22c  y field-ref     continue|throw
+op   57 iget-char                   22c  y field-ref     continue|throw
+op   58 iget-short                  22c  y field-ref     continue|throw
+op   59 iput                        22c  n field-ref     continue|throw
+op   5a iput-wide                   22c  n field-ref     continue|throw
+op   5b iput-object                 22c  n field-ref     continue|throw
+op   5c iput-boolean                22c  n field-ref     continue|throw
+op   5d iput-byte                   22c  n field-ref     continue|throw
+op   5e iput-char                   22c  n field-ref     continue|throw
+op   5f iput-short                  22c  n field-ref     continue|throw
+op   60 sget                        21c  y field-ref     continue|throw
+op   61 sget-wide                   21c  y field-ref     continue|throw
+op   62 sget-object                 21c  y field-ref     continue|throw
+op   63 sget-boolean                21c  y field-ref     continue|throw
+op   64 sget-byte                   21c  y field-ref     continue|throw
+op   65 sget-char                   21c  y field-ref     continue|throw
+op   66 sget-short                  21c  y field-ref     continue|throw
+op   67 sput                        21c  n field-ref     continue|throw
+op   68 sput-wide                   21c  n field-ref     continue|throw
+op   69 sput-object                 21c  n field-ref     continue|throw
+op   6a sput-boolean                21c  n field-ref     continue|throw
+op   6b sput-byte                   21c  n field-ref     continue|throw
+op   6c sput-char                   21c  n field-ref     continue|throw
+op   6d sput-short                  21c  n field-ref     continue|throw
+op   6e invoke-virtual              35c  n method-ref    continue|throw|invoke
+op   6f invoke-super                35c  n method-ref    continue|throw|invoke
+op   70 invoke-direct               35c  n method-ref    continue|throw|invoke
+op   71 invoke-static               35c  n method-ref    continue|throw|invoke
+op   72 invoke-interface            35c  n method-ref    continue|throw|invoke
 # unused: op 73
-op   74 invoke-virtual/range       3rc  n method-ref    continue|throw|invoke
-op   75 invoke-super/range         3rc  n method-ref    continue|throw|invoke
-op   76 invoke-direct/range        3rc  n method-ref    continue|throw|invoke
-op   77 invoke-static/range        3rc  n method-ref    continue|throw|invoke
-op   78 invoke-interface/range     3rc  n method-ref    continue|throw|invoke
+op   74 invoke-virtual/range        3rc  n method-ref    continue|throw|invoke
+op   75 invoke-super/range          3rc  n method-ref    continue|throw|invoke
+op   76 invoke-direct/range         3rc  n method-ref    continue|throw|invoke
+op   77 invoke-static/range         3rc  n method-ref    continue|throw|invoke
+op   78 invoke-interface/range      3rc  n method-ref    continue|throw|invoke
 # unused: op 79..7a
-op   7b neg-int                    12x  y none          continue
-op   7c not-int                    12x  y none          continue
-op   7d neg-long                   12x  y none          continue
-op   7e not-long                   12x  y none          continue
-op   7f neg-float                  12x  y none          continue
-op   80 neg-double                 12x  y none          continue
-op   81 int-to-long                12x  y none          continue
-op   82 int-to-float               12x  y none          continue
-op   83 int-to-double              12x  y none          continue
-op   84 long-to-int                12x  y none          continue
-op   85 long-to-float              12x  y none          continue
-op   86 long-to-double             12x  y none          continue
-op   87 float-to-int               12x  y none          continue
-op   88 float-to-long              12x  y none          continue
-op   89 float-to-double            12x  y none          continue
-op   8a double-to-int              12x  y none          continue
-op   8b double-to-long             12x  y none          continue
-op   8c double-to-float            12x  y none          continue
-op   8d int-to-byte                12x  y none          continue
-op   8e int-to-char                12x  y none          continue
-op   8f int-to-short               12x  y none          continue
-op   90 add-int                    23x  y none          continue
-op   91 sub-int                    23x  y none          continue
-op   92 mul-int                    23x  y none          continue
-op   93 div-int                    23x  y none          continue|throw
-op   94 rem-int                    23x  y none          continue|throw
-op   95 and-int                    23x  y none          continue
-op   96 or-int                     23x  y none          continue
-op   97 xor-int                    23x  y none          continue
-op   98 shl-int                    23x  y none          continue
-op   99 shr-int                    23x  y none          continue
-op   9a ushr-int                   23x  y none          continue
-op   9b add-long                   23x  y none          continue
-op   9c sub-long                   23x  y none          continue
-op   9d mul-long                   23x  y none          continue
-op   9e div-long                   23x  y none          continue|throw
-op   9f rem-long                   23x  y none          continue|throw
-op   a0 and-long                   23x  y none          continue
-op   a1 or-long                    23x  y none          continue
-op   a2 xor-long                   23x  y none          continue
-op   a3 shl-long                   23x  y none          continue
-op   a4 shr-long                   23x  y none          continue
-op   a5 ushr-long                  23x  y none          continue
-op   a6 add-float                  23x  y none          continue
-op   a7 sub-float                  23x  y none          continue
-op   a8 mul-float                  23x  y none          continue
-op   a9 div-float                  23x  y none          continue
-op   aa rem-float                  23x  y none          continue
-op   ab add-double                 23x  y none          continue
-op   ac sub-double                 23x  y none          continue
-op   ad mul-double                 23x  y none          continue
-op   ae div-double                 23x  y none          continue
-op   af rem-double                 23x  y none          continue
-op   b0 add-int/2addr              12x  y none          continue
-op   b1 sub-int/2addr              12x  y none          continue
-op   b2 mul-int/2addr              12x  y none          continue
-op   b3 div-int/2addr              12x  y none          continue|throw
-op   b4 rem-int/2addr              12x  y none          continue|throw
-op   b5 and-int/2addr              12x  y none          continue
-op   b6 or-int/2addr               12x  y none          continue
-op   b7 xor-int/2addr              12x  y none          continue
-op   b8 shl-int/2addr              12x  y none          continue
-op   b9 shr-int/2addr              12x  y none          continue
-op   ba ushr-int/2addr             12x  y none          continue
-op   bb add-long/2addr             12x  y none          continue
-op   bc sub-long/2addr             12x  y none          continue
-op   bd mul-long/2addr             12x  y none          continue
-op   be div-long/2addr             12x  y none          continue|throw
-op   bf rem-long/2addr             12x  y none          continue|throw
-op   c0 and-long/2addr             12x  y none          continue
-op   c1 or-long/2addr              12x  y none          continue
-op   c2 xor-long/2addr             12x  y none          continue
-op   c3 shl-long/2addr             12x  y none          continue
-op   c4 shr-long/2addr             12x  y none          continue
-op   c5 ushr-long/2addr            12x  y none          continue
-op   c6 add-float/2addr            12x  y none          continue
-op   c7 sub-float/2addr            12x  y none          continue
-op   c8 mul-float/2addr            12x  y none          continue
-op   c9 div-float/2addr            12x  y none          continue
-op   ca rem-float/2addr            12x  y none          continue
-op   cb add-double/2addr           12x  y none          continue
-op   cc sub-double/2addr           12x  y none          continue
-op   cd mul-double/2addr           12x  y none          continue
-op   ce div-double/2addr           12x  y none          continue
-op   cf rem-double/2addr           12x  y none          continue
-op   d0 add-int/lit16              22s  y none          continue
-op   d1 rsub-int                   22s  y none          continue
-op   d2 mul-int/lit16              22s  y none          continue
-op   d3 div-int/lit16              22s  y none          continue|throw
-op   d4 rem-int/lit16              22s  y none          continue|throw
-op   d5 and-int/lit16              22s  y none          continue
-op   d6 or-int/lit16               22s  y none          continue
-op   d7 xor-int/lit16              22s  y none          continue
-op   d8 add-int/lit8               22b  y none          continue
-op   d9 rsub-int/lit8              22b  y none          continue
-op   da mul-int/lit8               22b  y none          continue
-op   db div-int/lit8               22b  y none          continue|throw
-op   dc rem-int/lit8               22b  y none          continue|throw
-op   dd and-int/lit8               22b  y none          continue
-op   de or-int/lit8                22b  y none          continue
-op   df xor-int/lit8               22b  y none          continue
-op   e0 shl-int/lit8               22b  y none          continue
-op   e1 shr-int/lit8               22b  y none          continue
-op   e2 ushr-int/lit8              22b  y none          continue
+op   7b neg-int                     12x  y none          continue
+op   7c not-int                     12x  y none          continue
+op   7d neg-long                    12x  y none          continue
+op   7e not-long                    12x  y none          continue
+op   7f neg-float                   12x  y none          continue
+op   80 neg-double                  12x  y none          continue
+op   81 int-to-long                 12x  y none          continue
+op   82 int-to-float                12x  y none          continue
+op   83 int-to-double               12x  y none          continue
+op   84 long-to-int                 12x  y none          continue
+op   85 long-to-float               12x  y none          continue
+op   86 long-to-double              12x  y none          continue
+op   87 float-to-int                12x  y none          continue
+op   88 float-to-long               12x  y none          continue
+op   89 float-to-double             12x  y none          continue
+op   8a double-to-int               12x  y none          continue
+op   8b double-to-long              12x  y none          continue
+op   8c double-to-float             12x  y none          continue
+op   8d int-to-byte                 12x  y none          continue
+op   8e int-to-char                 12x  y none          continue
+op   8f int-to-short                12x  y none          continue
+op   90 add-int                     23x  y none          continue
+op   91 sub-int                     23x  y none          continue
+op   92 mul-int                     23x  y none          continue
+op   93 div-int                     23x  y none          continue|throw
+op   94 rem-int                     23x  y none          continue|throw
+op   95 and-int                     23x  y none          continue
+op   96 or-int                      23x  y none          continue
+op   97 xor-int                     23x  y none          continue
+op   98 shl-int                     23x  y none          continue
+op   99 shr-int                     23x  y none          continue
+op   9a ushr-int                    23x  y none          continue
+op   9b add-long                    23x  y none          continue
+op   9c sub-long                    23x  y none          continue
+op   9d mul-long                    23x  y none          continue
+op   9e div-long                    23x  y none          continue|throw
+op   9f rem-long                    23x  y none          continue|throw
+op   a0 and-long                    23x  y none          continue
+op   a1 or-long                     23x  y none          continue
+op   a2 xor-long                    23x  y none          continue
+op   a3 shl-long                    23x  y none          continue
+op   a4 shr-long                    23x  y none          continue
+op   a5 ushr-long                   23x  y none          continue
+op   a6 add-float                   23x  y none          continue
+op   a7 sub-float                   23x  y none          continue
+op   a8 mul-float                   23x  y none          continue
+op   a9 div-float                   23x  y none          continue
+op   aa rem-float                   23x  y none          continue
+op   ab add-double                  23x  y none          continue
+op   ac sub-double                  23x  y none          continue
+op   ad mul-double                  23x  y none          continue
+op   ae div-double                  23x  y none          continue
+op   af rem-double                  23x  y none          continue
+op   b0 add-int/2addr               12x  y none          continue
+op   b1 sub-int/2addr               12x  y none          continue
+op   b2 mul-int/2addr               12x  y none          continue
+op   b3 div-int/2addr               12x  y none          continue|throw
+op   b4 rem-int/2addr               12x  y none          continue|throw
+op   b5 and-int/2addr               12x  y none          continue
+op   b6 or-int/2addr                12x  y none          continue
+op   b7 xor-int/2addr               12x  y none          continue
+op   b8 shl-int/2addr               12x  y none          continue
+op   b9 shr-int/2addr               12x  y none          continue
+op   ba ushr-int/2addr              12x  y none          continue
+op   bb add-long/2addr              12x  y none          continue
+op   bc sub-long/2addr              12x  y none          continue
+op   bd mul-long/2addr              12x  y none          continue
+op   be div-long/2addr              12x  y none          continue|throw
+op   bf rem-long/2addr              12x  y none          continue|throw
+op   c0 and-long/2addr              12x  y none          continue
+op   c1 or-long/2addr               12x  y none          continue
+op   c2 xor-long/2addr              12x  y none          continue
+op   c3 shl-long/2addr              12x  y none          continue
+op   c4 shr-long/2addr              12x  y none          continue
+op   c5 ushr-long/2addr             12x  y none          continue
+op   c6 add-float/2addr             12x  y none          continue
+op   c7 sub-float/2addr             12x  y none          continue
+op   c8 mul-float/2addr             12x  y none          continue
+op   c9 div-float/2addr             12x  y none          continue
+op   ca rem-float/2addr             12x  y none          continue
+op   cb add-double/2addr            12x  y none          continue
+op   cc sub-double/2addr            12x  y none          continue
+op   cd mul-double/2addr            12x  y none          continue
+op   ce div-double/2addr            12x  y none          continue
+op   cf rem-double/2addr            12x  y none          continue
+op   d0 add-int/lit16               22s  y none          continue
+op   d1 rsub-int                    22s  y none          continue
+op   d2 mul-int/lit16               22s  y none          continue
+op   d3 div-int/lit16               22s  y none          continue|throw
+op   d4 rem-int/lit16               22s  y none          continue|throw
+op   d5 and-int/lit16               22s  y none          continue
+op   d6 or-int/lit16                22s  y none          continue
+op   d7 xor-int/lit16               22s  y none          continue
+op   d8 add-int/lit8                22b  y none          continue
+op   d9 rsub-int/lit8               22b  y none          continue
+op   da mul-int/lit8                22b  y none          continue
+op   db div-int/lit8                22b  y none          continue|throw
+op   dc rem-int/lit8                22b  y none          continue|throw
+op   dd and-int/lit8                22b  y none          continue
+op   de or-int/lit8                 22b  y none          continue
+op   df xor-int/lit8                22b  y none          continue
+op   e0 shl-int/lit8                22b  y none          continue
+op   e1 shr-int/lit8                22b  y none          continue
+op   e2 ushr-int/lit8               22b  y none          continue
 
 # Optimized opcodes (not valid in an unoptimized dex file)
 #
 # Note: Technically "breakpoint" isn't really an optimized opcode, but
 # it fits the label in terms of not being valid in dex files.
-op   e3 iget-volatile              22c  y field-ref     optimized|continue|throw
-op   e4 iput-volatile              22c  n field-ref     optimized|continue|throw
-op   e5 sget-volatile              21c  y field-ref     optimized|continue|throw
-op   e6 sput-volatile              21c  n field-ref     optimized|continue|throw
-op   e7 iget-object-volatile       22c  y field-ref     optimized|continue|throw
-op   e8 iget-wide-volatile         22c  y field-ref     optimized|continue|throw
-op   e9 iput-wide-volatile         22c  n field-ref     optimized|continue|throw
-op   ea sget-wide-volatile         21c  y field-ref     optimized|continue|throw
-op   eb sput-wide-volatile         21c  n field-ref     optimized|continue|throw
-op   ec breakpoint                 00x  n none          optimized|continue|throw
-op   ed throw-verification-error   20bc n varies        optimized|throw
-op   ee execute-inline             35mi n inline-method optimized|continue|throw
-op   ef execute-inline/range       3rmi n inline-method optimized|continue|throw
-op   f0 invoke-direct-empty        35c  n method-ref    optimized|continue|throw|invoke
-op   f1 return-void-barrier        10x  n none          optimized|return
-op   f2 iget-quick                 22cs y field-offset  optimized|continue|throw
-op   f3 iget-wide-quick            22cs y field-offset  optimized|continue|throw
-op   f4 iget-object-quick          22cs y field-offset  optimized|continue|throw
-op   f5 iput-quick                 22cs n field-offset  optimized|continue|throw
-op   f6 iput-wide-quick            22cs n field-offset  optimized|continue|throw
-op   f7 iput-object-quick          22cs n field-offset  optimized|continue|throw
-op   f8 invoke-virtual-quick       35ms n vtable-offset optimized|continue|throw|invoke
-op   f9 invoke-virtual-quick/range 3rms n vtable-offset optimized|continue|throw|invoke
-op   fa invoke-super-quick         35ms n vtable-offset optimized|continue|throw|invoke
-op   fb invoke-super-quick/range   3rms n vtable-offset optimized|continue|throw|invoke
-op   fc iput-object-volatile       22c  n field-ref     optimized|continue|throw
-op   fd sget-object-volatile       21c  y field-ref     optimized|continue|throw
-op   fe sput-object-volatile       21c  n field-ref     optimized|continue|throw
+op   e3 +iget-volatile              22c  y field-ref     optimized|continue|throw
+op   e4 +iput-volatile              22c  n field-ref     optimized|continue|throw
+op   e5 +sget-volatile              21c  y field-ref     optimized|continue|throw
+op   e6 +sput-volatile              21c  n field-ref     optimized|continue|throw
+op   e7 +iget-object-volatile       22c  y field-ref     optimized|continue|throw
+op   e8 +iget-wide-volatile         22c  y field-ref     optimized|continue|throw
+op   e9 +iput-wide-volatile         22c  n field-ref     optimized|continue|throw
+op   ea +sget-wide-volatile         21c  y field-ref     optimized|continue|throw
+op   eb +sput-wide-volatile         21c  n field-ref     optimized|continue|throw
+op   ec ^breakpoint                 00x  n none          optimized|continue|throw
+op   ed ^throw-verification-error   20bc n varies        optimized|throw
+op   ee +execute-inline             35mi n inline-method optimized|continue|throw
+op   ef +execute-inline/range       3rmi n inline-method optimized|continue|throw
+op   f0 +invoke-direct-empty        35c  n method-ref    optimized|continue|throw|invoke
+op   f1 +return-void-barrier        10x  n none          optimized|return
+op   f2 +iget-quick                 22cs y field-offset  optimized|continue|throw
+op   f3 +iget-wide-quick            22cs y field-offset  optimized|continue|throw
+op   f4 +iget-object-quick          22cs y field-offset  optimized|continue|throw
+op   f5 +iput-quick                 22cs n field-offset  optimized|continue|throw
+op   f6 +iput-wide-quick            22cs n field-offset  optimized|continue|throw
+op   f7 +iput-object-quick          22cs n field-offset  optimized|continue|throw
+op   f8 +invoke-virtual-quick       35ms n vtable-offset optimized|continue|throw|invoke
+op   f9 +invoke-virtual-quick/range 3rms n vtable-offset optimized|continue|throw|invoke
+op   fa +invoke-super-quick         35ms n vtable-offset optimized|continue|throw|invoke
+op   fb +invoke-super-quick/range   3rms n vtable-offset optimized|continue|throw|invoke
+op   fc +iput-object-volatile       22c  n field-ref     optimized|continue|throw
+op   fd +sget-object-volatile       21c  y field-ref     optimized|continue|throw
+op   fe +sput-object-volatile       21c  n field-ref     optimized|continue|throw
 
 # Extended-width opcodes 
-op 00ff const-class/jumbo          41c  y type-ref      continue|throw
-op 01ff check-cast/jumbo           41c  n type-ref      continue|throw
-op 02ff instance-of/jumbo          52c  y type-ref      continue|throw
-op 03ff new-instance/jumbo         41c  y type-ref      continue|throw
-op 04ff new-array/jumbo            52c  y type-ref      continue|throw
-op 05ff filled-new-array/jumbo     5rc  n type-ref      continue|throw
-op 06ff iget/jumbo                 52c  y field-ref     continue|throw
-op 07ff iget-wide/jumbo            52c  y field-ref     continue|throw
-op 08ff iget-object/jumbo          52c  y field-ref     continue|throw
-op 09ff iget-boolean/jumbo         52c  y field-ref     continue|throw
-op 0aff iget-byte/jumbo            52c  y field-ref     continue|throw
-op 0bff iget-char/jumbo            52c  y field-ref     continue|throw
-op 0cff iget-short/jumbo           52c  y field-ref     continue|throw
-op 0dff iput/jumbo                 52c  n field-ref     continue|throw
-op 0eff iput-wide/jumbo            52c  n field-ref     continue|throw
-op 0fff iput-object/jumbo          52c  n field-ref     continue|throw
-op 10ff iput-boolean/jumbo         52c  n field-ref     continue|throw
-op 11ff iput-byte/jumbo            52c  n field-ref     continue|throw
-op 12ff iput-char/jumbo            52c  n field-ref     continue|throw
-op 13ff iput-short/jumbo           52c  n field-ref     continue|throw
-op 14ff sget/jumbo                 41c  y field-ref     continue|throw
-op 15ff sget-wide/jumbo            41c  y field-ref     continue|throw
-op 16ff sget-object/jumbo          41c  y field-ref     continue|throw
-op 17ff sget-boolean/jumbo         41c  y field-ref     continue|throw
-op 18ff sget-byte/jumbo            41c  y field-ref     continue|throw
-op 19ff sget-char/jumbo            41c  y field-ref     continue|throw
-op 1aff sget-short/jumbo           41c  y field-ref     continue|throw
-op 1bff sput/jumbo                 41c  n field-ref     continue|throw
-op 1cff sput-wide/jumbo            41c  n field-ref     continue|throw
-op 1dff sput-object/jumbo          41c  n field-ref     continue|throw
-op 1eff sput-boolean/jumbo         41c  n field-ref     continue|throw
-op 1fff sput-byte/jumbo            41c  n field-ref     continue|throw
-op 20ff sput-char/jumbo            41c  n field-ref     continue|throw
-op 21ff sput-short/jumbo           41c  n field-ref     continue|throw
-op 22ff invoke-virtual/jumbo       5rc  n method-ref    continue|throw|invoke
-op 23ff invoke-super/jumbo         5rc  n method-ref    continue|throw|invoke
-op 24ff invoke-direct/jumbo        5rc  n method-ref    continue|throw|invoke
-op 25ff invoke-static/jumbo        5rc  n method-ref    continue|throw|invoke
-op 26ff invoke-interface/jumbo     5rc  n method-ref    continue|throw|invoke
+op 00ff const-class/jumbo           41c  y type-ref      continue|throw
+op 01ff check-cast/jumbo            41c  n type-ref      continue|throw
+op 02ff instance-of/jumbo           52c  y type-ref      continue|throw
+op 03ff new-instance/jumbo          41c  y type-ref      continue|throw
+op 04ff new-array/jumbo             52c  y type-ref      continue|throw
+op 05ff filled-new-array/jumbo      5rc  n type-ref      continue|throw
+op 06ff iget/jumbo                  52c  y field-ref     continue|throw
+op 07ff iget-wide/jumbo             52c  y field-ref     continue|throw
+op 08ff iget-object/jumbo           52c  y field-ref     continue|throw
+op 09ff iget-boolean/jumbo          52c  y field-ref     continue|throw
+op 0aff iget-byte/jumbo             52c  y field-ref     continue|throw
+op 0bff iget-char/jumbo             52c  y field-ref     continue|throw
+op 0cff iget-short/jumbo            52c  y field-ref     continue|throw
+op 0dff iput/jumbo                  52c  n field-ref     continue|throw
+op 0eff iput-wide/jumbo             52c  n field-ref     continue|throw
+op 0fff iput-object/jumbo           52c  n field-ref     continue|throw
+op 10ff iput-boolean/jumbo          52c  n field-ref     continue|throw
+op 11ff iput-byte/jumbo             52c  n field-ref     continue|throw
+op 12ff iput-char/jumbo             52c  n field-ref     continue|throw
+op 13ff iput-short/jumbo            52c  n field-ref     continue|throw
+op 14ff sget/jumbo                  41c  y field-ref     continue|throw
+op 15ff sget-wide/jumbo             41c  y field-ref     continue|throw
+op 16ff sget-object/jumbo           41c  y field-ref     continue|throw
+op 17ff sget-boolean/jumbo          41c  y field-ref     continue|throw
+op 18ff sget-byte/jumbo             41c  y field-ref     continue|throw
+op 19ff sget-char/jumbo             41c  y field-ref     continue|throw
+op 1aff sget-short/jumbo            41c  y field-ref     continue|throw
+op 1bff sput/jumbo                  41c  n field-ref     continue|throw
+op 1cff sput-wide/jumbo             41c  n field-ref     continue|throw
+op 1dff sput-object/jumbo           41c  n field-ref     continue|throw
+op 1eff sput-boolean/jumbo          41c  n field-ref     continue|throw
+op 1fff sput-byte/jumbo             41c  n field-ref     continue|throw
+op 20ff sput-char/jumbo             41c  n field-ref     continue|throw
+op 21ff sput-short/jumbo            41c  n field-ref     continue|throw
+op 22ff invoke-virtual/jumbo        5rc  n method-ref    continue|throw|invoke
+op 23ff invoke-super/jumbo          5rc  n method-ref    continue|throw|invoke
+op 24ff invoke-direct/jumbo         5rc  n method-ref    continue|throw|invoke
+op 25ff invoke-static/jumbo         5rc  n method-ref    continue|throw|invoke
+op 26ff invoke-interface/jumbo      5rc  n method-ref    continue|throw|invoke
 # unused: op 27ff..ffff
diff --git a/opcode-gen/opcode-gen b/opcode-gen/opcode-gen
index 7b2c363..976a169 100755
--- a/opcode-gen/opcode-gen
+++ b/opcode-gen/opcode-gen
@@ -85,7 +85,7 @@
     for (i = 0; i <= MAX_OPCODE; i++) {
         if (isUnused(i) || isOptimized(i)) continue;
         printf("    public static final int %s = 0x%s;\n",
-               uppername[i], hex[i]);
+               constName[i], hex[i]);
     }
 
     next;
@@ -98,7 +98,7 @@
     for (i = 0; i <= MAX_OPCODE; i++) {
         if (isUnused(i) || isOptimized(i)) continue;
         if (isFirst[i] == "true") {
-            printf("    //     DalvOps.%s\n", uppername[i]);
+            printf("    //     DalvOps.%s\n", constName[i]);
         }
     }
 
@@ -113,13 +113,13 @@
         if (isUnused(i) || isOptimized(i)) continue;
 
         nextOp = nextOpcode[i];
-        nextOp = (nextOp == -1) ? "NO_NEXT" : uppername[nextOp];
+        nextOp = (nextOp == -1) ? "NO_NEXT" : constName[nextOp];
 
         printf("    public static final Dop %s =\n" \
                "        new Dop(DalvOps.%s, DalvOps.%s,\n" \
                "            DalvOps.%s, Form%s.THE_ONE, %s,\n" \
                "            \"%s\");\n\n",
-               uppername[i], uppername[i], family[i], nextOp, format[i],
+               constName[i], constName[i], family[i], nextOp, format[i],
                hasResult[i], name[i]);
     }
 
@@ -132,7 +132,7 @@
 
     for (i = 0; i <= MAX_OPCODE; i++) {
         if (isUnused(i) || isOptimized(i)) continue;
-        printf("        set(%s);\n", uppername[i]);
+        printf("        set(%s);\n", constName[i]);
     }
 
     next;
@@ -143,7 +143,7 @@
     print;
 
     for (i = 0; i <= MAX_LIBDEX_OPCODE; i++) {
-        printf("    OP_%-28s = 0x%02x,\n", uppernameOrUnusedByte(i), i);
+        printf("    OP_%-28s = 0x%02x,\n", constNameOrUnusedByte(i), i);
     }
 
     next;
@@ -154,13 +154,24 @@
     print;
 
     for (i = 0; i <= MAX_LIBDEX_OPCODE; i++) {
-        content = sprintf("        H(OP_%s),", uppernameOrUnusedByte(i));
+        content = sprintf("        H(OP_%s),", constNameOrUnusedByte(i));
         printf("%-78s\\\n", content);
     }
 
     next;
 }
 
+/BEGIN\(libdex-opcode-names\)/ {
+    consumeUntil = "END(libdex-opcode-names)";
+    print;
+
+    for (i = 0; i <= MAX_LIBDEX_OPCODE; i++) {
+        printf("    \"%s\",\n", nameOrUnusedByte(i));
+    }
+
+    next;
+}
+
 { print; }
 
 # Read the bytecode description file.
@@ -219,11 +230,13 @@
     flags[idx] = parts[6];
 
     # Calculate derived values.
-    uppername[idx] = toupper(name[idx]);
-    gsub("[---/]", "_", uppername[idx]);
+    constName[idx] = toupper(name[idx]);
+    gsub("[---/]", "_", constName[idx]); # Dash and slash become underscore.
+    gsub("[+^]", "", constName[idx]);    # Plus and caret are removed.
     split(name[idx], parts, "/");
     family[idx] = toupper(parts[1]);
-    gsub("-", "_", family[idx]);
+    gsub("-", "_", family[idx]);         # Dash becomes underscore.
+    gsub("[+^]", "", family[idx]);       # Plus and caret are removed.
 
     # This association is used when computing "next" opcodes.
     familyFormat[family[idx],format[idx]] = idx;
@@ -385,29 +398,40 @@
     return 0;
 }
 
-# Returns true if the given opcode (by index) is unused. This is true either
-# if there is no definition at all for the opcode or if there is a definition
-# and the name contains the string "unused".
-function isUnused(idx, n) {
-    # locals: n
-    n = name[idx];
-    return (n == "") || (index(n, "unused") != 0);
+# Returns true if there is no definition for given opcode (by index).
+function isUnused(idx) {
+    return (name[idx] == "");
 }
 
-# Returns the uppercase name of the given single-byte opcode (by
-# index) or the string "UNUSED_XX" (where XX is the index in hex) if
-# the opcode is unused. The odd case for this function is 255, which
-# is the first extended (two-byte) opcode. For the purposes of this
+# Returns the constant name of the given single-byte opcode (by index)
+# or the string "UNUSED_XX" (where XX is the index in hex) if the
+# opcode is unused. The odd case for this function is 255, which is
+# the first extended (two-byte) opcode. For the purposes of this
 # function, it is considered unused. (This is meant as a stop-gap
 # measure for code that is not yet prepared to deal with extended
 # opcodes.)
-function uppernameOrUnusedByte(idx, n) {
-    n = uppername[idx];
+function constNameOrUnusedByte(idx, n) {
+    n = constName[idx];
     if ((n == "") || (i == 255)) {
        return toupper(sprintf("UNUSED_%02x", idx));
     }
     return n;
 }
+
+# Returns the (human-oriented) name of the given single-byte opcode
+# (by index) or the string "unused-xx" (where xx is the index in hex)
+# if the opcode is unused. The odd case for this function is 255,
+# which is the first extended (two-byte) opcode. For the purposes of
+# this function, it is considered unused. (This is meant as a stop-gap
+# measure for code that is not yet prepared to deal with extended
+# opcodes.)
+function nameOrUnusedByte(idx, n) {
+    n = name[idx];
+    if ((n == "") || (i == 255)) {
+       return sprintf("unused-%02x", idx);
+    }
+    return n;
+}
 ' "$file" > "$tmpfile"
 
 cp "$tmpfile" "$file"
diff --git a/opcode-gen/regen-all b/opcode-gen/regen-all
index 32330e8..4e5c382 100755
--- a/opcode-gen/regen-all
+++ b/opcode-gen/regen-all
@@ -38,3 +38,4 @@
 ${progdir}/opcode-gen dx/src/com/android/dx/dex/code/Dops.java
 ${progdir}/opcode-gen dx/src/com/android/dx/dex/code/RopToDop.java
 ${progdir}/opcode-gen libdex/OpCode.h
+${progdir}/opcode-gen libdex/OpCodeNames.c