]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: evaluate itabname during walk instead of SSA
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 28 Mar 2017 20:52:33 +0000 (13:52 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 1 Apr 2017 00:08:31 +0000 (00:08 +0000)
For backend concurrency safety. Follow-up to CL 38721.

This does introduce a Nodes where there wasn't one before,
but these are so rare that the performance impact is negligible.

Does not pass toolstash-check, but the only change is line numbers,
and the new line numbers appear preferable.

Updates #15756

name       old alloc/op    new alloc/op    delta
Template      39.9MB ± 0%     39.9MB ± 0%    ~     (p=0.841 n=5+5)
Unicode       29.8MB ± 0%     29.8MB ± 0%    ~     (p=0.690 n=5+5)
GoTypes        113MB ± 0%      113MB ± 0%  +0.09%  (p=0.008 n=5+5)
SSA            854MB ± 0%      855MB ± 0%    ~     (p=0.222 n=5+5)
Flate         25.3MB ± 0%     25.3MB ± 0%    ~     (p=0.690 n=5+5)
GoParser      31.8MB ± 0%     31.9MB ± 0%    ~     (p=0.421 n=5+5)
Reflect       78.2MB ± 0%     78.3MB ± 0%    ~     (p=0.548 n=5+5)
Tar           26.7MB ± 0%     26.7MB ± 0%    ~     (p=0.690 n=5+5)
XML           42.3MB ± 0%     42.3MB ± 0%    ~     (p=0.222 n=5+5)

name       old allocs/op   new allocs/op   delta
Template        391k ± 1%       391k ± 0%    ~     (p=0.841 n=5+5)
Unicode         320k ± 0%       320k ± 0%    ~     (p=0.841 n=5+5)
GoTypes        1.14M ± 0%      1.14M ± 0%  +0.26%  (p=0.008 n=5+5)
SSA            7.60M ± 0%      7.60M ± 0%    ~     (p=0.548 n=5+5)
Flate           234k ± 0%       234k ± 1%    ~     (p=1.000 n=5+5)
GoParser        316k ± 1%       317k ± 0%    ~     (p=0.841 n=5+5)
Reflect         979k ± 0%       980k ± 0%    ~     (p=0.690 n=5+5)
Tar             251k ± 1%       251k ± 0%    ~     (p=0.595 n=5+5)
XML             394k ± 0%       393k ± 0%    ~     (p=0.222 n=5+5)

Change-Id: I237ae5502db4560f78ce021dc62f6d289797afd6
Reviewed-on: https://go-review.googlesource.com/39197
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/walk.go

index e5f1beb0ce541f63019ce8a627307842d06b4ebf..c21422ac6504f416ab8989f7d5e025d22c48f5ec 100644 (file)
@@ -4076,7 +4076,7 @@ func (s *state) dottype(n *Node, commaok bool) (res, resok *ssa.Value) {
                targetITab = target
        } else {
                // Looking for pointer to itab for target type and source interface.
-               targetITab = s.expr(itabname(n.Type, n.Left.Type))
+               targetITab = s.expr(n.List.First())
        }
 
        var tmp *Node       // temporary for use with large types
index 214844f55b1fa02248aec6e9f5b7462c3b164644..db409900b3621b5eaf87ebf7c9697fefc8b21854 100644 (file)
@@ -521,6 +521,9 @@ opswitch:
                if n.Op == ODOTTYPE {
                        n.Right.Right = typename(n.Left.Type)
                }
+               if !n.Type.IsInterface() && !n.Left.Type.IsEmptyInterface() {
+                       n.List.Set1(itabname(n.Type, n.Left.Type))
+               }
 
        case ODOTPTR:
                usefield(n)