Add tables to map between callee saves and vregs

Also added function to return sp-relative offset for Dalvik
virtual registers using Method*

[Note: must be matched with corresponding libcore change to
reflect new field in Method]

Change-Id: Id739908c6232ce60763d8199bc05111e960da46e
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index 6a01e36..9659903 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -889,7 +889,21 @@
     memcpy(mapping_table->GetData(),
            reinterpret_cast<const int32_t*>(&cUnit.mappingTable[0]),
            mapping_table->GetLength() * sizeof(cUnit.mappingTable[0]));
-    method->SetCode(managed_code, art::kThumb2, mapping_table);
+    // Add a marker to take place of lr
+    cUnit.coreVmapTable.push_back(-1);
+    // Combine vmap tables - core regs, then fp regs
+    for (uint32_t i = 0; i < cUnit.fpVmapTable.size(); i++) {
+        cUnit.coreVmapTable.push_back(cUnit.fpVmapTable[i]);
+    }
+    DCHECK(cUnit.coreVmapTable.size() == (uint32_t)
+        (__builtin_popcount(cUnit.coreSpillMask) +
+         __builtin_popcount(cUnit.fpSpillMask)));
+    art::ShortArray* vmap_table =
+        art::ShortArray::Alloc(cUnit.coreVmapTable.size());
+    memcpy(vmap_table->GetData(),
+           reinterpret_cast<const int16_t*>(&cUnit.coreVmapTable[0]),
+           vmap_table->GetLength() * sizeof(cUnit.coreVmapTable[0]));
+    method->SetCode(managed_code, art::kThumb2, mapping_table, vmap_table);
     method->SetFrameSizeInBytes(cUnit.frameSize);
     method->SetReturnPcOffsetInBytes(cUnit.frameSize - sizeof(intptr_t));
     method->SetCoreSpillMask(cUnit.coreSpillMask);