Commit 80968819 authored by Shahar Kohanim's avatar Shahar Kohanim Committed by Brad Fitzpatrick

cmd/link: batch allocations of Lsym

Reduces best of 10 linking of cmd/go by ~5%

Change-Id: If673b877ee12595dae517d7eb48430451e5cadba
Reviewed-on: https://go-review.googlesource.com/20060Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent e0b04fa5
......@@ -158,6 +158,7 @@ type Link struct {
Nhistfile int32
Filesyms *LSym
Moduledata *LSym
LSymBatch []LSym
}
// The smallest possible offset from the hardware stack pointer to a local
......
......@@ -157,8 +157,12 @@ func linknew(arch *LinkArch) *Link {
}
func linknewsym(ctxt *Link, symb string, v int) *LSym {
s := new(LSym)
*s = LSym{}
batch := ctxt.LSymBatch
if len(batch) == 0 {
batch = make([]LSym, 1000)
}
s := &batch[0]
ctxt.LSymBatch = batch[1:]
s.Dynid = -1
s.Plt = -1
......
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