mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile, etc: use name for type pkgPath
By replacing the *string used to represent pkgPath with a reflect.name everywhere, the embedded *string for package paths inside the reflect.name can be replaced by an offset, nameOff. This reduces the number of pointers in the type information. This also moves all reflect.name types into the same section, making it possible to use nameOff more widely in later CLs. No significant binary size change for normal binaries, but: linux/amd64 PIE: cmd/go: -440KB (3.7%) jujud: -2.6MB (3.2%) For #6853. Change-Id: I3890b132a784a1090b1b72b32febfe0bea77eaee Reviewed-on: https://go-review.googlesource.com/21395 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
73e2ad2022
commit
f120936dff
7 changed files with 169 additions and 114 deletions
|
|
@ -183,10 +183,11 @@ func dumptype(t *_type) {
|
|||
dumpint(tagType)
|
||||
dumpint(uint64(uintptr(unsafe.Pointer(t))))
|
||||
dumpint(uint64(t.size))
|
||||
if x := t.uncommon(); x == nil || x.pkgpath == nil {
|
||||
if x := t.uncommon(); x == nil || x.pkgpath.name() == "" {
|
||||
dumpstr(t._string)
|
||||
} else {
|
||||
pkgpath := stringStructOf(x.pkgpath)
|
||||
pkgpathstr := x.pkgpath.name()
|
||||
pkgpath := stringStructOf(&pkgpathstr)
|
||||
namestr := t.name()
|
||||
name := stringStructOf(&namestr)
|
||||
dumpint(uint64(uintptr(pkgpath.len) + 1 + uintptr(name.len)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue