1. 04 Aug, 2017 7 commits
  2. 03 Aug, 2017 6 commits
  3. 02 Aug, 2017 5 commits
  4. 31 Jul, 2017 2 commits
    • Austin Clements's avatar
      runtime: map bitmap and spans during heap initialization · 623e2c46
      Austin Clements authored
      We lazily map the bitmap and spans areas as the heap grows. However,
      right now we're very slightly too lazy. Specifically, the following
      can happen on 32-bit:
      
      1. mallocinit fails to allocate any heap arena, so
         arena_used == arena_alloc == arena_end == bitmap.
      
      2. There's less than 256MB between the end of the bitmap mapping and
         the next mapping.
      
      3. On the first allocation, mheap.sysAlloc sees that there's not
         enough room in [arena_alloc, arena_end) because there's no room at
         all. It gets a 256MB mapping from somewhere *lower* in the address
         space than arena_used and sets arena_alloc and arena_end to this
         hole.
      
      4. Since the new arena_alloc is lower than arena_used, mheap.sysAlloc
         doesn't bother to call mheap.setArenaUsed, so we still don't have a
         bitmap mapping or a spans array mapping.
      
      5. mheap.grow, which called mheap.sysAlloc, attempts to fill in the
         spans array and crashes.
      
      Fix this by mapping the metadata regions for the initial arena_used
      when the heap is initialized, rather than trying to wait for an
      allocation. This maintains the intended invariant that the structures
      are always mapped for [arena_start, arena_used).
      
      Fixes #21044.
      
      Change-Id: I4422375a6e234b9f979d22135fc63ae3395946b0
      Reviewed-on: https://go-review.googlesource.com/51714
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      623e2c46
    • Austin Clements's avatar
      runtime: fall back to small mmaps if we fail to grow reservation · 780249ee
      Austin Clements authored
      Right now, if it's possible to grow the arena reservation but
      mheap.sysAlloc fails to get 256MB more of memory, it simply fails.
      However, on 32-bit we have a fallback path that uses much smaller
      mmaps that could take in this situation, but fail to.
      
      This commit fixes mheap.sysAlloc to use a common failure path in case
      it can't grow the reservation. On 32-bit, this path includes the
      fallback.
      
      Ideally, mheap.sysAlloc would attempt smaller reservation growths
      first, but taking the fallback path is a simple change for Go 1.9.
      
      Updates #21044 (fixes one of two issues).
      
      Change-Id: I1e0035ffba986c3551479d5742809e43da5e7c73
      Reviewed-on: https://go-review.googlesource.com/51713
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      780249ee
  5. 30 Jul, 2017 1 commit
  6. 28 Jul, 2017 1 commit
  7. 27 Jul, 2017 1 commit
  8. 26 Jul, 2017 2 commits
  9. 25 Jul, 2017 3 commits
  10. 24 Jul, 2017 4 commits
  11. 22 Jul, 2017 1 commit
    • Joe Tsai's avatar
      encoding/json: ignore embedded fields of pointers to unexported non-structs · b8173592
      Joe Tsai authored
      https://golang.org/cl/33773 fixes the JSON marshaler to avoid serializing
      embedded fields on unexported types of non-struct types. However, Go allows
      embedding pointer to types, so the check for whether the field is a non-struct
      type must first dereference the pointer to get at the underlying type.
      
      Furthermore, due to a edge-case in the behavior of StructField.PkgPath not
      being a reliable indicator of whether the field is unexported (see #21122),
      we use our own logic to determine whether the field is exported or not.
      
      The logic in this CL may be simplified depending on what happens in #21122.
      
      Fixes #21121
      Updates #21122
      
      Change-Id: I8dfd1cdfac8a87950df294a566fb96dfd04fd749
      Reviewed-on: https://go-review.googlesource.com/50711Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b8173592
  12. 21 Jul, 2017 5 commits
  13. 20 Jul, 2017 2 commits
    • Dmitri Shuralyov's avatar
      net/http: improve signature of Redirect, NewRequest · 2abd8aeb
      Dmitri Shuralyov authored
      In CL https://golang.org/cl/4893043 (6 years ago), a new package named
      "url" was created (it is currently known as "net/url"). During that
      change, some identifier name collisions were introduced, and two
      parameters in net/http were renamed to "urlStr".
      
      Since that time, Go has continued to put high emphasis on the quality
      and readability of the documentation. Sometimes, that means making small
      sacrifices in the implementation details of a package to ensure that
      the godoc reads better, since that's what the majority of users interact
      with. See https://golang.org/s/style#named-result-parameters:
      
      > Clarity of docs is always more important than saving a line or two
      > in your function.
      
      I think the "urlStr" parameter name is suboptimal for godoc purposes,
      and just "url" would be better.
      
      During the review of https://golang.org/cl/4893043, it was also noted
      by @rsc that having to rename parameters named "url" was suboptimal:
      
      > It's unfortunate that naming the package url means
      > you can't have a parameter or variable named url.
      
      However, at the time, the name of the url package was still being
      decided, and uri was an alternative name under consideration.
      The reason urlStr was chosen is because it was a lesser evil
      compared to naming the url package uri instead:
      
      > Let's not get hung up on URI vs. URL, but I'd like s/uri/urlStr/ even for just
      > that the "i" in "uri" looks very similar to the "l" in "url" in many fonts.
      
      > Please let's go with urlStr instead of uri.
      
      Now that we have the Go 1 compatibility guarantee, the name of the
      net/url package is fixed. However, it's possible to improve the
      signature of Redirect, NewRequest functions in net/http package
      for godoc purposes by creating a package global alias to url.Parse,
      and renaming urlStr parameter to url in the exported funcs. This CL
      does so.
      
      Updates #21077.
      
      Change-Id: Ibcc10e3825863a663e6ad91b6eb47b1862a299a6
      Reviewed-on: https://go-review.googlesource.com/49930
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      2abd8aeb
    • Ian Lance Taylor's avatar
      cmd/go, cmd/link: if -no-pie doesn't work, try -nopie · 9e859d5e
      Ian Lance Taylor authored
      GCC says -no-pie, clang says -nopie.
      
      Fixes #21042
      
      Change-Id: Iadc83ea7a48ea0debc5064c1ee8da4ebff752044
      Reviewed-on: https://go-review.googlesource.com/49710
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9e859d5e