]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/internal/goobj2, cmd/link: use short hash function for short symbols
authorCherry Zhang <cherryyz@google.com>
Mon, 13 Jul 2020 19:05:09 +0000 (15:05 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 16 Jul 2020 18:45:34 +0000 (18:45 +0000)
commit4f217d5aaa88536f641910e2b97b24489132ee16
tree538fca3316331d958753066c1986fdf2db9fba7e
parent3c54069907de8470b7ffa1cba8eae48e446feced
[dev.link] cmd/internal/goobj2, cmd/link: use short hash function for short symbols

For symbols of size 8 bytes or below, we can map them to 64-bit
hash values using the identity function. There is no need to use
longer and more expensive hash functions.

For them, we introduce another pseudo-package, PkgIdxHashed64. It
is like PkgIdxHashed except that the hash function is different.

Note that the hash value is not affected with trailing zeros,
e.g. "A" and "A\0\0\0" have the same hash value. This allows
deduplicating a few more symbols. When deduplicating them, we
need to keep the longer one.

Change-Id: Iad0c2e9e569b6a59ca6a121fb8c8f0c018c6da03
Reviewed-on: https://go-review.googlesource.com/c/go/+/242362
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/internal/goobj/readnew.go
src/cmd/internal/goobj2/objfile.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/objfile2.go
src/cmd/internal/obj/sym.go
src/cmd/link/internal/loader/loader.go