1. 03 Apr, 2016 4 commits
  2. 02 Apr, 2016 7 commits
  3. 01 Apr, 2016 22 commits
    • Brad Fitzpatrick's avatar
      runtime, syscall: only search for Windows DLLs in the System32 directory · 683448a3
      Brad Fitzpatrick authored
      Make sure that for any DLL that Go uses itself, we only look for the
      DLL in the Windows System32 directory, guarding against DLL preloading
      attacks.
      
      (Unless the Windows version is ancient and LoadLibraryEx is
      unavailable, in which case the user probably has bigger security
      problems anyway.)
      
      This does not change the behavior of syscall.LoadLibrary or NewLazyDLL
      if the DLL name is something unused by Go itself.
      
      This change also intentionally does not add any new API surface. Instead,
      x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in:
          https://golang.org/cl/21388
      
      Updates #14959
      
      Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9
      Reviewed-on: https://go-review.googlesource.com/21140Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      683448a3
    • Ian Lance Taylor's avatar
      runtime: allocate mp.cgocallers earlier · 59fc42b2
      Ian Lance Taylor authored
      Fixes #15061.
      
      Change-Id: I71f69f398d1c5f3a884bbd044786f1a5600d0fae
      Reviewed-on: https://go-review.googlesource.com/21398
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      59fc42b2
    • Josh Bleecher Snyder's avatar
      cmd/compile: rename Node.Int to Node.Int64 · 5cab0169
      Josh Bleecher Snyder authored
      gorename -from '"cmd/compile/internal/gc".Node.Int' -to 'Int64'
      
      Change-Id: I2fe3bf9a26ae6b0600d990d0c981e4b8b53020a4
      Reviewed-on: https://go-review.googlesource.com/21426Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5cab0169
    • Matthew Dempsky's avatar
      cmd/compile: more Isfoo Type cleanups · 00e5a68c
      Matthew Dempsky authored
      Replace isideal(t) with t.IsUntyped().
      Replace Istype(t, k) with t.IsKind(k).
      Replace isnilinter(t) with t.IsEmptyInterface().
      
      Also replace a lot of t.IsKind(TFOO) with t.IsFoo().
      
      Replacements prepared mechanically with gofmt -w -r.
      
      Passes toolstash -cmp.
      
      Change-Id: Iba48058f3cc863e15af14277b5ff5e729e67e043
      Reviewed-on: https://go-review.googlesource.com/21424Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      00e5a68c
    • Josh Bleecher Snyder's avatar
      cmd/compile: add Type.SetNumElem · 5dd129bc
      Josh Bleecher Snyder authored
      This removes all access to Type.Bound
      from outside type.go.
      
      Update sinit to make a new type rather than
      copy and mutate.
      
      Update bimport to create a new slice type
      instead of mutating TDDDFIELD.
      These are rare, so the extra allocs are nominal.
      
      I’m not happy about having a setter,
      but it appears the most practical route
      forward at the moment, and it only has a few uses.
      
      Passes toolstash -cmp.
      
      Change-Id: I174f07c8f336afc656904bde4bdbde4f3ef0db96
      Reviewed-on: https://go-review.googlesource.com/21423
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5dd129bc
    • Josh Bleecher Snyder's avatar
      cmd/compile: use Node.Int more · e504055e
      Josh Bleecher Snyder authored
      Generated by eg.
      
      Passes toolstash -cmp.
      
      Change-Id: I7516c211ca9aacf824f74894671dc62d31763b01
      Reviewed-on: https://go-review.googlesource.com/21422
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e504055e
    • Josh Bleecher Snyder's avatar
      cmd/compile: use NumElem instead of Type.Bound · 3a0783c5
      Josh Bleecher Snyder authored
      This eliminates all direct reads of Type.Bound
      outside type.go.
      
      Change-Id: I0a9a72539f8f4c0de7f5e05e1821936bf7db5eb7
      Reviewed-on: https://go-review.googlesource.com/21421
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3a0783c5
    • Matthew Dempsky's avatar
      cmd/compile: cleanup algtype code · 077902d1
      Matthew Dempsky authored
      Add AlgKind enum type to represent AFOO values.
      
      Add IsComparable, IsRegularMemory, IncomparableField helper methods to
      codify common higher-level idioms.
      
      Passes toolstash -cmp.
      
      Change-Id: I54c544953997a8ccc72396b3058897edcbbea392
      Reviewed-on: https://go-review.googlesource.com/21420
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      077902d1
    • Ian Lance Taylor's avatar
      runtime/cgo: only build _cgo_callers if x_cgo_callers is defined · 58394fd7
      Ian Lance Taylor authored
      Fixes a problem when using the external linker on Solaris.  The Solaris
      external linker still doesn't work due to issue #14957.
      
      The problem is, for example, with `go test cmd/objdump`:
      
              objdump_test.go:71: go build fmthello.go: exit status 2
                      # command-line-arguments
                      /var/gcc/iant/go/pkg/tool/solaris_amd64/link: running gcc failed: exit status 1
                      Undefined                       first referenced
                       symbol                             in file
                      x_cgo_callers                       /tmp/go-link-355600608/go.o
                      ld: fatal: symbol referencing errors
                      collect2: error: ld returned 1 exit status
      
      Change-Id: I54917cfd5c288ee77ea25c439489bd2c9124fe73
      Reviewed-on: https://go-review.googlesource.com/21392
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      58394fd7
    • Sebastien Binet's avatar
      reflect: implement StructOf · 633ab742
      Sebastien Binet authored
      This change exposes a facility to create new struct types from a slice of
      reflect.StructFields.
      
      - reflect: first stab at implementing StructOf
      - reflect: tests for StructOf
      
      StructOf creates new struct types in the form of structTypeWithMethods
      to accomodate the GC (especially the uncommonType.methods slice field.)
      
      Creating struct types with embedded interfaces with unexported methods
      is not supported yet and will panic.
      Creating struct types with non-ASCII field names or types is not yet
      supported (see #15064.)
      
      Binaries' sizes for linux_amd64:
      
      old=tip (0104a31b)
      
                  old bytes     new bytes     delta
      bin/go      9911336       9915456       +0.04%
      reflect     781704        830048        +6.18%
      
      Updates #5748.
      Updates #15064.
      
      Change-Id: I3b8fd4fadd6ce3b1b922e284f0ae72a3a8e3ce44
      Reviewed-on: https://go-review.googlesource.com/9251Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      633ab742
    • Shahar Kohanim's avatar
      cmd/internal/obj: more idiomatic object writer · 014f3e1e
      Shahar Kohanim authored
      Change-Id: I41722ee605ea76a6b52e8a7e1e10f2293cef1a7a
      Reviewed-on: https://go-review.googlesource.com/21371Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      014f3e1e
    • Alexandru Moșoi's avatar
      cmd/compile/internal/ssa: BCE for induction variables · b91cc530
      Alexandru Moșoi authored
      There are 5293 loop in the main go repository.
      A survey of the top most common for loops:
      
           18 for __k__ := 0; i < len(sa.Addr); i++ {
           19 for __k__ := 0; ; i++ {
           19 for __k__ := 0; i < 16; i++ {
           25 for __k__ := 0; i < length; i++ {
           30 for __k__ := 0; i < 8; i++ {
           49 for __k__ := 0; i < len(s); i++ {
           67 for __k__ := 0; i < n; i++ {
          376 for __k__ := range __slice__ {
          685 for __k__, __v__ := range __slice__ {
         2074 for __, __v__ := range __slice__ {
      
      The algorithm to find induction variables handles all cases
      with an upper limit. It currently doesn't find related induction
      variables such as c * ind or c + ind.
      
      842 out of 22954 bound checks are removed for src/make.bash.
      1957 out of 42952 bounds checks are removed for src/all.bash.
      
      Things to do in follow-up CLs:
      * Find the associated pointer for `for _, v := range a {}`
      * Drop the NilChecks on the pointer.
      * Replace the implicit induction variable by a loop over the pointer
      
      Generated garbage can be reduced if we share the sdom between passes.
      
      % benchstat old.txt new.txt
      name       old time/op     new time/op     delta
      Template       337ms ± 3%      333ms ± 3%    ~             (p=0.258 n=9+9)
      GoTypes        1.11s ± 2%      1.10s ± 2%    ~           (p=0.912 n=10+10)
      Compiler       5.25s ± 1%      5.29s ± 2%    ~             (p=0.077 n=9+9)
      MakeBash       33.5s ± 1%      34.1s ± 2%  +1.85%          (p=0.011 n=9+9)
      
      name       old alloc/op    new alloc/op    delta
      Template      63.6MB ± 0%     63.9MB ± 0%  +0.52%         (p=0.000 n=10+9)
      GoTypes        218MB ± 0%      219MB ± 0%  +0.59%         (p=0.000 n=10+9)
      Compiler       978MB ± 0%      985MB ± 0%  +0.69%        (p=0.000 n=10+10)
      
      name       old allocs/op   new allocs/op   delta
      Template        582k ± 0%       583k ± 0%  +0.10%        (p=0.000 n=10+10)
      GoTypes        1.78M ± 0%      1.78M ± 0%  +0.12%        (p=0.000 n=10+10)
      Compiler       7.68M ± 0%      7.69M ± 0%  +0.05%        (p=0.000 n=10+10)
      
      name       old text-bytes  new text-bytes  delta
      HelloSize       581k ± 0%       581k ± 0%  -0.08%        (p=0.000 n=10+10)
      CmdGoSize      6.40M ± 0%      6.39M ± 0%  -0.08%        (p=0.000 n=10+10)
      
      name       old data-bytes  new data-bytes  delta
      HelloSize      3.66k ± 0%      3.66k ± 0%    ~     (all samples are equal)
      CmdGoSize       134k ± 0%       134k ± 0%    ~     (all samples are equal)
      
      name       old bss-bytes   new bss-bytes   delta
      HelloSize       126k ± 0%       126k ± 0%    ~     (all samples are equal)
      CmdGoSize       149k ± 0%       149k ± 0%    ~     (all samples are equal)
      
      name       old exe-bytes   new exe-bytes   delta
      HelloSize       947k ± 0%       946k ± 0%  -0.01%        (p=0.000 n=10+10)
      CmdGoSize      9.92M ± 0%      9.91M ± 0%  -0.06%        (p=0.000 n=10+10)
      
      Change-Id: Ie74bdff46fd602db41bb457333d3a762a0c3dc4d
      Reviewed-on: https://go-review.googlesource.com/20517Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      b91cc530
    • Ian Lance Taylor's avatar
      runtime: support symbolic backtrace of C code in a cgo crash · ea306ae6
      Ian Lance Taylor authored
      The new function runtime.SetCgoTraceback may be used to register stack
      traceback and symbolizer functions, written in C, to do a stack
      traceback from cgo code.
      
      There is a sample implementation of runtime.SetCgoSymbolizer at
      github.com/ianlancetaylor/cgosymbolizer.  Just importing that package is
      sufficient to get symbolic C backtraces.
      
      Currently only supported on linux/amd64.
      
      Change-Id: If96ee2eb41c6c7379d407b9561b87557bfe47341
      Reviewed-on: https://go-review.googlesource.com/17761Reviewed-by: default avatarAustin Clements <austin@google.com>
      ea306ae6
    • David Chase's avatar
      cmd/compile: ignore OXXX nodes in closure captured vars list · b64f549b
      David Chase authored
      Added a debug flag "-d closure" to explain compilation of
      closures (should this be done some other way? Should we
      rewrite the "-m" flag to "-d escapes"?)  Used this to
      discover that cause was an OXXX node in the captured vars
      list, and in turn noticed that OXXX nodes are explicitly
      ignored in all other processing of captured variables.
      
      Couldn't figure out a reproducer, did verify that this OXXX
      was not caused by an unnamed return value (which is one use
      of these).  Verified lack of heap allocation by examining -S
      output.
      
      Assembly:
      (runtime/mgc.go:1371) PCDATA $0, $2
      (runtime/mgc.go:1371) CALL "".notewakeup(SB)
      (runtime/mgc.go:1377) LEAQ "".gcBgMarkWorker.func1·f(SB), AX
      (runtime/mgc.go:1404) MOVQ AX, (SP)
      (runtime/mgc.go:1404) MOVQ "".autotmp_2242+88(SP), CX
      (runtime/mgc.go:1404) MOVQ CX, 8(SP)
      (runtime/mgc.go:1404) LEAQ go.string."GC worker (idle)"(SB), AX
      (runtime/mgc.go:1404) MOVQ AX, 16(SP)
      (runtime/mgc.go:1404) MOVQ $16, 24(SP)
      (runtime/mgc.go:1404) MOVB $20, 32(SP)
      (runtime/mgc.go:1404) MOVQ $0, 40(SP)
      (runtime/mgc.go:1404) PCDATA $0, $2
      (runtime/mgc.go:1404) CALL "".gopark(SB)
      
      Added a check for compiling_runtime to ensure that this is
      caught in the future.  Added a test to test the check.
      Verified that 1.5.3 did NOT reject the test case when
      compiled with -+ flag, so this is not a recently added bug.
      
      Cause of bug is two-part -- there was no leaking closure
      detection ever, and instead it relied on capture-of-variables
      to trigger compiling_runtime test, but closures improved in
      1.5.3 so that mere capture of a value did not also capture
      the variable, which thus allowed closures to escape, as well
      as this case where the escape was spurious.  In
      fixedbugs/issue14999.go, compare messages for f and g;
      1.5.3 would reject g, but not f.  1.4 rejects both because
      1.4 heap-allocates parameter x for both.
      
      Fixes #14999.
      
      Change-Id: I40bcdd27056810628e96763a44f2acddd503aee1
      Reviewed-on: https://go-review.googlesource.com/21322
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b64f549b
    • Dominik Honnef's avatar
      all: use bytes.Equal, bytes.Contains and strings.Contains · 1cb3044c
      Dominik Honnef authored
      Change-Id: Iba82a5bd3846f7ab038cc10ec72ff6bcd2c0b484
      Reviewed-on: https://go-review.googlesource.com/21377
      Run-TryBot: Dave Cheney <dave@cheney.net>
      Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      1cb3044c
    • Dave Cheney's avatar
      crypto/x509: fix build break on darwin/{arm,arm64} · 42d62946
      Dave Cheney authored
      Fix build error on darwin/{arm,arm64} caused by a62ae9f6.
      
      Change-Id: I7da4d147a529b11b3e71352a9276a57595ec4b05
      Reviewed-on: https://go-review.googlesource.com/21356
      Run-TryBot: Dave Cheney <dave@cheney.net>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      42d62946
    • Brad Fitzpatrick's avatar
      net/http/httputil: deprecate Client+ServerConn harder, use Deprecated syntax · f76b7937
      Brad Fitzpatrick authored
      Also cleans up return parameter stutter and missing periods.
      
      Change-Id: I47f5c230227ddfd1b105d5e06842f89ffea50760
      Reviewed-on: https://go-review.googlesource.com/21362Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      f76b7937
    • Brad Fitzpatrick's avatar
      net/http: clean up the Client redirect code, document Body.Close rules more · aecfcd82
      Brad Fitzpatrick authored
      Issue #8633 (and #9134) noted that we didn't document the rules about
      closing the Response.Body when Client.Do returned both a non-nil
      *Response and a non-nil error (which can only happen when the user's
      CheckRedirect returns an error).
      
      In the process of investigating, I cleaned this code up a bunch, but
      no user-visible behavior should have changed, except perhaps some
      better error messages in some cases.
      
      It turns out it's always been the case that when a CheckRedirect error
      occurs, the Response.Body is already closed. Document that.
      
      And the new code makes that more obvious too.
      
      Fixes #8633
      
      Change-Id: Ibc40cc786ad7fc4e0cf470d66bb559c3b931684d
      Reviewed-on: https://go-review.googlesource.com/21364
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      aecfcd82
    • Ian Lance Taylor's avatar
      cmd/compile: s.f aliases itself · 92bb694a
      Ian Lance Taylor authored
      The change in 20907 fixed varexpr but broke aliased.  After that change,
      a reference to a field in a struct would not be seen as aliasing itself.
      Before that change, it would, but only because all fields in a struct
      aliased everything.
      
      This CL changes the compiler to consider all references to a field as
      aliasing all other fields in that struct.  This is imperfect--a
      reference to one field does not alias another field--but is a simple fix
      for the immediate problem.  A better fix would require tracking the
      specific fields as well.
      
      Fixes #15042.
      
      Change-Id: I5c95c0dd7b0699e53022fce9bae2e8f50d6d1d04
      Reviewed-on: https://go-review.googlesource.com/21390
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      92bb694a
    • Brad Fitzpatrick's avatar
      net/http/httputil: make ReverseProxy return 502 Bad Gateway instead of 500 · 1bf779a4
      Brad Fitzpatrick authored
      ... when the backend can't be reached.
      
      Fixes #9864
      
      Change-Id: I9e4814824943060e0101b6236d6dfd8d7822b4c7
      Reviewed-on: https://go-review.googlesource.com/21363Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1bf779a4
    • Brad Fitzpatrick's avatar
      net/http: update bundled http2 · a3537522
      Brad Fitzpatrick authored
      Updates x/net/http2 to git rev 31df19d6 for changes since Go 1.6.
      
      The main change was https://go-review.googlesource.com/19726 (move
      merging of HEADERS and CONTINUATION into Framer), but there were a few
      garbage reduction changes too.
      
      Change-Id: I882443d20749f8638f637a2835efe92538c95d31
      Reviewed-on: https://go-review.googlesource.com/21365
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      a3537522
    • Brad Fitzpatrick's avatar
      net/http: limit Transport's reading of response header bytes from servers · 36feb1a0
      Brad Fitzpatrick authored
      The default is 10MB, like http2, but can be configured with a new
      field http.Transport.MaxResponseHeaderBytes.
      
      Fixes #9115
      
      Change-Id: I01808ac631ce4794ef2b0dfc391ed51cf951ceb1
      Reviewed-on: https://go-review.googlesource.com/21329
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      36feb1a0
  4. 31 Mar, 2016 7 commits
    • Alexandru Moșoi's avatar
      cmd/compile: constant fold ANDs. · 7a4211bc
      Alexandru Moșoi authored
      ANDQConst show up occassionally because of right shifting lowering.
      ORs and XORs are already folded properly during generic.
      
      Change-Id: I2f9134679555029c641264ce5333d70e167c65f7
      Reviewed-on: https://go-review.googlesource.com/21375Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7a4211bc
    • Alexandru Moșoi's avatar
      cmd/compile: combine SHLQ into loads and stores · ec5083e4
      Alexandru Moșoi authored
      Very common, cuts about 70k from pkg/tools/linux_amd64/* binaries.
      
      Change-Id: Ied0c049e56e56a56810c781435d79027fbcaf274
      Reviewed-on: https://go-review.googlesource.com/21374Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      ec5083e4
    • Christopher Nelson's avatar
      cmd/link: Replace fmt.Sprintf with filepath.Join · 8677cad1
      Christopher Nelson authored
      In a number of places the code was joining filepaths explicitly with
      "/", instead of using filepath.Join. This may cause problems on Windows
      (or other) platforms.
      
      This is in support of https://go-review.googlesource.com/#/c/18057
      
      Change-Id: Ieb1334f35ddb2e125be690afcdadff8d7b0ace10
      Reviewed-on: https://go-review.googlesource.com/21369Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      8677cad1
    • Joe Tsai's avatar
      compress/flate: make Reader.Read return io.EOF eagerly · c27efce6
      Joe Tsai authored
      Rather than checking the block final bit on the next invocation
      of nextBlock, we check it at the termination of the current block.
      This ensures that we return (n, io.EOF) instead of (0, io.EOF)
      more frequently for most streams.
      
      However, there are certain situations where an eager io.EOF is not done:
      1) We previously returned from Read because the write buffer of the internal
      dictionary was full, and it just so happens that there is no more data
      remaining in the stream.
      2) There exists a [non-final, empty, raw block] after all blocks that
      actually contain uncompressed data. We cannot return io.EOF eagerly here
      since it would break flushing semantics.
      
      Both situations happen infrequently, but it is still important to note that
      this change does *not* guarantee that flate will *always* return (n, io.EOF).
      
      Furthermore, this CL makes no changes to the pattern of ReadByte calls
      to the underlying io.ByteReader.
      
      Below is the motivation for this change, pulling the text from
      @bradfitz's CL/21290:
      
      net/http and other things work better when io.Reader implementations
      return (n, io.EOF) at the end, instead of (n, nil) followed by (0,
      io.EOF). Both are legal, but the standard library has been moving
      towards n+io.EOF.
      
      An investigation of net/http connection re-use in
      https://github.com/google/go-github/pull/317 revealed that with gzip
      compression + http/1.1 chunking, the net/http package was not
      automatically reusing the underlying TCP connections when the final
      EOF bytes were already read off the wire. The net/http package only
      reuses the connection if the underlying Readers (many of them nested
      in this case) all eagerly return io.EOF.
      
      Previous related CLs:
          https://golang.org/cl/76400046 - tls.Reader
          https://golang.org/cl/58240043 - http chunked reader
      
      In addition to net/http, this behavior also helps things like
      ioutil.ReadAll (see comments about performance improvements in
      https://codereview.appspot.com/49570044)
      
      Updates #14867
      Updates google/go-github#317
      
      Change-Id: I637c45552efb561d34b13ed918b73c660f668378
      Reviewed-on: https://go-review.googlesource.com/21302
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c27efce6
    • Keith Randall's avatar
      cmd/compile: better job of naming compound types · 4a7aba77
      Keith Randall authored
      Compound AUTO types weren't named previously.  That was because live
      variable analysis (plive.go) doesn't handle spilling to compound types.
      It can't handle them because there is no valid place to put VARDEFs when
      regalloc is spilling compound types.
      
      compound types = multiword builtin types: complex, string, slice, and
      interface.
      
      Instead, we split named AUTOs into individual one-word variables.  For
      example, a string s gets split into a byte ptr s.ptr and an integer
      s.len.  Those two variables can be spilled to / restored from
      independently.  As a result, live variable analysis can handle them
      because they are one-word objects.
      
      This CL will change how AUTOs are described in DWARF information.
      Consider the code:
      
      func f(s string, i int) int {
          x := s[i:i+5]
          g()
          return lookup(x)
      }
      
      The old compiler would spill x to two consecutive slots on the stack,
      both named x (at offsets 0 and 8).  The new compiler spills the pointer
      of x to a slot named x.ptr.  It doesn't spill x.len at all, as it is a
      constant (5) and can be rematerialized for the call to lookup.
      
      So compound objects may not be spilled in their entirety, and even if
      they are they won't necessarily be contiguous.  Such is the price of
      optimization.
      
      Re-enable live variable analysis tests.  One test remains disabled, it
      fails because of #14904.
      
      Change-Id: I8ef2b5ab91e43a0d2136bfc231c05d100ec0b801
      Reviewed-on: https://go-review.googlesource.com/21233
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      4a7aba77
    • Brad Fitzpatrick's avatar
      net/http, net/http/httputil: rename lk to mu · e55896b9
      Brad Fitzpatrick authored
      The conventional name for a sync.Mutex is "mu".
      
      These "lk" names date back to a time before conventions.
      
      Change-Id: Iee57f9f4423d04269e1125b5d82455c453aac26f
      Reviewed-on: https://go-review.googlesource.com/21361
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e55896b9
    • Keith Randall's avatar
      cmd/compile: don't put SP in index slot · 9f66636c
      Keith Randall authored
      For idx1 ops, SP can appear in the index slot.
      Swap SP into the base register slot so we can encode
      the instruction.
      
      Fixes #15053
      
      Change-Id: I19000cc9d6c86c7611743481e6e2cb78b1ef04eb
      Reviewed-on: https://go-review.googlesource.com/21384
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarAlexandru Moșoi <alexandru@mosoi.ro>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9f66636c