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
}
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)
if len(methods) == 0 {
continue
}
- tab.lsym = tab.sym.Linksym()
tab.entries = methods
}
}
// 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))
}