From 3cf72322dc234b01dff0757a9d928362967fe9e3 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 21 Apr 2017 14:47:09 -0700 Subject: [PATCH] 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 Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/reflect.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index 9c2a2429ff..712c2aad9e 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -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