]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: move function only lsym fields to pcln struct
authorShahar Kohanim <skohanim@gmail.com>
Mon, 11 Apr 2016 19:19:34 +0000 (22:19 +0300)
committerIan Lance Taylor <iant@golang.org>
Wed, 13 Apr 2016 00:23:45 +0000 (00:23 +0000)
name       old secs    new secs    delta
LinkCmdGo   0.53 ± 9%   0.53 ±10%  -1.30%  (p=0.022 n=100+99)

name       old MaxRSS  new MaxRSS  delta
LinkCmdGo   151k ± 4%   142k ± 6%  -5.92%  (p=0.000 n=98+100)

Change-Id: Ic30e63a948f8e626b3396f458a0163f7234810c1
Reviewed-on: https://go-review.googlesource.com/21920
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/link.go
src/cmd/link/internal/ld/objfile.go
src/cmd/link/internal/ld/pcln.go

index 8b2d0d447e2e084f146f71fbed6f48d8de3ea653..83e4cdc07704c4ffd4ab4baac4fb54ed88c3db2b 100644 (file)
@@ -272,9 +272,12 @@ func (d *deadcodepass) flood() {
                        if Debug['v'] > 1 {
                                fmt.Fprintf(d.ctxt.Bso, "marktext %s\n", s.Name)
                        }
-                       for _, a := range s.Autom {
-                               d.mark(a.Gotype, s)
+                       if s.Pcln != nil {
+                               for _, a := range s.Pcln.Autom {
+                                       d.mark(a.Gotype, s)
+                               }
                        }
+
                }
 
                if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' {
index a3a931f94c6459c97fe52256c2696e45ecba91ec..82689988c5828412208ea831eb73672cd853fa8d 100644 (file)
@@ -1556,7 +1556,7 @@ func writelines(prev *LSym) *LSym {
                        dt, da int
                        offs   int64
                )
-               for _, a := range s.Autom {
+               for _, a := range s.Pcln.Autom {
                        switch a.Name {
                        case obj.A_AUTO:
                                dt = DW_ABRV_AUTO
index 1f2df8b9c545b76c2fb241a0796573e914881925..db34e68404ccc042785e8e756c44c3d6bbbe25dd 100644 (file)
@@ -1747,7 +1747,11 @@ func stkcheck(up *Chain, depth int) int {
                        return 0
                }
                // Raise limit to allow frame.
-               limit = int(obj.StackLimit+s.Locals) + int(Ctxt.FixedFrameSize())
+               locals := int32(0)
+               if s.Pcln != nil {
+                       locals = s.Pcln.Locals
+               }
+               limit = int(obj.StackLimit+locals) + int(Ctxt.FixedFrameSize())
        }
 
        // Walk through sp adjustments in function, consuming relocs.
@@ -1978,10 +1982,17 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
        for s := Ctxt.Textp; s != nil; s = s.Next {
                put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), s.Gotype)
 
+               locals := int32(0)
+               if s.Pcln != nil {
+                       locals = s.Pcln.Locals
+               }
                // NOTE(ality): acid can't produce a stack trace without .frame symbols
-               put(nil, ".frame", 'm', int64(s.Locals)+int64(SysArch.PtrSize), 0, 0, nil)
+               put(nil, ".frame", 'm', int64(locals)+int64(SysArch.PtrSize), 0, 0, nil)
 
-               for _, a := range s.Autom {
+               if s.Pcln == nil {
+                       continue
+               }
+               for _, a := range s.Pcln.Autom {
                        // Emit a or p according to actual offset, even if label is wrong.
                        // This avoids negative offsets, which cannot be encoded.
                        if a.Name != obj.A_AUTO && a.Name != obj.A_PARAM {
index 52b52f1cc009b8cb94e57f1b158fc647eae84a85..93454fb4b2d292435e5e6d873fca468ce502861f 100644 (file)
@@ -50,8 +50,6 @@ type LSym struct {
        Align       int32
        Elfsym      int32
        LocalElfsym int32
-       Args        int32
-       Locals      int32
        Value       int64
        Size        int64
        // ElfType is set for symbols read from shared libraries by ldshlibsyms. It
@@ -67,7 +65,6 @@ type LSym struct {
        Dynimplib   string
        Dynimpvers  string
        Sect        *Section
-       Autom       []Auto
        Pcln        *Pcln
        P           []byte
        R           []Reloc
@@ -221,6 +218,9 @@ type Library struct {
 }
 
 type Pcln struct {
+       Args        int32
+       Locals      int32
+       Autom       []Auto
        Pcsp        Pcdata
        Pcfile      Pcdata
        Pcline      Pcdata
index 578afd4c74ea6cbe8a6cd099c48a56bb0c2c3f4b..eacccb59fb93f3b46043ce6a90c28f51b5ee45bb 100644 (file)
@@ -331,8 +331,11 @@ overwrite:
        }
 
        if s.Type == obj.STEXT {
-               s.Args = r.readInt32()
-               s.Locals = r.readInt32()
+               s.Pcln = new(Pcln)
+               pc := s.Pcln
+
+               pc.Args = r.readInt32()
+               pc.Locals = r.readInt32()
                if r.readUint8() != 0 {
                        s.Attr |= AttrNoSplit
                }
@@ -341,13 +344,13 @@ overwrite:
                        s.Attr |= AttrReflectMethod
                }
                n := r.readInt()
-               s.Autom = r.autom[:n:n]
+               pc.Autom = r.autom[:n:n]
                if !isdup {
                        r.autom = r.autom[n:]
                }
 
                for i := 0; i < n; i++ {
-                       s.Autom[i] = Auto{
+                       pc.Autom[i] = Auto{
                                Asym:    r.readSymIndex(),
                                Aoffset: r.readInt32(),
                                Name:    r.readInt16(),
@@ -355,8 +358,6 @@ overwrite:
                        }
                }
 
-               s.Pcln = new(Pcln)
-               pc := s.Pcln
                pc.Pcsp.P = r.readData()
                pc.Pcfile.P = r.readData()
                pc.Pcline.P = r.readData()
index 9a947c7c07535b52805ecfa2188bad58c18b5dd4..3ef52444afbaf989e799e49bf55380fb6b8d7c8b 100644 (file)
@@ -293,7 +293,11 @@ func pclntab() {
 
                // args int32
                // TODO: Move into funcinfo.
-               off = int32(setuint32(Ctxt, ftab, int64(off), uint32(Ctxt.Cursym.Args)))
+               args := uint32(0)
+               if Ctxt.Cursym.Pcln != nil {
+                       args = uint32(Ctxt.Cursym.Pcln.Args)
+               }
+               off = int32(setuint32(Ctxt, ftab, int64(off), args))
 
                // frame int32
                // This has been removed (it was never set quite correctly anyway).