mirror of
https://github.com/golang/go
synced 2024-11-05 17:46:16 -07:00
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 <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
eba396f596
commit
07d09003f1
@ -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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user