aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/iface.go
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2016-03-28 21:51:10 -0400
committerDavid Crawshaw <crawshaw@golang.org>2016-04-18 09:12:41 +0000
commit95df0c6ab93f6a42bdc9fd45500fd4d56bfc9add (patch)
tree29fe9162ca68298b592ff154bff3637632aedbac /src/runtime/iface.go
parent3c8d6af8e02bbf230c2bef9f181d8ea393068299 (diff)
downloadgo-95df0c6ab93f6a42bdc9fd45500fd4d56bfc9add.tar.gz
go-95df0c6ab93f6a42bdc9fd45500fd4d56bfc9add.zip
cmd/compile, etc: use name offset in method tables
Introduce and start using nameOff for two encoded names. This pair of changes is best done together because the linker's method decoder expects the method layouts to match. Precursor to converting all existing name and *string fields to nameOff. linux/amd64: cmd/go: -45KB (0.5%) jujud: -389KB (0.6%) linux/amd64 PIE: cmd/go: -170KB (1.4%) jujud: -1.5MB (1.8%) For #6853. Change-Id: Ia044423f010fb987ce070b94c46a16fc78666ff6 Reviewed-on: https://go-review.googlesource.com/21396 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/iface.go')
-rw-r--r--src/runtime/iface.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/runtime/iface.go b/src/runtime/iface.go
index 84f0ee8f0c..8f179bac80 100644
--- a/src/runtime/iface.go
+++ b/src/runtime/iface.go
@@ -37,7 +37,8 @@ func getitab(inter *interfacetype, typ *_type, canfail bool) *itab {
if canfail {
return nil
}
- panic(&TypeAssertionError{"", typ._string, inter.typ._string, inter.mhdr[0].name.name()})
+ name := inter.typ.nameOff(inter.mhdr[0].name)
+ panic(&TypeAssertionError{"", typ._string, inter.typ._string, name.name()})
}
h := itabhash(inter, typ)
@@ -98,20 +99,22 @@ func additab(m *itab, locked, canfail bool) {
j := 0
for k := 0; k < ni; k++ {
i := &inter.mhdr[k]
- iname := i.name.name()
- itype := i._type
- ipkg := i.name.pkgPath()
+ itype := inter.typ.typeOff(i.ityp)
+ name := inter.typ.nameOff(i.name)
+ iname := name.name()
+ ipkg := name.pkgPath()
if ipkg == "" {
ipkg = inter.pkgpath.name()
}
for ; j < nt; j++ {
t := &xmhdr[j]
- if typ.typeOff(t.mtyp) == itype && t.name.name() == iname {
- pkgPath := t.name.pkgPath()
+ tname := typ.nameOff(t.name)
+ if typ.typeOff(t.mtyp) == itype && tname.name() == iname {
+ pkgPath := tname.pkgPath()
if pkgPath == "" {
pkgPath = x.pkgpath.name()
}
- if t.name.isExported() || pkgPath == ipkg {
+ if tname.isExported() || pkgPath == ipkg {
if m != nil {
ifn := typ.textOff(t.ifn)
*(*unsafe.Pointer)(add(unsafe.Pointer(&m.fun[0]), uintptr(k)*sys.PtrSize)) = ifn