Use type lookup tables in compiler
This recently regressed and stopped happening, the fix creates fake
OatDexFiles so that the compiler uses the type lookup tables instead
of slow FindClassDef and FindTypeId.
Perf on host compile Facebook:
Before:
2.49%: art::DexFile::FindClassDef(unsigned short) const
1.59%: art::DexFile::FindTypeId(char const*) const
After:
0.42%: art::OatDexFile::FindClassDef(art::DexFile const&, char const*, unsigned long)
0%: art::DexFile::FindTypeId(char const*) const
0%: art::DexFile::FindClassDef(unsigned short) const
Average install (N6P 960 mhz average of 40 samples): 38.2s -> 35.64s
Bug: 32641252
Test: test-art-host, adb install.
Change-Id: I34df21dc2c155bc2579c5cafdd91f9cb0fead1a9
diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h
index 3d08ad3..b92ba76 100644
--- a/compiler/oat_writer.h
+++ b/compiler/oat_writer.h
@@ -363,6 +363,9 @@
// Offset of the oat data from the start of the mmapped region of the elf file.
size_t oat_data_offset_;
+ // Fake OatDexFiles to hold type lookup tables for the compiler.
+ std::vector<std::unique_ptr<art::OatDexFile>> type_lookup_table_oat_dex_files_;
+
// data to write
std::unique_ptr<OatHeader> oat_header_;
dchecked_vector<OatDexFile> oat_dex_files_;