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/Frontend.cc b/src/compiler/Frontend.cc
index 2abefe10..702611d 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -861,19 +861,25 @@
         }
     }
 
-    art::ByteArray* managed_code = art::ByteArray::Alloc(cUnit.codeBuffer.size() * 2);
+    art::ByteArray* managed_code =
+        art::ByteArray::Alloc(cUnit.codeBuffer.size() *
+        sizeof(cUnit.codeBuffer[0]));
     memcpy(managed_code->GetData(),
            reinterpret_cast<const int8_t*>(&cUnit.codeBuffer[0]),
            managed_code->GetLength());
-    method->SetCode(managed_code, art::kThumb2);
+    art::ByteArray* mapping_table =
+        art::ByteArray::Alloc(cUnit.mappingTable.size() *
+        sizeof(cUnit.mappingTable[0]));
+    memcpy(mapping_table->GetData(),
+           reinterpret_cast<const int8_t*>(&cUnit.mappingTable[0]),
+           mapping_table->GetLength());
+    method->SetCode(managed_code, art::kThumb2, mapping_table);
     method->SetFrameSizeInBytes(cUnit.frameSize);
     method->SetCoreSpillMask(cUnit.coreSpillMask);
     method->SetFpSpillMask(cUnit.fpSpillMask);
     LOG(INFO) << "Compiled " << PrettyMethod(method)
               << " code at " << reinterpret_cast<void*>(managed_code->GetData())
               << " (" << managed_code->GetLength() << " bytes)";
-    // TODO: Transmit mapping table to caller
-
 #if 0
     oatDumpCFG(&cUnit, "/sdcard/cfg/");
 #endif