mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: Use bitfield for LSym attributes
Reduces the size of LSym struct. On 32bit: before 84 after 76 On 64bit: before 136 after 128 name old time/op new time/op delta Template 182ms ± 3% 182ms ± 3% ~ (p=0.607 n=19+20) Unicode 93.5ms ± 4% 94.2ms ± 3% ~ (p=0.141 n=20+19) GoTypes 608ms ± 1% 605ms ± 2% ~ (p=0.056 n=20+20) name old user-ns/op new user-ns/op delta Template 249M ± 7% 249M ± 4% ~ (p=0.605 n=18+19) Unicode 149M ±14% 151M ± 5% ~ (p=0.724 n=20+17) GoTypes 855M ± 4% 853M ± 3% ~ (p=0.537 n=19+19) name old alloc/op new alloc/op delta Template 40.3MB ± 0% 40.3MB ± 0% -0.11% (p=0.000 n=19+20) Unicode 33.8MB ± 0% 33.8MB ± 0% -0.08% (p=0.000 n=20+20) GoTypes 119MB ± 0% 119MB ± 0% -0.10% (p=0.000 n=19+20) name old allocs/op new allocs/op delta Template 383k ± 0% 383k ± 0% ~ (p=0.703 n=20+20) Unicode 317k ± 0% 317k ± 0% ~ (p=0.982 n=19+18) GoTypes 1.14M ± 0% 1.14M ± 0% ~ (p=0.086 n=20+20) Change-Id: Id6ba0db3ecc4503a4e9af3ed0d5884d4366e8bf9 Reviewed-on: https://go-review.googlesource.com/31870 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Shahar Kohanim <skohanim@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
2ee82edfc2
commit
d391dc260a
16 changed files with 134 additions and 109 deletions
|
|
@ -314,7 +314,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
|||
}
|
||||
|
||||
if cursym.Text.Mark&LEAF != 0 {
|
||||
cursym.Leaf = true
|
||||
cursym.Set(obj.AttrLeaf, true)
|
||||
break
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +559,7 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog {
|
|||
p.From.Type = obj.TYPE_MEM
|
||||
p.From.Reg = REGG
|
||||
p.From.Offset = 2 * int64(ctxt.Arch.PtrSize) // G.stackguard0
|
||||
if ctxt.Cursym.Cfunc {
|
||||
if ctxt.Cursym.CFunc() {
|
||||
p.From.Offset = 3 * int64(ctxt.Arch.PtrSize) // G.stackguard1
|
||||
}
|
||||
p.To.Type = obj.TYPE_REG
|
||||
|
|
@ -689,7 +689,7 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog {
|
|||
|
||||
p.As = AJAL
|
||||
p.To.Type = obj.TYPE_BRANCH
|
||||
if ctxt.Cursym.Cfunc {
|
||||
if ctxt.Cursym.CFunc() {
|
||||
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
||||
} else if ctxt.Cursym.Text.From3.Offset&obj.NEEDCTXT == 0 {
|
||||
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue