Ensure VM's heap is accounted correctly.

The meminfo dumping assumes that dalvik heap is created using ashmem and has a
prefix of "dalvik-". Ensure ART's anonymous mmaps fit this pattern. Tidy up
anonymous mmaps so naming is more consistent.

Change-Id: I9c62a9d1da21da6a048effb0399a1f85865cb12d
diff --git a/src/gc/card_table.cc b/src/gc/card_table.cc
index 4331270..e053a06 100644
--- a/src/gc/card_table.cc
+++ b/src/gc/card_table.cc
@@ -53,7 +53,7 @@
   /* Set up the card table */
   size_t capacity = heap_capacity / kCardSize;
   /* Allocate an extra 256 bytes to allow fixed low-byte of base */
-  UniquePtr<MemMap> mem_map(MemMap::MapAnonymous("dalvik-card-table", NULL,
+  UniquePtr<MemMap> mem_map(MemMap::MapAnonymous("card table", NULL,
                                                  capacity + 256, PROT_READ | PROT_WRITE));
   CHECK(mem_map.get() != NULL) << "couldn't allocate card table";
   // All zeros is the correct initial value; all clean. Anonymous mmaps are initialized to zero, we
diff --git a/src/gc/large_object_space.cc b/src/gc/large_object_space.cc
index 69320fa..a589e67 100644
--- a/src/gc/large_object_space.cc
+++ b/src/gc/large_object_space.cc
@@ -60,7 +60,8 @@
 }
 
 mirror::Object* LargeObjectMapSpace::Alloc(Thread* self, size_t num_bytes) {
-  MemMap* mem_map = MemMap::MapAnonymous("allocation", NULL, num_bytes, PROT_READ | PROT_WRITE);
+  MemMap* mem_map = MemMap::MapAnonymous("large object space allocation", NULL, num_bytes,
+                                         PROT_READ | PROT_WRITE);
   if (mem_map == NULL) {
     return NULL;
   }
diff --git a/src/gc/mod_union_table.h b/src/gc/mod_union_table.h
index 23c0a51..c0b9535 100644
--- a/src/gc/mod_union_table.h
+++ b/src/gc/mod_union_table.h
@@ -63,12 +63,12 @@
   // bitmap or not.
   virtual void Verify() EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) = 0;
 
-  Heap* GetHeap() {
+  Heap* GetHeap() const {
     return heap_;
   }
 
  protected:
-  Heap* heap_;
+  Heap* const heap_;
 };
 
 // Bitmap implementation.
diff --git a/src/gc/space.cc b/src/gc/space.cc
index 9db84f2..9c71841 100644
--- a/src/gc/space.cc
+++ b/src/gc/space.cc
@@ -105,12 +105,12 @@
   CHECK(reinterpret_cast<uintptr_t>(mem_map->Begin()) % kGcCardSize == 0);
   CHECK(reinterpret_cast<uintptr_t>(mem_map->End()) % kGcCardSize == 0);
   live_bitmap_.reset(SpaceBitmap::Create(
-      StringPrintf("allocspace-%s-live-bitmap-%d", name.c_str(), static_cast<int>(bitmap_index)),
+      StringPrintf("allocspace %s live-bitmap %d", name.c_str(), static_cast<int>(bitmap_index)),
       Begin(), Capacity()));
   DCHECK(live_bitmap_.get() != NULL) << "could not create allocspace live bitmap #" << bitmap_index;
 
   mark_bitmap_.reset(SpaceBitmap::Create(
-      StringPrintf("allocspace-%s-mark-bitmap-%d", name.c_str(), static_cast<int>(bitmap_index)),
+      StringPrintf("allocspace %s mark-bitmap %d", name.c_str(), static_cast<int>(bitmap_index)),
       Begin(), Capacity()));
   DCHECK(live_bitmap_.get() != NULL) << "could not create allocspace mark bitmap #" << bitmap_index;
 }
@@ -469,7 +469,7 @@
     : MemMapSpace(name, mem_map, mem_map->Size(), kGcRetentionPolicyNeverCollect) {
   const size_t bitmap_index = bitmap_index_++;
   live_bitmap_.reset(SpaceBitmap::Create(
-      StringPrintf("imagespace-%s-live-bitmap-%d", name.c_str(), static_cast<int>(bitmap_index)),
+      StringPrintf("imagespace %s live-bitmap %d", name.c_str(), static_cast<int>(bitmap_index)),
       Begin(), Capacity()));
   DCHECK(live_bitmap_.get() != NULL) << "could not create imagespace live bitmap #" << bitmap_index;
 }
diff --git a/src/gc/space_bitmap_test.cc b/src/gc/space_bitmap_test.cc
index 5a829e4..4645659 100644
--- a/src/gc/space_bitmap_test.cc
+++ b/src/gc/space_bitmap_test.cc
@@ -33,7 +33,7 @@
 TEST_F(SpaceBitmapTest, Init) {
   byte* heap_begin = reinterpret_cast<byte*>(0x10000000);
   size_t heap_capacity = 16 * MB;
-  UniquePtr<SpaceBitmap> space_bitmap(SpaceBitmap::Create("test-bitmap",
+  UniquePtr<SpaceBitmap> space_bitmap(SpaceBitmap::Create("test bitmap",
                                                           heap_begin, heap_capacity));
   EXPECT_TRUE(space_bitmap.get() != NULL);
 }
@@ -60,7 +60,7 @@
   byte* heap_begin = reinterpret_cast<byte*>(0x10000000);
   size_t heap_capacity = 16 * MB;
 
-  UniquePtr<SpaceBitmap> space_bitmap(SpaceBitmap::Create("test-bitmap",
+  UniquePtr<SpaceBitmap> space_bitmap(SpaceBitmap::Create("test bitmap",
                                                           heap_begin, heap_capacity));
   EXPECT_TRUE(space_bitmap.get() != NULL);