]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove itabEntry.sym
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 21 Apr 2017 23:09:56 +0000 (16:09 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sun, 23 Apr 2017 19:01:25 +0000 (19:01 +0000)
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 <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/reflect.go

index 6db48a4fb98103ce9f04bd953aa48b8fdf53d12d..08ca0f13e65f281ebcd6e19e46bd7d2aeaf25692 100644 (file)
@@ -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))
        }