Say kNumDalvikInstructions when appropriate.

In particular, use it instead of just saying 256, and similarly for
255. The number of opcodes will be changing soon.

Change-Id: Icc77120c2673968dddd6b4003f717245d46e4159
diff --git a/vm/compiler/CompilerIR.h b/vm/compiler/CompilerIR.h
index 82b97e5..c83c0ba 100644
--- a/vm/compiler/CompilerIR.h
+++ b/vm/compiler/CompilerIR.h
@@ -78,7 +78,7 @@
 } LIR;
 
 enum ExtendedMIROpcode {
-    kMirOpFirst = 256,
+    kMirOpFirst = kNumDalvikInstructions,
     kMirOpPhi = kMirOpFirst,
     kMirOpNullNRangeUpCheck,
     kMirOpNullNRangeDownCheck,
diff --git a/vm/compiler/Dataflow.c b/vm/compiler/Dataflow.c
index cd1761c..9c31f61 100644
--- a/vm/compiler/Dataflow.c
+++ b/vm/compiler/Dataflow.c
@@ -20,9 +20,10 @@
 #include "libdex/OpCodeNames.h"
 
 /*
- * Main table containing data flow attributes for each bytecode. The first
- * 256 entries are for Dalvik bytecode instructions, where extended opcode at
- * the MIR level are appended afterwards.
+ * Main table containing data flow attributes for each bytecode. The
+ * first kNumDalvikInstructions entries are for Dalvik bytecode
+ * instructions, where extended opcode at the MIR level are appended
+ * afterwards.
  *
  * TODO - many optimization flags are incomplete - they will only limit the
  * scope of optimizations but will not cause mis-optimizations.
diff --git a/vm/compiler/Loop.c b/vm/compiler/Loop.c
index 6492187..f309450 100644
--- a/vm/compiler/Loop.c
+++ b/vm/compiler/Loop.c
@@ -309,7 +309,7 @@
             dvmCompilerDataFlowAttributes[mir->dalvikInsn.opCode];
 
         /* Skip extended MIR instructions */
-        if (dInsn->opCode > 255) continue;
+        if (dInsn->opCode >= kNumDalvikInstructions) continue;
 
         int instrFlags = dexGetInstrFlags(dInsn->opCode);
 
diff --git a/vm/compiler/codegen/arm/CodegenCommon.c b/vm/compiler/codegen/arm/CodegenCommon.c
index ee5d9f5..d14dd06 100644
--- a/vm/compiler/codegen/arm/CodegenCommon.c
+++ b/vm/compiler/codegen/arm/CodegenCommon.c
@@ -30,7 +30,7 @@
 static intptr_t templateEntryOffsets[TEMPLATE_LAST_MARK];
 
 /* Track exercised opcodes */
-static int opcodeCoverage[256];
+static int opcodeCoverage[kNumDalvikInstructions];
 
 static void setMemRefType(ArmLIR *lir, bool isLoad, int memType)
 {
diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c
index 8e1d9a2..b52420f 100644
--- a/vm/compiler/codegen/arm/CodegenDriver.c
+++ b/vm/compiler/codegen/arm/CodegenDriver.c
@@ -4383,13 +4383,13 @@
 
     streak = i = 0;
     buf[0] = 0;
-    while (opcodeCoverage[i] == 0 && i < 256) {
+    while (opcodeCoverage[i] == 0 && i < kNumDalvikInstructions) {
         i++;
     }
-    if (i == 256) {
+    if (i == kNumDalvikInstructions) {
         return;
     }
-    for (start = i++, streak = 1; i < 256; i++) {
+    for (start = i++, streak = 1; i < kNumDalvikInstructions; i++) {
         if (opcodeCoverage[i]) {
             streak++;
         } else {
@@ -4399,10 +4399,10 @@
                 sprintf(buf+strlen(buf), "%x-%x,", start, start + streak - 1);
             }
             streak = 0;
-            while (opcodeCoverage[i] == 0 && i < 256) {
+            while (opcodeCoverage[i] == 0 && i < kNumDalvikInstructions) {
                 i++;
             }
-            if (i < 256) {
+            if (i < kNumDalvikInstructions) {
                 streak = 1;
                 start = i;
             }
diff --git a/vm/compiler/codegen/x86/CodegenDriver.c b/vm/compiler/codegen/x86/CodegenDriver.c
index 026a0b5..60f003b 100644
--- a/vm/compiler/codegen/x86/CodegenDriver.c
+++ b/vm/compiler/codegen/x86/CodegenDriver.c
@@ -24,7 +24,7 @@
  * applicable directory below this one.
  */
 
-static int opcodeCoverage[256];
+static int opcodeCoverage[kNumDalvikInstructions];
 static intptr_t templateEntryOffsets[TEMPLATE_LAST_MARK];
 
 /*
@@ -196,13 +196,13 @@
 
     streak = i = 0;
     buf[0] = 0;
-    while (opcodeCoverage[i] == 0 && i < 256) {
+    while (opcodeCoverage[i] == 0 && i < kNumDalvikInstructions) {
         i++;
     }
-    if (i == 256) {
+    if (i == kNumDalvikInstructions) {
         return;
     }
-    for (start = i++, streak = 1; i < 256; i++) {
+    for (start = i++, streak = 1; i < kNumDalvikInstructions; i++) {
         if (opcodeCoverage[i]) {
             streak++;
         } else {
@@ -212,10 +212,10 @@
                 sprintf(buf+strlen(buf), "%x-%x,", start, start + streak - 1);
             }
             streak = 0;
-            while (opcodeCoverage[i] == 0 && i < 256) {
+            while (opcodeCoverage[i] == 0 && i < kNumDalvikInstructions) {
                 i++;
             }
-            if (i < 256) {
+            if (i < kNumDalvikInstructions) {
                 streak = 1;
                 start = i;
             }
diff --git a/vm/compiler/template/gen-template.py b/vm/compiler/template/gen-template.py
index 8a1ba0c..2474ee2 100755
--- a/vm/compiler/template/gen-template.py
+++ b/vm/compiler/template/gen-template.py
@@ -146,7 +146,8 @@
 
 #
 # Extract an ordered list of instructions from the VM sources.  We use the
-# "goto table" definition macro, which has exactly 256 entries.
+# "goto table" definition macro, which has exactly kNumDalvikInstructions
+# entries.
 #
 def getOpcodeList():
     opcodes = []
@@ -163,7 +164,7 @@
 
 
 #
-# Load and emit opcodes for all 256 instructions.
+# Load and emit opcodes for all kNumDalvikInstructions instructions.
 #
 def loadAndEmitOpcodes():
     sister_list = []