1. 28 Mar, 2017 7 commits
    • Ilya Tocar's avatar
      test/fixedbugs: add a test for 19201 · 4b50c813
      Ilya Tocar authored
      This was cherry-picked to 1.8 as CL 38587, but on master issue was fixed
      by CL 37661. Add still relevant part (test) and close issue, since test passes.
      
      Fixes #19201
      
      Change-Id: I6415792e2c465dc6d9bd6583ba1e54b107bcf5cc
      Reviewed-on: https://go-review.googlesource.com/37376
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      4b50c813
    • Josh Bleecher Snyder's avatar
      cmd/compile: fix two instances of { lineno = ...; yyerror } · 95bfd927
      Josh Bleecher Snyder authored
      Updates #19683
      
      Change-Id: Ic00d5a9807200791cf37553f4f802dbf27beea19
      Reviewed-on: https://go-review.googlesource.com/38770
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      95bfd927
    • Josh Bleecher Snyder's avatar
      cmd/compile: number autotmps per-func, not per-package · b87fcc6e
      Josh Bleecher Snyder authored
      Prior to this CL, autotmps were global to a package.
      They also shared numbering with static variables.
      Switch autotmp numbering to be per-function instead,
      and do implicit numbering based on len(Func.Dcl).
      This eliminates a dependency on a global variable
      from the backend without adding to the Func struct.
      While we're here, move statuniqgen closer to its
      sole remaining user.
      
      This actually improves compiler performance,
      because the autotmp_* names can now be
      reused across functions.
      
      name       old alloc/op    new alloc/op    delta
      Template      40.6MB ± 0%     40.1MB ± 0%  -1.38%  (p=0.000 n=10+10)
      Unicode       29.9MB ± 0%     29.9MB ± 0%    ~     (p=0.912 n=10+10)
      GoTypes        116MB ± 0%      114MB ± 0%  -1.53%  (p=0.000 n=10+10)
      SSA            865MB ± 0%      856MB ± 0%  -1.04%  (p=0.000 n=10+10)
      Flate         25.8MB ± 0%     25.4MB ± 0%  -1.36%  (p=0.000 n=10+10)
      GoParser      32.2MB ± 0%     32.0MB ± 0%  -0.72%  (p=0.000 n=10+10)
      Reflect       80.3MB ± 0%     79.0MB ± 0%  -1.65%  (p=0.000 n=9+10)
      Tar           27.0MB ± 0%     26.7MB ± 0%  -0.86%  (p=0.000 n=10+9)
      XML           42.8MB ± 0%     42.4MB ± 0%  -0.95%  (p=0.000 n=10+10)
      
      name       old allocs/op   new allocs/op   delta
      Template        398k ± 1%       396k ± 1%  -0.59%  (p=0.002 n=10+10)
      Unicode         321k ± 1%       321k ± 0%    ~     (p=0.912 n=10+10)
      GoTypes        1.17M ± 0%      1.16M ± 0%  -0.77%  (p=0.000 n=10+10)
      SSA            7.65M ± 0%      7.62M ± 0%  -0.40%  (p=0.000 n=10+10)
      Flate           240k ± 1%       238k ± 1%  -0.56%  (p=0.001 n=10+10)
      GoParser        323k ± 1%       320k ± 1%  -0.65%  (p=0.002 n=10+10)
      Reflect        1.01M ± 0%      1.00M ± 0%  -0.37%  (p=0.001 n=9+10)
      Tar             256k ± 1%       255k ± 0%    ~     (p=0.101 n=10+8)
      XML             400k ± 1%       398k ± 1%    ~     (p=0.063 n=10+10)
      
      
      Change-Id: I3c23ca98129137d373106990b1a3e1507bbe0cc3
      Reviewed-on: https://go-review.googlesource.com/38729
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      b87fcc6e
    • Josh Bleecher Snyder's avatar
      cmd/compile: strengthen SetFields/Width safety guarantee · 8ee2d5bc
      Josh Bleecher Snyder authored
      It is currently possible in the compiler to create a struct type,
      calculate the widths of types that depend on it,
      and then alter the struct type.
      
      transformclosure has local protection against this.
      Protect against it at a deeper level.
      
      This is preparation to call dowidth automatically,
      rather than explicitly.
      
      This is a re-roll of CL 38469.
      
      Change-Id: Ic5b4baa250618504611fc57cbf51ab01d1eddf80
      Reviewed-on: https://go-review.googlesource.com/38534
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      8ee2d5bc
    • Josh Bleecher Snyder's avatar
      cmd/compile: add Type.WidthCalculated · 8dafdb1b
      Josh Bleecher Snyder authored
      Prior to this CL, Type.Width != 0 was the mark
      of a Type whose Width had been calculated.
      As a result, dowidth always recalculated
      the width of struct{}.
      This, combined with the prohibition on calculating
      the width of a FuncArgsStruct and the use of
      struct{} as a function argument,
      meant that there were circumstances in which
      it was forbidden to call dowidth on a type.
      This inhibits refactoring to call dowidth automatically,
      rather than explicitly.
      Instead add a helper method, Type.WidthCalculated,
      and implement as Type.Align > 0.
      Type.Width is not a good candidate for tracking
      whether the width has been calculated;
      0 is a value type width, and Width is subject to
      too much magic value game-playing.
      
      For good measure, add a test for #11354.
      
      Change-Id: Ie9a9fb5d924e7a2010c1904ae5e38ed4a38eaeb2
      Reviewed-on: https://go-review.googlesource.com/38468
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      8dafdb1b
    • haya14busa's avatar
      regexp: reduce allocations at onePassCopy · f5c1926e
      haya14busa authored
      It reduces needless allocations on compiling onepass regex.
      
      name                                      old time/op    new time/op    delta
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-4    6.31µs ± 3%    6.11µs ± 3%     ~     (p=0.056 n=5+5)
      CompileOnepass/^abcd$-4                     5.69µs ±12%    4.93µs ± 4%  -13.42%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a{0,})*?)$-4          7.10µs ±12%    5.82µs ± 5%  -17.95%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a+)*)$-4              5.99µs ±10%    6.07µs ±11%     ~     (p=1.000 n=5+5)
      CompileOnepass/^(?:(?:a|(?:aa)))$-4         7.36µs ± 4%    7.81µs ±19%     ~     (p=0.310 n=5+5)
      CompileOnepass/^(?:[^\s\S])$-4              4.71µs ± 3%    4.71µs ± 5%     ~     (p=1.000 n=5+5)
      CompileOnepass/^(?:(?:(?:a*)+))$-4          6.06µs ± 2%    6.23µs ± 9%     ~     (p=0.310 n=5+5)
      CompileOnepass/^[a-c]+$-4                   4.74µs ± 4%    4.64µs ± 6%     ~     (p=0.421 n=5+5)
      CompileOnepass/^[a-c]*$-4                   5.17µs ± 2%    4.68µs ± 0%   -9.57%  (p=0.016 n=5+4)
      CompileOnepass/^(?:a*)$-4                   5.34µs ± 3%    5.08µs ±12%     ~     (p=0.151 n=5+5)
      CompileOnepass/^(?:(?:aa)|a)$-4             7.24µs ± 5%    7.33µs ±12%     ~     (p=0.841 n=5+5)
      CompileOnepass/^...$-4                      5.28µs ± 3%    4.99µs ± 9%     ~     (p=0.095 n=5+5)
      CompileOnepass/^(?:a|(?:aa))$-4             7.20µs ± 4%    7.24µs ±10%     ~     (p=0.841 n=5+5)
      CompileOnepass/^a((b))c$-4                  7.99µs ± 3%    7.76µs ± 8%     ~     (p=0.151 n=5+5)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-4          8.30µs ± 5%    7.29µs ± 4%  -12.08%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))$-4                   7.34µs ± 4%    7.24µs ±19%     ~     (p=0.690 n=5+5)
      CompileOnepass/^a(?:(b)|(c))c$-4            9.80µs ± 6%    9.49µs ±18%     ~     (p=0.151 n=5+5)
      CompileOnepass/^a(?:b|c)$-4                 5.23µs ± 3%    4.80µs ±10%     ~     (p=0.056 n=5+5)
      CompileOnepass/^a(?:b?|c)$-4                8.26µs ± 3%    7.30µs ± 3%  -11.62%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c+)$-4               9.18µs ± 2%    8.16µs ± 2%  -11.06%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:bc)+$-4                 6.16µs ± 3%    6.41µs ±13%     ~     (p=0.548 n=5+5)
      CompileOnepass/^a(?:[bcd])+$-4              5.75µs ± 5%    5.50µs ±12%     ~     (p=0.151 n=5+5)
      CompileOnepass/^a((?:[bcd])+)$-4            7.65µs ± 5%    6.93µs ± 9%     ~     (p=0.056 n=5+5)
      CompileOnepass/^a(:?b|c)*d$-4               13.0µs ± 1%    12.1µs ± 2%   -6.91%  (p=0.008 n=5+5)
      CompileOnepass/^.bc(d|e)*$-4                9.20µs ± 4%    8.25µs ± 3%  -10.38%  (p=0.008 n=5+5)
      CompileOnepass/^loooooooooooooooooo...-4     254µs ± 2%     220µs ± 6%  -13.47%  (p=0.008 n=5+5)
      
      name                                      old alloc/op   new alloc/op   delta
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-4    3.92kB ± 0%    3.41kB ± 0%  -13.06%  (p=0.008 n=5+5)
      CompileOnepass/^abcd$-4                     3.20kB ± 0%    2.75kB ± 0%  -14.00%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a{0,})*?)$-4          3.85kB ± 0%    3.34kB ± 0%  -13.31%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a+)*)$-4              3.46kB ± 0%    2.95kB ± 0%  -14.78%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a|(?:aa)))$-4         4.20kB ± 0%    3.75kB ± 0%  -10.67%  (p=0.008 n=5+5)
      CompileOnepass/^(?:[^\s\S])$-4              3.10kB ± 0%    2.46kB ± 0%  -20.62%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:(?:a*)+))$-4          3.64kB ± 0%    3.13kB ± 0%  -14.07%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]+$-4                   3.06kB ± 0%    2.48kB ± 0%  -18.85%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]*$-4                   3.10kB ± 0%    2.52kB ± 0%  -18.60%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a*)$-4                   3.21kB ± 0%    2.63kB ± 0%  -17.96%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:aa)|a)$-4             4.09kB ± 0%    3.64kB ± 0%  -10.96%  (p=0.008 n=5+5)
      CompileOnepass/^...$-4                      3.42kB ± 0%    2.91kB ± 0%  -14.95%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a|(?:aa))$-4             4.09kB ± 0%    3.64kB ± 0%  -10.96%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))c$-4                  5.67kB ± 0%    4.39kB ± 0%  -22.59%  (p=0.008 n=5+5)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-4          5.73kB ± 0%    4.32kB ± 0%  -24.58%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))$-4                   5.41kB ± 0%    4.06kB ± 0%  -24.85%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:(b)|(c))c$-4            6.40kB ± 0%    5.31kB ± 0%  -17.00%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b|c)$-4                 3.46kB ± 0%    2.88kB ± 0%  -16.67%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c)$-4                5.77kB ± 0%    4.36kB ± 0%  -24.41%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c+)$-4               5.94kB ± 0%    4.59kB ± 0%  -22.64%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:bc)+$-4                 3.60kB ± 0%    3.15kB ± 0%  -12.44%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:[bcd])+$-4              3.46kB ± 0%    2.94kB ± 0%  -14.81%  (p=0.008 n=5+5)
      CompileOnepass/^a((?:[bcd])+)$-4            5.50kB ± 0%    4.09kB ± 0%  -25.62%  (p=0.008 n=5+5)
      CompileOnepass/^a(:?b|c)*d$-4               7.24kB ± 0%    6.15kB ± 0%  -15.03%  (p=0.008 n=5+5)
      CompileOnepass/^.bc(d|e)*$-4                5.75kB ± 0%    4.47kB ± 0%  -22.25%  (p=0.008 n=5+5)
      CompileOnepass/^loooooooooooooooooo...-4     225kB ± 0%     135kB ± 0%  -39.99%  (p=0.008 n=5+5)
      
      name                                      old allocs/op  new allocs/op  delta
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-4      52.0 ± 0%      49.0 ± 0%   -5.77%  (p=0.008 n=5+5)
      CompileOnepass/^abcd$-4                       44.0 ± 0%      41.0 ± 0%   -6.82%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a{0,})*?)$-4            52.0 ± 0%      49.0 ± 0%   -5.77%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a+)*)$-4                47.0 ± 0%      44.0 ± 0%   -6.38%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a|(?:aa)))$-4           57.0 ± 0%      54.0 ± 0%   -5.26%  (p=0.008 n=5+5)
      CompileOnepass/^(?:[^\s\S])$-4                36.0 ± 0%      33.0 ± 0%   -8.33%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:(?:a*)+))$-4            49.0 ± 0%      46.0 ± 0%   -6.12%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]+$-4                     39.0 ± 0%      36.0 ± 0%   -7.69%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]*$-4                     44.0 ± 0%      41.0 ± 0%   -6.82%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a*)$-4                     45.0 ± 0%      42.0 ± 0%   -6.67%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:aa)|a)$-4               56.0 ± 0%      53.0 ± 0%   -5.36%  (p=0.008 n=5+5)
      CompileOnepass/^...$-4                        46.0 ± 0%      43.0 ± 0%   -6.52%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a|(?:aa))$-4               56.0 ± 0%      53.0 ± 0%   -5.36%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))c$-4                    57.0 ± 0%      53.0 ± 0%   -7.02%  (p=0.008 n=5+5)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-4            62.0 ± 0%      58.0 ± 0%   -6.45%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))$-4                     51.0 ± 0%      47.0 ± 0%   -7.84%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:(b)|(c))c$-4              69.0 ± 0%      65.0 ± 0%   -5.80%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b|c)$-4                   43.0 ± 0%      40.0 ± 0%   -6.98%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c)$-4                  61.0 ± 0%      57.0 ± 0%   -6.56%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c+)$-4                 67.0 ± 0%      63.0 ± 0%   -5.97%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:bc)+$-4                   49.0 ± 0%      46.0 ± 0%   -6.12%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:[bcd])+$-4                46.0 ± 0%      43.0 ± 0%   -6.52%  (p=0.008 n=5+5)
      CompileOnepass/^a((?:[bcd])+)$-4              53.0 ± 0%      49.0 ± 0%   -7.55%  (p=0.008 n=5+5)
      CompileOnepass/^a(:?b|c)*d$-4                  109 ± 0%       105 ± 0%   -3.67%  (p=0.008 n=5+5)
      CompileOnepass/^.bc(d|e)*$-4                  66.0 ± 0%      62.0 ± 0%   -6.06%  (p=0.008 n=5+5)
      CompileOnepass/^loooooooooooooooooo...-4     1.10k ± 0%     1.09k ± 0%   -0.91%  (p=0.008 n=5+5)
      
      Fixes #19735
      
      Change-Id: Ic68503aaa08e42fafcf7e11cf1f584d674f5ea7b
      Reviewed-on: https://go-review.googlesource.com/38750Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f5c1926e
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: eliminate stray ctxt.Cursym write · aca58647
      Josh Bleecher Snyder authored
      It is explicitly assigned in each of the
      assemblers as needed.
      I plan to remove Cursym entirely eventually,
      but this is a helpful intermediate step.
      
      Passes toolstash-check -all.
      
      Updates #15756
      
      Change-Id: Id7ddefae2def439af44d03053886ca8cc935731f
      Reviewed-on: https://go-review.googlesource.com/38727
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      aca58647
  2. 27 Mar, 2017 11 commits
  3. 26 Mar, 2017 7 commits
  4. 25 Mar, 2017 7 commits
  5. 24 Mar, 2017 8 commits