Split dex_pc<->native_pc mapping table

First of 2 related CLs - this one moves to a split table, a future
CL will compress the table to save image space.

The current MappingTable mixes two flavors of entries: dex->pc and
pc(return address)->dex.  The problem is that we can have two
entries with the same native pc address but two different dex pcs.
The reason is that when we go from native pc to dex, the native
pc is actually the return address from the previous call, whereas
when we go from dex to native pc, the mapping refers to the first
native instruction of the sequence.

Previously, the first entry in the mapping table was the number
of subsequent entries.  That will remain the same, but now
the second entry will be a count of the number of entries in
the pc->dex section of the table.  The difference between the
two counts gives us the number of entries in the following dex->pc
section.

Change-Id: Ibadb96cb50bf1f93e079dff3832130b9f9782723
diff --git a/src/object.h b/src/object.h
index 947b77d..5fccb04 100644
--- a/src/object.h
+++ b/src/object.h
@@ -729,14 +729,40 @@
     return map + 1;
   }
 
-  uint32_t GetMappingTableLength() const {
+  uint32_t GetPcToDexMappingTableLength() const {
     const uint32_t* map = GetMappingTableRaw();
     if (map == NULL) {
       return 0;
     }
-    return *map;
+    return map[2];
   }
 
+  const uint32_t* GetPcToDexMappingTable() const {
+    const uint32_t* map = GetMappingTableRaw();
+    if (map == NULL) {
+      return map;
+    }
+    return map + 3;
+  }
+
+
+  uint32_t GetDexToPcMappingTableLength() const {
+    const uint32_t* map = GetMappingTableRaw();
+    if (map == NULL) {
+      return 0;
+    }
+    return map[1] - map[2];
+  }
+
+  const uint32_t* GetDexToPcMappingTable() const {
+    const uint32_t* map = GetMappingTableRaw();
+    if (map == NULL) {
+      return map;
+    }
+    return map + 3 + map[2];
+  }
+
+
   const uint32_t* GetMappingTableRaw() const {
     return GetFieldPtr<const uint32_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, mapping_table_), false);
   }
@@ -922,6 +948,10 @@
   // Converts a dex PC to a native PC.
   uintptr_t ToNativePc(const uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
+  // Converts a dex PC to the first corresponding safepoint PC.
+  uintptr_t ToFirstNativeSafepointPc(const uint32_t dex_pc)
+      const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
   // Find the catch block for the given exception type and dex_pc
   uint32_t FindCatchBlock(Class* exception_type, uint32_t dex_pc) const
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);