+ add_string(const Stringpool_char*, size_t, Key*);
+
+ // Return whether s1 is a suffix of s2.
+ static bool
+ is_suffix(const Stringpool_char* s1, size_t len1,
+ const Stringpool_char* s2, size_t len2);
+
+ // The hash table key includes the string, the length of the string,
+ // and the hash code for the string. We put the hash code
+ // explicitly into the key so that we can do a find()/insert()
+ // sequence without having to recompute the hash. Computing the
+ // hash code is a significant user of CPU time in the linker.
+ struct Hashkey
+ {
+ const Stringpool_char* string;
+ // Length is in characters, not bytes.
+ size_t length;
+ size_t hash_code;
+
+ // This goes in an STL container, so we need a default
+ // constructor.
+ Hashkey()
+ : string(NULL), length(0), hash_code(0)
+ { }
+
+ // Note that these constructors are relatively expensive, because
+ // they compute the hash code.
+ Hashkey(const Stringpool_char* s)
+ : string(s), length(string_length(s)), hash_code(string_hash(s, length))
+ { }
+
+ Hashkey(const Stringpool_char* s, size_t len)
+ : string(s), length(len), hash_code(string_hash(s, len))
+ { }
+ };