Commit b0cbe158 authored by Shahar Kohanim's avatar Shahar Kohanim Committed by Ian Lance Taylor

cmd/link: move function only lsym fields to pcln struct

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: 's avatarIan Lance Taylor <iant@golang.org>
parent a0ab6cd6
......@@ -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] != '.' {
......
......@@ -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
......
......@@ -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 {
......
......@@ -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
......
......@@ -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()
......
......@@ -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).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment