Various bug fixes.

The most amusing fix was the wierd NaN test failure.  After spending way
too much time debugging, it turned out to be a missing comma in the argument
list of the test launcher.

Change-Id: I76253575d7fbe2c2c260f1839a517c1b93dc9224
diff --git a/src/compiler/RuntimeUtilities.cc b/src/compiler/RuntimeUtilities.cc
index b18e4da..53bd20e 100644
--- a/src/compiler/RuntimeUtilities.cc
+++ b/src/compiler/RuntimeUtilities.cc
@@ -50,3 +50,29 @@
     else
         return (s8)f;
 }
+
+/*
+ * Temporary placeholder.  Should include run-time checks for size
+ * of fill data <= size of array.  If not, throw arrayOutOfBoundsException.
+ * As with other new "NoThrow" routines, this should return to the caller
+ * only if no exception has been thrown.
+ *
+ * NOTE: When dealing with a raw dex file, the data to be copied uses
+ * little-endian ordering.  Require that oat2dex do any required swapping
+ * so this routine can get by with a memcpy().
+ *
+ * Format of the data:
+ *  ushort ident = 0x0300   magic value
+ *  ushort width            width of each element in the table
+ *  uint   size             number of elements in the table
+ *  ubyte  data[size*width] table of data values (may contain a single-byte
+ *                          padding at the end)
+ */
+void artHandleFillArrayDataNoThrow(Array* array, const uint16_t* table)
+{
+    uint32_t size = (uint32_t)table[2] | (((uint32_t)table[3]) << 16);
+    uint32_t size_in_bytes = size * table[1];
+    UNIMPLEMENTED(WARNING) << "Need to check if array.length() <= size";
+    memcpy((char*)array + art::Array::DataOffset().Int32Value(),
+           (char*)&table[4], size_in_bytes);
+}
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index d9dd8c4..54e0aaf 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -1039,9 +1039,9 @@
              &iterator);
         if (tabRec == NULL) break;
         alignBuffer(cUnit->codeBuffer, tabRec->offset);
-        cUnit->codeBuffer.reserve(cUnit->codeBuffer.size() + (tabRec->size/2));
-        memcpy(&cUnit->codeBuffer[tabRec->offset/2],
-              (char*)tabRec->table, tabRec->size);
+        for (int i = 0; i < (tabRec->size / 2) ; i++) {
+            cUnit->codeBuffer.push_back( tabRec->table[i]);
+        }
     }
 }
 
diff --git a/src/compiler/codegen/arm/LocalOptimizations.cc b/src/compiler/codegen/arm/LocalOptimizations.cc
index 8d6f3a5..1aaeebf 100644
--- a/src/compiler/codegen/arm/LocalOptimizations.cc
+++ b/src/compiler/codegen/arm/LocalOptimizations.cc
@@ -439,10 +439,12 @@
                                         LIR* tailLIR)
 {
     if (!(cUnit->disableOpt & (1 << kLoadStoreElimination))) {
+        LOG(INFO) << "Doing ldstElim, op: 0x" << std::hex << cUnit->disableOpt;
         applyLoadStoreElimination(cUnit, (ArmLIR* ) headLIR,
                                   (ArmLIR* ) tailLIR);
     }
     if (!(cUnit->disableOpt & (1 << kLoadHoisting))) {
+        LOG(INFO) << "Doing hoisting, op: 0x" << std::hex << cUnit->disableOpt;
         applyLoadHoisting(cUnit, (ArmLIR* ) headLIR, (ArmLIR* ) tailLIR);
     }
 }
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index f7194f1..1cf3766 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -1455,15 +1455,12 @@
             genArithOpLong(cUnit, mir, rlDest, rlSrc[0], rlSrc[1]);
             break;
 
-        case OP_SHL_LONG_2ADDR:
-        case OP_SHR_LONG_2ADDR:
-        case OP_USHR_LONG_2ADDR:
-            genShiftOpLong(cUnit,mir, rlDest, rlSrc[0], rlSrc[0]);
-            break;
-
         case OP_SHL_LONG:
         case OP_SHR_LONG:
         case OP_USHR_LONG:
+        case OP_SHL_LONG_2ADDR:
+        case OP_SHR_LONG_2ADDR:
+        case OP_USHR_LONG_2ADDR:
             genShiftOpLong(cUnit,mir, rlDest, rlSrc[0], rlSrc[1]);
             break;
 
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index 2239bd9..992eca6 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -342,7 +342,7 @@
     loadValueDirectFixed(cUnit, rlSrc, r0);
     loadWordDisp(cUnit, rSELF,
                  OFFSETOF_MEMBER(Thread, pArtHandleFillArrayDataNoThrow), rLR);
-    // Materialize a pointer to the switch table
+    // Materialize a pointer to the fill data image
     newLIR3(cUnit, kThumb2AdrST, r1, 0, (intptr_t)tabRec);
     opReg(cUnit, kOpBlx, rLR);
     oatClobberCallRegs(cUnit);
@@ -1358,11 +1358,6 @@
     oatFlushAllRegs(cUnit);   /* Send everything to home location */
     loadWordDisp(cUnit, rSELF, funcOffset, rLR);
     loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
-    if (rlShift.wide) {
-        LOG(WARNING) << "Invalid RegLocation size - dataflow problem";
-        LOG(WARNING) << "   sReg[" << rlShift.sRegLow << "]";
-        rlShift.wide = false;
-    }
     loadValueDirect(cUnit, rlShift, r2);
     opReg(cUnit, kOpBlx, rLR);
     oatClobberCallRegs(cUnit);