1. 17 Apr, 2017 20 commits
  2. 16 Apr, 2017 3 commits
    • Takuto Ikuta's avatar
      regexp: Use []bool instead of map[uint32]bool in makeOnePass · a306a851
      Takuto Ikuta authored
      Variable m is accessed like variable onePassRunes.
      So, we can use array instead of map for variable m.
      
      Onepass compile performance is improved 10~20%.
      
      name                                      old time/op    new time/op    delta
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-4    4.60µs ± 1%    4.10µs ± 1%  -10.98%  (p=0.008 n=5+5)
      CompileOnepass/^abcd$-4                     3.76µs ± 2%    3.33µs ± 1%  -11.43%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a{0,})*?)$-4          4.47µs ± 1%    4.14µs ± 1%   -7.49%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a+)*)$-4              4.07µs ± 1%    3.81µs ± 2%   -6.60%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a|(?:aa)))$-4         5.21µs ± 1%    4.80µs ± 2%   -7.90%  (p=0.008 n=5+5)
      CompileOnepass/^(?:[^\s\S])$-4              3.26µs ± 1%    3.06µs ± 1%   -6.15%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:(?:a*)+))$-4          4.33µs ± 0%    4.04µs ± 3%   -6.78%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]+$-4                   3.33µs ± 1%    3.06µs ± 4%   -8.24%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]*$-4                   3.69µs ± 1%    3.39µs ± 4%   -8.26%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a*)$-4                   3.78µs ± 2%    3.36µs ± 0%  -11.09%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:aa)|a)$-4             5.11µs ± 1%    4.60µs ± 1%   -9.85%  (p=0.008 n=5+5)
      CompileOnepass/^...$-4                      3.51µs ± 1%    3.25µs ± 1%   -7.37%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a|(?:aa))$-4             5.05µs ± 1%    4.59µs ± 1%   -9.13%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))c$-4                  5.24µs ± 1%    4.66µs ± 1%  -11.16%  (p=0.008 n=5+5)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-4          5.94µs ± 7%    5.02µs ± 1%  -15.62%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))$-4                   5.34µs ± 7%    4.21µs ± 2%  -21.05%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:(b)|(c))c$-4            7.25µs ± 7%    5.86µs ± 1%  -19.17%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b|c)$-4                 4.13µs ± 9%    3.35µs ± 1%  -18.99%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c)$-4                6.48µs ± 4%    5.05µs ± 1%  -22.16%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c+)$-4               7.05µs ± 7%    5.48µs ± 1%  -22.21%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:bc)+$-4                 4.71µs ± 4%    3.85µs ± 0%  -18.14%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:[bcd])+$-4              4.10µs ± 2%    3.69µs ± 1%   -9.98%  (p=0.008 n=5+5)
      CompileOnepass/^a((?:[bcd])+)$-4            5.20µs ± 1%    4.59µs ± 0%  -11.72%  (p=0.008 n=5+5)
      CompileOnepass/^a(:?b|c)*d$-4               9.29µs ± 2%    8.23µs ± 1%  -11.43%  (p=0.008 n=5+5)
      CompileOnepass/^.bc(d|e)*$-4                6.33µs ± 3%    5.51µs ± 5%  -12.95%  (p=0.008 n=5+5)
      CompileOnepass/^loooooooooooooooooo...-4     162µs ± 0%     138µs ± 2%  -14.70%  (p=0.008 n=5+5)
      
      name                                      old alloc/op   new alloc/op   delta
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-4    3.38kB ± 0%    3.27kB ± 0%   -3.08%  (p=0.008 n=5+5)
      CompileOnepass/^abcd$-4                     2.74kB ± 0%    2.59kB ± 0%   -5.54%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a{0,})*?)$-4          3.34kB ± 0%    3.23kB ± 0%   -3.12%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a+)*)$-4              2.95kB ± 0%    2.85kB ± 0%   -3.52%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a|(?:aa)))$-4         3.74kB ± 0%    3.58kB ± 0%   -4.07%  (p=0.008 n=5+5)
      CompileOnepass/^(?:[^\s\S])$-4              2.45kB ± 0%    2.35kB ± 0%   -4.20%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:(?:a*)+))$-4          3.13kB ± 0%    3.02kB ± 0%   -3.32%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]+$-4                   2.48kB ± 0%    2.38kB ± 0%   -4.19%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]*$-4                   2.52kB ± 0%    2.42kB ± 0%   -4.13%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a*)$-4                   2.63kB ± 0%    2.53kB ± 0%   -3.95%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:aa)|a)$-4             3.62kB ± 0%    3.47kB ± 0%   -4.19%  (p=0.008 n=5+5)
      CompileOnepass/^...$-4                      2.87kB ± 0%    2.78kB ± 0%   -3.34%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a|(?:aa))$-4             3.62kB ± 0%    3.47kB ± 0%   -4.19%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))c$-4                  4.38kB ± 0%    4.23kB ± 0%   -3.33%  (p=0.008 n=5+5)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-4          4.30kB ± 0%    4.15kB ± 0%   -3.35%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))$-4                   4.05kB ± 0%    3.90kB ± 0%   -3.56%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:(b)|(c))c$-4            5.30kB ± 0%    5.05kB ± 0%   -4.83%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b|c)$-4                 2.87kB ± 0%    2.77kB ± 0%   -3.62%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c)$-4                4.35kB ± 0%    4.21kB ± 0%   -3.31%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c+)$-4               4.58kB ± 0%    4.44kB ± 0%   -3.14%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:bc)+$-4                 3.15kB ± 0%    3.00kB ± 0%   -4.82%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:[bcd])+$-4              2.94kB ± 0%    2.84kB ± 0%   -3.53%  (p=0.008 n=5+5)
      CompileOnepass/^a((?:[bcd])+)$-4            4.08kB ± 0%    3.94kB ± 0%   -3.53%  (p=0.008 n=5+5)
      CompileOnepass/^a(:?b|c)*d$-4               6.10kB ± 0%    5.85kB ± 0%   -4.19%  (p=0.008 n=5+5)
      CompileOnepass/^.bc(d|e)*$-4                4.46kB ± 0%    4.31kB ± 0%   -3.28%  (p=0.008 n=5+5)
      CompileOnepass/^loooooooooooooooooo...-4     135kB ± 0%     127kB ± 0%   -5.88%  (p=0.008 n=5+5)
      
      name                                      old allocs/op  new allocs/op  delta
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-4      47.0 ± 0%      46.0 ± 0%   -2.13%  (p=0.008 n=5+5)
      CompileOnepass/^abcd$-4                       41.0 ± 0%      40.0 ± 0%   -2.44%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a{0,})*?)$-4            49.0 ± 0%      48.0 ± 0%   -2.04%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a+)*)$-4                44.0 ± 0%      43.0 ± 0%   -2.27%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:a|(?:aa)))$-4           54.0 ± 0%      53.0 ± 0%   -1.85%  (p=0.008 n=5+5)
      CompileOnepass/^(?:[^\s\S])$-4                33.0 ± 0%      32.0 ± 0%   -3.03%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:(?:a*)+))$-4            46.0 ± 0%      45.0 ± 0%   -2.17%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]+$-4                     36.0 ± 0%      35.0 ± 0%   -2.78%  (p=0.008 n=5+5)
      CompileOnepass/^[a-c]*$-4                     41.0 ± 0%      40.0 ± 0%   -2.44%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a*)$-4                     42.0 ± 0%      41.0 ± 0%   -2.38%  (p=0.008 n=5+5)
      CompileOnepass/^(?:(?:aa)|a)$-4               53.0 ± 0%      52.0 ± 0%   -1.89%  (p=0.008 n=5+5)
      CompileOnepass/^...$-4                        39.0 ± 0%      38.0 ± 0%   -2.56%  (p=0.008 n=5+5)
      CompileOnepass/^(?:a|(?:aa))$-4               53.0 ± 0%      52.0 ± 0%   -1.89%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))c$-4                    53.0 ± 0%      52.0 ± 0%   -1.89%  (p=0.008 n=5+5)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-4            56.0 ± 0%      55.0 ± 0%   -1.79%  (p=0.008 n=5+5)
      CompileOnepass/^a((b))$-4                     47.0 ± 0%      46.0 ± 0%   -2.13%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:(b)|(c))c$-4              65.0 ± 0%      64.0 ± 0%   -1.54%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b|c)$-4                   40.0 ± 0%      39.0 ± 0%   -2.50%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c)$-4                  57.0 ± 0%      56.0 ± 0%   -1.75%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:b?|c+)$-4                 63.0 ± 0%      62.0 ± 0%   -1.59%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:bc)+$-4                   46.0 ± 0%      45.0 ± 0%   -2.17%  (p=0.008 n=5+5)
      CompileOnepass/^a(?:[bcd])+$-4                43.0 ± 0%      42.0 ± 0%   -2.33%  (p=0.008 n=5+5)
      CompileOnepass/^a((?:[bcd])+)$-4              49.0 ± 0%      48.0 ± 0%   -2.04%  (p=0.008 n=5+5)
      CompileOnepass/^a(:?b|c)*d$-4                  101 ± 0%       100 ± 0%   -0.99%  (p=0.008 n=5+5)
      CompileOnepass/^.bc(d|e)*$-4                  60.0 ± 0%      59.0 ± 0%   -1.67%  (p=0.008 n=5+5)
      CompileOnepass/^loooooooooooooooooo...-4     1.09k ± 0%     1.08k ± 0%   -0.74%  (p=0.008 n=5+5)
      
      Fixes #19984
      
      Change-Id: I2268b28d068926a057c62751528de15b6de61a7b
      Reviewed-on: https://go-review.googlesource.com/40890Reviewed-by: default avatarRalph Corderoy <ralph@inputplus.co.uk>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a306a851
    • Andreas Auernhammer's avatar
      vendor: update golang_org/x/net/route package · d71863ad
      Andreas Auernhammer authored
      Update the route package to git rev 6b27048a.
      
      Introduce the following changes:
       - 6b27048 route: drop support for go1.5
       - b7fd658 route: fix typo
       - 41bba8d route: add support for the manipulation of routing informaion
      
      Updates #19967
      
      Change-Id: Id2bb93df97a45254a2df2b048db0143e3e52bbdf
      Reviewed-on: https://go-review.googlesource.com/40830
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      d71863ad
    • Josh Bleecher Snyder's avatar
      cmd/compile: remove flag_largemodel · 0e4824aa
      Josh Bleecher Snyder authored
      It was added in 2013 in CL 7064048.
      All uses of it in the compiler disappeared with
      (or possibly before) the SSA backend.
      Several releases have gone by without it,
      from which I conclude that it is now not needed.
      
      Change-Id: I2095f4ac05d4d7ab998168993a7fd5d954aeee88
      Reviewed-on: https://go-review.googlesource.com/40856
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      0e4824aa
  3. 15 Apr, 2017 4 commits
  4. 14 Apr, 2017 8 commits
    • Caleb Spare's avatar
      testing: add TB.Helper to better support test helpers · bc293137
      Caleb Spare authored
      This CL implements the proposal at
      https://github.com/golang/proposal/blob/master/design/4899-testing-helper.md.
      
      It's based on Josh's CL 79890043 from a few years ago:
      https://codereview.appspot.com/79890043 but makes several changes,
      most notably by using the new CallersFrames API so that it works with
      mid-stack inlining.
      
      Another detail came up while I was working on this: I didn't want the
      user to be able to call t.Helper from inside their TestXxx function
      directly (which would mean we'd print a file:line from inside the
      testing package itself), so I explicitly prevented this from working.
      
      Fixes #4899.
      
      Change-Id: I37493edcfb63307f950442bbaf993d1589515310
      Reviewed-on: https://go-review.googlesource.com/38796
      Run-TryBot: Caleb Spare <cespare@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      bc293137
    • Alberto Donizetti's avatar
      cmd/compile: add test for Issue 12536 · 6266b0f0
      Alberto Donizetti authored
      The fixedbugs/issue12536.go file was erroneously deleted just before
      committing the patch that fixed the issue (CL 14400).
      
      That's an easy test and there's a small reproducer in the issue, add
      it back.
      
      Updates #12536
      
      Change-Id: Ib7b0cd245588299e9a5469e1d75805fd0261ce1a
      Reviewed-on: https://go-review.googlesource.com/40712Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      6266b0f0
    • Andreas Auernhammer's avatar
      vendor: update golang_org/x/crypto packages · 3b6ecdf9
      Andreas Auernhammer authored
      Update the poly1305 and curve25519 packages to the current state of /x/crypto.
      
      Updates #19967
      
      Change-Id: Ib71534f78040f31bfd5debb06f3c4a54a77955b3
      Reviewed-on: https://go-review.googlesource.com/40711Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3b6ecdf9
    • David Lazar's avatar
      runtime/trace: iterate over frames instead of PCs · 3249cb0a
      David Lazar authored
      Now the runtime/trace tests pass with -l=4.
      
      This also gets rid of the frames cache for multiple reasons:
      
      1) The frames cache was used to avoid repeated calls to funcname and
      funcline. Now these calls happen inside the CallersFrames iterator.
      
      2) Maintaining a frames cache is harder: map[uintptr]traceFrame
      doesn't work since each PC can map to multiple traceFrames.
      
      3) It's not clear that the cache is important.
      
      Change-Id: I2914ac0b3ba08e39b60149d99a98f9f532b35bbb
      Reviewed-on: https://go-review.googlesource.com/40591
      Run-TryBot: David Lazar <lazard@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      3249cb0a
    • David Lazar's avatar
      runtime/trace: better output when test fails · a7276742
      David Lazar authored
      Change-Id: I108d15eb4cd25904bb76de4ed7548c039c69d1a3
      Reviewed-on: https://go-review.googlesource.com/40590
      Run-TryBot: David Lazar <lazard@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      a7276742
    • Mikio Hara's avatar
      net: validate network in Dial{,IP} and Listen{Packet,IP} for IP networks · 7337181d
      Mikio Hara authored
      The argument of the first parameter for connection setup functions on
      IP networks must contain a protocol name or number. This change adds
      validation for arguments of IP networks to connection setup functions.
      
      Fixes #18185.
      
      Change-Id: I6aaedd7806e3ed1043d4b1c834024f350b99361d
      Reviewed-on: https://go-review.googlesource.com/40512
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      7337181d
    • Mikio Hara's avatar
      net: don't enclose non-literal IPv6 addresses in square brackets · dc74f51c
      Mikio Hara authored
      The net package uses various textual representations for network
      identifiers and locators on the Internet protocol suite as API.
      In fact, the representations are the composition of subset of multple
      RFCs: RFC 3986, RFC 4007, RFC 4632, RFC 4291 and RFC 5952.
      
      RFC 4007 describes guidelines for the use of textual representation of
      IPv6 addressing/routing scope zone and doesn't prohibit the format for
      implementation dependent purposes, as in, specifying a literal IPv6
      address and its connected region of routing topology as application
      user interface. However, a non-literal IPv6 address, for example, a
      host name, with a zone enclosed in square brackets confuses us because
      a zone is basically for non-global IPv6 addresses and a pair of square
      brackets is used as a set of delimiters between a literal IPv6 address
      and a service name or transport port number.
      
      To mitigate such confusion, this change makes JoinHostPort not enclose
      non-literal IPv6 addresses in square brackets and SplitHostPort accept
      the form "host%zone:port" to recommend that anything enclosed in
      square brackets should be a literal IPv6 address.
      
      Before this change:
      	JoinHostPort("name%zone", "80") = "[name%zone]:80"
      	JoinHostPort("[::1%zone]", "80") = "[::1%zone]:80"
      	SplitHostPort("name%zone:80") = "", "", "address name%zone:80: missing brackets in address"
      	SplitHostPort("[name%zone]:80") = "name%zone", "80", nil
      	SplitHostPort("[::1%zone]:80") = "::1%zone", "80", nil
      
      After this change:
      	JoinHostPort("name%zone", "80") = "name%zone:80"
      	JoinHostPort("[::1%zone]", "80") = "[::1%zone]:80"
      	SplitHostPort("name%zone:80") = "name%zone", "80", nil
      	SplitHostPort("[name%zone]:80") = "name%zone", "80", nil // for backwards compatibility
      	SplitHostPort("[::1%zone]:80") = "::1%zone", "80", nil
      
      Also updates docs and test cases on SplitHostPort and JoinHostPort for
      clarification.
      
      Fixes #18059.
      Fixes #18060.
      
      Change-Id: I5c3ccce4fa0fbdd58f698fc280635ea4a14d2a37
      Reviewed-on: https://go-review.googlesource.com/40510
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      dc74f51c
    • Wei Xiao's avatar
      cmd/dist: fix incorrect platform string shared by all tests · 1cf6d474
      Wei Xiao authored
      all tests currently share the same platform string and fail to
      vet expected platforms
      
      Fixes #19958
      
      Change-Id: I2801e1e84958e31975769581e27ea5ca6a0edf5b
      Reviewed-on: https://go-review.googlesource.com/40511
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      1cf6d474
  5. 13 Apr, 2017 5 commits
    • Jess Frazelle's avatar
      syscall: fix TestGroupCleanup{UserNamespace} on Alpine · 75176947
      Jess Frazelle authored
      This updates TestGroupCleanup and TestGroupCleanupUserNamespace to pass in the
      Alpine builder.
      
      Updates #19938
      
      Change-Id: Iacbfd73782eccd57f872f9e85726c6024529c277
      Reviewed-on: https://go-review.googlesource.com/40692Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      75176947
    • Michael Munday's avatar
      cmd/compile: fix s390x unsigned comparison constant merging rules · f75b5e99
      Michael Munday authored
      On s390x unsigned integer comparisons with immediates require the immediate
      to be an unsigned 32-bit integer. The rule was checking that the immediate
      was a signed 32-bit integer.
      
      This CL also adds a test for comparisons that could be turned into compare
      with immediate or equivalent instructions (depending on architecture and
      optimizations applied).
      
      Fixes #19940.
      
      Change-Id: Ifd6aa989fd3d50e282f7d30fec9db462c28422b1
      Reviewed-on: https://go-review.googlesource.com/40433
      Run-TryBot: Michael Munday <munday@ca.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      f75b5e99
    • Brad Fitzpatrick's avatar
      test: disable flaky test/fixedbugs/issue10958.go · dc09a7af
      Brad Fitzpatrick authored
      Updates #18589
      
      Change-Id: I2c3bbc8257c68295051bd2e63e1e11794d0609c3
      Reviewed-on: https://go-review.googlesource.com/40651
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dc09a7af
    • Austin Clements's avatar
      runtime: free workbufs during sweeping · 051809e3
      Austin Clements authored
      This extends the sweeper to free workbufs back to the heap between GC
      cycles, allowing this memory to be reused for GC'd allocations or
      eventually returned to the OS.
      
      This helps for applications that have high peak heap usage relative to
      their regular heap usage (for example, a high-memory initialization
      phase). Workbuf memory is roughly proportional to heap size and since
      we currently never free workbufs, it's proportional to *peak* heap
      size. By freeing workbufs, we can release and reuse this memory for
      other purposes when the heap shrinks.
      
      This is somewhat complicated because this costs ~1–2 µs per workbuf
      span, so for large heaps it's too expensive to just do synchronously
      after mark termination between starting the world and dropping the
      worldsema. Hence, we do it asynchronously in the sweeper. This adds a
      list of "free" workbuf spans that can be returned to the heap. GC
      moves all workbuf spans to this list after mark termination and the
      background sweeper drains this list back to the heap. If the sweeper
      doesn't finish, that's fine, since getempty can directly reuse any
      remaining spans to allocate more workbufs.
      
      Performance impact is negligible. On the x/benchmarks, this reduces
      GC-bytes-from-system by 6–11%.
      
      Fixes #19325.
      
      Change-Id: Icb92da2196f0c39ee984faf92d52f29fd9ded7a8
      Reviewed-on: https://go-review.googlesource.com/38582
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      051809e3
    • Austin Clements's avatar
      runtime: allocate GC workbufs from manually-managed spans · 9cc883a4
      Austin Clements authored
      Currently the runtime allocates workbufs from persistent memory, which
      means they can never be freed.
      
      Switch to allocating them from manually-managed heap spans. This
      doesn't free them yet, but it puts us in a position to do so.
      
      For #19325.
      
      Change-Id: I94b2512a2f2bbbb456cd9347761b9412e80d2da9
      Reviewed-on: https://go-review.googlesource.com/38581
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      9cc883a4