1. 20 May, 2019 9 commits
    • Keith Randall's avatar
      runtime: In Frames.Next, delay file/line lookup until just before return · c77a9e0a
      Keith Randall authored
      That way we will never have to look up the file/line for the frame
      that's next to be returned when the user stops calling Next.
      
      For the benchmark from #32093:
      
      name      old time/op  new time/op  delta
      Helper-4   948ns ± 1%   836ns ± 3%  -11.89%  (p=0.000 n=9+9)
      
      (#32093 was fixed with a more specific, and better, fix, but this
      fix is much more general.)
      
      Change-Id: I89e796f80c9706706d8d8b30eb14be3a8a442846
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178077
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c77a9e0a
    • Michael Anthony Knyszek's avatar
      runtime: overhaul TestPhysicalMemoryUtilization · 5a903063
      Michael Anthony Knyszek authored
      Currently, this test allocates many objects and relies on heap-growth
      scavenging to happen unconditionally on heap-growth. However with the
      new pacing system for the scavenging, this is no longer true and the
      test is flaky.
      
      So, this change overhauls TestPhysicalMemoryUtilization to check the
      same aspect of the runtime, but in a much more robust way.
      
      Firstly, it sets up a much more constrained scenario: only 5 objects are
      allocated total with a maximum worst-case (i.e. the test fails) memory
      footprint of about 16 MiB. The test is now aware that scavenging will
      only happen if the heap growth causes us to push way past our scavenge
      goal, which is based on the heap goal. So, it makes the holes in the
      test much bigger and the actual retained allocations much smaller to
      keep the heap goal at the heap's minimum size. It does this twice to
      create exactly two unscavenged holes. Because the ratio between the size
      of the "saved" objects and the "condemned" object is so small, two holes
      are sufficient to create a consistent test.
      
      Then, the test allocates one enormous object (the size of the 4 other
      objects allocated, combined) with the intent that heap-growth scavenging
      should kick in and scavenge the holes. The heap goal will rise after
      this object is allocated, so it's very important we do all the
      scavenging in a single allocation that exceeds the heap goal because
      otherwise the rising heap goal could foil our test.
      
      Finally, we check memory use relative to HeapAlloc as before. Since the
      runtime should scavenge the entirety of the remaining holes,
      theoretically there should be no more free and unscavenged memory.
      However due to other allocations that may happen during the test we may
      still see unscavenged memory, so we need to have some threshold. We keep
      the current 10% threshold which, while arbitrary, is very conservative
      and should easily account for any other allocations the test makes.
      
      Before, we also had to ensure the allocations we were making looked
      large relative to the size of a heap arena since newly-mapped memory was
      considered unscavenged, and so that could significantly skew the test.
      However, thanks to the fix for #32012 we were able to reduce memory use
      to 16 MiB in the worst case.
      
      Fixes #32010.
      
      Change-Id: Ia38130481e292f581da7fa3289c98c99dc5394ed
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177237Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5a903063
    • Alex Myasoedov's avatar
      context: document CancelFunc to be safe for simultaneous use by multiple goroutines · 82ee4e7f
      Alex Myasoedov authored
      Fixes #32145
      
      Change-Id: If4c9dd3a2af748974141ad6e571f80efcbaad772
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177899Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      82ee4e7f
    • Shulhan's avatar
      internal/envcmd: print GO111MODULE when executing "go env" · 295c5662
      Shulhan authored
      If we look at the issues in the past releases that are related
      to go command that involved modules, its usually mention or ask about
      the value of GO111MODULE, either in separate line or in separate
      comment.
      
      There are quite long time range before GO111MODULE will be removed
      (unused).  The next release is still default to auto [1], and until Go
      1.13 unsupported (two releases after that) there is about one and half
      years after that.
      
      Since the change is not that big (one line) [2], maybe temporary adding
      it to "go env" give more clarity and benefit in issue reporting rather
      than not.
      
      [1] https://github.com/golang/go/issues/31857
      
      Fixes #29656
      
      Change-Id: I609ad6664774018e4f4147ec6158485172968e16
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176837
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      295c5662
    • LE Manh Cuong's avatar
      cmd/compile: use internal/race · 4ee4607c
      LE Manh Cuong authored
      CL 14870 added internal/race to factor out duplicated race thunks,
      we should use it.
      
      No signification changes in compile time and compile binary size.
      
      Change-Id: I786af44dd5bb0f4ab6709432eeb603f27a5b6c63
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178118
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4ee4607c
    • Brad Fitzpatrick's avatar
      net/http/httptest: update docs, remove old inaccurate sentence · c6f9321b
      Brad Fitzpatrick authored
      The "After it is called, changing rw.Header will not affect
      rw.HeaderMap" claim predates the Result method which changed how the
      Recorder should be used.
      
      Fixes #32144
      Fixes #32136
      
      Change-Id: I95bdfa5ac489ce7b0202824bb5663f4da188e8a7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178058Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
      c6f9321b
    • Brad Fitzpatrick's avatar
      cmd/go/internal/work: fix a couple typos · be9f10b2
      Brad Fitzpatrick authored
      Change-Id: I357669d8c9bc004031b17f057803c9b152edefee
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178057Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      be9f10b2
    • taoyuanyuan's avatar
      internal/poll: avoid memory leak in Writev · 5eeb3724
      taoyuanyuan authored
      The chunks that were referenced by fd.iovecs would not be GC.
      
      Change-Id: I7bfcb91a3fef57a4a1861168e9cd3ab55ce1334e
      GitHub-Last-Rev: e0b7f68447441fd89ed1a6e8aa37e2084fd863b2
      GitHub-Pull-Request: golang/go#32138
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178037
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      5eeb3724
    • smasher164's avatar
      math/bits: make Add and Sub fallbacks constant time · 5ca44dc4
      smasher164 authored
      Make the extended precision add-with-carry and sub-with-carry operations
      take a constant amount of time to execute, regardless of input.
      
      name             old time/op  new time/op  delta
      Add-4            1.16ns ±11%  1.51ns ± 5%  +30.52%  (p=0.008 n=5+5)
      Add32-4          1.08ns ± 0%  1.03ns ± 1%   -4.86%  (p=0.029 n=4+4)
      Add64-4          1.09ns ± 1%  1.95ns ± 3%  +79.23%  (p=0.008 n=5+5)
      Add64multiple-4  4.03ns ± 1%  4.55ns ±11%  +13.07%  (p=0.008 n=5+5)
      Sub-4            1.08ns ± 1%  1.50ns ± 0%  +38.17%  (p=0.016 n=5+4)
      Sub32-4          1.09ns ± 2%  1.53ns ±10%  +40.26%  (p=0.008 n=5+5)
      Sub64-4          1.10ns ± 1%  1.47ns ± 1%  +33.39%  (p=0.008 n=5+5)
      Sub64multiple-4  4.30ns ± 2%  4.08ns ± 4%   -5.07%  (p=0.032 n=5+5)
      
      Fixes #31267
      
      Change-Id: I1824b1b3ab8f09902ce8b5fef84ce2fdb8847ed9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170758Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5ca44dc4
  2. 17 May, 2019 12 commits
  3. 16 May, 2019 19 commits