]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: add reusable []Location to ssa.Config
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 27 Jan 2017 20:01:05 +0000 (12:01 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 2 Feb 2017 22:39:32 +0000 (22:39 +0000)
name       old time/op      new time/op      delta
Template        218ms ± 3%       214ms ± 3%  -1.70%  (p=0.000 n=30+30)
Unicode         100ms ± 3%       100ms ± 4%    ~     (p=0.614 n=29+30)
GoTypes         657ms ± 1%       660ms ± 3%  +0.46%  (p=0.046 n=29+30)
Compiler        2.80s ± 2%       2.80s ± 1%    ~     (p=0.451 n=28+29)
Flate           131ms ± 2%       132ms ± 4%    ~     (p=1.000 n=29+29)
GoParser        159ms ± 3%       160ms ± 5%    ~     (p=0.341 n=28+30)
Reflect         406ms ± 3%       408ms ± 4%    ~     (p=0.511 n=28+30)
Tar             118ms ± 4%       118ms ± 4%    ~     (p=0.827 n=29+30)
XML             222ms ± 6%       222ms ± 3%    ~     (p=0.532 n=30+30)

name       old user-ns/op   new user-ns/op   delta
Template   274user-ms ± 3%  272user-ms ± 3%  -0.87%  (p=0.015 n=29+30)
Unicode    140user-ms ± 4%  140user-ms ± 3%    ~     (p=0.735 n=29+30)
GoTypes    890user-ms ± 1%  897user-ms ± 2%  +0.88%  (p=0.002 n=29+30)
Compiler   3.88user-s ± 2%  3.89user-s ± 1%    ~     (p=0.132 n=30+29)
Flate      168user-ms ± 2%  157user-ms ± 4%  -6.21%  (p=0.000 n=25+28)
GoParser   211user-ms ± 2%  213user-ms ± 5%    ~     (p=0.086 n=28+30)
Reflect    539user-ms ± 2%  541user-ms ± 3%    ~     (p=0.267 n=27+29)
Tar        156user-ms ± 7%  155user-ms ± 5%    ~     (p=0.708 n=30+30)
XML        291user-ms ± 5%  294user-ms ± 3%  +0.83%  (p=0.029 n=29+30)

name       old alloc/op     new alloc/op     delta
Template       40.7MB ± 0%      39.4MB ± 0%  -3.26%  (p=0.000 n=29+26)
Unicode        30.8MB ± 0%      30.7MB ± 0%  -0.40%  (p=0.000 n=28+30)
GoTypes         123MB ± 0%       119MB ± 0%  -3.47%  (p=0.000 n=30+29)
Compiler        472MB ± 0%       455MB ± 0%  -3.60%  (p=0.000 n=30+30)
Flate          26.5MB ± 0%      25.6MB ± 0%  -3.21%  (p=0.000 n=28+30)
GoParser       32.3MB ± 0%      31.4MB ± 0%  -2.98%  (p=0.000 n=29+30)
Reflect        84.4MB ± 0%      82.1MB ± 0%  -2.83%  (p=0.000 n=30+30)
Tar            27.3MB ± 0%      26.5MB ± 0%  -2.70%  (p=0.000 n=29+29)
XML            44.6MB ± 0%      43.1MB ± 0%  -3.49%  (p=0.000 n=30+30)

name       old allocs/op    new allocs/op    delta
Template         401k ± 1%        399k ± 0%  -0.35%  (p=0.000 n=30+28)
Unicode          331k ± 0%        331k ± 1%    ~     (p=0.907 n=28+30)
GoTypes         1.24M ± 0%       1.23M ± 0%  -0.43%  (p=0.000 n=30+30)
Compiler        4.26M ± 0%       4.25M ± 0%  -0.34%  (p=0.000 n=29+30)
Flate            252k ± 1%        251k ± 1%  -0.41%  (p=0.000 n=30+30)
GoParser         325k ± 1%        324k ± 1%  -0.31%  (p=0.000 n=27+30)
Reflect         1.06M ± 0%       1.05M ± 0%  -0.69%  (p=0.000 n=30+30)
Tar              266k ± 1%        265k ± 1%  -0.51%  (p=0.000 n=29+30)
XML              416k ± 1%        415k ± 1%  -0.36%  (p=0.002 n=30+30)

Change-Id: I8f784001324df83b2764c44f0e83a540e5beab34
Reviewed-on: https://go-review.googlesource.com/36212
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssa/regalloc.go

index 1cf05ef1cdd5a440e688ce85bfc50c255c22f850..ae99e3f31d01a80baf8c498487be2735ed3a0627 100644 (file)
@@ -51,6 +51,7 @@ type Config struct {
        // Storage for low-numbered values and blocks.
        values [2000]Value
        blocks [200]Block
+       locs   [2000]Location
 
        // Reusable stackAllocState.
        // See stackalloc.go's {new,put}StackAllocState.
index e931f2285b75788120e9be1be94ebf32e481d63f..3f3c0d6888900e166aea1b852a8c1cbeff7f74c9 100644 (file)
@@ -438,6 +438,16 @@ func (f *Func) Free() {
                f.Config.blocks[i].ID = ID(i)
        }
 
+       // Clear locs.
+       n = len(f.RegAlloc)
+       if n > len(f.Config.locs) {
+               n = len(f.Config.locs)
+       }
+       head := f.Config.locs[:n]
+       for i := range head {
+               head[i] = nil
+       }
+
        // Unregister from config.
        if f.Config.curFunc != f {
                f.Fatalf("free of function which isn't the last one allocated")
index 1f8092e4b9d954c8807d9e19b09187071d7982a5..aac950a76b9ce5475cea59126f35dd476006441d 100644 (file)
@@ -476,6 +476,7 @@ func isLeaf(f *Func) bool {
 
 func (s *regAllocState) init(f *Func) {
        s.f = f
+       s.f.RegAlloc = s.f.Config.locs[:0]
        s.registers = f.Config.registers
        if nr := len(s.registers); nr == 0 || nr > int(noRegister) || nr > int(unsafe.Sizeof(regMask(0))*8) {
                s.f.Fatalf("bad number of registers: %d", nr)