1
0
mirror of https://github.com/golang/go synced 2024-10-02 04:28:33 -06:00

runtime: remove link field from itab

We don't use it any more, remove it.

Change-Id: I76ce1a4c2e7048fdd13a37d3718b5abf39ed9d26
Reviewed-on: https://go-review.googlesource.com/44474
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Keith Randall 2017-05-31 10:08:51 -07:00
parent 98d0634b7a
commit 04d6f982ae
5 changed files with 3 additions and 7 deletions

View File

@ -1408,7 +1408,7 @@ func itabsym(it *obj.LSym, offset int64) *obj.LSym {
}
// keep this arithmetic in sync with *itab layout
methodnum := int((offset - 3*int64(Widthptr) - 8) / int64(Widthptr))
methodnum := int((offset - 2*int64(Widthptr) - 8) / int64(Widthptr))
if methodnum >= len(syms) {
return nil
}
@ -1457,14 +1457,12 @@ func dumptabs() {
// type itab struct {
// inter *interfacetype
// _type *_type
// _ uintptr TODO: remove
// hash uint32
// _ [4]byte
// fun [1]uintptr // variable sized
// }
o := dsymptr(i.lsym, 0, dtypesym(i.itype).Linksym(), 0)
o = dsymptr(i.lsym, o, dtypesym(i.t).Linksym(), 0)
o = duintptr(i.lsym, o, 0) // unused
o = duint32(i.lsym, o, typehash(i.t)) // copy of type hash
o += 4 // skip unused field
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers

View File

@ -3122,7 +3122,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
if k != callNormal {
s.nilCheck(itab)
}
itabidx := fn.Xoffset + 3*int64(Widthptr) + 8 // offset of fun field in runtime.itab
itabidx := fn.Xoffset + 2*int64(Widthptr) + 8 // offset of fun field in runtime.itab
itab = s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.UintptrPtr, itabidx, itab)
if k == callNormal {
codeptr = s.newValue2(ssa.OpLoad, types.Types[TUINTPTR], itab, s.mem())

View File

@ -757,7 +757,7 @@ func (s *typeSwitch) walk(sw *Node) {
if cond.Right.Type.IsEmptyInterface() {
h.Xoffset = int64(2 * Widthptr) // offset of hash in runtime._type
} else {
h.Xoffset = int64(3 * Widthptr) // offset of hash in runtime.itab
h.Xoffset = int64(2 * Widthptr) // offset of hash in runtime.itab
}
h.SetBounded(true) // guaranteed not to fault
a = nod(OAS, s.hashname, h)

View File

@ -182,7 +182,6 @@ type nonEmptyInterface struct {
itab *struct {
ityp *rtype // static interface type
typ *rtype // dynamic concrete type
_ uintptr
hash uint32 // copy of typ.hash
_ [4]byte
fun [100000]unsafe.Pointer // method table

View File

@ -626,7 +626,6 @@ type _func struct {
type itab struct {
inter *interfacetype
_type *_type
_ uintptr
hash uint32 // copy of _type.hash. Used for type switches.
_ [4]byte
fun [1]uintptr // variable sized. fun[0]==0 means _type does not implement inter.