mirror of
https://github.com/golang/go
synced 2024-11-19 14:24:47 -07: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:
parent
98d0634b7a
commit
04d6f982ae
@ -1408,7 +1408,7 @@ func itabsym(it *obj.LSym, offset int64) *obj.LSym {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// keep this arithmetic in sync with *itab layout
|
// 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) {
|
if methodnum >= len(syms) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1457,14 +1457,12 @@ func dumptabs() {
|
|||||||
// type itab struct {
|
// type itab struct {
|
||||||
// inter *interfacetype
|
// inter *interfacetype
|
||||||
// _type *_type
|
// _type *_type
|
||||||
// _ uintptr TODO: remove
|
|
||||||
// hash uint32
|
// hash uint32
|
||||||
// _ [4]byte
|
// _ [4]byte
|
||||||
// fun [1]uintptr // variable sized
|
// fun [1]uintptr // variable sized
|
||||||
// }
|
// }
|
||||||
o := dsymptr(i.lsym, 0, dtypesym(i.itype).Linksym(), 0)
|
o := dsymptr(i.lsym, 0, dtypesym(i.itype).Linksym(), 0)
|
||||||
o = dsymptr(i.lsym, o, dtypesym(i.t).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 = duint32(i.lsym, o, typehash(i.t)) // copy of type hash
|
||||||
o += 4 // skip unused field
|
o += 4 // skip unused field
|
||||||
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
|
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
|
||||||
|
@ -3122,7 +3122,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
|
|||||||
if k != callNormal {
|
if k != callNormal {
|
||||||
s.nilCheck(itab)
|
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)
|
itab = s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.UintptrPtr, itabidx, itab)
|
||||||
if k == callNormal {
|
if k == callNormal {
|
||||||
codeptr = s.newValue2(ssa.OpLoad, types.Types[TUINTPTR], itab, s.mem())
|
codeptr = s.newValue2(ssa.OpLoad, types.Types[TUINTPTR], itab, s.mem())
|
||||||
|
@ -757,7 +757,7 @@ func (s *typeSwitch) walk(sw *Node) {
|
|||||||
if cond.Right.Type.IsEmptyInterface() {
|
if cond.Right.Type.IsEmptyInterface() {
|
||||||
h.Xoffset = int64(2 * Widthptr) // offset of hash in runtime._type
|
h.Xoffset = int64(2 * Widthptr) // offset of hash in runtime._type
|
||||||
} else {
|
} 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
|
h.SetBounded(true) // guaranteed not to fault
|
||||||
a = nod(OAS, s.hashname, h)
|
a = nod(OAS, s.hashname, h)
|
||||||
|
@ -182,7 +182,6 @@ type nonEmptyInterface struct {
|
|||||||
itab *struct {
|
itab *struct {
|
||||||
ityp *rtype // static interface type
|
ityp *rtype // static interface type
|
||||||
typ *rtype // dynamic concrete type
|
typ *rtype // dynamic concrete type
|
||||||
_ uintptr
|
|
||||||
hash uint32 // copy of typ.hash
|
hash uint32 // copy of typ.hash
|
||||||
_ [4]byte
|
_ [4]byte
|
||||||
fun [100000]unsafe.Pointer // method table
|
fun [100000]unsafe.Pointer // method table
|
||||||
|
@ -626,7 +626,6 @@ type _func struct {
|
|||||||
type itab struct {
|
type itab struct {
|
||||||
inter *interfacetype
|
inter *interfacetype
|
||||||
_type *_type
|
_type *_type
|
||||||
_ uintptr
|
|
||||||
hash uint32 // copy of _type.hash. Used for type switches.
|
hash uint32 // copy of _type.hash. Used for type switches.
|
||||||
_ [4]byte
|
_ [4]byte
|
||||||
fun [1]uintptr // variable sized. fun[0]==0 means _type does not implement inter.
|
fun [1]uintptr // variable sized. fun[0]==0 means _type does not implement inter.
|
||||||
|
Loading…
Reference in New Issue
Block a user