Commit 080e2d43 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 93c5fbf3
......@@ -1014,13 +1014,12 @@ func unlinkedprog(as obj.As) *obj.Prog {
// Construct a new PCDATA instruction associated with and for the purposes of
// covering an existing instruction.
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.Lineno = prog.Lineno
Naddr(&pcdata.From, &from)
Naddr(&pcdata.To, &to)
pcdata.From.Type = obj.TYPE_CONST
pcdata.From.Offset = obj.PCDATA_StackMapIndex
pcdata.To.Type = obj.TYPE_CONST
pcdata.To.Offset = int64(index)
return pcdata
}
......
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