Add shared separate data section for compact dex

Added a shared dex data buffer for compact dex files, this buffer
is referenced by all compact dex files in a vdex file. Repurposed
the existing data_off / data_size fields in the header.

After the shared buffer is filled up, it is placed after the dex
files in the oat writer and the dex file headers are fixed up to have
the correct offsets / sizes to the shared buffer.

Motivation:
Make it easy to deduplicate data across dexes.

Bug: 63756964
Test: test-art-host
Change-Id: I17855a0c78b20be3d323d12dedb9c695962be3ed
diff --git a/runtime/dex/compact_dex_file.h b/runtime/dex/compact_dex_file.h
index 8dad84d..1ecff04 100644
--- a/runtime/dex/compact_dex_file.h
+++ b/runtime/dex/compact_dex_file.h
@@ -35,10 +35,22 @@
 
   class Header : public DexFile::Header {
    public:
+    static const Header* At(const void* at) {
+      return reinterpret_cast<const Header*>(at);
+    }
+
     uint32_t GetFeatureFlags() const {
       return feature_flags_;
     }
 
+    uint32_t GetDataOffset() const {
+      return data_off_;
+    }
+
+    uint32_t GetDataSize() const {
+      return data_size_;
+    }
+
    private:
     uint32_t feature_flags_ = 0u;
 
@@ -245,9 +257,17 @@
     return debug_info_offsets_.GetDebugInfoOffset(dex_method_index);
   }
 
+  static uint32_t CalculateChecksum(const uint8_t* base_begin,
+                                    size_t base_size,
+                                    const uint8_t* data_begin,
+                                    size_t data_size);
+  virtual uint32_t CalculateChecksum() const OVERRIDE;
+
  private:
   CompactDexFile(const uint8_t* base,
                  size_t size,
+                 const uint8_t* data_begin,
+                 size_t data_size,
                  const std::string& location,
                  uint32_t location_checksum,
                  const OatDexFile* oat_dex_file,