mirror of
https://github.com/golang/go
synced 2024-11-24 13:00:15 -07:00
cmd/compile: don’t generate Nodes for PCDATA
We were allocating two Nodes just to help Naddr fill in Type and Offset. Fill them in directly instead. Passes toolstash -cmp. name old time/op new time/op delta Template 324ms ± 5% 320ms ± 5% -1.34% (p=0.033 n=25+22) Unicode 164ms ± 6% 162ms ± 5% ~ (p=0.152 n=24+23) GoTypes 1.05s ± 5% 1.05s ± 6% ~ (p=0.653 n=23+25) Compiler 5.12s ± 4% 5.06s ± 3% -1.13% (p=0.006 n=25+23) MakeBash 41.8s ± 2% 41.6s ± 3% -0.65% (p=0.024 n=24+24) name old alloc/op new alloc/op delta Template 57.8MB ± 0% 57.3MB ± 0% -0.87% (p=0.000 n=25+25) Unicode 41.2MB ± 0% 41.1MB ± 0% -0.29% (p=0.000 n=24+22) GoTypes 193MB ± 0% 191MB ± 0% -0.97% (p=0.000 n=22+25) Compiler 850MB ± 0% 840MB ± 0% -1.28% (p=0.000 n=25+25) name old allocs/op new allocs/op delta Template 506k ± 0% 500k ± 0% -1.15% (p=0.000 n=25+25) Unicode 402k ± 0% 400k ± 0% -0.37% (p=0.000 n=24+25) GoTypes 1.52M ± 0% 1.50M ± 0% -1.42% (p=0.000 n=25+25) Compiler 6.16M ± 0% 6.04M ± 0% -2.05% (p=0.000 n=24+25) Change-Id: Ia80d28b32023a620d9ddf99c1252c16fa6477b3c Reviewed-on: https://go-review.googlesource.com/21174 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
93c5fbf390
commit
080e2d4320
@ -1014,13 +1014,12 @@ func unlinkedprog(as obj.As) *obj.Prog {
|
|||||||
// Construct a new PCDATA instruction associated with and for the purposes of
|
// Construct a new PCDATA instruction associated with and for the purposes of
|
||||||
// covering an existing instruction.
|
// covering an existing instruction.
|
||||||
func newpcdataprog(prog *obj.Prog, index int32) *obj.Prog {
|
func newpcdataprog(prog *obj.Prog, index int32) *obj.Prog {
|
||||||
var from, to Node
|
|
||||||
Nodconst(&from, Types[TINT32], obj.PCDATA_StackMapIndex)
|
|
||||||
Nodconst(&to, Types[TINT32], int64(index))
|
|
||||||
pcdata := unlinkedprog(obj.APCDATA)
|
pcdata := unlinkedprog(obj.APCDATA)
|
||||||
pcdata.Lineno = prog.Lineno
|
pcdata.Lineno = prog.Lineno
|
||||||
Naddr(&pcdata.From, &from)
|
pcdata.From.Type = obj.TYPE_CONST
|
||||||
Naddr(&pcdata.To, &to)
|
pcdata.From.Offset = obj.PCDATA_StackMapIndex
|
||||||
|
pcdata.To.Type = obj.TYPE_CONST
|
||||||
|
pcdata.To.Offset = int64(index)
|
||||||
return pcdata
|
return pcdata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user