]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link,runtime: remove unused fields from inlinedCall
authorMichael Pratt <mpratt@google.com>
Fri, 2 Sep 2022 20:50:41 +0000 (16:50 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 6 Sep 2022 22:23:43 +0000 (22:23 +0000)
The parent, file, and line fields are no longer used now that we have
parentPc to find the parent and NOPs in the parent to attach file/line
pcdata to.

Removing these fields reduces the binary size of cmd/go on linux-amd64
by 1.1%.

Fixes #54849.

Change-Id: If58f08622736b2b322288608776f8bedf0c3fd17
Reviewed-on: https://go-review.googlesource.com/c/go/+/427960
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/link/internal/ld/pcln.go
src/runtime/symtab.go

index 45a4e07fb74a1c57c5aaed50acabddf8355da503..9b743a853050c453c31138f77be5123fc1eedabb 100644 (file)
@@ -162,26 +162,22 @@ func genInlTreeSym(ctxt *Link, cu *sym.CompilationUnit, fi loader.FuncInfo, arch
        ninl := fi.NumInlTree()
        for i := 0; i < int(ninl); i++ {
                call := fi.InlTree(i)
-               val := call.File
                nameoff, ok := nameOffsets[call.Func]
                if !ok {
                        panic("couldn't find function name offset")
                }
 
-               inlTreeSym.SetUint16(arch, int64(i*20+0), uint16(call.Parent))
                inlFunc := ldr.FuncInfo(call.Func)
-
                var funcID objabi.FuncID
                if inlFunc.Valid() {
                        funcID = inlFunc.FuncID()
                }
-               inlTreeSym.SetUint8(arch, int64(i*20+2), uint8(funcID))
-
-               // byte 3 is unused
-               inlTreeSym.SetUint32(arch, int64(i*20+4), uint32(val))
-               inlTreeSym.SetUint32(arch, int64(i*20+8), uint32(call.Line))
-               inlTreeSym.SetUint32(arch, int64(i*20+12), uint32(nameoff))
-               inlTreeSym.SetUint32(arch, int64(i*20+16), uint32(call.ParentPC))
+               // Construct runtime.inlinedCall value.
+               const size = 12
+               inlTreeSym.SetUint8(arch, int64(i*size+0), uint8(funcID))
+               // Bytes 1-3 are unused.
+               inlTreeSym.SetUint32(arch, int64(i*size+4), uint32(nameoff))
+               inlTreeSym.SetUint32(arch, int64(i*size+8), uint32(call.ParentPC))
        }
        return its
 }
index 69190233a27cb0d77d813b50ded71b0eed3a5add..a1a7eba83ceb79e5d5bccccb0064818267c770de 100644 (file)
@@ -117,8 +117,7 @@ func (ci *Frames) Next() (frame Frame, more bool) {
                                // Note: entry is not modified. It always refers to a real frame, not an inlined one.
                                f = nil
                                name = funcnameFromNameoff(funcInfo, inltree[ix].func_)
-                               // File/line is already correct.
-                               // TODO: remove file/line from InlinedCall?
+                               // File/line from funcline1 below are already correct.
                        }
                }
                ci.frames = append(ci.frames, Frame{
@@ -1173,11 +1172,8 @@ func stackmapdata(stkmap *stackmap, n int32) bitvector {
 
 // inlinedCall is the encoding of entries in the FUNCDATA_InlTree table.
 type inlinedCall struct {
-       parent   int16  // index of parent in the inltree, or < 0
        funcID   funcID // type of the called function
-       _        byte
-       file     int32 // perCU file index for inlined call. See cmd/link:pcln.go
-       line     int32 // line number of the call site
+       _        [3]byte
        func_    int32 // offset into pclntab for name of called function
        parentPc int32 // position of an instruction whose source position is the call site (offset from entry)
 }