Transmit mapping table to runtime

Pass the <native offset,dalvik offset> mapping table to the
runtime.  Also update the MonitorEnter/Exit stubs to optionally
take the thread pointer.

Change-Id: Ie1345fbafc6c0477deed44297bba1c566e6301f6
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index 54e0aaf..2004d46 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -1429,11 +1429,10 @@
     return offset;
 }
 
-static int createMappingTable(CompilationUnit* cUnit, MappingTable** pTable)
+static void createMappingTable(CompilationUnit* cUnit)
 {
     ArmLIR* armLIR;
     int currentDalvikOffset = -1;
-    int count = 0;
 
     for (armLIR = (ArmLIR *) cUnit->firstLIRInsn;
          armLIR;
@@ -1441,17 +1440,11 @@
         if ((armLIR->opcode >= 0) && !armLIR->flags.isNop &&
             (currentDalvikOffset != armLIR->generic.dalvikOffset)) {
             // Changed - need to emit a record
-            if (pTable) {
-                MappingTable *table = *pTable;
-                assert(table);
-                table[count].targetOffset = armLIR->generic.offset;
-                table[count].dalvikOffset = armLIR->generic.dalvikOffset;
-            }
-            count++;
+            cUnit->mappingTable.push_back(armLIR->generic.offset);
+            cUnit->mappingTable.push_back(armLIR->generic.dalvikOffset);
             currentDalvikOffset = armLIR->generic.dalvikOffset;
         }
     }
-    return count;
 }
 
 /* Determine the offset of each literal field */
@@ -1577,8 +1570,5 @@
     /*
      * Create the mapping table
      */
-    cUnit->mappingTableSize = createMappingTable(cUnit, NULL /* just count */);
-    cUnit->mappingTable = (MappingTable*)oatNew(
-        cUnit->mappingTableSize * sizeof(*cUnit->mappingTable), true);
-    createMappingTable(cUnit, &cUnit->mappingTable);
+    createMappingTable(cUnit);
 }