1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:26:11 -07:00

cmd/compile: reuse LSyms in dumptypestructs

Passes toolstash-check.

Change-Id: I4a5c841eb16e05db7d923d4c3c7cd2d7695fa4af
Reviewed-on: https://go-review.googlesource.com/41409
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2017-04-21 14:47:09 -07:00
parent 1dc3b60bd6
commit 3cf72322dc

View File

@ -1441,19 +1441,20 @@ func dumptypestructs() {
// unused [2]byte
// fun [1]uintptr // variable sized
// }
o := dsymptr(i.sym.Linksym(), 0, dtypesym(i.itype).Linksym(), 0)
o = dsymptr(i.sym.Linksym(), o, dtypesym(i.t).Linksym(), 0)
o += Widthptr // skip link field
o = duint32(i.sym.Linksym(), o, typehash(i.t)) // copy of type hash
o += 4 // skip bad/inhash/unused fields
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
ilsym := i.sym.Linksym()
o := dsymptr(ilsym, 0, dtypesym(i.itype).Linksym(), 0)
o = dsymptr(ilsym, o, dtypesym(i.t).Linksym(), 0)
o += Widthptr // skip link field
o = duint32(ilsym, o, typehash(i.t)) // copy of type hash
o += 4 // skip bad/inhash/unused fields
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
// at runtime the itab will contain pointers to types, other itabs and
// method functions. None are allocated on heap, so we can use obj.NOPTR.
ggloblsym(i.sym.Linksym(), int32(o), int16(obj.DUPOK|obj.NOPTR))
ggloblsym(ilsym, int32(o), int16(obj.DUPOK|obj.NOPTR))
ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString())
dsymptr(ilink.Linksym(), 0, i.sym.Linksym(), 0)
ggloblsym(ilink.Linksym(), int32(Widthptr), int16(obj.DUPOK|obj.RODATA))
ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString()).Linksym()
dsymptr(ilink, 0, ilsym, 0)
ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA))
}
// process ptabs