diff options
author | 2018-02-05 15:49:10 +0000 | |
---|---|---|
committer | 2018-02-05 15:55:35 +0000 | |
commit | 3f427c4bdb589c3c6bd46ad3e941518176ce7b6c (patch) | |
tree | f701aee25e39554711fe30c250192b883cc6a57c /compiler/linker | |
parent | 09f86297e7f82176fb8bb78fee86249e012c3af7 (diff) |
Revert "Properly de-duplicate debug symbol names."
This is no longer needed with the current dex symbol resolution approach,
so go back to naive name de-duplication to avoid paying the memory cost.
This reverts commit d8f2702c2a56ac64bf8b69c831d566c4a38b88b8.
Test: testrunner.py --host -t 137
Change-Id: Ia48ee5d45dda369455295893db151c7db563a79a
Diffstat (limited to 'compiler/linker')
-rw-r--r-- | compiler/linker/elf_builder.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/compiler/linker/elf_builder.h b/compiler/linker/elf_builder.h index 1c875189c5..3145497091 100644 --- a/compiler/linker/elf_builder.h +++ b/compiler/linker/elf_builder.h @@ -18,7 +18,6 @@ #define ART_COMPILER_LINKER_ELF_BUILDER_H_ #include <vector> -#include <unordered_map> #include "arch/instruction_set.h" #include "arch/mips/instruction_set_features_mips.h" @@ -310,24 +309,27 @@ class ElfBuilder FINAL { /* info */ 0, align, /* entsize */ 0), - current_offset_(0) { + current_offset_(0), + last_offset_(0) { } Elf_Word Write(const std::string& name) { if (current_offset_ == 0) { DCHECK(name.empty()); + } else if (name == last_name_) { + return last_offset_; // Very simple string de-duplication. } - auto res = written_names_.emplace(name, current_offset_); - if (res.second) { // Inserted. - this->WriteFully(name.c_str(), name.length() + 1); - current_offset_ += name.length() + 1; - } - return res.first->second; // Offset. + last_name_ = name; + last_offset_ = current_offset_; + this->WriteFully(name.c_str(), name.length() + 1); + current_offset_ += name.length() + 1; + return last_offset_; } private: Elf_Word current_offset_; - std::unordered_map<std::string, Elf_Word> written_names_; // Dedup strings. + std::string last_name_; + Elf_Word last_offset_; }; // Writer of .dynsym and .symtab sections. |