From: Josh Bleecher Snyder Date: Fri, 21 Apr 2017 23:09:56 +0000 (-0700) Subject: cmd/compile: remove itabEntry.sym X-Git-Tag: go1.9beta1~521 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=07d09003f1f3360ae870b9960b6a96079e319b3b;p=gostls13.git cmd/compile: remove itabEntry.sym Follow-up to codereview feedback on CL 41409. Passes toolstash-check. Change-Id: Ica6658bdb8215fc4a0a30f41fe7bc8d9a8b109b4 Reviewed-on: https://go-review.googlesource.com/41412 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index 6db48a4fb9..08ca0f13e6 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -18,15 +18,11 @@ import ( type itabEntry struct { t, itype *types.Type - sym *types.Sym - - // symbol of the itab itself; - // filled in lazily after typecheck - lsym *obj.LSym + lsym *obj.LSym // symbol of the itab itself // symbols of each method in // the itab, sorted by byte offset; - // filled in at the same time as lsym + // filled in by peekitabs entries []*obj.LSym } @@ -961,8 +957,7 @@ func itabname(t, itype *types.Type) *Node { n.Class = PEXTERN n.Typecheck = 1 s.Def = asTypesNode(n) - - itabs = append(itabs, itabEntry{t: t, itype: itype, sym: s}) + itabs = append(itabs, itabEntry{t: t, itype: itype, lsym: s.Linksym()}) } n := nod(OADDR, asNode(s.Def), nil) @@ -1333,7 +1328,6 @@ func peekitabs() { if len(methods) == 0 { continue } - tab.lsym = tab.sym.Linksym() tab.entries = methods } } @@ -1441,19 +1435,18 @@ func dumptypestructs() { // unused [2]byte // fun [1]uintptr // variable sized // } - ilsym := i.sym.Linksym() - o := dsymptr(ilsym, 0, dtypesym(i.itype).Linksym(), 0) - o = dsymptr(ilsym, o, dtypesym(i.t).Linksym(), 0) + o := dsymptr(i.lsym, 0, dtypesym(i.itype).Linksym(), 0) + o = dsymptr(i.lsym, o, dtypesym(i.t).Linksym(), 0) o += Widthptr // skip link field - o = duint32(ilsym, o, typehash(i.t)) // copy of type hash + o = duint32(i.lsym, 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(ilsym, int32(o), int16(obj.DUPOK|obj.NOPTR)) + ggloblsym(i.lsym, int32(o), int16(obj.DUPOK|obj.NOPTR)) ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString()).Linksym() - dsymptr(ilink, 0, ilsym, 0) + dsymptr(ilink, 0, i.lsym, 0) ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA)) }