diff options
author | Ian Lance Taylor <iant@google.com> | 2007-09-18 05:16:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-09-18 05:16:39 +0000 |
commit | 614f30a283ede08a5d2913a0597581edeb7c0905 (patch) | |
tree | fe049c54055d903fd5d8635c476358b4ad43663f /gold/stringpool.h | |
parent | b6ac5419b4d56765a569ed11bfb41d96d713ae9f (diff) | |
download | binutils-gdb-614f30a283ede08a5d2913a0597581edeb7c0905.tar.gz |
Compute string lengths before sorting. From Craig Silverstein.
Diffstat (limited to 'gold/stringpool.h')
-rw-r--r-- | gold/stringpool.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gold/stringpool.h b/gold/stringpool.h index b9a65f6db98..bc014984069 100644 --- a/gold/stringpool.h +++ b/gold/stringpool.h @@ -116,7 +116,8 @@ class Stringpool_template // Return whether s1 is a suffix of s2. static bool - is_suffix(const Stringpool_char* s1, const Stringpool_char* s2); + is_suffix(const Stringpool_char* s1, size_t len1, + const Stringpool_char* s2, size_t len2); // The hash table is a map from string names to a pair of Key and // ELF strtab offsets. We only use the offsets if we turn this into @@ -135,13 +136,22 @@ class Stringpool_template Stringpool_eq> String_set_type; #endif - // Comparison routine used when sorting into an ELF strtab. + // Comparison routine used when sorting into an ELF strtab. We + // store string-sizes in the sort-vector so we don't have to + // recompute them log(n) times as we sort. + struct Stringpool_sort_info + { + typename String_set_type::iterator it; + size_t string_length; + Stringpool_sort_info(typename String_set_type::iterator i, size_t s) + : it(i), string_length(s) + { } + }; struct Stringpool_sort_comparison { bool - operator()(typename String_set_type::iterator, - typename String_set_type::iterator) const; + operator()(const Stringpool_sort_info&, const Stringpool_sort_info&) const; }; // List of Stringdata structures. |