Remove TypeLookupTable from DexFile.
One more step towards removing runtime dependencies from the DexFile
API. This severs the ties to OatFile. Work remains to move MemMap out
of DexFile.
Bug: 22322814
Change-Id: I29e7ad8fd292c7919ed2689dc754b958b88d6819
Test: test-art-host
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index 5e0c64b..d629c0c 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -259,7 +259,16 @@
// Data to write to a separate section.
dchecked_vector<uint32_t> class_offsets_;
+ void InitTypeLookupTable(const DexFile& dex_file, uint8_t* storage) const {
+ lookup_table_.reset(TypeLookupTable::Create(dex_file, storage));
+ }
+
+ TypeLookupTable* GetTypeLookupTable() const {
+ return lookup_table_.get();
+ }
+
private:
+ mutable std::unique_ptr<TypeLookupTable> lookup_table_;
size_t GetClassOffsetsRawSize() const {
return class_offsets_.size() * sizeof(class_offsets_[0]);
}
@@ -2285,9 +2294,9 @@
}
// Create the lookup table. When `nullptr` is given as the storage buffer,
- // TypeLookupTable allocates its own and DexFile takes ownership.
- opened_dex_files[i]->CreateTypeLookupTable(/* storage */ nullptr);
- TypeLookupTable* table = opened_dex_files[i]->GetTypeLookupTable();
+ // TypeLookupTable allocates its own and OatDexFile takes ownership.
+ oat_dex_file->InitTypeLookupTable(*opened_dex_files[i], /* storage */ nullptr);
+ TypeLookupTable* table = oat_dex_file->GetTypeLookupTable();
// Type tables are required to be 4 byte aligned.
size_t initial_offset = oat_size_;