]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove link field from itab
authorKeith Randall <khr@golang.org>
Wed, 31 May 2017 17:08:51 +0000 (10:08 -0700)
committerKeith Randall <khr@golang.org>
Tue, 15 Aug 2017 01:52:35 +0000 (01:52 +0000)
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>
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/swt.go
src/reflect/value.go
src/runtime/runtime2.go

index 1b4198d03db92fc509fa9291c261b757b6a3d5ce..e3d8b1537e0ec5e049d149efc6325b3d3921a566 100644 (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
index f018697fc1af03890e6e568fe710df8a2df8bae4..932d1f2b700eab3262179ecb4478f93d6cb60bc7 100644 (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())
index 1b76650a7f9dcc5eb5314d0b5b60fcda18dbb7b1..3051341b6a6edca97550bca048c17c8c93ddcf82 100644 (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)
index 9cc68d610f4797abf0fe5914c959c64b2f9facfc..a6a7d84c3b4a9e0d362b0ae57b759b90850172ba 100644 (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
index ebcbe658207308fc60a17794cbfee1ff1a065268..21b1758af90cab125171f059f2e38b8bc996a3eb 100644 (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.